| Commit message (Collapse) | Author | Age | Files | Lines |
|
|
|
|
|
|
|
| |
by merging `rb_ast_body_t#line_count` and `#script_lines`.
Fortunately `line_count == RARRAY_LEN(script_lines)` was always
satisfied. When script_lines is saved, it has an array of lines, and
when not saved, it has a Fixnum that represents the old line_count.
|
|
|
|
|
|
|
| |
This option makes the parser keep the original source as an array of
the original code lines. This feature exploits the mechanism of
`SCRIPT_LINES__` but records only the specified code that is passed to
RubyVM::AST.of or .parse, instead of recording all parsed program texts.
|
| |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
I prefer pconst to be the first element of NODE.
Before:
| ARYPTN | FNDPTN | HSHPTN
---+--------+--------+-----------
u1 | imemo | imemo | pkwargs
u2 | pconst | pconst | pconst
u3 | apinfo | fpinfo | pkwrestarg
After:
| ARYPTN | FNDPTN | HSHPTN
---+--------+--------+-----------
u1 | pconst | pconst | pconst
u2 | imemo | imemo | pkwargs
u3 | apinfo | fpinfo | pkwrestarg
|
|
|
|
|
| |
Remove all usages of RCAST() so that the header file can be excluded
from ruby/ruby.h's dependency.
|
|
|
|
|
| |
I accidentally added this in 35ba2783fe6b3316a6bbc6f00bf975ad7185d6e0,
and it's making the size of RVALUE be too big. I'm sorry! orz
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
This is a partial revert commit of 8f096226e1b76f95f4d853d3dea2bc75eeeb5244.
NODE layout:
Before:
| ARYPTN | FNDPTN | HSHPTN
---+--------+--------+-----------
u1 | pconst | pconst | pconst
u2 | unused | unused | pkwargs
u3 | apinfo | fpinfo | pkwrestarg
After:
| ARYPTN | FNDPTN | HSHPTN
---+--------+--------+-----------
u1 | imemo | imemo | pkwargs
u2 | pconst | pconst | pconst
u3 | apinfo | fpinfo | pkwrestarg
|
|
|
|
|
|
|
| |
This patch changes local table memory to be managed by a linked list
rather than via the garbage collector. It reduces allocations from the
GC and also fixes a use-after-free bug in the concurrent-with-sweep
compactor I'm working on.
|
|
|
|
|
|
|
|
|
|
|
|
| |
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.
|
| |
|
| |
|
| |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
According to MSVC manual (*1), cl.exe can skip including a header file
when that:
- contains #pragma once, or
- starts with #ifndef, or
- starts with #if ! defined.
GCC has a similar trick (*2), but it acts more stricter (e. g. there
must be _no tokens_ outside of #ifndef...#endif).
Sun C lacked #pragma once for a looong time. Oracle Developer Studio
12.5 finally implemented it, but we cannot assume such recent version.
This changeset modifies header files so that each of them include
strictly one #ifndef...#endif. I believe this is the most portable way
to trigger compiler optimizations. [Bug #16770]
*1: https://docs.microsoft.com/en-us/cpp/preprocessor/once
*2: https://gcc.gnu.org/onlinedocs/cppinternals/Guard-Macros.html
|
|
|
|
|
|
| |
This removes the related tests, and puts the related specs behind
version guards. This affects all code in lib, including some
libraries that may want to support older versions of Ruby.
|
|
|
|
|
|
|
|
|
|
|
|
| |
Looking at the list of symbols inside of libruby-static.a, I found
hundreds of functions that are defined, but used from nowhere.
There can be reasons for each of them (e.g. some functions are
specific to some platform, some are useful when debugging, etc).
However it seems the functions deleted here exist for no reason.
This changeset reduces the size of ruby binary from 26,671,456
bytes to 26,592,864 bytes on my machine.
|
|
|
|
|
| |
This reverts commit 67c574736912003c377218153f9d3b9c0c96a17b.
[Feature #16275]
|
|
|
|
|
|
|
|
|
|
|
|
| |
Get rid of these redundant and useless warnings.
```
$ ruby -e 'def bar(a) a; end; def foo(...) bar(...) end; foo({})'
-e:1: warning: The last argument is used as the keyword parameter
-e:1: warning: for `foo' defined here
-e:1: warning: The keyword argument is passed as the last hash parameter
-e:1: warning: for `bar' defined here
```
|
|
|
|
| |
This commit adds compaction support to `rb_ast_t`.
|
| |
|
| |
|
|
|
|
|
|
| |
Macros can't be expressions, that is a GNU extension (I didn't know
that). This commit converts the macro to a function so that everything
will compile correctly on non-GNU compatible compilers.
|
| |
|
|
|
|
| |
This reverts commit 092f31e7e23c0ee04df987f0c0f979d036971804.
|
|
|
|
|
|
|
|
|
|
| |
and NODE_ZARRAY to NODE_ZLIST.
NODE_ARRAY is used not only by an Array literal, but also the contents
of Hash literals, method call arguments, dynamic string literals, etc.
In addition, the structure of NODE_ARRAY is a linked list, not an array.
This is very confusing, so I believe `NODE_LIST` is a better name.
|
|
|
|
|
| |
Looks like we're getting WB misses during stressful GC on startup. I am
investigating.
|
|
|
|
|
|
| |
I guess those AST node were actually used for something, so we'd better
not touch them. Instead this commit just puts the tmpbuffer inside a
different internal struct so that we can mark them.
|
|
|
|
|
|
|
|
|
| |
This commit adds two buckets for allocating NODE structs, then allocates
"markable" NODE objects from one bucket. The reason to do this is so
when the AST mark function scans nodes for VALUE objects to mark, we
only scan NODE objects that we know to reference VALUE objects. If we
*did not* divide the objects, then the mark function spends too much
time scanning objects that don't contain any references.
|
| |
|
|
|
|
|
|
|
|
|
| |
This syntax means the method should be treated as a method that
uses keyword arguments, but no specific keyword arguments are
supported, and therefore calling the method with keyword arguments
will raise an ArgumentError. It is still allowed to double splat
an empty hash when calling the method, as that does not pass
any keyword arguments.
|
|
|
|
|
|
| |
[Feature #15805]
Closes: https://github.com/ruby/ruby/pull/2140
|
| |
|
|
|
|
|
| |
Fix the name of the macro variable introduced in 0872ea5330
from NODE_SPECIAL_EXCESSED_COMMA to NODE_SPECIAL_EXCESSIVE_COMMA.
|
|
|
|
|
|
| |
`(ID)1` was assigned to NODE_ARGS#rest_arg for `{|x,| }`.
This change removes the magic number by introducing an explicit macro
variable for it: NODE_SPECIAL_EXCESSED_COMMA.
|
|
|
|
|
| |
* parse.y (case_args): moved "duplicated when clause" warning from
compile phase, so that `ruby -wc` shows them.
|
|
|
|
|
|
| |
[ruby-core:87945] [Feature #14912]
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@67586 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
|
|
|
|
|
|
|
|
|
| |
NODE_HASH#nd_brace is a flag that is 1 for `foo({ k: 1 })` and 0 for
`foo(k: 1)`.
nd_alen had been abused for the flag (and the implementation is
completely the same), but an explicit name is better to read.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@67266 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
|
|
|
|
|
|
|
|
| |
Introduce the new operator for method reference, `.:`.
[Feature #12125] [Feature #13581]
[EXPERIMENTAL]
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@66667 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
|
|
|
|
| |
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@65653 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
|
|
|
|
| |
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@65542 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
* node.h: Add `nd_first_loc` and `nd_set_first_loc`
* parse.y: Fix to start with the beginning of `->` .
e.g. The locations of the NODE_LAMBDA is fixed:
```
-> x { 1 + 2 }
```
* Before
```
NODE_LAMBDA (line: 1, location: (1,2)-(1,14))
```
* After
```
NODE_LAMBDA (line: 1, location: (1,0)-(1,14))
```
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@65221 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
|
|
|
|
|
|
|
| |
* node.h (enum node_type): removed unused macros which redefine the
same name enum values, and probably had ended the historical role.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@64710 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
The code fragments that initializes coverage data were scattered into
both parse.y and compile.c. parse.y allocated a coverage data, and
compile.c initialize the data.
To remove this cross-cutting concern, this change moves the allocation
from "coverage" function of parse.y to "rb_iseq_new_top" of iseq.c.
For the sake, parse.y just counts the line number of the original source
code, and the number is passed via rb_ast_body_t.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@64508 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
|
|
|
|
|
|
|
| |
I want to add a new field to rb_ast_t whose size is restricted because
it is an imemo. This change makes one room in rb_ast_t.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@64507 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
|
|
|
|
|
|
| |
Follow up of r61610
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@63973 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
|
|
|
|
|
|
|
|
| |
* node.h (nd_cnt, struct RNode): nd_cnt has been unused
since r60239, and also cnt field.
* .gdbinit (nd_cnt): ditto
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@63519 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
|
|
|
|
|
|
|
| |
* node.h (nd_noex): nd_noex has been unused since r24128.
* .gdbinit (nd_noex): ditto
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@63518 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
|
|
|
|
|
|
|
| |
* node.h (nd_frml): nd_frml has been unused since r34134.
* .gdbinit (nd_frml): ditto
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@63517 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
|
|
|
|
|
|
|
| |
* node.h (nd_argc): nd_argc has been unused since r24128.
* .gdbinit (nd_argc): ditto
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@63515 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
|
|
|
|
|
|
|
|
| |
* node.h (nd_cfnc, struct RNode): nd_cfnc has been unused
since r49938, and also cfunc field.
* .gdbinit (nd_cfnc): ditto
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@63511 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
|
|
|
|
|
|
|
|
| |
* node.h (rb_parser_printf): delcare as PRINTF_ARGS.
* parse.y (parser_token_value_print): cast to adjust to %c.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@63454 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
|