Skip to content

Commit

Permalink
Merge branch 'master' into yjit_count_entry
Browse files Browse the repository at this point in the history
  • Loading branch information
maximecb authored Jul 5, 2023
2 parents 7586b2b + f0f099a commit d918f43
Show file tree
Hide file tree
Showing 86 changed files with 4,922 additions and 5,596 deletions.
7 changes: 2 additions & 5 deletions .cirrus.yml
Original file line number Diff line number Diff line change
Expand Up @@ -90,10 +90,6 @@ yjit_task:
matrix:
- CC: gcc-11
configure: --enable-yjit
install_rust_script:
- sudo apt-get update -y
- sudo apt-get install -y curl
- "curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh -s -- -y $rustup_init"
<< : *CONFIG_TEMPLATE
make_miniruby_script: make miniruby
make_bindgen_script: |
Expand All @@ -110,4 +106,5 @@ yjit_task:
make_test_script: make test RUN_OPTS="--yjit-call-threshold=1 --yjit-verify-ctx"
make_test_all_script: make test-all RUN_OPTS="--yjit-call-threshold=1 --yjit-verify-ctx" TESTOPTS="$RUBY_TESTOPTS"
make_test_spec_script: make test-spec RUN_OPTS="--yjit-call-threshold=1 --yjit-verify-ctx"
clippy_script: cd yjit && cargo clippy --all-targets --all-features
# Cirrus Rust environments don't have enough permission to run `rustup component add clippy`.
# clippy_script: cd yjit && rustup component add clippy && cargo clippy --all-targets --all-features
336 changes: 135 additions & 201 deletions common.mk

Large diffs are not rendered by default.

1 change: 1 addition & 0 deletions configure.ac
Original file line number Diff line number Diff line change
Expand Up @@ -2132,6 +2132,7 @@ AC_CHECK_FUNCS(sigaction)
AC_CHECK_FUNCS(sigaltstack)
AC_CHECK_FUNCS(sigprocmask)
AC_CHECK_FUNCS(sinh)
AC_CHECK_FUNCS(snprintf)
AC_CHECK_FUNCS(spawnv)
AC_CHECK_FUNCS(symlink)
AC_CHECK_FUNCS(syscall)
Expand Down
93 changes: 0 additions & 93 deletions doc/yarp/fuzzing.md

This file was deleted.

111 changes: 53 additions & 58 deletions ext/bigdecimal/bigdecimal.c
Original file line number Diff line number Diff line change
Expand Up @@ -2689,22 +2689,22 @@ BigDecimal_ceil(int argc, VALUE *argv, VALUE self)
* A space at the start of s returns positive values with a leading space.
*
* If s contains a number, a space is inserted after each group of that many
* fractional digits.
* digits, starting from '.' and counting outwards.
*
* If s ends with an 'E', engineering notation (0.xxxxEnn) is used.
*
* If s ends with an 'F', conventional floating point notation is used.
*
* Examples:
*
* BigDecimal('-123.45678901234567890').to_s('5F')
* #=> '-123.45678 90123 45678 9'
* BigDecimal('-1234567890123.45678901234567890').to_s('5F')
* #=> '-123 45678 90123.45678 90123 45678 9'
*
* BigDecimal('123.45678901234567890').to_s('+8F')
* #=> '+123.45678901 23456789'
* BigDecimal('1234567890123.45678901234567890').to_s('+8F')
* #=> '+12345 67890123.45678901 23456789'
*
* BigDecimal('123.45678901234567890').to_s(' F')
* #=> ' 123.4567890123456789'
* BigDecimal('1234567890123.45678901234567890').to_s(' F')
* #=> ' 1234567890123.4567890123456789'
*/
static VALUE
BigDecimal_to_s(int argc, VALUE *argv, VALUE self)
Expand Down Expand Up @@ -6706,95 +6706,90 @@ VpToFString(Real *a, char *buf, size_t buflen, size_t fFmt, int fPlus)
/* fPlus = 0: default, 1: set ' ' before digits, 2: set '+' before digits. */
{
size_t i, n;
DECDIG m, e, nn;
DECDIG m, e;
char *p = buf;
size_t plen = buflen;
size_t plen = buflen, delim = fFmt;
ssize_t ex;

if (VpToSpecialString(a, buf, buflen, fPlus)) return;

#define ADVANCE(n) do { \
if (plen < n) goto overflow; \
p += n; \
plen -= n; \
#define APPEND(c, group) do { \
if (plen < 1) goto overflow; \
if (group && delim == 0) { \
*p = ' '; \
p += 1; \
plen -= 1; \
} \
if (plen < 1) goto overflow; \
*p = c; \
p += 1; \
plen -= 1; \
if (group) delim = (delim + 1) % fFmt; \
} while (0)


if (BIGDECIMAL_NEGATIVE_P(a)) {
*p = '-';
ADVANCE(1);
APPEND('-', false);
}
else if (fPlus == 1) {
*p = ' ';
ADVANCE(1);
APPEND(' ', false);
}
else if (fPlus == 2) {
*p = '+';
ADVANCE(1);
APPEND('+', false);
}

n = a->Prec;
ex = a->exponent;
if (ex <= 0) {
*p = '0'; ADVANCE(1);
*p = '.'; ADVANCE(1);
while (ex < 0) {
for (i=0; i < BASE_FIG; ++i) {
*p = '0'; ADVANCE(1);
}
++ex;
APPEND('0', false);
APPEND('.', false);
}
while (ex < 0) {
for (i=0; i < BASE_FIG; ++i) {
APPEND('0', fFmt > 0);
}
ex = -1;
++ex;
}

for (i = 0; i < n; ++i) {
--ex;
if (i == 0 && ex >= 0) {
size_t n = snprintf(p, plen, "%lu", (unsigned long)a->frac[i]);
if (n > plen) goto overflow;
ADVANCE(n);
}
else {
m = BASE1;
e = a->frac[i];
while (m) {
nn = e / m;
*p = (char)(nn + '0');
ADVANCE(1);
e = e - nn * m;
m = BASE1;
e = a->frac[i];
if (i == 0 && ex > 0) {
for (delim = 0; e / m == 0; delim++) {
m /= 10;
}
if (fFmt > 0) {
delim = 2*fFmt - (ex * BASE_FIG - delim) % fFmt;
}
}
if (ex == 0) {
*p = '.';
ADVANCE(1);
while (m && (e || (i < n - 1) || ex > 0)) {
APPEND((char)(e / m + '0'), fFmt > 0);
e %= m;
m /= 10;
}
if (--ex == 0) {
APPEND('.', false);
delim = fFmt;
}
}
while (--ex>=0) {
m = BASE;
while (m /= 10) {
*p = '0';
ADVANCE(1);

while (ex > 0) {
for (i=0; i < BASE_FIG; ++i) {
APPEND('0', fFmt > 0);
}
if (ex == 0) {
*p = '.';
ADVANCE(1);
if (--ex == 0) {
APPEND('.', false);
}
}

*p = '\0';
while (p - 1 > buf && p[-1] == '0') {
*(--p) = '\0';
++plen;
}
if (p - 1 > buf && p[-1] == '.') {
snprintf(p, plen, "0");
}
if (fFmt) VpFormatSt(buf, fFmt);

overflow:
return;
#undef ADVANCE
#undef APPEND
}

/*
Expand Down
14 changes: 14 additions & 0 deletions lib/reline.rb
Original file line number Diff line number Diff line change
Expand Up @@ -266,6 +266,7 @@ def get_screen_size
Reline::DEFAULT_DIALOG_CONTEXT = Array.new

def readmultiline(prompt = '', add_hist = false, &confirm_multiline_termination)
Reline.update_iogate
Reline::IOGate.with_raw_input do
unless confirm_multiline_termination
raise ArgumentError.new('#readmultiline needs block to confirm multiline termination')
Expand All @@ -284,6 +285,7 @@ def readmultiline(prompt = '', add_hist = false, &confirm_multiline_termination)
end

def readline(prompt = '', add_hist = false)
Reline.update_iogate
inner_readline(prompt, add_hist, false)

line = line_editor.line.dup
Expand Down Expand Up @@ -580,6 +582,18 @@ def self.ungetc(c)
def self.line_editor
core.line_editor
end

def self.update_iogate
return if core.config.test_mode

# Need to change IOGate when `$stdout.tty?` change from false to true by `$stdout.reopen`
# Example: rails/spring boot the application in non-tty, then run console in tty.
if ENV['TERM'] != 'dumb' && Reline::IOGate == Reline::GeneralIO && $stdout.tty?
require 'reline/ansi'
remove_const(:IOGate)
const_set(:IOGate, Reline::ANSI)
end
end
end

require 'reline/general_io'
Expand Down
Loading

0 comments on commit d918f43

Please sign in to comment.