1
0
Fork 0
mirror of https://github.com/ruby/ruby.git synced 2022-11-09 12:17:21 -05:00
Commit graph

59148 commits

Author SHA1 Message Date
Hiroshi SHIBATA
80705e2c4f
Add to support the single commit for sync_default_gems.rb 2019-11-30 14:48:26 +09:00
aycabta
f8cc05dec3 Use @eof variable for ReidlineInputMethod#eof?
"IRB::InputMethod#eof?" requires eof status each user input but
"ReidlineInputMethod#eof?" used "Reline.eof?" what is singleton data.
"ReidlineInputMethod#eof?" is changed to use the result of user input.
2019-11-30 11:20:39 +09:00
Hiroshi SHIBATA
0b1b2f2442 Remove e2mmap from sync_default_gems.rb 2019-11-30 08:00:40 +09:00
Hiroshi SHIBATA
c50d30f659 Simplified ErrDimensionMismatch class 2019-11-30 08:00:40 +09:00
Hiroshi SHIBATA
2f66c443d7 Support argument for ErrNotRegular 2019-11-30 08:00:40 +09:00
Hiroshi SHIBATA
0c59bfae0a Also replace E2MM to standard exception class 2019-11-30 08:00:40 +09:00
Hiroshi SHIBATA
0950ef9a9a Remove e2mmap entries from docs 2019-11-30 08:00:40 +09:00
Hiroshi SHIBATA
c1059e99d3 Support existence usecase for the custom exception classes 2019-11-30 08:00:40 +09:00
Hiroshi SHIBATA
5044260dcd replace raise method from e2mmap on Scalar class 2019-11-30 08:00:40 +09:00
Hiroshi SHIBATA
9b950310be raise method accepts 3 argument with exception class 2019-11-30 08:00:40 +09:00
Hiroshi SHIBATA
f47f2076fe Retire to maintain e2mmap on ruby core 2019-11-30 08:00:40 +09:00
Hiroshi SHIBATA
04511b994e Remove re-define embedded error classes and extract argument on custom error classes 2019-11-30 08:00:40 +09:00
Hiroshi SHIBATA
d82c541ae4 Use simple exception classes instead of e2mmap 2019-11-30 08:00:40 +09:00
Jeremy Evans
0c273b2279 Supress class variable overtaken warning when original modules are the same
This issue was exposed by recent commits to better support including
refined modules.
2019-11-29 20:32:03 +02:00
git
8a1f313e2e * 2019-11-30 [ci skip] 2019-11-30 00:21:48 +09:00
Nobuyoshi Nakada
d1ef4fd08e
Make single line pattern matching void expression
Instead of returning `nil`, raise a syntax error if its value is
used.  [Feature ]
2019-11-30 00:15:29 +09:00
Koichi Sasada
36da0b3da1 check interrupts at each frame pop timing.
Asynchronous events such as signal trap, finalization timing,
thread switching and so on are managed by "interrupt_flag".
Ruby's threads check this flag periodically and if a thread
does not check this flag, above events doesn't happen.

This checking is CHECK_INTS() (related) macro and it is placed
at some places (laeve instruction and so on). However, at the end
of C methods, C blocks (IMEMO_IFUNC) etc there are no checking
and it can introduce uninterruptible thread.

To modify this situation, we decide to place CHECK_INTS() at
vm_pop_frame(). It increases interrupt checking points.
[Bug ]

This patch can introduce unexpected events...
2019-11-29 17:47:02 +09:00
aycabta
c4686b9235 Revert "Treat :@1, :@@1, @1, and @@1 correctly to check termination"
This reverts commit 5e275dd2af.

...The @1 type numberd parameter is reverted from Ruby syntax.
2019-11-29 17:38:18 +09:00
Kazuhiro NISHIYAMA
bbbe481dc3
Add SECURITY.md [ci skip]
for https://github.com/ruby/ruby/security/policy
2019-11-29 17:35:30 +09:00
Yusuke Endoh
191ce5344e Reduce duplicated warnings for the change of Ruby 3 keyword arguments
By this change, the following code prints only one warning.

```
def foo(**opt); end
100.times { foo({kw:1}) }
```

A global variable `st_table *caller_to_callees` is a map from caller to
a set of callee methods.  It remembers that a warning is already printed
for each pair of caller and callee.

[Feature ]
2019-11-29 17:32:27 +09:00
Yusuke Endoh
3a87826d0c vm_method.c: add top-level ruby2_keywords
This is a top-level version of Module#ruby2_keywords.
It can be used for functions (top-level methods) that delegates
arguments.  [Feature ]
2019-11-29 16:51:13 +09:00
Nobuyoshi Nakada
5ad32d5504
LoadError is not a subclass of StandardError 2019-11-29 11:25:23 +09:00
Nobuyoshi Nakada
f83bebdf7a
Skip useless test
`JSONGeneratorTest#test_remove_const_seg` is meaningful only for
the extension library version, but nonsense for pure ruby version.
2019-11-29 11:21:38 +09:00
Nobuyoshi Nakada
ba1cb388a9
Fixed the position in NEWS [Feature ]
[ci skip]
2019-11-29 11:17:27 +09:00
Nobuyoshi Nakada
a593186a02
Nmake needs VPATH 2019-11-29 11:09:08 +09:00
Nobuyoshi Nakada
98006cea4f
Add dependency on bundled yaml.h when using 2019-11-29 10:16:33 +09:00
Koichi Sasada
6b460a7948 export func for MJIT 2019-11-29 03:24:30 +09:00
Koichi Sasada
f38b6d197f Revert "export for MJIT"
This reverts commit 2e6f1cf8b2.
2019-11-29 03:22:24 +09:00
Koichi Sasada
e4e41840ad Revert "* remove trailing spaces. [ci skip]"
This reverts commit 27d0d7c0d3.
2019-11-29 03:22:13 +09:00
git
27d0d7c0d3 * remove trailing spaces. [ci skip] 2019-11-29 03:18:19 +09:00
Koichi Sasada
2e6f1cf8b2 export for MJIT 2019-11-29 03:17:52 +09:00
git
e5705c351c * 2019-11-29 [ci skip] 2019-11-29 03:11:40 +09:00
git
d104ebf2c4 * remove trailing spaces. [ci skip] 2019-11-29 03:11:28 +09:00
Koichi Sasada
dd723771c1 fastpath for ivar read of FL_EXIVAR objects.
vm_getivar() provides fastpath for T_OBJECT by caching an index
of ivar. This patch also provides fastpath for FL_EXIVAR objects.
FL_EXIVAR objects have an each ivar array and index can be cached
as T_OBJECT. To access this ivar array, generic_iv_tbl is exposed
by rb_ivar_generic_ivtbl() (declared in variable.h which is newly
introduced).

Benchmark script:

Benchmark.driver(repeat_count: 3){|x|
  x.executable name: 'clean', command: %w'../clean/miniruby'
  x.executable name: 'trunk', command: %w'./miniruby'

  objs = [Object.new, 'str', {a: 1, b: 2}, [1, 2]]

  objs.each.with_index{|obj, i|
    rep = obj.inspect
    rep = 'Object.new' if /\#/ =~ rep
    x.prelude str = %Q{
      v#{i} = #{rep}
      def v#{i}.foo
        @iv # ivar access method (attr_reader)
      end
      v#{i}.instance_variable_set(:@iv, :iv)
    }
    puts str
    x.report %Q{
      v#{i}.foo
    }
  }
}

Result:

      v0.foo # T_OBJECT

               clean:  85387141.8 i/s
               trunk:  85249373.6 i/s - 1.00x  slower

      v1.foo # T_STRING

               trunk:  57894407.5 i/s
               clean:  39957178.6 i/s - 1.45x  slower

      v2.foo # T_HASH

               trunk:  56629413.2 i/s
               clean:  39227088.9 i/s - 1.44x  slower

      v3.foo # T_ARRAY

               trunk:  55797530.2 i/s
               clean:  38263572.9 i/s - 1.46x  slower
2019-11-29 03:11:04 +09:00
NARUSE, Yui
b5fbefbf2c Added Symbol#start_with? and Symbol#end_with? method. [Feature ] 2019-11-28 23:49:28 +09:00
NARUSE, Yui
76871dea6b Use more template feature of w.r-l.o 2019-11-28 23:49:28 +09:00
Nobuyoshi Nakada
0b453e2a55
Get rid of inadvertent label [ci skip] 2019-11-28 21:45:43 +09:00
Nobuyoshi Nakada
2fa3b4565a
Merged common statements [Bug ] 2019-11-28 21:31:53 +09:00
Nobuyoshi Nakada
f0a5a07fa5
Removed unused variable [Bug ] 2019-11-28 19:57:43 +09:00
Jeremy Evans
a0579f3606 Make prepending a refined module after inclusion not break refinements
After the previous commit, this was still broken. The reason it
was broken is that a refined module that hasn't been prepended to
yet keeps the refined methods in the module's method table. When
prepending, the module's method table is moved to the origin
iclass, and then the refined methods are moved from the method
table to a new method table in the module itself.

Unfortunately, that means that if a class has included the module,
prepending breaks the refinements, because when the methods are
moved from the origin iclass method table to the module method
table, they are removed from the method table from the iclass
created when the module was included earlier.

Fix this by always creating an origin class when including a
module that has any refinements, even if the refinements are
not currently used.  I wasn't sure the best way to do that.
The approach I choose was to use an object flag. The flag is
set on the module when Module#refine is called, and if the
flag is present when the module is included in another module
or class, an origin iclass is created for the module.

Fixes [Bug ]
2019-11-28 19:57:04 +09:00
Jeremy Evans
5069c5f521 Honor refinements for modules that prepend other modules
This previously did not work, and the reason it did not work is
that:

1) Refining a module or class that prepends other modules places
   the refinements in the class itself and not the origin iclass.

2) Inclusion of a module that prepends other modules skips the
   module itself, including only iclasses for the prepended modules
   and the origin iclass.

Those two behaviors combined meant that the method table for the
refined methods for the included module never ends up in the
method lookup chain for the class including the module.

Fix this by not skipping the module itself when the module is
included.  This requires some code rearranging in
rb_include_class_new to make sure the correct method tables and
origin settings are used for the created iclass.

As origin iclasses shouldn't be exposed to Ruby, this also
requires skipping modules that have origin iclasses in
Module#ancestors (classes that have origin iclasses were already
skipped).

Fixes [Bug ]
2019-11-28 19:57:04 +09:00
aycabta
4325f08086 Add require "irb" to test/irb/test_completion.rb 2019-11-28 15:32:21 +09:00
aycabta
7d75e94ea9 Fix regexp to complete complex literal
IRB completion logic always needed exponential notation for complex literal
such as 3e6i but it's bug. I fixed to support complex literal without
exponential notation such as 3i.
2019-11-28 15:22:38 +09:00
Nobuyoshi Nakada
8b4ee5d6ba
Raise NoMatchingPatternError when expr in pat doesn't match
* `expr in pattern` should raise `NoMatchingError` when unmatched
* `expr in pattern` should return `nil`. (this is unspecified, but
  this feature is experimental, at all)

[Feature ]
2019-11-28 13:47:14 +09:00
y-yagi
18953416de Fix documentation of MonitorMixin#new_cond [ci skip] ()
Since https://github.com/ruby/ruby/pull/2576,
`new_cond` uses the Monitor object, not the receiver.
2019-11-27 20:24:01 -08:00
Nobuyoshi Nakada
c688026455
Suppress strict-aliasing warning by x86_64-w64-mingw32-gcc 7.4.0 2019-11-28 10:53:26 +09:00
aycabta
abe8fb49f0 Delete newline when C-k on emacs mode at EOL 2019-11-28 09:32:51 +09:00
aycabta
7769975c3c Remove two removed constants 2019-11-28 08:26:10 +09:00
aycabta
2d0a1a1869 Fix ghost method line no 2019-11-28 08:19:05 +09:00
Jeremy Evans
f9debf3437 Update documentation for ruby2_keywords [ci skip] 2019-11-27 15:13:35 -08:00