aboutsummaryrefslogtreecommitdiffstats
path: root/ruby.c
Commit message (Collapse)AuthorAgeFilesLines
* Make warning values consistent [Bug #17523]Nobuyoshi Nakada2021-01-131-2/+2
| | | | | | They should be affected, as well as `$VERBOSE`, by `-w`/`-W` options, not only in the main script but in scripts loaded by `-r` option too.
* Ignore failure on unsupported fcntl to drop non-blocking modeNobuyoshi Nakada2020-12-261-9/+21
| | | | Fixes https://github.com/ruby/ruby/pull/3723
* Enable escape sequence on Windows10 console via pager tooNobuyoshi Nakada2020-12-211-2/+19
|
* Use category: :deprecated in warnings that are related to deprecationJeremy Evans2020-12-181-1/+4
| | | | | | | | | | | | | | | | | 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.
* Ignore failure on unsupported fcntl to drop non-blocking modeNobuyoshi Nakada2020-12-161-2/+6
|
* Make ruby -We the same as ruby -W -eJeremy Evans2020-12-101-1/+1
| | | | | | This changes the behavior, which I'm not sure is acceptable. However, it's odd to allow an option to be combined, but change the behavior of the option when combined.
* ruby.c: remove needless substitution of uencKenta Murata2020-12-081-3/+0
| | | | uenc has already been initialized the top of the function.
* Set default for Encoding.default_external to UTF-8 on Windows (#2877)Lars Kanis2020-12-081-2/+5
| | | | | | * Use UTF-8 as default for Encoding.default_external on Windows * Document UTF-8 change on Windows to Encoding.default_external fix https://bugs.ruby-lang.org/issues/16604
* Initialize UTF-8 encoding first as it is used always nowNobuyoshi Nakada2020-11-231-3/+3
|
* Some global variables can be accessed from ractorsKoichi Sasada2020-10-201-9/+41
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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, ```
* Disable deprecation warning by the default [Feature #16345]Nobuyoshi Nakada2020-09-251-0/+12
| | | | And `-w` option turns it on.
* [Feature #17157] removed -T command line optionNobuyoshi Nakada2020-09-071-12/+0
|
* feature_option: do not goto into a branch卜部昌平2020-06-291-3/+6
| | | | | I'm not necessarily against every goto in general, but jumping into a branch is definitely a bad idea. Better refactor.
* Improved error messages for mjit optionNobuyoshi Nakada2020-06-231-15/+26
| | | | and default jit-verbose to 1 if no argument.
* Defer initializationNobuyoshi Nakada2020-05-161-16/+25
| | | | | Defer initialization of extension libraries, loading prelude files and requiring files, and skip if dump options are given.
* Merge pull request #3047 from mame/suppress-backtraceYusuke Endoh2020-05-151-0/+7
| | | Add `--suppress-backtrace=num` option to limit the backtrace length
* sed -i 's|ruby/impl|ruby/internal|'卜部昌平2020-05-111-1/+1
| | | | To fix build failures.
* sed -i s|ruby/3|ruby/impl|g卜部昌平2020-05-111-1/+1
| | | | This shall fix compile errors.
* internal/process.h: add a no-warning simple wrapper for fork(2)Yusuke Endoh2020-05-021-1/+2
| | | | | | | | | | | | As fork(2) is deprecated, its calls must be guarded by `COMPILER_WARNING_IGNORED(-Wdeprecated-declarations)`. All usages of fork(2) in process have been alread guarded. A new call to fork(2) was added in ruby.c with f22c4ff359498ab342e4b6d6feb21af6004ee270. This caused a build failure on Solaris 11. It may hide a bug to guard big code unnecessarily, so this change introduces a simple wrapper "rb_fork" whose definition is guarded, and replaces all calls to fork(2) with the wrapper function.
* Honor COLUMNS [Feature #16754]Nobuyoshi Nakada2020-04-121-6/+9
|
* Hightlight usage [Feature #16754]Nobuyoshi Nakada2020-04-121-14/+27
|
* Set up environment variable for pager [Feature #16754]Nobuyoshi Nakada2020-04-121-0/+8
|
* PAGER without fork&exec too [Feature #16754]Nobuyoshi Nakada2020-04-121-2/+17
|
* View the help message with PAGER [Feature #16754]Nobuyoshi Nakada2020-04-121-0/+29
| | | | | View the help message wth pager designed by RUBY_PAGER or PAGER environment variable, unless that value is empty.
* Merge pull request #2991 from shyouhei/ruby.h卜部昌平2020-04-081-1/+1
| | | Split ruby.h
* io.c, ruby.c: include internal/variable.h for rb_gvar_readonly_setterYusuke Endoh2020-01-091-0/+1
| | | | | | Same as 053f78e13988e9253d1f207bf5e23d9505112b32. emscripten requires a prototype declaration of rb_gvar_readonly_setter if it is refered as a function pointer.
* decouple internal.h headers卜部昌平2019-12-261-20/+35
| | | | | | | | | | | | | | | | | | Saves comitters' daily life by avoid #include-ing everything from internal.h to make each file do so instead. This would significantly speed up incremental builds. We take the following inclusion order in this changeset: 1. "ruby/config.h", where _GNU_SOURCE is defined (must be the very first thing among everything). 2. RUBY_EXTCONF_H if any. 3. Standard C headers, sorted alphabetically. 4. Other system headers, maybe guarded by #ifdef 5. Everything else, sorted alphabetically. Exceptions are those win32-related headers, which tend not be self- containing (headers have inclusion order dependencies).
* Added `-W:experimental` to `--help` [Feature #16420]Nobuyoshi Nakada2019-12-241-0/+1
|
* Re-apply f85e8d2a8b keeping characters < 80Takashi Kokubun2019-12-221-1/+1
|
* Revert "Fixed misspellings"Yusuke Endoh2019-12-231-1/+1
| | | | | | This reverts commit f85e8d2a8b2a37740334db4fd92ef820f05ddbc5. It violated the limit of width (> 80) and caused the test failure
* Fixed misspellingsNobuyoshi Nakada2019-12-231-1/+1
| | | | Fixed misspellings reported at [Bug #16437]
* Added `-W:experimental` command line optionNobuyoshi Nakada2019-12-201-0/+3
| | | | [Feature #16420]
* Added -W: command line optionNobuyoshi Nakada2019-12-201-1/+29
| | | | | To manage `Warning[category]` flags. Only `-W:deprecated` and `-W:no-deprecated` are available now. [Feature #16345]
* Added `FEATURE_SET_RESTORE` macroNobuyoshi Nakada2019-12-201-1/+2
|
* use compiled binary for gem_prelude.rb.Koichi Sasada2019-12-111-1/+3
| | | | | `gem_prelude.rb` is not compiled yet. This patch compile it to compiled binary.
* Allow specifying arbitrary MJIT flags by --jit-debugTakashi Kokubun2019-12-011-1/+4
| | | | | | | | This is a secret feature for me. It's only for testing and any behavior with this flag override is unsupported. I needed this because I sometimes want to add debug options but do not want to disable optimizations, for using Linux perf.
* delete unused codes卜部昌平2019-11-181-4/+1
| | | | Suppress compiler warnings.
* Deprecate taint/trust and related methods, and make the methods no-opsJeremy Evans2019-11-181-1/+0
| | | | | | 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.
* Warn on access/modify of $SAFE, and remove effects of modifying $SAFEJeremy Evans2019-11-181-37/+19
| | | | | | | | | | | | | | | | | This removes the security features added by $SAFE = 1, and warns for access or modification of $SAFE from Ruby-level, as well as warning when calling all public C functions related to $SAFE. This modifies some internal functions that took a safe level argument to no longer take the argument. rb_require_safe now warns, rb_require_string has been added as a version that takes a VALUE and does not warn. One public C function that still takes a safe level argument and that this doesn't warn for is rb_eval_cmd. We may want to consider adding an alternative method that does not take a safe level argument, and warn for rb_eval_cmd.
* Refactor parser_params by removing "in_main" flagYusuke Endoh2019-10-041-10/+6
| | | | | | | | | | | | | | | | | | | The relation between parser_param#base_block and #in_main were very subtle. A main script (that is passed via a command line) was parsed under base_block = TOPLEVEL_BINDING and in_main = 1. A script loaded by Kernel#require was parsed under base_block = NULL and in_main = 0. If base_block is non-NULL and in_main == 0, it is parsed by Kernel#eval or family. However, we know that TOPLEVEL_BINDING has no local variables when a main script is parsed. So, we don't have to parse a main script under base_block = TOPLEVEL_BINDING. Instead, this change parses a main script under base_block = 0. If base_block is non-NULL, it is parsed by Kernel#eval or family. By this simplication, "in_main" is no longer needed.
* drop-in type check for rb_define_global_function卜部昌平2019-08-291-4/+4
| | | | | | We can check the function pointer passed to rb_define_global_function like we do so in rb_define_method. It turns out that almost anybody is misunderstanding the API.
* rb_define_hooked_variable now free from ANYARGS卜部昌平2019-08-271-7/+5
| | | | | | | | | After 5e86b005c0f2ef30df2f9906c7e2f3abefe286a2, I now think ANYARGS is dangerous and should be extinct. This commit uses rb_gvar_getter_t / rb_gvar_setter_t for rb_define_hooked_variable / rb_define_virtual_variable which revealed lots of function prototype inconsistencies. Some of them were literally decades old, going back to dda5dc00cff334cac373096d444a0fd59e716124.
* ruby.c (name_match_p): remove unnecessary conditionYusuke Endoh2019-07-141-3/+2
| | | | | | It always returns immediately when len was decremented to zero. So len is always positive. This change will suppress Coverity Scan warning.
* * expand tabs.git2019-06-041-1/+1
|
* EOF by 2 ^D on a TTYNobuyoshi Nakada2019-06-041-1/+1
| | | | | | | Terminate the input from a TTY by 2 ^D at the middle of line, like as many programs, `cat`, `perl` and so on, do. By the first ^D, the line will be sent without a newline, and then EOF will be send by the next ^D.
* Do not modify shared arrayNobuyoshi Nakada2019-05-211-1/+12
| | | | [Bug #15821]
* ruby.c: respect features by command linenobu2019-03-301-18/+42
| | | | | | | | * ruby.c (process_options): feature options in command line arguments take precedence over options in RUBYOPT environment variable. [ruby-core:92052] [Bug #15738] git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@67388 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* [DOC] fix markups [ci skip]nobu2019-03-281-2/+2
| | | | git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@67354 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* Change defaults of --jit optionsk0kubun2019-03-171-2/+2
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | * --jit-min-calls: 5 -> 10000 --jit-min-calls=5 obviously can compile non hotspot. This was not a problem for MJIT-benchmarks and Optcarrot because the former has very few hot optimiziable methods and the latter is likely to trigger compilation of hotspot by its intensive calls to optimizable hotspot methods and has a very short window to allow limited compilations. In real-world applications, it has more time to compile more methods and it pressures computer's limited resources like icache. We should avoid compiling too many methods. Also compiling many methods exhausts time budget for compilation in one ruby process lifetime and delays the "JIT compaction" of Ruby 2.6. JVM is known to use 1,500 for C1 (client) compiler and 10,000 for C2 (server) compiler for -XX:CompileThreshold by default. https://docs.oracle.com/javase/8/embedded/develop-apps-platforms/codecache.htm When things are called X,000 times, requiring 10,000 can eliminate compilation of methods which are called only once in these X,000 iterations and obviously not hotspot. And in fact things like unicorn-worker-killer restarts unicorn process every 4096 requests. So I felt 10,000 is good for such an environment. * --jit-max-cache: 1000 -> 100 By the same reason stated above, we should not allow compiling many methods especially on MJIT which has a larger overhead due to poor code locality by dlopen and whose code is also likely to be bigger by just inlining many VM instructions with -O3 rather than directly generating low-level code. In JVM -XX:ReservedCodeCacheSize is 32M for reserved and 48M for maximum. --jit-max-cache=1,000 could be closer to it, but in this case MJIT's compilation is slow due to data synchronization between threads (to be improved in Ruby 2.7 though) and we do not want to delay the "JIT compaction" for a long time. So I chose a really conservative number for this, but by having method inlining in the future, wider range could be optimized even with this value. * Optcarrot --disable-gems, --benchmark Lan_Master.nes 12 attempts. No significant impact. | r67276 | r67276 --jit | after --jit | |:-------------------|:------------------|:------------------| | 50.44369263063978 | 72.87390680773056 | 73.47873485047297 | | 50.58788746124193 | 78.06820808947026 | 78.29723420171945 | | 50.77509250801378 | 80.29010348842613 | 78.94689404460769 | | 50.935361702064405 | 80.42796829926374 | 80.39539527351525 | | 51.27352672981195 | 81.98758158033202 | 81.6754198664817 | | 51.720715743242124 | 82.00118535811626 | 82.22960569251283 | | 51.89643169822524 | 82.2290091613556 | 82.5013636146388 | | 51.95895898113868 | 82.37318990939565 | 82.74002377794454 | | 52.10124886807968 | 82.48796686037502 | 83.23354941183932 | | 52.292280637519376 | 83.0265226541066 | 84.01552618012572 | | 52.51856237784144 | 83.8797360318052 | 84.8588319093393 | | 52.65076845986818 | 84.80037351256634 | 85.13577756273656 | * Railsbench `WARMUP=20000 BENCHMARK=1000 bin/bench` of https://github.com/k0kubun/railsbench. It gets closer to --disable=jit. | | r67276 | r67276 | after | | | | --jit | --jit | |:----------|:-------|:-------|:-------| | req/s | 891.3 | 742.2 | 841.5 | |:----------|:-------|:-------|:-------| | 50%ile ms | 1.00 | 1.21 | 1.08 | | 66%ile ms | 1.02 | 1.24 | 1.09 | | 75%ile ms | 1.03 | 1.28 | 1.10 | | 80%ile ms | 1.03 | 1.30 | 1.11 | | 90%ile ms | 1.09 | 1.42 | 1.15 | | 95%ile ms | 1.32 | 1.65 | 1.27 | | 98%ile ms | 4.79 | 2.23 | 1.81 | | 99%ile ms | 5.68 | 7.52 | 6.64 | |100%ile ms | 6.52 | 9.69 | 8.59 | git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@67277 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* Defer escaping control char in error messagesnobu2019-01-081-8/+1
| | | | | | | | * eval_error.c (print_errinfo): defer escaping control char in error messages until writing to stderr, instead of quoting at building the message. [ruby-core:90853] [Bug #15497] git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@66753 b2dd03c8-39d4-4d8f-98ff-823fe69b080e