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

694 Коммитов

Автор SHA1 Сообщение Дата
Nobuyoshi Nakada 301d194ee3 Add Integer.try_convert [Feature #15211] 2021-07-16 17:49:53 +09:00
S-H-GAMELINKS b32ae9898f Move rb_str_escape function declaration 2021-07-11 18:26:20 +09:00
Nobuyoshi Nakada 94bd3bde81 Specify version to remove as bare numbers 2021-06-30 10:47:01 +09:00
Nobuyoshi Nakada 8118d435d0 rb_warn_deprecated_to_remove_at [Feature #17432]
At compilation time with RUBY_DEBUG enabled, check if the removal
version has been reached.
2021-06-30 10:47:01 +09:00
Nobuyoshi Nakada 47a9b58b2a
Share freeze option handling 2021-06-28 10:53:37 +09:00
Nobuyoshi Nakada e4f891ce8d
Adjust styles [ci skip]
* --braces-after-func-def-line
* --dont-cuddle-else
* --procnames-start-lines
* --space-after-for
* --space-after-if
* --space-after-while
2021-06-17 10:13:40 +09:00
S.H 28b481938b
Implemented some NilClass method in Ruby code is faster [Feature #17054] (#3366) 2021-06-02 20:04:56 -07:00
Burdette Lamar 6b32f1f338
Object whats here (#4503)
What's Here section for class Object.
2021-05-18 08:16:29 -05:00
Burdette Lamar 434cd3c399
What's Here for BasicObject (#4499)
* What's Here for BasicObject
2021-05-13 17:19:07 -05:00
Burdette Lamar 879cc64d06
What's Here for Kernel (#4488) 2021-05-13 12:09:07 -05:00
Aaron Patterson 9a6226c61e Eagerly allocate instance variable tables along with object
This allows us to allocate the right size for the object in advance,
meaning that we don't have to pay the cost of ivar table extension
later.  The idea is that if an object type ever became "extended" at
some point, then it is very likely it will become extended again.  So we
may as well allocate the ivar table up front.
2021-05-03 14:11:48 -07:00
Kenichi Kamiya c080bb2284 [Doc] Update to FrozenError from RuntimeError in Object#freeze 2021-04-01 10:10:02 -07:00
Nobuyoshi Nakada 1499f626a5
[DOC] Modified prefixes to get rid of conflicts 2021-02-07 23:35:06 +09:00
Nobuyoshi Nakada 03e3cc2b72
[DOC] make individual names so that rdoc can find each documents 2021-02-07 23:12:06 +09:00
Nobuyoshi Nakada 0261519f6e
[DOC] Module#method_undefined 2021-02-07 23:11:59 +09:00
Marcus Stollsteimer c3f91f9d88 [DOC] Fix typos 2020-12-24 23:09:51 +01:00
卜部昌平 7fbad92241 rb_cData: no longer exists
Commit 8918a9cf6c introduced macro
`#define rb_cData rb_cData()`.  This deleting `VALUE rb_cData;`
declaration was then macro-expanded into `VALUE rb_cData();`.  This
worked by accident because the expanded expression happen to be a K&R
style function declaration.

This is rather complicated and I guess unintended.  Just delete the line
to keep things simple straight forward.
2020-12-22 16:18:17 +09:00
Nobuyoshi Nakada 8918a9cf6c Removed rb_cData entity
* Use the wrapper of rb_cObject instead of data access
* Replaced rest of extentions
* Updated the version guard for Data
* Added the version guard of rb_cData
2020-12-22 02:51:49 +09:00
卜部昌平 c30f03d328 Data: delete
Has been deprecated since 684bdf6171.

Matz says in [ruby-core:83954] that Data should be an alias of Object.
Because rb_cData has not been deprecated, let us deprecate the constant
to make it a C-level synonym of rb_cObject.
2020-12-22 02:51:49 +09:00
Nobuyoshi Nakada 34f6b22df0
Use rb_id_attrset without intermediate strings 2020-12-19 11:44:05 +09:00
Radosław Bułat d40d95296d Feature 17314: update docs and NEWS about attr* methods returning array of symbols 2020-12-19 09:22:26 +09:00
Yusuke Endoh aa7a020710 Revert "Revert "Use rb_id_attrset without intermediate strings""
This reverts commit 41c208d4a4.

Reintroduce 66090b9d10.
2020-12-19 03:20:09 +09:00
Radosław Bułat 5944c4b3cf
attr_reader, attr_writer, attr_accessor and attr methods returns array of symbols (#3935)
Co-authored-by: Yusuke Endoh <mame@ruby-lang.org>
2020-12-19 03:11:35 +09:00
Jeremy Evans 05313c914b Use category: :deprecated in warnings that are related to deprecation
Also document that both :deprecated and :experimental are supported
:category option values.

The locations where warnings were marked as deprecation warnings
was previously reviewed by shyouhei.

Comment a couple locations where deprecation warnings should probably
be used but are not currently used because deprecation warning
enablement has not occurred at the time they are called
(RUBY_FREE_MIN, RUBY_HEAP_MIN_SLOTS, -K).

Add assert_deprecated_warn to test assertions.  Use this to simplify
some tests, and fix failing tests after marking some warnings with
deprecated category.
2020-12-18 09:54:11 -08:00
Yusuke Endoh 982443e6e3 Revert "Better cooperation between public/protected/private with attr* and alias_method"
This reverts commit 81739ad4fd.
2020-12-18 16:08:55 +09:00
Yusuke Endoh 41c208d4a4 Revert "Use rb_id_attrset without intermediate strings"
This reverts commit 66090b9d10.
2020-12-18 16:08:25 +09:00
Nobuyoshi Nakada 66090b9d10
Use rb_id_attrset without intermediate strings 2020-12-18 12:10:20 +09:00
Radosław Bułat 81739ad4fd Better cooperation between public/protected/private with attr* and alias_method 2020-12-17 12:46:02 -05:00
Nobuyoshi Nakada a039dc018c
[DOC] Described "numeric representation" more precisely [ci skip]
[Bug #17395]
2020-12-16 00:07:37 +09:00
Nobuyoshi Nakada d2b7e1e4b2
Protoized old pre-ANSI K&R style definitions 2020-12-05 14:57:31 +09:00
Aaron Patterson 0bbbb5a657 `dest` is always embedded so we can remove this check 2020-10-28 08:41:39 -07:00
Stefan Stüben 8c2e5bbf58 Don't redefine #rb_intern over and over again 2020-10-21 12:45:18 +09:00
Koichi Sasada 91ec5f9e39 remove rb_obj_iv_index_tbl
(1) nobody uses it (gem-codesearch)
(2) the data strucuture will be changed.
2020-10-17 08:18:04 +09:00
S.H 5e120a2389
Improve doc in rb_class_real doc (#3637) 2020-10-10 04:52:21 -04:00
John Hawthorn 0b81a484f3 Initialize new T_OBJECT as ROBJECT_EMBED
Previously, when an object is first initialized, ROBJECT_EMBED isn't
set. This means that for brand new objects, ROBJECT_NUMIV(obj) is 0 and
ROBJECT_IV_INDEX_TBL(obj) is NULL.

Previously, this combination meant that the inline cache would never be
initialized when setting an ivar on an object for the first time since
iv_index_tbl was NULL, and if it were it would never be used because
ROBJECT_NUMIV was 0. Both cases always fell through to the generic
rb_ivar_set which would then set the ROBJECT_EMBED flag and initialize
the ivar array.

This commit changes rb_class_allocate_instance to set the ROBJECT_EMBED
flag on the object initially and to initialize all members of the
embedded array to Qundef. This allows the inline cache to be set
correctly on first use and to be used on future uses.

This moves rb_class_allocate_instance to gc.c, so that it has access to
newobj_of. This seems appropriate given that there are other allocating
methods in this file (ex. rb_data_object_wrap, rb_imemo_new).
2020-09-02 14:54:29 -07:00
卜部昌平 6649677eb9 ROBJECT_IV_INDEX_TBL: convert into an inline function
Former ROBJECT_IV_INDEX_TBL macro included RCLASS_IV_INDEX_TBL, which is
not disclosed to extension libraies.  The macro was kind of broken.  Why
not just deprecate it, and convert the internal use into an inline
function.
2020-08-19 14:30:57 +09:00
Espartaco Palma cfbae7dae0 [skip-ci] Clarification for dup vs clone docs
Both clone & dup returns a new object when executed
on the documentation looks like they are returning the
same object cloned or dup'ed which is true for method
as extend, but not for the above mentioned.
2020-07-30 18:34:17 +09:00
卜部昌平 9721f477c7 inline Primitive.cexpr!
We can obtain the verbatim source code of Primitive.cexpr!.  Why not
paste that content into the JITed program.
2020-07-13 08:56:18 +09:00
Takashi Kokubun 24fa37d87a
Make Kernel#then, #yield_self, #frozen? builtin (#3283)
* Make Kernel#then, #yield_self, #frozen? builtin

* Fix test_jit
2020-07-03 18:02:43 -07: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
卜部昌平 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
卜部昌平 82ed66a75a rb_cstr_to_dbl_raise: 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
卜部昌平 06ed9a7a04 rb_convert_to_integer: 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
卜部昌平 268962077a rb_mod_const_location: 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
卜部昌平 60212cd8ee rb_mod_const_defined: 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
卜部昌平 3b8d9badab rb_mod_const_get: 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
卜部昌平 1f6e74106f class_or_module_required: 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
Takashi Kokubun 946e5cc668
Annotate Kernel#class as inline (#3250)
```
$ benchmark-driver -v --rbenv 'before;after;before --jit;after --jit' benchmark/mjit_class.yml --repeat-count=4
before: ruby 2.8.0dev (2020-06-23T07:09:54Z master 37a2e48d76) [x86_64-linux]
after: ruby 2.8.0dev (2020-06-23T17:29:56Z inline-class 0ff147c007) [x86_64-linux]
before --jit: ruby 2.8.0dev (2020-06-23T07:09:54Z master 37a2e48d76) +JIT [x86_64-linux]
after --jit: ruby 2.8.0dev (2020-06-23T17:29:56Z inline-class 0ff147c007) +JIT [x86_64-linux]
Calculating -------------------------------------
                         before       after  before --jit  after --jit
    mjit_class(self)    39.219M     40.060M       53.502M      69.202M i/s -     40.000M times in 1.019915s 0.998495s 0.747631s 0.578021s
       mjit_class(1)    39.567M     41.242M       52.100M      68.895M i/s -     40.000M times in 1.010935s 0.969885s 0.767749s 0.580591s

Comparison:
                 mjit_class(self)
         after --jit:  69201690.7 i/s
        before --jit:  53502336.4 i/s - 1.29x  slower
               after:  40060289.1 i/s - 1.73x  slower
              before:  39218939.2 i/s - 1.76x  slower

                    mjit_class(1)
         after --jit:  68895358.6 i/s
        before --jit:  52100353.0 i/s - 1.32x  slower
               after:  41241993.6 i/s - 1.67x  slower
              before:  39567314.0 i/s - 1.74x  slower
```
2020-06-23 23:49:03 -07:00
Jean byroot Boussier f48fce4981 Fix a typo in instance_variable_set documentation 2020-06-10 17:49:11 -07:00
Jeremy Evans 573e8d7736 Change language used in instance_variable_set documentation [ci skip]
This uses less harsh language recommended by duerst.

Fixes [Misc #15265]
Fixes [Misc #15748]
2020-06-10 10:49:28 -07:00