summaryrefslogtreecommitdiff
AgeCommit message (Collapse)Author
2017-11-16cleanup hook cleanup code.ko1
* vm_trace.c: before this patch, deleted hooks are remvoed at *the beggining* of hooks (exec_hooks_precheck). This patch cleanup deleted hooks at (1) just after hook is deleted (TracePoint#disable and so on) (2) just after executing hooks (exec_hooks_postcheck) Most of time (1) is enough, but if some threads running hooks, we need to wait cleaning up deleted hooks until threads finish running the hooks. This is why (2) is introduced (and this is why current impl cleanup deleted hooks at the beggining of hooks). * test/lib/tracepointchecker.rb: check also the number of delete waiting hooks. * cont.c (cont_restore_thread): fix VM->trace_running count. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@60782 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2017-11-16parse.y: Fix location of asgn nodeyui-knk
* parse.y (new_op_assign_gen): Fix location of asgn node. Assignable node (e.g. NODE_LASGN) is generated before rhs is generated, so we reset the location when nd_value of asgn is fixed. e.g. : ``` a -= 10 ``` * Before ``` NODE_DASGN_CURR (line: 1, first_lineno: 1, first_column: 0, last_lineno: 1, last_column: 1) ``` * After ``` NODE_DASGN_CURR (line: 1, first_lineno: 1, first_column: 0, last_lineno: 1, last_column: 7) ``` git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@60781 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2017-11-16parse.y: Preserve previous line and restore it when read '\n'yui-knk
* parse.y (parser_params): Add prevline to store previous line. * parse.y (yycompile0): Initialize prevline with 0. * parse.y (parser_nextline): Store previous line on prevline. * parse.y (parser_nextc): Check parser is on EOF or has nextline. Now parser_yylex does not always set lex_p as lex_pend, we should check EOF flag and nextline is set. * parse.y (parser_yylex): Restore previous line, set lex_p and tokp on '\n'. Before this commit, tokp is on the head of next line of '\n' and lex_p is on the tail of next line when next token is '\n'. By this behavior, in some case the last column of NODE_CALL (or NODE_QCALL) is set to the last column of next line. NODE_CALL can be generated via `primary_value call_op operation2 {} opt_paren_args` and opt_paren_args can be none. If none is generated with next token '\n', the last column of none is set to the last column of next line. e.g. : ``` a.b cd.ef ``` The location of NODE_CALL of first line is set to, * Before ``` NODE_CALL (line: 1, first_lineno: 1, first_column: 0, last_lineno: 1, last_column: 6) ``` * After ``` NODE_CALL (line: 1, first_lineno: 1, first_column: 0, last_lineno: 1, last_column: 3) ``` * parse.y (parser_mark): GC mark prevline. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@60780 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2017-11-15* 2017-11-16svn
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@60779 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2017-11-15Bump rake-12.3.0 on bundled gems.hsbt
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@60778 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2017-11-15Remove redundant last newline [ci skip]kazu
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@60777 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2017-11-15remove rb_thread_t::event_hooks.ko1
* vm_core.h (rb_thread_t): remove rb_thread_t::event_hooks. * vm_trace.c: all hooks are connected to vm->event_hooks and add rb_event_hook_t::filter::th to filter invoke thread. It will simplify invoking hooks code. * thread.c (thread_start_func_2): clear thread specific trace_func. * test/ruby/test_settracefunc.rb: add a test for Thread#add_trace_func. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@60776 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2017-11-15tmpdir.rb: merged make_tmpname to createnobu
* lib/tmpdir.rb (Dir::Tmpname#create): try conversion of prefix and suffix just once before loop. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@60775 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2017-11-15dir.c: revert r60772, r60770, and r60769normal
Using readdir(3) without any locking causes thread-safety problems if directory streams get shared between threads. On ancient platforms, readdir(3) may have thread-safety problems even on different directory streams. Using readdir_r(3) is not viable, either, as it's deprecated due to name overflow problems. So for now, rely on GVL as in previous Rubies and perhaps consider per-"struct dir_data" mutexes for modern platforms which allow concurrent calls to readdir(3) on different directory streams. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@60774 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2017-11-15thread.c: use ecnobu
* thread.c (call_without_gvl): use execution context for RUBY_VM_CHECK_INTS_BLOCKING. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@60773 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2017-11-15Cannot call rb_thread_call_without_gvl before running VMusa
* dir.c (readdir_without_gvl): check the VM is already initialized before calling rb_thread_call_without_gvl(). [Bug #14108] git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@60772 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2017-11-15fix uninitialized memory reference.ko1
* compile.c (iseq_set_sequence): clear kwargs (in ci_entries) memory area. kwargs ci entries are initialized by compiler. However, sometimes these initializations are skipped because corresponding calls are eliminated by some optimizations (for example, `if true` syntax elimnates else code). git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@60771 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2017-11-15nogvl readdir make SEGV on Windowsusa
* dir.c (readdir_without_gvl): workaround for Windows. [Bug #14108] git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@60770 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2017-11-14dir.c: release GVL around remaining readdir callsnormal
Release GVL around all remaining readdir calls from the Dir class to prevent pathological stalls on slow filesystems in multi-threaded applications. opendir, rewinddir, closedir calls are not affected yet, but will be changed in future commits. In the future, further work may be done consolidate multiple GVL releasing calls to reduce overhead, similar to how changes to Dir.empty? were made in r60111 * dir.c (nogvl_readdir): new function (readdir_without_gvl): ditto (dir_read): s/READDIR/readdir_without_gvl/ (dir_each_entry): ditto (glob_helper): ditto git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@60769 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2017-11-14compile.c: fixup TRACEnobu
* compile.c (remove_unreachable_chunk): ignore TRACE elements. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@60768 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2017-11-14* 2017-11-15svn
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@60767 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2017-11-14parse.y: zero codepointsnobu
* parse.y (parser_tokadd_utf8): relax restriction to allow zero or more codepoints. fixup r59417. https://github.com/ruby/ruby/commit/7e8b910#commitcomment-25602670 git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@60766 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2017-11-14rewrite only if changed.ko1
* vm_trace.c (update_global_event_hook): rewrite ISeqs only when effective events are changed. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@60765 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2017-11-14fix prefix.ko1
* compile.c: the following functions accept LINK_ELEMENT so rename to `ELEM_` prefix names: * INSERT_ELEM_NEXT -> ELEM_INSERT_NEXT * INSERT_ELEM_PREV -> ELEM_INSERT_PREV * REPLACE_ELEM -> ELEM_REPLACE * REMOVE_ELEM -> ELEM_REMOVE git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@60764 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2017-11-14remove `trace` instruction. [Feature #14104]ko1
* tool/instruction.rb: create `trace_` prefix instructions. * compile.c (ADD_TRACE): do not add `trace` instructions but add TRACE link elements. TRACE elements will be unified with a next instruction as instruction information. * vm_trace.c (update_global_event_hook): modify all ISeqs when hooks are enabled. * iseq.c (rb_iseq_trace_set): added to toggle `trace_` instructions. * vm_insnhelper.c (vm_trace): added. This function is a body of `trace_` prefix instructions. * vm_insnhelper.h (JUMP): save PC to a control frame. * insns.def (trace): removed. * vm_exec.h (INSN_ENTRY_SIG): add debug output (disabled). git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@60763 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2017-11-14process.c: removed preserving_errnonobu
* process.c (try_with_sh, handle_fork_error): added argument for errno. * process.c (proc_exec_cmd, proc_exec_sh, exec_async_signal_safe): now return errno instead of -1. * process.c (rb_fork_ruby): merged retry_fork_ruby() and unified clean-up after fork regardless failure. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@60762 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2017-11-14string.c: prefer rb_syserr_failnobu
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@60761 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2017-11-14common.mk: add dependencies for iseq.hnobu
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@60760 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2017-11-14compile.c: comments for concatstrings optimization [ci skip]nobu
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@60759 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2017-11-14use RUBY_API_VERSION as ISEQ versions.ko1
* iseq.h: use RUBY_API_VERSION_MAJOR for ISEQ_MAJOR_VERSION and RUBY_API_VERSION_MINOR for ISEQ_MINOR_VERSION. We need to keep compatibility for ISeq during same major/minor versions. If we need to change compatibility between teeny versions, we should use (RUBY_API_VERSION_MINOR * 10 + iseq revs) for ISEQ_MINOR_VERSION. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@60758 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2017-11-13* 2017-11-14svn
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@60757 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2017-11-13compile.c: fixup r60727nobu
* compile.c (iseq_peephole_optimize): skip next `freezestring` instruction after `concatstrings` instruction when frozen string literal is enabled. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@60756 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2017-11-13regexec.c: invalidate previously matched positionnobu
* regexec.c (match_at): invalidate end position not yet matched when new start position is pushed, to dispose previously stored position. [ruby-core:83743] [Bug #14101] git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@60755 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2017-11-13test_regexp.rb: test_absentnobu
* test/ruby/test_regexp.rb (test_absent): add simple tests for absent operator. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@60754 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2017-11-13envutil.rb: preserve RUBYLIBnobu
* test/lib/envutil.rb (invoke_ruby): preserve RUBYLIB which is set by runruby.rb and necessary to load standard libraries. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@60753 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2017-11-13Print last location of a nodeyui-knk
* node.c (A_NODE_HEADER): Print last location of a node. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@60752 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2017-11-13Initialize last column with -1 and lineno with 0yui-knk
* parse.y (node_newnode): Initialize last column of nodes with -1 and lineno with 0 to make it easy to detect nodes which we forget to set a column number or lineno. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@60751 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2017-11-13Store last location of a node on RNodeyui-knk
* node.c (rb_node_init): Initialize last location with 0. * node.h (struct rb_code_range_struct): Define a structure which contains first location and last location of a node. * node.h (struct RNode): Use rb_code_range_t to store last location of a node. * node.h (nd_column, nd_set_column, nd_lineno, nd_set_lineno): Follow-up the change of struct RNode. * node.h (nd_last_column, nd_set_last_column, nd_last_lineno, nd_set_last_lineno): Define getter/setter macros for last location of RNode. * parse.y : Set last location of tokens. Thanks to Yusuke Endoh (mame) for design of data structures. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@60750 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2017-11-12string.c: fix up r60748rhe
An #ifdef was missing in r60748 and build broke on systems without crypt_r(). https://rubyci.org/logs/rubyci.s3.amazonaws.com/unstable11s/ruby-trunk/log/20171112T162503Z.fail.html.gz git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@60749 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2017-11-12string.c: fix memory leak in String#cryptrhe
Use ALLOCV to allocate struct crypt_data for slightly cleaner and less error-prone code. It is currently possible it leaks when an invalid argument is passed to String#crypt or rb_str_new_cstr() fails to allocate memory. SIZEOF_CRYPT_DATA macro in missing/crypt.h is removed since it is not used any longer. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@60748 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2017-11-12* 2017-11-13svn
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@60747 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2017-11-12.gitignore: ignore dlntest.dllk0kubun
This was generated with in-place build on MinGW and not ignored. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@60746 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2017-11-12Clarify Dir.mktmpdir's changekazu
`FileUtils.remove_entry_secure` checks `world_writable?` (and `sticky?`) only. [ci skip] ref https://github.com/rurema/doctree/pull/805 git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@60745 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2017-11-12* 2017-11-12svn
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@60744 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2017-11-12load.c: cwd encodingnobu
* load.c (rb_get_expanded_load_path): save cwd cache in OS path encoding, to get rid of unnecessary conversion and infinite loading when it needs encoding conversion. [ruby-dev:50221] [Bug #13863] git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@60743 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2017-11-11parse.y: constified YYLTYPEnobu
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@60742 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2017-11-11* 2017-11-11svn
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@60741 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2017-11-11* ext/win32ole/win32ole.c(ole_const_load): suppress constant redefinitionsuke
warnings when WIN32OLE.const_load [Bug #14085] git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@60740 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2017-11-10bin/erb: change template file encoding to UTF-8k0kubun
Unlike Ruby source file encoding (script encoding) whose default is changed to UTF-8 in Ruby 2.0 (Feature #6679), template's file encoding given to erb(1) has been ASCII-8BIT since ERB supports m17n at r21170. Like Ruby source file encoding, erb template file encoding should be UTF-8 in Ruby 2. [Bug #14095] [ruby-core:83708] git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@60739 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2017-11-10Fix a typo [ci skip]kazu
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@60738 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2017-11-10Make `rb_ast_dispose` use `RB_OBJ_WRITE`mame
This fixes the mistake of r60722. I used `rb_gc_writebarrier_remember` to notify to GC that the references is changed. But the function just adds the object to the remember set blindly. Ko1 told me that `RB_OBJ_WRITE` is suitable in this case. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@60737 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2017-11-10.travis.yml: workaround to resolve ::1k0kubun
Container-based Trusty environment (sudo: false) does not support IPv6. https://github.com/travis-ci/travis-ci/issues/3302 And the image has "::1 localhost ip6-localhost ip6-loopback" entry in addition to "127.0.0.1 localhost" in /etc/hosts. Thus when it can resolve localhost to ::1 and CI fails. To resolve this, at least we need to modify /etc/hosts for now but we can't modify /etc/hosts without sudo. So I enabled sudo. As Sudo-enabled VM didn't have "::1 localhost" entry, this change fixed the cause without touching /etc/hosts. Since boot of `sudo: required` is slower than `sudo: false`, please revert this commit anytime when Container-based Trusty environment is updated and ::1 issue has gone. https://docs.travis-ci.com/user/reference/overview/ git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@60736 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2017-11-10iseq.c: disasm only once for each iseqnobu
* iseq.c (rb_iseq_disasm): do not dump repeatedly same iseq which has been dumped by catch tables. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@60735 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2017-11-10Do not define test method instead of skip when Calendar class is not defined.hsbt
Revisit r34739. Patch by MSP-Greg. [Bug #14088][ruby-core:83690][fix GH-1743] git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@60734 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2017-11-10refactoring about source line.ko1
* iseq.c (find_line_no): renamed to rb_iseq_line_no(). * vm_backtrace.c (calc_lineno): add a comment why we need to use "pos-1". git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@60733 b2dd03c8-39d4-4d8f-98ff-823fe69b080e