Don't enable YJIT by default. More tests on both Ubuntu and MacOS.

Add RUBY_YJIT_ENABLE env var and YJIT_FORCE_ENABLE compile-time constant.
Rename YJIT_STATS to RUBY_YJIT_STATS.
This commit is contained in:
Noah Gibbs 2021-10-01 13:45:02 +01:00 коммит произвёл Alan Wu
Родитель 7c08538aa3
Коммит 21e58acef3
6 изменённых файлов: 163 добавлений и 72 удалений

1
.github/workflows/compilers.yml поставляемый
Просмотреть файл

@ -167,6 +167,7 @@ jobs:
# - { key: cppflags, name: VM_DEBUG_VERIFY_METHOD_CACHE, value: '-DVM_DEBUG_VERIFY_METHOD_CACHE' }
- { key: cppflags, name: MJIT_FORCE_ENABLE, value: '-DMJIT_FORCE_ENABLE' }
- { key: cppflags, name: YJIT_FORCE_ENABLE, value: '-DYJIT_FORCE_ENABLE' }
name: ${{ matrix.entry.name }}
runs-on: ubuntu-latest

69
.github/workflows/yjit-macos.yml поставляемый Normal file
Просмотреть файл

@ -0,0 +1,69 @@
name: YJIT MacOS
on: [push, pull_request]
jobs:
make:
runs-on: macos-latest
strategy:
matrix:
test_task: [ "check", "test-bundler-parallel" ] #, "test-bundled-gems" ]
yjit_opts: [
"--yjit",
"--yjit --yjit-call-threshold=1 --yjit-max-versions=1",
"--yjit --yjit-call-threshold=1",
"--yjit --yjit-call-threshold=2"
]
fail-fast: false
env:
TESTOPTS: '-q --tty=no'
RUN_OPTS: '--disable-gems ${{ matrix.yjit_opts }}'
GITPULLOPTIONS: --no-tags origin ${{github.ref}}
steps:
- run: mkdir build
working-directory:
- name: git config
run: |
git config --global advice.detachedHead 0
git config --global init.defaultBranch garbage
- uses: actions/checkout@v2
with:
path: src
- name: Install libraries
run: |
brew upgrade
brew install gmp libffi openssl@1.1 zlib autoconf automake libtool readline
working-directory: src
- name: Set ENV
run: |
echo "JOBS=-j$((1 + $(sysctl -n hw.activecpu)))" >> $GITHUB_ENV
- run: ./autogen.sh
working-directory: src
- name: Run configure
run: ../src/configure -C --disable-install-doc --with-openssl-dir=$(brew --prefix openssl@1.1) --with-readline-dir=$(brew --prefix readline)
- run: make $JOBS incs
- run: make $JOBS
# - run: make leaked-globals
# if: matrix.test_task == 'check'
- run: make prepare-gems
if: ${{ matrix.test_task == 'check' }}
- run: make $JOBS -s ${{ matrix.test_task }}
timeout-minutes: 60
env:
RUBY_TESTOPTS: "-q --tty=no"
TEST_BUNDLED_GEMS_ALLOW_FAILURES: "rexml"
- uses: k0kubun/action-slack@v2.0.0
with:
payload: |
{
"ci": "GitHub Actions",
"env": "${{ github.workflow }} / ${{ matrix.test_task }}",
"url": "https://github.com/${{ github.repository }}/actions/runs/${{ github.run_id }}",
"commit": "${{ github.sha }}",
"branch": "${{ github.ref }}".split('/').reverse()[0]
}
env:
SLACK_WEBHOOK_URL: ${{ secrets.SIMPLER_ALERTS_URL }} # ruby-lang slack: ruby/simpler-alerts-bot
if: ${{ failure() && github.event_name == 'push' }}
defaults:
run:
working-directory: build

86
.github/workflows/yjit-ubuntu.yml поставляемый Normal file
Просмотреть файл

@ -0,0 +1,86 @@
name: Ubuntu
on: [push, pull_request]
jobs:
make:
strategy:
matrix:
test_task: ["check", "test-bundler-parallel", "test-bundled-gems", "test-all", "test-spec"]
os:
- ubuntu-20.04
# - ubuntu-18.04
yjit_opts: [
"--yjit",
"--yjit --yjit-call-threshold=1 --yjit-max-versions=1",
"--yjit --yjit-call-threshold=1",
"--yjit --yjit-call-threshold=2"
]
configure: ["", "cppflags=-DRUBY_DEBUG"]
include:
- test_task: "test-all TESTS=--repeat-count=2"
os: ubuntu-20.04
configure: ""
fail-fast: false
env:
GITPULLOPTIONS: --no-tags origin ${{github.ref}}
RUN_OPTS: ${{ matrix.yjit_opts }}
RUBY_DEBUG: ci
runs-on: ${{ matrix.os }}
steps:
- run: mkdir build
working-directory:
- name: Install libraries
run: |
set -x
sudo apt-get update -q || :
sudo apt-get install --no-install-recommends -q -y build-essential libssl-dev libyaml-dev libreadline6-dev zlib1g-dev libncurses5-dev libffi-dev bison autoconf ruby
- name: git config
run: |
git config --global advice.detachedHead 0
git config --global init.defaultBranch garbage
- uses: actions/checkout@v2
with:
path: src
- name: Fixed world writable dirs
run: |
chmod -v go-w $HOME $HOME/.config
sudo chmod -R go-w /usr/share
sudo bash -c 'IFS=:; for d in '"$PATH"'; do chmod -v go-w $d; done' || :
- name: Set ENV
run: |
echo "JOBS=-j$((1 + $(nproc --all)))" >> $GITHUB_ENV
- run: ./autogen.sh
working-directory: src
- name: Run configure
run: ../src/configure -C --disable-install-doc ${{ matrix.configure }}
- run: make $JOBS incs
- run: make $JOBS
# - run: make leaked-globals
# if: matrix.test_task == 'check'
- run: make prepare-gems
if: ${{ matrix.test_task == 'check' }}
- name: Create dummy files in build dir
run: |
./miniruby -e '(("a".."z").to_a+("A".."Z").to_a+("0".."9").to_a+%w[foo bar test zzz]).each{|basename|File.write("#{basename}.rb", "raise %(do not load #{basename}.rb)")}'
if: ${{ matrix.test_task == 'check' }}
- run: make $JOBS -s ${{ matrix.test_task }} RUN_OPTS="$RUN_OPTS"
timeout-minutes: 60
env:
RUBY_TESTOPTS: "-q --tty=no"
TEST_BUNDLED_GEMS_ALLOW_FAILURES: ""
- uses: k0kubun/action-slack@v2.0.0
with:
payload: |
{
"ci": "GitHub Actions",
"env": "${{ matrix.os }} / ${{ matrix.test_task }}${{ matrix.configure }}",
"url": "https://github.com/${{ github.repository }}/actions/runs/${{ github.run_id }}",
"commit": "${{ github.sha }}",
"branch": "${{ github.ref }}".split('/').reverse()[0]
}
env:
SLACK_WEBHOOK_URL: ${{ secrets.SIMPLER_ALERTS_URL }} # ruby-lang slack: ruby/simpler-alerts-bot
if: ${{ failure() && github.event_name == 'push' }}
defaults:
run:
working-directory: build

70
.github/workflows/yjit.yml поставляемый
Просмотреть файл

@ -1,70 +0,0 @@
name: YJIT options
on: [push, pull_request]
jobs:
make:
strategy:
matrix:
# To make job names consistent
test_task: [ "check" ]
# Run with multiple thresholds and params to surface more bugs
yjit_opts: [
"--yjit-call-threshold=1 --yjit-max-versions=1",
"--yjit-call-threshold=1",
"--yjit-call-threshold=2"
]
fail-fast: false
runs-on: ubuntu-latest
env:
TESTOPTS: '-q --tty=no'
RUN_OPTS: '--disable-gems ${{ matrix.yjit_opts }}'
GITPULLOPTIONS: --no-tags origin ${{ github.ref }}
steps:
- run: mkdir build
working-directory:
- name: Install libraries
run: |
set -x
sudo apt-get update -q || :
sudo apt-get install --no-install-recommends -q -y build-essential libssl-dev libyaml-dev libreadline6-dev zlib1g-dev libncurses5-dev libffi-dev libgdbm-dev bison autoconf ruby
- name: git config
run: |
git config --global advice.detachedHead 0
git config --global init.defaultBranch garbage
- uses: actions/checkout@v2
with:
path: src
- name: Fixed world writable dirs
run: |
chmod -v go-w $HOME $HOME/.config
sudo chmod -R go-w /usr/share
sudo bash -c 'IFS=:; for d in '"$PATH"'; do chmod -v go-w $d; done' || :
- name: Set ENV
run: |
echo "JOBS=-j$((1 + $(nproc --all)))" >> $GITHUB_ENV
- run: ./autogen.sh
working-directory: src
- name: Run configure
run: ../src/configure -C --disable-install-doc
- run: make $JOBS incs
- run: make $JOBS
- run: sudo make $JOBS -s install
- run: sudo apt-get install gdb # used by test / test-all failure
- name: Run test
run: |
ulimit -c unlimited
make $JOBS -s test RUN_OPTS="$RUN_OPTS"
timeout-minutes: 60
- name: Run test-all
run: |
ulimit -c unlimited
make $JOBS -s test-all RUN_OPTS="$RUN_OPTS"
timeout-minutes: 60
- name: Run test-spec
run: |
ulimit -c unlimited
make $JOBS -s test-spec RUN_OPTS="$RUN_OPTS"
timeout-minutes: 60
defaults:
run:
working-directory: build

7
ruby.c
Просмотреть файл

@ -234,9 +234,14 @@ cmdline_options_init(ruby_cmdline_options_t *opt)
opt->features.set = DEFAULT_FEATURES;
#ifdef MJIT_FORCE_ENABLE /* to use with: ./configure cppflags="-DMJIT_FORCE_ENABLE" */
opt->features.set |= FEATURE_BIT(jit);
#else
#elif defined(YJIT_FORCE_ENABLE)
opt->features.set |= FEATURE_BIT(yjit);
#endif
if(getenv("RUBY_YJIT_ENABLE")) {
opt->features.set |= FEATURE_BIT(yjit);
}
return opt;
}

Просмотреть файл

@ -1092,7 +1092,7 @@ rb_yjit_init(struct rb_yjit_options *options)
rb_yjit_opts = *options;
rb_yjit_opts.yjit_enabled = true;
rb_yjit_opts.gen_stats |= !!getenv("YJIT_STATS");
rb_yjit_opts.gen_stats = rb_yjit_opts.gen_stats || getenv("RUBY_YJIT_STATS");
#if !YJIT_STATS
if(rb_yjit_opts.gen_stats) {