Граф коммитов

62221 Коммитов

Автор SHA1 Сообщение Дата
Takashi Kokubun a69dd699ee
Merge ivar guards on JIT (#3284)
when an ISeq has multiple ivar accesses.
2020-07-03 17:52:52 -07:00
git ccb2e6eaa5 * 2020-07-04 [ci skip] 2020-07-04 01:52:54 +09:00
Takashi Kokubun f3a0d7a203
Rewrite Kernel#tap with Ruby (#3281)
* Rewrite Kernel#tap with Ruby

This was good for VM too, but of course my intention is to unblock JIT's inlining of a block over yield
(inlining invokeyield has not been committed though).

* Fix test_settracefunc

About the :tap deletions, the :tap events are actually traced (we already have a TracePoint test for builtin methods),
but it's filtered out by tp.path == "xyzzy" (it became "<internal:kernel>"). We could trace tp.path == "<internal:kernel>"
cases too, but the lineno is impacted by kernel.rb changes and I didn't want to make it fragile for kernel.rb lineno changes.
2020-07-03 09:52:35 -07:00
Burdette Lamar e8010c7401
Enhanced RDoc for Array (#3276)
*Methods:

    keep_if
    delete
    delete_at
    slice!
2020-07-03 09:49:36 -05:00
Koichi Sasada a0f12a0258
Use ID instead of GENTRY for gvars. (#3278)
Use ID instead of GENTRY for gvars.

Global variables are compiled into GENTRY (a pointer to struct
rb_global_entry). This patch replace this GENTRY to ID and
make the code simple.

We need to search GENTRY from ID every time (st_lookup), so
additional overhead will be introduced.
However, the performance of accessing global variables is not
important now a day and this simplicity helps Ractor development.
2020-07-03 16:56:44 +09:00
Koichi Sasada 8655c2e690
RUBY_DEBUG_LOG: Logging debug information mechanism (#3279)
* RUBY_DEBUG_LOG: Logging debug information mechanism

This feature provides a mechanism to store logging information
to a file, stderr or memory space with simple macros.

The following information will be stored.
  * (1) __FILE__, __LINE__ in C
  * (2) __FILE__, __LINE__ in Ruby
  * (3) __func__ in C (message title)
  * (4) given string with sprintf format
  * (5) Thread number (if multiple threads are running)

This feature is enabled only USE_RUBY_DEBUG_LOG is enabled.
Release version should not enable it.

Running with the `RUBY_DEBUG_LOG` environment variable enables
this feature.

  # logging into a file
  RUBY_DEBUG_LOG=/path/to/file STDERR

  # logging into STDERR
  RUBY_DEBUG_LOG=stderr

  # logging into memory space (check with a debugger)
  # It will help if the timing is important.
  RUBY_DEBUG_LOG=mem

RUBY_DEBUG_LOG_FILTER environment variable can specify the fileter string.
If "(3) __func__ in C (message title)" contains the specified string, the
infomation will be stored (example: RUBY_DEBUG_LOG_FILTER=str will enable
only on str related information).

In a MRI source code, you can use the following macros:
  * RUBY_DEBUG_LOG(fmt, ...): Above (1) to (4) will be logged.
  * RUBY_DEBUG_LOG2(file, line, fmt, ...):
    Same as RUBY_DEBUG_LOG(), but (1) will be replaced with given file, line.
2020-07-03 16:55:54 +09:00
Hiroshi SHIBATA 01776ca1c0 Ignore conftest.c under the ext directories for CodeQL analysis 2020-07-03 15:16:55 +09:00
Yusuke Endoh 1e039474a2 test/json/json_fixtures_test.rb: Prevent an "out of range" warning
```
/home/mame/work/ruby/.ext/common/json/common.rb:263: warning: Float 23456789012E666 out of range
```
2020-07-03 11:47:09 +09:00
git 05a12297c3 * 2020-07-03 [ci skip] 2020-07-03 11:27:07 +09:00
Yusuke Endoh e6a8590aa4 Reintroduce c565dfb09a 2020-07-03 11:05:08 +09:00
Hiroshi SHIBATA 59ded36c60
Expose `assert_pattern_list` for drb test with test-unit gem. 2020-07-02 20:53:42 +09:00
git 08ba5bec2b * 2020-07-02 [ci skip] 2020-07-02 14:34:56 +09:00
卜部昌平 bf3f03c925 integer.rbinc: do not generate C functions
This changeset changes for instance Integer#integer? from:

    == disasm: #<ISeq:to_i@<internal:integer>:66 (66,2)-(69,5)> (catch: FALSE)
    0000 opt_invokebuiltin_delegate_leave       <builtin!_bi7/0>, 0       (68)[LiCa]
    0003 leave                                                            (69)[Re]

to:

    == disasm: #<ISeq:to_i@<internal:integer>:66 (66,2)-(69,5)> (catch: FALSE)
    0000 putself                                                          (68)[LiCa]
    0001 leave                                                            (69)[Re]

which is of course faster.
2020-07-02 14:34:30 +09:00
Nobuyoshi Nakada 49029811d9
Reduced working `Rational` object allocations
When rationalizing negative values.
2020-07-01 22:41:16 +09:00
Nobuyoshi Nakada 254bed3027
Renamed `nurat_sub` compliant with `rb_rational_plus` 2020-07-01 22:41:15 +09:00
Nobuyoshi Nakada 53d2bfd540
Added a few integer case short-circuits 2020-07-01 22:41:15 +09:00
Nobuyoshi Nakada 29ecce4d72
Replaced f_odd_p with rb_int_odd_p 2020-07-01 22:41:14 +09:00
git 68d7e93b3b * 2020-07-01 [ci skip] 2020-07-01 18:51:19 +09:00
Hiroshi SHIBATA 0aac138e0b
Merge json-2.3.1 from flori/json 2020-07-01 18:50:39 +09:00
Marc-Andre Lafortune 26041da2fb
[flori/json] Typo fix
https://github.com/flori/json/commit/26c1769969
2020-07-01 18:47:51 +09:00
BurdetteLamar d69b55ac05
[flori/json] Added :call-seq: to RDOc for some methods
https://github.com/flori/json/commit/ee5b6a74e9
2020-07-01 18:47:51 +09:00
Watson cb3e62511c
[flori/json] Use frozen string for hash key
When use non-frozen string for hash key with `rb_hash_aset()`, it will duplicate and freeze it internally.
To avoid duplicate and freeze, this patch will give a frozen string in `rb_hash_aset()`.

```
Warming up --------------------------------------
                json    14.000  i/100ms
Calculating -------------------------------------
                json    148.844  (± 1.3%) i/s -    756.000  in   5.079969s
```

```
Warming up --------------------------------------
                json    16.000  i/100ms
Calculating -------------------------------------
                json    165.608  (± 1.8%) i/s -    832.000  in   5.025367s
```

```
require 'json'
require 'securerandom'
require 'benchmark/ips'

obj = []

1000.times do |i|
  obj << {
    "id": i,
    "uuid": SecureRandom.uuid,
    "created_at": Time.now
  }
end

json = obj.to_json

Benchmark.ips do |x|
  x.report "json" do |iter|
    count = 0
    while count < iter
      JSON.parse(json)
      count += 1
    end
  end
end
```

https://github.com/flori/json/commit/18292c0c1d
2020-07-01 18:47:51 +09:00
BurdetteLamar 7d8ce96de6
[flori/json] RDoc enhancements
https://github.com/flori/json/commit/ada48f0236
2020-07-01 18:47:51 +09:00
BurdetteLamar be6447381c
[flori/json] RDoc enhancements
https://github.com/flori/json/commit/470d909c0d
2020-07-01 18:47:51 +09:00
BurdetteLamar 99980b3034
[flori/json] RDoc enhancements
https://github.com/flori/json/commit/7bee2c7c13
2020-07-01 18:47:51 +09:00
Marc-Andre Lafortune fe10323a35
[flori/json] Fix test that wasn't testing anything
https://github.com/flori/json/commit/d5c6566b41
2020-07-01 18:47:51 +09:00
BurdetteLamar 4689fd5f99
[flori/json] Rdoc enhancements
https://github.com/flori/json/commit/e7e3732130
2020-07-01 18:47:50 +09:00
Nobuyoshi Nakada 1351374bd1
Split visibility cases 2020-06-30 19:12:05 +09:00
Nobuyoshi Nakada 52ef2477e4
Extracted METHOD_ENTRY_CACHEABLE macro 2020-06-30 19:12:02 +09:00
Nobuyoshi Nakada 74ac12830b
Evaluate macros argument just once 2020-06-30 19:12:00 +09:00
Samuel Giddins 7cb8904a12 Extract correct processor name for ARM64 Macs 2020-06-30 19:03:50 +09:00
git 15a312ed40 * 2020-06-30 [ci skip] 2020-06-30 17:14:18 +09:00
Kazuhiro NISHIYAMA eefc2d8a3c
Fix a typo [ci skip] 2020-06-30 17:13:37 +09:00
Bart de Water 3621a7debf Avoid deprecated OpenSSL::Digest constants 2020-06-29 13:25:32 +09:00
卜部昌平 1ce9c37257 Revert "RBIMPL_UNREACHABLE_RETURN: evaluate the argument"
This reverts commit c8dc2bf140.

No longer necessary.
2020-06-29 12:33:17 +09:00
卜部昌平 94ab244b43 rb_class_modify_check: add UNREACHABLE
(I was not aware of this because I use clang, but) it seems gcc cannot
detect reachablility of this point.  It renders an unused variable
warning, which is a false positive.  Let us suppress the compiler.

https://github.com/ruby/ruby/runs/816997191#step:9:62
2020-06-29 11:43:48 +09:00
git 1020e120e0 * 2020-06-29 [ci skip] 2020-06-29 11:06:18 +09:00
卜部昌平 a523eca1c2 rb_enc_symname_type: refactor split
Reduce goto by splitting the function.
2020-06-29 11:05:41 +09:00
卜部昌平 2bd0f37e2b glob_opendir: move cleanup codes at the end
Nobu likes this arrangement.
2020-06-29 11:05:41 +09:00
卜部昌平 da8af471fb find_time_t: reset status before goto 2020-06-29 11:05:41 +09:00
卜部昌平 de3e931df7 add UNREACHABLE_RETURN
Not every compilers understand that rb_raise does not return.  When a
function does not end with a return statement, such compilers can issue
warnings.  We would better tell them about reachabilities.
2020-06-29 11:05:41 +09:00
卜部昌平 c8dc2bf140 RBIMPL_UNREACHABLE_RETURN: evaluate the argument
Prevent casual typos inside of UNREACHABLE_RETURN(...).
2020-06-29 11:05:41 +09:00
卜部昌平 bacd03ebdf compile_redo: fix wrong condition 2020-06-29 11:05:41 +09:00
卜部昌平 2b636dc81d make_exception: early return
The rb_exc_new3() result is already ready to be returned.  No need to
fall through the switch.
2020-06-29 11:05:41 +09:00
卜部昌平 801752f577 builtin_class_name: add variant that return VALUE
Found that `if (builtin_class_name) { printf } else { printf }` happens
twice.  It would be better if we could eliminate those if statements.
2020-06-29 11:05:41 +09:00
卜部昌平 2071c61e42 tracepoint_inspect: do not goto into a branch
I'm not necessarily against every goto in general, but jumping into a
branch is definitely a bad idea.  Better refactor.
2020-06-29 11:05:41 +09:00
卜部昌平 1bf0d36171 vm_getivar: do not goto into a branch
I'm not necessarily against every goto in general, but jumping into a
branch is definitely a bad idea.  Better refactor.
2020-06-29 11:05:41 +09:00
卜部昌平 6e67b30503 method_missing: do not goto into a branch
I'm not necessarily against every goto in general, but jumping into a
branch is definitely a bad idea.  Better refactor.
2020-06-29 11:05:41 +09:00
卜部昌平 edb1680a05 rb_method_call_status: do not goto into a branch
I'm not necessarily against every goto in general, but jumping into a
branch is definitely a bad idea.  Better refactor.
2020-06-29 11:05:41 +09:00
卜部昌平 f12efec2c2 vm_exec_handle_exception: do not goto into a branch
I'm not necessarily against every goto in general, but jumping into a
branch is definitely a bad idea.  Better refactor.
2020-06-29 11:05:41 +09:00