Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[GR-57603] Import Ruby 3.3.5 #3682

Merged
merged 87 commits into from
Nov 12, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
87 commits
Select commit Hold shift + click to select a range
fd9cf78
Import files from MRI 3.3.5
andrykonchin Sep 24, 2024
fd8dc74
Re-apply changes on top of 3.3 files
andrykonchin Sep 25, 2024
d6b1d27
Suppress rb_io_t warnings, we still need to set the fields
eregon Sep 25, 2024
54f7bb8
Comment out -test- requires
andrykonchin Sep 25, 2024
93cb7da
Update json to 2.7.1
andrykonchin Sep 25, 2024
3e6127a
Re-apply changes in json files
andrykonchin Sep 25, 2024
cf9883d
Update default and bundled gems
andrykonchin Sep 25, 2024
0c973d0
Update exe/ executables
andrykonchin Sep 25, 2024
adaf231
Update version in .ruby-version
andrykonchin Sep 25, 2024
764711c
Update version in TruffleRuby.LANGUAGE_VERSION
andrykonchin Sep 25, 2024
903832a
Reset truffleruby-abi-version.h and lib/cext/ABI_check.txt
andrykonchin Sep 25, 2024
d8d6dc6
Update versions.json
andrykonchin Sep 25, 2024
c0e477d
Update version numbers for debug and rbs
andrykonchin Sep 25, 2024
7aca869
Copy and paste -h and --help output to RubyLauncher
andrykonchin Sep 25, 2024
71a98c8
Copy additional C headers for ripper
andrykonchin Sep 26, 2024
a286f8f
Fix compiling ripper-related source code
andrykonchin Sep 26, 2024
52589d5
Fix compiling io-console native extension
andrykonchin Sep 26, 2024
7cda9fc
Update tool/parse_mri_errors.rb script and raise more proper error me…
andrykonchin Sep 27, 2024
e78c2e9
Update doc/user/options.md
andrykonchin Sep 27, 2024
ca98468
Update doc/user/compatibility.md
andrykonchin Sep 27, 2024
c17e87e
Update "Bundled gems" section in doc/legal/legal.md
andrykonchin Sep 27, 2024
cf9eaa0
Regenerate files for spec/truffle/methods_spec.rb
andrykonchin Sep 27, 2024
121268a
Purge spec/tags/truffle/methods_tags.txt file
andrykonchin Sep 27, 2024
6321e9d
Add Data class into spec/truffle/methods_spec.rb test
andrykonchin Sep 27, 2024
9b00c5a
Regenerate core symbols
andrykonchin Sep 27, 2024
540a083
Fix compiling errors in rb_tr_rtypeddata_create
andrykonchin Oct 1, 2024
9081ecb
Tag failing specs
andrykonchin Sep 27, 2024
08d65b4
Fix specs in spec/truffle/rubygems/default_gems_list_spec.rb
andrykonchin Sep 30, 2024
63dff60
Fix building native extensions and implement new errno-related functions
andrykonchin Sep 30, 2024
b9da7f7
Fix fiddle and add BOOL type
andrykonchin Sep 30, 2024
de77d57
Tag slow specs
andrykonchin Sep 30, 2024
dbbed46
Fix syntax_suggest cli command and add to the default gems list in th…
andrykonchin Sep 30, 2024
a242363
Update spec/truffle/rubygems/default_gems_activation_spec.rb and remo…
andrykonchin Sep 30, 2024
f67df84
Fix tool/import-mri-files.sh to import Prism's generated files
andrykonchin Oct 1, 2024
f4877b9
Run tool/generate-config-header.sh
andrykonchin Oct 1, 2024
e67f50d
Remove mentions of readline-ext gem
andrykonchin Oct 1, 2024
c76e115
Mark the racc C extension as built so the gem is properly activated
eregon Oct 2, 2024
86bffb2
Fix spec/truffle/launcher_spec.rb
andrykonchin Oct 2, 2024
11a69a3
Revisit patches and remove outdated
andrykonchin Oct 3, 2024
ed23d5f
Fix Truffle::CExt::RBasic#flag_to_string
andrykonchin Oct 3, 2024
bc0c2bc
Fix spec/truffle/irb/arrows_spec.rb specs
andrykonchin Oct 3, 2024
0ce85a6
Fix rb_ivar_foreach function for modules/classes
andrykonchin Oct 4, 2024
2e8c617
Fix lib/cext/include/internal_all.h and add missing headers
andrykonchin Oct 8, 2024
f6d1c71
Import tool/test/init.rb and tool/test/runner.rb MRI files
andrykonchin Oct 8, 2024
3eeae3d
Adjust test files to use tool/test/init.rb and tool/test/runner.rb
andrykonchin Oct 8, 2024
e43c8aa
Remove Pathname#taint and Pathname#untaint methods
andrykonchin Oct 8, 2024
8f46185
Implement Process.warmup
andrykonchin Oct 8, 2024
ad3e69e
Remove Prism files as we will import them differently
eregon Oct 9, 2024
7d5107c
Import Prism files for the default gem
eregon Oct 9, 2024
b2b3efa
Changes to Prism FFI backend to find libprism and headers
eregon Oct 9, 2024
5386348
Fix typo in spec/ruby/library/time/iso8601_spec.rb
andrykonchin Oct 14, 2024
bc71f4e
Update the CLI section in the HowTo guide
andrykonchin Oct 7, 2024
5638857
Don't retag files listed in test/mri/failing.exclude
andrykonchin Oct 11, 2024
745ea54
Fix jt.rb and retagging MRI test files with classes not directly inhe…
andrykonchin Oct 14, 2024
b759925
Exclude or fix MRI tests that lead to a process termination, are hang…
andrykonchin Oct 18, 2024
e91167c
Don't skip retagging a test file if there is no a corresponding exclu…
andrykonchin Oct 14, 2024
3e74cad
Fix tool/parse_mri_errors.rb to handle test cases method names with n…
andrykonchin Oct 4, 2024
386f803
Review patches in MRI tests
andrykonchin Oct 17, 2024
29992d4
Add a CI job to retag MRI tests
andrykonchin Oct 14, 2024
07c6494
Fix 'jt test gems default-bundled-gems' command
andrykonchin Oct 22, 2024
ed3195e
Fix spec/truffle/launcher_spec.rb on CI
andrykonchin Oct 22, 2024
739bbe0
Remove generating platform-dependent 'if RUBY_PLATFORM.include?' guar…
andrykonchin Oct 23, 2024
cb69d3f
Update tool/import-prism.sh to copy also tests
andrykonchin Oct 23, 2024
1f4d6cd
Reimport Prism 1.1.0 with tests
andrykonchin Nov 5, 2024
1b660dc
Add new step to update Prism into the Update Ruby document
andrykonchin Oct 23, 2024
d84f8f4
Update tool/import-mri-files.sh to preserve existing Prism tests
andrykonchin Oct 23, 2024
e61d358
Fix tool/parse_mri_errors.rb with error messages containing new lines
andrykonchin Oct 25, 2024
a448180
Polish jt.rb a bit
andrykonchin Oct 25, 2024
4e569f9
Fix issue in jt.rb with detecting test classes
andrykonchin Oct 25, 2024
633b209
Simplify parser_st.h to the bare minimum since only 2 functions from …
eregon Oct 28, 2024
3ea6eaf
Use the same logic to select MRI test files for jt test mri & jt retag
eregon Oct 28, 2024
8388d31
Speedup jt retag by processing all test files together (opt-in)
eregon Oct 28, 2024
2ef7f4b
Fix retagging tests in test/mri/tests/cext-ruby/
andrykonchin Nov 4, 2024
7041167
Fix some MRI tests
andrykonchin Oct 21, 2024
629d52a
Retag MRI tests
andrykonchin Oct 17, 2024
96e6356
Increase timeouts for
andrykonchin Nov 6, 2024
e557dbd
Tag failed specs
andrykonchin Nov 8, 2024
f949966
Clean up the spec/truffleruby.next-specs file
andrykonchin Nov 8, 2024
202cd20
Update CHANGELOG.md
andrykonchin Nov 8, 2024
4c4fb81
Remove duplicated checks to skip CRuby specific code and tests
andrykonchin Nov 11, 2024
b9bfdf7
Optimise performance of patched URI::Generic#check_host and use Regex…
andrykonchin Nov 11, 2024
38db14c
Remove not needed patch in src/main/c/cext/st.c
andrykonchin Nov 11, 2024
a871479
Remove tests for racc that was promoted to bundled gems
andrykonchin Nov 11, 2024
f7f3f77
Enable some Data-specific tests because Data class is already impleme…
andrykonchin Nov 11, 2024
5a3e4fe
Update instruction to update default and bundled gems and remove not …
andrykonchin Nov 11, 2024
3591ea1
Fix building native extension for cext-ruby/string/test_capacity.rb
andrykonchin Nov 12, 2024
4f0edf9
Bump ABI check
andrykonchin Oct 18, 2024
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
The table of contents is too big for display.
Diff view
Diff view
  •  
  •  
  •  
The diff you're trying to view is too large. We only load the first 3000 changed files.
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -43,8 +43,10 @@ src/main/c/**/*.dylib
src/main/c/**/extconf.h
src/main/c/**/mkmf.log
src/main/c/*/Makefile
!src/main/c/prism-gem/Makefile
!src/main/c/spawn-helper/Makefile
!src/main/c/truffleposix/Makefile
!src/main/c/yarp/Makefile
src/main/c/cext-trampoline/trampoline.c
src/main/c/cext/wrappers.c
src/main/c/etc/constdefs.h
Expand Down
2 changes: 1 addition & 1 deletion .ruby-version
Original file line number Diff line number Diff line change
@@ -1 +1 @@
3.2.4
3.3.5
3 changes: 3 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,8 @@

New features:

* Updated to Ruby 3.3.5 (#3681, @andrykonchin, @eregon).

Bug fixes:

* Fix `Module#name` called inside the `Module#const_added` callback when the module is defined in the top-level scope (#3683, @andrykonchin).
Expand All @@ -20,6 +22,7 @@ Compatibility:
* Support `Time.new` with String argument and error when invalid (#3693, @rwstauner).
* Implement `rb_enc_interned_str()` (#3703, @Th3-M4jor).
* Implement `rb_hash_bulk_insert()` (#3705, @Th3-M4jor).
* Remove deprecated `Pathname#{taint,untaint}` methods (#3681, @andrykonchin).

Performance:

Expand Down
20 changes: 18 additions & 2 deletions ci.jsonnet
Original file line number Diff line number Diff line change
Expand Up @@ -393,6 +393,20 @@ local part_definitions = {
is_after+:: ["$.run.generate_native_config"],
run+: jt(["check_native_configuration"]) + jt(["check_config_header"]),
},

retag_mri_tests: {
run+: jt(["retag"]) + [
["set-export", "DATE", ["date", "+%F"]],
["set-export", "TRUFFLERUBY_BRANCH", "retag-mri-tests-$DATE"],
["git", "checkout", "-b", "$TRUFFLERUBY_BRANCH"],
["git", "config", "--local", "user.email", "[email protected]"],
["git", "config", "--local", "user.name", "ol-automation_ww"],
["git", "add", "."],
["git", "commit", "-m", "Retag MRI tests"],
["git", "remote", "-v"],
["git", "push", "-f", "origin", "HEAD"],
],
},
},

benchmark: {
Expand Down Expand Up @@ -513,8 +527,8 @@ local composition_environment = utils.add_inclusion_tracking(part_definitions, "
# Order: platform, jdk, mx_env. Keep aligned for an easy visual comparison.
"ruby-test-specs-linux-amd64-stable": $.platform.linux + $.jdk.stable + $.env.jvm + gate_no_build + $.use.build + $.run.test_unit_tck + native_config + $.run.test_specs + { timelimit: "01:20:00" },
"ruby-test-specs-linux-amd64-latest": $.platform.linux + $.jdk.latest + $.env.jvm + gate_no_build + $.use.build + $.run.test_unit_tck + native_config + $.run.test_specs + { timelimit: "01:20:00" },
"ruby-test-specs-darwin-amd64-stable": $.platform.darwin_amd64 + $.jdk.stable + $.env.jvm + gate_no_build + $.use.build + $.run.test_unit_tck + native_config + $.run.test_specs + { timelimit: "01:40:00" },
"ruby-test-specs-darwin-amd64-latest": $.platform.darwin_amd64 + $.jdk.latest + $.env.jvm + gate_no_build + $.use.build + $.run.test_unit_tck + native_config + $.run.test_specs + { timelimit: "01:40:00" },
"ruby-test-specs-darwin-amd64-stable": $.platform.darwin_amd64 + $.jdk.stable + $.env.jvm + gate_no_build + $.use.build + $.run.test_unit_tck + native_config + $.run.test_specs + { timelimit: "02:00:00" },
"ruby-test-specs-darwin-amd64-latest": $.platform.darwin_amd64 + $.jdk.latest + $.env.jvm + gate_no_build + $.use.build + $.run.test_unit_tck + native_config + $.run.test_specs + { timelimit: "02:00:00" },
"ruby-test-specs-darwin-aarch64-stable": $.platform.darwin_aarch64 + $.jdk.stable + $.env.jvm + gate_no_build + $.use.build + $.run.test_unit_tck + native_config + $.run.test_specs + { timelimit: "01:40:00" },
"ruby-test-specs-darwin-aarch64-latest": $.platform.darwin_aarch64 + $.jdk.latest + $.env.jvm + gate_no_build + $.use.build + $.run.test_unit_tck + native_config + $.run.test_specs + { timelimit: "01:40:00" },
"ruby-test-fast-linux-aarch64": $.platform.linux_aarch64 + $.jdk.latest + $.env.jvm + gate + $.run.test_fast + native_config + { timelimit: "45:00" },
Expand Down Expand Up @@ -698,6 +712,8 @@ local composition_environment = utils.add_inclusion_tracking(part_definitions, "
"ruby-generate-native-config-linux-aarch64": $.platform.linux_aarch64 + $.jdk.latest + shared + native_config,
"ruby-generate-native-config-darwin-amd64": $.platform.darwin_amd64 + $.jdk.latest + shared + native_config,
"ruby-generate-native-config-darwin-aarch64": $.platform.darwin_aarch64 + $.jdk.latest + shared + native_config,

"ruby-retag-mri-tests-linux-amd64": $.platform.linux + $.jdk.latest + shared + $.env.native + $.use.build + $.run.retag_mri_tests + { timelimit: "02:00:00" },
},

builds:
Expand Down
2 changes: 1 addition & 1 deletion doc/contributor/how-to-guide.md
Original file line number Diff line number Diff line change
Expand Up @@ -1627,7 +1627,7 @@ The `jt` CLI tool has a lot of commands but there are very few basic ones that y
- `jt sync` - to synchronize changes in Standard Library Ruby source code and apply them without rebuilding TruffleRuby
- `jt tag` - ruby/spec only
- `jt untag <path-to-file>` - (ruby/spec only) regenerate an exclude file for particular ruby/spec file (and list all the failed test cases)
- `jt retag <path-to-file>` - (MRI test only) regenerate an exclude file for particular MRI test file (and list all the failed test cases)
- `jt retag <path-to-file>` - (MRI test only) regenerate an exclude file for particular MRI test file (and list all the failed test cases). Do nothing if there aren't any already excluded cases for this file.
- `jt lint fast` - to run some linter checks (that are run on CI) locally
- `jt rubocop` - to run Ruby source code linter separately from other linter checks.
- `jt rubocop -a` - to correct safely Rubocop warnings automatically
Expand Down
9 changes: 8 additions & 1 deletion doc/contributor/updating-ruby.md
Original file line number Diff line number Diff line change
Expand Up @@ -135,12 +135,19 @@ rm -rf lib/gems/specifications
cd ~/.rubies/ruby-$VERSION
cp -R lib/ruby/gems/*.0/gems $TRUFFLERUBY/lib/gems
cp -R lib/ruby/gems/*.0/specifications $TRUFFLERUBY/lib/gems
rm -f lib/gems/gems/**/*.{o,a,so,bundle} lib/gems/gems/**/{Makefile,extconf.h,mkmf.log} lib/gems/gems/**/*.mk

cd $TRUFFLERUBY
rm -rf lib/gems/gems/typeprof-* lib/gems/specifications/typeprof-*.gemspec
ruby tool/patch-default-gemspecs.rb
```

Then review bundled gems with extensions like `lib/gems/gems/debug-*` and `lib/gems/gems/rbs-*`
to ensure no build artifacts/generated files are committed, only "sources".

Update the `ruby/prism` default gem with `tool/import-prism.sh` script. See the "Update Prism" section
in the [Prism](prism.md) document.

## Updating exe/ executables

```
Expand All @@ -162,7 +169,7 @@ Update all of these:
* with bundled gem versions provided by `cat ../ruby/gems/bundled_gems | sort`,
* default gem versions provided by `ls -l lib/gems/specifications/default`
* and `gem` gem version provided by `grep 'VERSION =' lib/mri/rubygems.rb`
* Also update version numbers for `debug` and `rbs` in `src/main/c/Makefile`, `mx.truffleruby/suite.py` and `lib/gems/gems/debug-*/ext/debug/extconf.rb`.
* Also update version numbers for `debug`, `racc`, and `rbs` in `src/main/c/Makefile`, `mx.truffleruby/suite.py` and `lib/gems/gems/debug-*/ext/debug/extconf.rb`.
* Copy and paste `-h` and `--help` output to `RubyLauncher` (instructions are in the end of the file `src/launcher/java/org/truffleruby/launcher/RubyLauncher.java`)
* This is a good time to get `jt build` working.
* Copy and paste the TruffleRuby `--help` output to `doc/user/options.md` (e.g., with `jt ruby --help | xsel -b`)
Expand Down
31 changes: 19 additions & 12 deletions doc/legal/bundled_gems
Original file line number Diff line number Diff line change
@@ -1,16 +1,23 @@
# gem-name version-to-bundle repository-url [optional-commit-hash-to-test-or-defaults-to-v-version]
minitest 5.16.3 https://github.com/seattlerb/minitest
# gem-name version repository-url [revision]
#
# - gem-name: gem name to bundle
# - version: released version to bundle
# - repository-url: URL from where clone for test
# - revision: revision in repository-url to test
# if `revision` is not given, "v"+`version` or `version` will be used.
minitest 5.20.0 https://github.com/minitest/minitest
power_assert 2.0.3 https://github.com/ruby/power_assert
rake 13.0.6 https://github.com/ruby/rake
test-unit 3.5.7 https://github.com/test-unit/test-unit
rexml 3.2.5 https://github.com/ruby/rexml
rss 0.2.9 https://github.com/ruby/rss
net-ftp 0.2.1 https://github.com/ruby/net-ftp
net-imap 0.3.4.1 https://github.com/ruby/net-imap
rake 13.1.0 https://github.com/ruby/rake
test-unit 3.6.1 https://github.com/test-unit/test-unit
rexml 3.3.6 https://github.com/ruby/rexml
rss 0.3.1 https://github.com/ruby/rss
net-ftp 0.3.4 https://github.com/ruby/net-ftp
net-imap 0.4.9.1 https://github.com/ruby/net-imap
net-pop 0.1.2 https://github.com/ruby/net-pop
net-smtp 0.3.4 https://github.com/ruby/net-smtp
net-smtp 0.4.0.1 https://github.com/ruby/net-smtp
matrix 0.4.2 https://github.com/ruby/matrix
prime 0.1.2 https://github.com/ruby/prime
rbs 2.8.2 https://github.com/ruby/rbs
typeprof 0.21.3 https://github.com/ruby/typeprof
debug 1.7.1 https://github.com/ruby/debug
rbs 3.4.0 https://github.com/ruby/rbs
typeprof 0.21.9 https://github.com/ruby/typeprof
debug 1.9.1 https://github.com/ruby/debug
racc 1.7.3 https://github.com/ruby/racc
6 changes: 5 additions & 1 deletion doc/legal/legal.md
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ See `epl-2.0.txt`, `gpl-2.txt`, `lgpl-2.1.txt`.
## MRI

The standard implementation of Ruby is MRI. TruffleRuby contains code from MRI
version 3.2.4, including:
version 3.3.5, including:

* the standard library in `lib/mri`,
* Ruby C extension API in `lib/cext/include` and `src/main/c/cext`,
Expand Down Expand Up @@ -124,6 +124,10 @@ power_assert is copyright Kazuki Tsujimoto and is available under the same licen

prime is under the same copyright and licence as MRI (see `ruby-bsdl.txt`).

#### racc

racc is under the same copyright and licence as MRI (see `ruby-bsdl.txt`).

#### rake

Rake is copyright Jim Weirich and is available under an MIT licence (see `mit.txt`).
Expand Down
2 changes: 1 addition & 1 deletion doc/user/compatibility.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ permalink: /reference-manual/ruby/Compatibility/
# Compatibility

TruffleRuby aims to be fully compatible with the standard implementation of
Ruby, MRI, version 3.2.4, [including C extensions](#c-extension-compatibility).
Ruby, MRI, version 3.3.5, [including C extensions](#c-extension-compatibility).
TruffleRuby is still in development, so it is not 100% compatible yet.

TruffleRuby can run Rails and is compatible with many gems, including C extensions.
Expand Down
8 changes: 6 additions & 2 deletions doc/user/options.md
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ TruffleRuby has the same command-line interface as our compatible MRI version.
```shell
Usage: truffleruby [switches] [--] [programfile] [arguments]
-0[octal] specify record separator (\0, if no argument)
(-00 for paragraph mode, -0777 for slurp mode)
-a autosplit mode with -n or -p (splits $_ into $F)
-c check syntax only
-Cdirectory cd to directory before executing your script
Expand All @@ -33,9 +34,11 @@ Usage: truffleruby [switches] [--] [programfile] [arguments]
set warning level; 0=silence, 1=medium, 2=verbose
-x[directory] strip off text before #!ruby line and perhaps cd to directory
--copyright print the copyright
--enable={jit|rubyopt|...}[,...], --disable={jit|rubyopt|...}[,...]
--enable={rubyopt|...}[,...]
--disable={rubyopt|...}[,...]
enable or disable features. see below for available features
--external-encoding=encoding, --internal-encoding=encoding
--external-encoding=encoding
--internal-encoding=encoding
specify the default external or internal character encoding
--backtrace-limit=num
limit the maximum length of backtrace
Expand All @@ -55,6 +58,7 @@ Features:
Warning categories:
deprecated deprecated features
experimental experimental features
performance performance issues

Runtime options:
--polyglot Run with all other guest languages accessible.
Expand Down
2 changes: 2 additions & 0 deletions exe/gem
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,8 @@ done
exec "$(dirname $SELF_PATH)/ruby" "$SELF_PATH" "$@"

#!ruby
# frozen_string_literal: true

#--
# Copyright 2006 by Chad Fowler, Rich Kilmer, Jim Weirich and others.
# All rights reserved.
Expand Down
48 changes: 48 additions & 0 deletions exe/syntax_suggest
Original file line number Diff line number Diff line change
@@ -0,0 +1,48 @@
#!/usr/bin/env bash
#
# This file was generated by RubyGems.
# The above lines match the format expected by rubygems/installer.rb check_executable_overwrite
# bash section ignored by the Ruby interpreter

# get the absolute path of the executable and resolve symlinks
SELF_PATH=$(cd "$(dirname "$0")" && pwd -P)/$(basename "$0")
while [ -h "$SELF_PATH" ]; do
# 1) cd to directory of the symlink
# 2) cd to the directory of where the symlink points
# 3) get the pwd
# 4) append the basename
DIR=$(dirname "$SELF_PATH")
SYM=$(readlink "$SELF_PATH")
SELF_PATH=$(cd "$DIR" && cd "$(dirname "$SYM")" && pwd)/$(basename "$SYM")
done
exec "$(dirname $SELF_PATH)/ruby" "$SELF_PATH" "$@"

#!ruby
#
# This file was generated by RubyGems.
#
# The application 'syntax_suggest' is installed as part of a gem, and
# this file is here to facilitate running it.
#

require 'rubygems'

Gem.use_gemdeps

version = ">= 0.a"

str = ARGV.first
if str
str = str.b[/\A_(.*)_\z/, 1]
if str and Gem::Version.correct?(str)
version = str
ARGV.shift
end
end

if Gem.respond_to?(:activate_bin_path)
load Gem.activate_bin_path('syntax_suggest', 'syntax_suggest', version)
else
gem "syntax_suggest", version
load Gem.bin_path("syntax_suggest", "syntax_suggest", version)
end
2 changes: 1 addition & 1 deletion lib/cext/ABI_check.txt
Original file line number Diff line number Diff line change
@@ -1 +1 @@
3
2
6 changes: 4 additions & 2 deletions lib/cext/include/ccan/list/list.h
Original file line number Diff line number Diff line change
Expand Up @@ -635,14 +635,16 @@ static inline void ccan_list_prepend_list_(struct ccan_list_head *to,

/* internal macros, do not use directly */
#define ccan_list_for_each_off_dir_(h, i, off, dir) \
for (i = ccan_list_node_to_off_(ccan_list_debug(h, CCAN_LIST_LOC)->n.dir, \
for (i = 0, \
i = ccan_list_node_to_off_(ccan_list_debug(h, CCAN_LIST_LOC)->n.dir, \
(off)); \
ccan_list_node_from_off_((void *)i, (off)) != &(h)->n; \
i = ccan_list_node_to_off_(ccan_list_node_from_off_((void *)i, (off))->dir, \
(off)))

#define ccan_list_for_each_safe_off_dir_(h, i, nxt, off, dir) \
for (i = ccan_list_node_to_off_(ccan_list_debug(h, CCAN_LIST_LOC)->n.dir, \
for (i = 0, \
i = ccan_list_node_to_off_(ccan_list_debug(h, CCAN_LIST_LOC)->n.dir, \
(off)), \
nxt = ccan_list_node_to_off_(ccan_list_node_from_off_(i, (off))->dir, \
(off)); \
Expand Down
2 changes: 2 additions & 0 deletions lib/cext/include/internal.h
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,8 @@
#define LIKELY(x) RB_LIKELY(x)
#define UNLIKELY(x) RB_UNLIKELY(x)

#define numberof(array) ((int)(sizeof(array) / sizeof((array)[0])))

#include "ruby/ruby.h"

#define RBOOL(v) ((v) ? Qtrue : Qfalse)
Expand Down
2 changes: 0 additions & 2 deletions lib/cext/include/internal/bignum.h
Original file line number Diff line number Diff line change
Expand Up @@ -167,11 +167,9 @@ VALUE rb_str2big_gmp(VALUE arg, int base, int badcheck);
VALUE rb_int_parse_cstr(const char *str, ssize_t len, char **endp, size_t *ndigits, int base, int flags);
RUBY_SYMBOL_EXPORT_END

MJIT_SYMBOL_EXPORT_BEGIN
#if defined(HAVE_INT128_T)
VALUE rb_int128t2big(int128_t n);
#endif
MJIT_SYMBOL_EXPORT_END

/* sign: positive:1, negative:0 */
static inline bool
Expand Down
31 changes: 17 additions & 14 deletions lib/cext/include/internal/bits.h
Original file line number Diff line number Diff line change
Expand Up @@ -34,8 +34,7 @@
# include <stdlib.h> /* for _byteswap_uint64 */
#endif

#if defined(HAVE_X86INTRIN_H) && ! defined(MJIT_HEADER)
# /* Rule out MJIT_HEADER, which does not interface well with <immintrin.h> */
#if defined(HAVE_X86INTRIN_H)
# include <x86intrin.h> /* for _lzcnt_u64 */
#elif MSC_VERSION_SINCE(1310)
# include <intrin.h> /* for the following intrinsics */
Expand Down Expand Up @@ -119,12 +118,16 @@
MUL_OVERFLOW_SIGNED_INTEGER_P(a, b, FIXNUM_MIN, FIXNUM_MAX)
#endif

#ifdef MUL_OVERFLOW_P
#if defined(MUL_OVERFLOW_P) && defined(USE___BUILTIN_MUL_OVERFLOW_LONG_LONG)
# define MUL_OVERFLOW_LONG_LONG_P(a, b) MUL_OVERFLOW_P(a, b)
#else
# define MUL_OVERFLOW_LONG_LONG_P(a, b) MUL_OVERFLOW_SIGNED_INTEGER_P(a, b, LLONG_MIN, LLONG_MAX)
#endif

#ifdef MUL_OVERFLOW_P
# define MUL_OVERFLOW_LONG_P(a, b) MUL_OVERFLOW_P(a, b)
# define MUL_OVERFLOW_INT_P(a, b) MUL_OVERFLOW_P(a, b)
#else
# define MUL_OVERFLOW_LONG_LONG_P(a, b) MUL_OVERFLOW_SIGNED_INTEGER_P(a, b, LLONG_MIN, LLONG_MAX)
# define MUL_OVERFLOW_LONG_P(a, b) MUL_OVERFLOW_SIGNED_INTEGER_P(a, b, LONG_MIN, LONG_MAX)
# define MUL_OVERFLOW_INT_P(a, b) MUL_OVERFLOW_SIGNED_INTEGER_P(a, b, INT_MIN, INT_MAX)
#endif
Expand Down Expand Up @@ -235,7 +238,7 @@ nlz_int32(uint32_t x)
* safety. */
return (unsigned int)__lzcnt(x);

#elif defined(__x86_64__) && defined(__LZCNT__) && ! defined(MJIT_HEADER)
#elif defined(__x86_64__) && defined(__LZCNT__)
return (unsigned int)_lzcnt_u32(x);

#elif MSC_VERSION_SINCE(1400) /* &&! defined(__AVX2__) */
Expand Down Expand Up @@ -264,7 +267,7 @@ nlz_int64(uint64_t x)
#if defined(_MSC_VER) && defined(__AVX2__)
return (unsigned int)__lzcnt64(x);

#elif defined(__x86_64__) && defined(__LZCNT__) && ! defined(MJIT_HEADER)
#elif defined(__x86_64__) && defined(__LZCNT__)
return (unsigned int)_lzcnt_u64(x);

#elif defined(_WIN64) && MSC_VERSION_SINCE(1400) /* &&! defined(__AVX2__) */
Expand Down Expand Up @@ -395,9 +398,9 @@ rb_popcount32(uint32_t x)
#else
x = (x & 0x55555555) + (x >> 1 & 0x55555555);
x = (x & 0x33333333) + (x >> 2 & 0x33333333);
x = (x & 0x0f0f0f0f) + (x >> 4 & 0x0f0f0f0f);
x = (x & 0x001f001f) + (x >> 8 & 0x001f001f);
x = (x & 0x0000003f) + (x >>16 & 0x0000003f);
x = (x & 0x07070707) + (x >> 4 & 0x07070707);
x = (x & 0x000f000f) + (x >> 8 & 0x000f000f);
x = (x & 0x0000001f) + (x >>16 & 0x0000001f);
return (unsigned int)x;

#endif
Expand Down Expand Up @@ -425,9 +428,9 @@ rb_popcount64(uint64_t x)
x = (x & 0x5555555555555555) + (x >> 1 & 0x5555555555555555);
x = (x & 0x3333333333333333) + (x >> 2 & 0x3333333333333333);
x = (x & 0x0707070707070707) + (x >> 4 & 0x0707070707070707);
x = (x & 0x001f001f001f001f) + (x >> 8 & 0x001f001f001f001f);
x = (x & 0x0000003f0000003f) + (x >>16 & 0x0000003f0000003f);
x = (x & 0x000000000000007f) + (x >>32 & 0x000000000000007f);
x = (x & 0x000f000f000f000f) + (x >> 8 & 0x000f000f000f000f);
x = (x & 0x0000001f0000001f) + (x >>16 & 0x0000001f0000001f);
x = (x & 0x000000000000003f) + (x >>32 & 0x000000000000003f);
return (unsigned int)x;

#endif
Expand All @@ -450,7 +453,7 @@ rb_popcount_intptr(uintptr_t x)
static inline int
ntz_int32(uint32_t x)
{
#if defined(__x86_64__) && defined(__BMI__) && ! defined(MJIT_HEADER)
#if defined(__x86_64__) && defined(__BMI__)
return (unsigned)_tzcnt_u32(x);

#elif MSC_VERSION_SINCE(1400)
Expand All @@ -472,7 +475,7 @@ ntz_int32(uint32_t x)
static inline int
ntz_int64(uint64_t x)
{
#if defined(__x86_64__) && defined(__BMI__) && ! defined(MJIT_HEADER)
#if defined(__x86_64__) && defined(__BMI__)
return (unsigned)_tzcnt_u64(x);

#elif defined(_WIN64) && MSC_VERSION_SINCE(1400)
Expand Down
Loading
Loading