aboutsummaryrefslogtreecommitdiffstats
path: root/bootstraptest
Commit message (Collapse)AuthorAgeFilesLines
* Ractor.make_shareable(obj)Koichi Sasada2020-10-211-0/+74
| | | | | | | | | | | | | | | | | | | | | | | | | | Introduce new method Ractor.make_shareable(obj) which tries to make obj shareable object. Protocol is here. (1) If obj is shareable, it is shareable. (2) If obj is not a shareable object and if obj can be shareable object if it is frozen, then freeze obj. If obj has reachable objects (rs), do rs.each{|o| Ractor.make_shareable(o)} recursively (recursion is not Ruby-level, but C-level). (3) Otherwise, raise Ractor::Error. Now T_DATA is not a shareable object even if the object is frozen. If the method finished without error, given obj is marked as a sharable object. To allow makng a shareable frozen T_DATA object, then set `RUBY_TYPED_FROZEN_SHAREABLE` as type->flags. On default, this flag is not set. It means user defined T_DATA objects are not allowed to become shareable objects when it is frozen. You can make any object shareable by setting FL_SHAREABLE flag, so if you know that the T_DATA object is shareable (== thread-safe), set this flag, at creation time for example. `Ractor` object is one example, which is not a frozen, but a shareable object.
* fix conditionKoichi Sasada2020-10-201-1/+1
|
* skip `echo foo` on SolarisKoichi Sasada2020-10-201-1/+1
| | | | | | | | | | | | | | | | | On Solaris, it seems to access ENV in ``, so skip it now. ``` stderr output is not empty Exception `NameError' at bootstraptest.tmp.rb:7 - can not access non-sharable objects in constant Object::ENV by non-main Ractor. #<Thread:0x0044cdf0 run> terminated with exception (report_on_exception is true): bootstraptest.tmp.rb:7:in ``': can not access non-sharable objects in constant Object::ENV by non-main Ractor. (NameError) Exception `Ractor::RemoteError' at <internal:ractor>:130 - thrown by remote Ractor. <internal:ractor>:130:in `take': thrown by remote Ractor. (Ractor::RemoteError) from bootstraptest.tmp.rb:55:in `<main>' bootstraptest.tmp.rb:7:in ``': can not access non-sharable objects in constant Object::ENV by non-main Ractor. (NameError) from bootstraptest.tmp.rb:7:in `ractor_local_globals' from bootstraptest.tmp.rb:54:in `block in <main>' ```
* ObjectSpace.each_object with RactorsKoichi Sasada2020-10-201-0/+9
| | | | | | | Unshareable objects should not be touched from multiple ractors so ObjectSpace.each_object should be restricted. On multi-ractor mode, ObjectSpace.each_object only iterates shareable objects. [Feature #17270]
* Some global variables can be accessed from ractorsKoichi Sasada2020-10-201-0/+59
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Some global variables should be used from non-main Ractors. [Bug #17268] ```ruby # ractor-local (derived from created ractor): debug '$DEBUG' => $DEBUG, '$-d' => $-d, # ractor-local (derived from created ractor): verbose '$VERBOSE' => $VERBOSE, '$-w' => $-w, '$-W' => $-W, '$-v' => $-v, # process-local (readonly): other commandline parameters '$-p' => $-p, '$-l' => $-l, '$-a' => $-a, # process-local (readonly): getpid '$$' => $$, # thread local: process result '$?' => $?, # scope local: match '$~' => $~.inspect, '$&' => $&, '$`' => $`, '$\'' => $', '$+' => $+, '$1' => $1, # scope local: last line '$_' => $_, # scope local: last backtrace '$@' => $@, '$!' => $!, # ractor local: stdin, out, err '$stdin' => $stdin.inspect, '$stdout' => $stdout.inspect, '$stderr' => $stderr.inspect, ```
* sync generic_ivtblKoichi Sasada2020-10-141-0/+17
| | | | | | | | | generic_ivtbl is a process global table to maintain instance variables for non T_OBJECT/T_CLASS/... objects. So we need to protect them for multi-Ractor exection. Hint: we can make them Ractor local for unshareable objects, but now it is premature optimization.
* sync enc_table and rb_encoding_listKoichi Sasada2020-10-141-0/+14
| | | | | | | | | | | | | | | | | enc_table which manages Encoding information. rb_encoding_list also manages Encoding objects. Both are accessed/modified by ractors simultaneously so that they should be synchronized. For enc_table, this patch introduced GLOBAL_ENC_TABLE_ENTER/LEAVE/EVAL to access this table with VM lock. To make shortcut, three new global variables global_enc_ascii, global_enc_utf_8, global_enc_us_ascii are also introduced. For rb_encoding_list, we split it to rb_default_encoding_list (256 entries) and rb_additional_encoding_list. rb_default_encoding_list is fixed sized Array so we don't need to synchronized (and most of apps only needs it). To manage 257 or more encoding objects, they are stored into rb_additional_encoding_list. To access rb_additional_encoding_list., VM lock is needed.
* Add Ractor#receive and Ractor.receive and use it in all placesBenoit Daloze2020-10-101-24/+24
| | | | * Keep Ractor#recv/Ractor.recv as an alias for now.
* fix typo [ci skip]Koichi Sasada2020-09-271-2/+2
|
* freeze all Range objects.v3_0_0_preview1Koichi Sasada2020-09-251-4/+3
| | | | | Matz want to try to freeze all Range objects. [Feature #15504]
* prohibi method call by defined_method in other racotrsKoichi Sasada2020-09-251-0/+11
| | | | We can not call a non-isolated Proc in multiple ractors.
* Range is based on Struct.Koichi Sasada2020-09-251-0/+4
| | | | Range can be shareable because it is implemented by Struct.
* Frozen Struct can be shareable.Koichi Sasada2020-09-251-0/+6
| | | | | A frozen Struct object which refers to shareable objects should be shareable.
* refactoring a test code.Koichi Sasada2020-09-251-17/+49
| | | | make a test more clear.
* Ractor.yield should raise if out-port is closedKoichi Sasada2020-09-251-0/+21
| | | | | Ractor.yield should raise Ractor::ClosedError if current Ractor's outgoing-port is closed.
* frozen T_OBJECT can be shareable.Koichi Sasada2020-09-251-0/+27
| | | | | If an T_OBJECT object is frozen and all ivars are shareable, the object should be shareable.
* Ractor#close_outgoping cancel Ractor.yieldKoichi Sasada2020-09-251-0/+1
| | | | | | Ractor#close_outgoing should cancel waiting Ractor.yield. However, yield a value by the Ractor's block should not cancel (to recognize terminating Ractor, introduce rb_ractor_t::yield_atexit flag).
* Remove test for putiseq insnMichael Lindley2020-09-241-1/+0
| | | putiseq was removed from instruction set in 2b5bb8a0
* Fulfill missing tests and stabilize testsQuang-Minh Nguyen2020-09-201-22/+126
|
* Validate name during initializationQuang-Minh Nguyen2020-09-201-17/+33
|
* Add status to Ractor#inspectQuang-Minh Nguyen2020-09-201-0/+21
|
* Interpolated strings are no longer frozen with frozen-string-literal: trueBenoit Daloze2020-09-151-2/+0
| | | | | * Remove freezestring instruction since this was the only usage for it. * [Feature #17104]
* sync fstring poolKoichi Sasada2020-09-151-0/+17
| | | | fstring pool should be sync with other Ractors.
* Fix typos [ci skip]Kazuhiro NISHIYAMA2020-09-131-2/+2
|
* don't use toplevel returnKoichi Sasada2020-09-041-2/+5
| | | | | Toplevel return is supported after Ruby 2.4, so don't use it for older BASERUBY.
* skip Ractor tests on Compiler testsKoichi Sasada2020-09-031-1/+6
| | | | | | This implementation has memory corruption errors so and it causes BUG on rare occasions. This commit skips suspect tests on Github actions Compiler tests.
* Introduce Ractor mechanism for parallel executionKoichi Sasada2020-09-031-0/+516
| | | | | | | | | | | | | | | | This commit introduces Ractor mechanism to run Ruby program in parallel. See doc/ractor.md for more details about Ractor. See ticket [Feature #17100] to see the implementation details and discussions. [Feature #17100] This commit does not complete the implementation. You can find many bugs on using Ractor. Also the specification will be changed so that this feature is experimental. You will see a warning when you make the first Ractor with `Ractor.new`. I hope this feature can help programmers from thread-safety issues.
* display stderr output even if core dump filesKoichi Sasada2020-07-291-2/+8
| | | | | | On btest, stderr messages are not displayed if core files are generated. There is no reason to skip it, so this patch display stderr and check core files.
* Remove obsoleted opt_call_c_function insn (#3232)Takashi Kokubun2020-06-171-2/+0
| | | | | * Remove obsoleted opt_call_c_function insn * Keep opt_call_c_function with DEFINE_INSN_IF
* Make proc/Proc.new without block an error instead of warningJeremy Evans2020-06-102-6/+6
| | | | The warning for these was added in 2.7.
* Moved already resolved testNobuyoshi Nakada2020-04-271-16/+0
| | | | Couldn't figure out failed/fixed versions.
* Removed already resolved test [ci skip]Nobuyoshi Nakada2020-04-271-7/+0
| | | | | That bug has been fixed by ec0c394b9eb, and the test has been added by 181ffea5e04.
* Added test for `debug_level:` option of `RubyVM::InstructionSequence.compile`Nobuyoshi Nakada2020-04-151-0/+5
|
* Turn class variable warnings into exceptionsJeremy Evans2020-04-103-6/+12
| | | | | | | | | | | | | | | | | | This changes the following warnings: * warning: class variable access from toplevel * warning: class variable @foo of D is overtaken by C into RuntimeErrors. Handle defined?(@@foo) at toplevel by returning nil instead of raising an exception (the previous behavior warned before returning nil when defined? was used). Refactor the specs to avoid the warnings even in older versions. The specs were checking for the warnings, but the purpose of the related specs as evidenced from their description is to test for behavior, not for warnings. Fixes [Bug #14541]
* should check pending interrupts correctly.Koichi Sasada2020-04-091-0/+14
| | | | | | | | | | | | rb_uninterruptible() disables any interrupts using handle_interrupt feature (This function is used by `p`). After this function, pending interrupts should be checked correctly, however there is no chance to setup interrupt flag of working threads, it means that nobody checks pending interrupts. For example, it ignores terminate signal delivered at the end of main thread and program can't stop. This patch set interrupt flag if there are pending interrupts.
* disable to show the maximum number of threads.Koichi Sasada2020-03-231-1/+2
| | | | | | On Deiban 9 environment, the thread tests failed and this maximum threads information can finish up the machine resources. To check it, I turned-off showing this information.
* Make yield in singleton class definitions in methods a SyntaxErrorJeremy Evans2020-02-111-9/+14
| | | | | | | | This behavior was deprecated in 2.7 and scheduled to be removed in 3.0. Calling yield in a class definition outside a method is now a SyntaxError instead of a LocalJumpError, as well.
* Remove special handling of $SAFE and related C-APIsJeremy Evans2020-01-221-13/+0
| | | | These were all deprecated in Ruby 2.7.
* Show the failed message tooNobuyoshi Nakada2019-12-121-1/+1
|
* Show the failed messageNobuyoshi Nakada2019-12-111-1/+1
|
* Use a monotonically increasing number for object_idJohn Hawthorn2019-11-071-0/+9
| | | | | | | | | | | | | | | | | This changes object_id from being based on the objects location in memory (or a nearby memory location in the case of a conflict) to be based on an always increasing number. This number is a Ruby Integer which allows it to overflow the size of a pointer without issue (very unlikely to happen in real programs especially on 64-bit, but a nice guarantee). This changes obj_to_id_tbl and id_to_obj_tbl to both be maps of Ruby objects to Ruby objects (previously they were Ruby object to C integer) which simplifies updating them after compaction as we can run them through gc_update_table_refs. Co-authored-by: Aaron Patterson <tenderlove@ruby-lang.org>
* Revert "Use a monotonically increasing number for object_id"Aaron Patterson2019-11-061-9/+0
| | | | This reverts commit bd2b314a05ae9192b3143e1e678a37c370d8a9ce.
* Use a monotonically increasing number for object_idJohn Hawthorn2019-11-061-0/+9
| | | | | | | | | | | | | | | | | This changes object_id from being based on the objects location in memory (or a nearby memory location in the case of a conflict) to be based on an always increasing number. This number is a Ruby Integer which allows it to overflow the size of a pointer without issue (very unlikely to happen in real programs especially on 64-bit, but a nice guarantee). This changes obj_to_id_tbl and id_to_obj_tbl to both be maps of Ruby objects to Ruby objects (previously they were Ruby object to C integer) which simplifies updating them after compaction as we can run them through gc_update_table_refs. Co-authored-by: Aaron Patterson <tenderlove@ruby-lang.org>
* Relaxed tests for CPDEBUG modeNobuyoshi Nakada2019-10-232-4/+6
|
* fix memory corruption in old GCC卜部昌平2019-10-101-1/+0
| | | | | | | | This typo introduced memory corruption when __builtin_add_overflow is not available but uint128_t is. GCC before 5 are one of such situatins. See also https://rubyci.org/logs/rubyci.s3.amazonaws.com/opensuseleap/ruby-master/log/20191009T120004Z.log.html.gz
* Changed numbered parameter prefixNobuyoshi Nakada2019-09-241-1/+1
|
* add tests卜部昌平2019-09-051-0/+2
| | | | Some coverage improvements.
* Move an unstable bootstraptest to pendingTakashi Kokubun2019-09-032-3/+5
| | | | | | | | This has been unstable on AppVeyor mswin since the introduction 3fd83cb6fcc483d2eac0795bc139c521a3a59bd2. https://ci.appveyor.com/project/ruby/ruby/builds/27103307/job/j7xwjmsos2k22cck Let's have it in pending.rb to be fixed.
* Add insn tests for newarraykwsplatTakashi Kokubun2019-09-031-0/+1
|
* Fix opt_regexpmatch1 referencesTakashi Kokubun2019-09-021-2/+2
|