Граф коммитов

113 Коммитов

Автор SHA1 Сообщение Дата
nobu 86ffd21c39 load.c: defer initalization of static-linked-ext
* load.c (rb_feature_p): deal with default loadable suffixes.
* load.c (load_lock): initialize statically linked extensions.
* load.c (search_required, rb_require_safe): deal with statically
  linked extensions.
* load.c (ruby_init_ext): defer initalization of statically linked
  extensions until required actually.  [Bug #8883]

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@43514 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2013-11-03 00:35:49 +00:00
nobu 97b88a1773 load.c: suppress warning
* load.c (rb_load_internal): split to suppress false "clobbered"
  warning by gcc 4.4.5.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@43499 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2013-11-01 07:37:27 +00:00
nobu ea09a7b755 load.c: use local variable
* load.c (rb_load_internal): use local variable th instead of
  GET_THREAD() for each time.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@43498 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2013-11-01 07:37:24 +00:00
nobu 06969b6bce load.c: share feature names
* load.c (ruby_init_ext): share feature names between frame name and
  provided features.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@43449 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2013-10-28 05:57:04 +00:00
nobu 21e858e518 load.c: display backtrace to $stderr
* load.c (load_lock): display backtrace to $stderr at circular
  require.
* vm_backtrace.c (rb_backtrace_print_to): new function to print
  backtrace to the given output.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@43204 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2013-10-08 15:56:01 +00:00
nobu 8948280c67 load.c: search in OS path encoding
* load.c (rb_load_internal): use rb_load_file_str() to keep path
  encoding.
* load.c (rb_require_safe): search in OS path encoding for Windows.
* ruby.c (rb_load_file_str): load file with keeping path encoding.
* win32/file.c (rb_file_load_ok): use WCHAR type API assuming incoming
  path is encoded in UTF-8.  [ruby-core:56136] [Bug #8676]

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@42183 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2013-07-26 04:04:23 +00:00
nobu d9119160be load.c: suppress warning
* load.c (rb_load_internal): suppress clobbered-by-longjmp warning by
  gcc 4.4.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@41555 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2013-06-22 01:27:17 +00:00
shugo 1f828497d1 * safe.c (rb_set_safe_level, safe_setter): raise an ArgumentError
when $SAFE is set to 4.  $SAFE=4 is now obsolete.
  [ruby-core:55222] [Feature #8468]

* object.c (rb_obj_untrusted, rb_obj_untrust, rb_obj_trust):
  Kernel#untrusted?, untrust, and trust are now deprecated.
  Their behavior is same as tainted?, taint, and untaint,
  respectively.

* include/ruby/ruby.h (OBJ_UNTRUSTED, OBJ_UNTRUST): OBJ_UNTRUSTED()
  and OBJ_UNTRUST() are aliases of OBJ_TAINTED() and OBJ_TAINT(),
  respectively.

* array.c, class.c, debug.c, dir.c, encoding.c, error.c, eval.c,
  ext/curses/curses.c, ext/dbm/dbm.c, ext/dl/cfunc.c,
  ext/dl/cptr.c, ext/dl/dl.c, ext/etc/etc.c, ext/fiddle/fiddle.c,
  ext/fiddle/pointer.c, ext/gdbm/gdbm.c, ext/readline/readline.c,
  ext/sdbm/init.c, ext/socket/ancdata.c, ext/socket/basicsocket.c,
  ext/socket/socket.c, ext/socket/udpsocket.c,
  ext/stringio/stringio.c, ext/syslog/syslog.c, ext/tk/tcltklib.c,
  ext/win32ole/win32ole.c, file.c, gc.c, hash.c, io.c, iseq.c,
  load.c, marshal.c, object.c, proc.c, process.c, random.c, re.c,
  safe.c, string.c, thread.c, transcode.c, variable.c,
  vm_insnhelper.c, vm_method.c, vm_trace.c: remove code for
  $SAFE=4.

* test/dl/test_dl2.rb, test/erb/test_erb.rb,
  test/readline/test_readline.rb,
  test/readline/test_readline_history.rb, test/ruby/test_alias.rb,
  test/ruby/test_array.rb, test/ruby/test_dir.rb,
  test/ruby/test_encoding.rb, test/ruby/test_env.rb,
  test/ruby/test_eval.rb, test/ruby/test_exception.rb,
  test/ruby/test_file_exhaustive.rb, test/ruby/test_hash.rb,
  test/ruby/test_io.rb, test/ruby/test_method.rb,
  test/ruby/test_module.rb, test/ruby/test_object.rb,
  test/ruby/test_pack.rb, test/ruby/test_rand.rb,
  test/ruby/test_regexp.rb, test/ruby/test_settracefunc.rb,
  test/ruby/test_struct.rb, test/ruby/test_thread.rb,
  test/ruby/test_time.rb: remove tests for $SAFE=4.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@41259 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2013-06-12 14:20:51 +00:00
akr bd15d4ca78 * internal.h (numberof): Gathered from various files.
* array.c, math.c, thread_pthread.c, iseq.c, enum.c, string.c, io.c,
  load.c, compile.c, struct.c, eval.c, gc.c, parse.y, process.c,
  error.c, ruby.c: Remove the definitions of numberof.



git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@41142 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2013-06-07 10:01:19 +00:00
nobu f8180b8963 load.c: fix invalid read
* load.c (loaded_feature_path): fix invalid read by index underflow.
  the beginning of name is also a boundary as well as just after '/'.


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@40900 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2013-05-23 08:35:34 +00:00
ko1 aacd771046 * *.c, parse.y, insns.def: use RARRAY_AREF/ASET macro
instead of using RARRAY_PTR().



git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@40690 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2013-05-13 09:56:22 +00:00
shirosaki 07636ed42e * load.c (features_index_add): use rb_str_subseq() to specify C string
position properly to fix require non ascii path.
  [ruby-core:53733] [Bug #8165]

* test/ruby/test_require.rb (TestRequire#test_require_nonascii_path):
  a test for the above.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@40135 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2013-04-05 15:30:52 +00:00
nobu 61f50e317e load.c: no longer used variable and object
* load.c (rb_feature_p): remvoe variable and string object which are
  no longer used since r39874.  [Bug #8048]

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@39898 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2013-03-24 00:04:43 +00:00
nobu 228b29a697 load.c: loaded_features_index st_table
* load.c (rb_feature_p), vm_core.h (rb_vm_struct): turn
  loaded_features_index into st_table.  patches by tmm1 (Aman Gupta)
  in [ruby-core:53251] and [ruby-core:53274] [Bug #8048]

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@39874 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2013-03-22 08:38:51 +00:00
nobu 198a2eac90 fix commit miss
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@39647 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2013-03-09 00:05:40 +00:00
nobu 6c4ab3f439 load.c: hide internal objects
* load.c (rb_construct_expanded_load_path, Init_load): hide internal
  objects, expanded_load_path, {load_path,loaded_features}_snapshot,
  and loaded_features_index in the VM, and ruby_dln_librefs.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@39646 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2013-03-09 00:03:40 +00:00
nobu 1b7143309b load.c: move loop invariant condition
* load.c (rb_feature_p): move this_feature_index condition which is
  loop invariant.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@39645 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2013-03-08 23:54:41 +00:00
nobu 8237581a2e load.c: reduce indexes arrays
* load.c (features_index_add_single, rb_feature_p): store single index
  as Fixnum to reduce the number of arrays for the indexes.  based on
  the patch by tmm1 (Aman Gupta) in [ruby-core:53216] [Bug #8048].

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@39644 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2013-03-08 23:37:02 +00:00
nobu 4a3970c211 load.c: reorder conditions
* load.c (loaded_feature_path): reorder conditions so simple
  comparision comes first.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@39637 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2013-03-08 05:47:52 +00:00
tenderlove 9ef6eefbd3 * probes.d: updating probes to be more symmetrical, adding
documentation.

* load.c: ditto

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@38755 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2013-01-10 02:16:00 +00:00
glass 62efc6f305 * load.c (load_lock): if thread shield is destroyed and there is no
waiting thread, insert new thread shield into load_table.
  [Bug #7530] [ruby-core:50645]

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@38750 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2013-01-09 13:14:09 +00:00
glass 94b4e7c783 * load.c (load_lock): revert r38744. it should acquire new thread
shield.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@38749 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2013-01-09 13:14:05 +00:00
glass bc0577c6c8 * load.c (load_lock): fix not to delete thread shield twice.
it may break the shield locked by another thread.
  [Bug #7530] [ruby-core:50645]

* test/ruby/test_require.rb: a test for above.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@38744 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2013-01-09 00:59:30 +00:00
nobu 320b49473e error.c: rb_write_error_str
* error.c (compile_err_append, compile_warn_print, warn_print): use
  rb_write_error_str() instead of writing to rb_stderr directly.
* io.c (rb_write_error_str): a stopgap measure not to unblock GVL.
  warning from require seems to still have race condition errors.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@38590 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2012-12-25 04:38:18 +00:00
nagachika 26221584a9 * vm.c (rb_vm_jump_tag_but_local_jump): remove unnessesary 2nd
argument.

* load.c (rb_load_internal): ditto.

* eval_intern.h (rb_vm_jump_tag_but_local_jump): ditto.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@38452 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2012-12-18 17:04:05 +00:00
nobu 66fd9d44d8 adjust style.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@38128 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2012-12-01 15:25:28 +00:00
tenderlove 4c740bae97 * probes.d: add DTrace probe declarations. [ruby-core:27448]
* array.c (empty_ary_alloc, ary_new): added array create DTrace probe.

* compile.c (rb_insns_name): allowing DTrace probes to access
  instruction sequence name.

* Makefile.in: translate probes.d file to appropriate header file.

* common.mk: declare dependencies on the DTrace header.

* configure.in: add a test for existence of DTrace.

* eval.c (setup_exception): add a probe for when an exception is
  raised.

* gc.c: Add DTrace probes for mark begin and end, and sweep begin and
  end.

* hash.c (empty_hash_alloc): Add a probe for hash allocation.

* insns.def: Add probes for function entry and return.

* internal.h: function declaration for compile.c change.

* load.c (rb_f_load): add probes for `load` entry and exit, require
  entry and exit, and wrapping search_required for load path search.

* object.c (rb_obj_alloc): added a probe for general object creation.

* parse.y (yycompile0): added a probe around parse and compile phase.

* string.c (empty_str_alloc, str_new): DTrace probes for string
  allocation.

* test/dtrace/*: tests for DTrace probes.

* vm.c (vm_invoke_proc): add probes for function return on exception
  raise, hash create, and instruction sequence execution.

* vm_core.h: add probe declarations for function entry and exit.

* vm_dump.c: add probes header file.

* vm_eval.c (vm_call0_cfunc, vm_call0_cfunc_with_frame): add probe on
  function entry and return.

* vm_exec.c: expose instruction number to instruction name function.

* vm_insnshelper.c: add function entry and exit probes for cfunc
  methods.

* vm_insnhelper.h: vm usage information is always collected, so
  uncomment the functions.

12 19:14:50 2012  Akinori MUSHA  <knu@iDaemons.org>

* configure.in (isinf, isnan): isinf() and isnan() are macros on
  DragonFly which cannot be found by AC_REPLACE_FUNCS().  This
  workaround enforces the fact that they exist on DragonFly.

12 15:59:38 2012  Shugo Maeda  <shugo@ruby-lang.org>

* vm_core.h (rb_call_info_t::refinements), compile.c (new_callinfo),
  vm_insnhelper.c (vm_search_method): revert r37616 because it's too
  slow.  [ruby-dev:46477]

* test/ruby/test_refinement.rb (test_inline_method_cache): skip
  the test until the bug is fixed efficiently.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@37631 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2012-11-12 21:52:12 +00:00
shirosaki 6678422fee Fix typos in comments
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@37529 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2012-11-06 22:00:12 +00:00
shirosaki d33b9a8a72 Fix compatibility of cached expanded load path
* file.c (rb_get_path_check_to_string): extract from
  rb_get_path_check(). We change the spec not to call to_path of
  String object.

* file.c (rb_get_path_check_convert): extract from rb_get_path_check().

* file.c (rb_get_path_check): follow the above change.

* file.c (rb_file_expand_path_fast): remove check_expand_path_args().
  Instead we call it in load.c.

* file.c (rb_find_file_ext_safe): use rb_get_expanded_load_path() to
  reduce expand cost.

* file.c (rb_find_file_safe): ditto.

* internal.h (rb_get_expanded_load_path): add a declaration.

* internal.h (rb_get_path_check_to_string, rb_get_path_check_convert):
  add declarations.

* load.c (rb_construct_expanded_load_path): fix for compatibility.
  Same checks in rb_get_path_check() are added. We don't replace
  $LOAD_PATH and ensure that String object of $LOAD_PATH are frozen.
  We don't freeze non String object and expand it every times. We add
  arguments for expanding load path partially and checking if load path
  have relative paths or non String objects.

* load.c (load_path_getcwd): get current working directory for checking
  if it's changed when getting load path.

* load.c (rb_get_expanded_load_path): fix for rebuilding cache properly.
  We check if current working directory is changed and rebuild expanded
  load path cache. We expand paths which start with ~ (User HOME) and
  non String objects every times for compatibility. We make this
  accessible from other source files.

* load.c (rb_feature_provided): call rb_get_path() since we changed
  rb_file_expand_path_fast() not to call it.

* load.c (Init_load): initialize vm->load_path_check_cache.

* vm.c (rb_vm_mark): mark vm->load_path_check_cache for GC.

* vm_core.h (rb_vm_struct): add vm->load_path_check_cache to store data
  to check load path cache validity.

* test/ruby/test_require.rb (TestRequire): add tests for require
  compatibility related to cached expanded load path.
  [ruby-core:47970] [Bug #7158]

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@37482 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2012-11-05 15:27:08 +00:00
shirosaki 9823c46189 Cache the expanded load path
* load.c (rb_get_expanded_load_path): cache the expanded load
  path.  This saves 4KB of allocation and some stats for every
  element of the load path (so nearly a MB in my Rails app)
  on every require.

* load.c (rb_construct_expanded_load_path): ensure that $LOAD_PATH
  entries are frozen strings.  The user must mutate $LOAD_PATH
  itself rather than its individual entries.

* vm_core.h (rb_vm_struct): add fields.

* vm.c (rb_vm_mark): mark new fields.

* ruby.c (process_options): modify $LOAD_PATH directly rather than
  its elements.
  Patch by Greg Price.
  [ruby-core:47970] [Bug #7158]

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@37481 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2012-11-05 15:27:05 +00:00
shirosaki b56a2afc14 Index $LOADED_FEATURES so that require isn't so slow
* load.c (rb_feature_p, rb_provide_feature): index $LOADED_FEATURES
  so that require isn't so slow.

* load.c (rb_provide_feature, get_loaded_features_index): ensure
  that $LOADED_FEATURES entries are frozen strings.  The user
  must mutate $LOADED_FEATURES itself rather than its individual
  entries.

* load.c (reset_loaded_features_snapshot): add a new function to reset
  vm->loaded_features_snapshot.

* load.c (get_loaded_features_index_raw): add a new function to get
  the loaded-features index.

* load.c (features_index_add_single): add a new function to add to the
  loaded-features index a single feature.

* load.c (features_index_add): add a new function to add to the
  loaded-features index all the required entries for `feature`.

* vm_core.h (rb_vm_struct): add fields.

* vm.c (rb_vm_mark): mark new fields.

* include/ruby/intern.h (rb_hash_clear): declare function.

* hash.c (rb_hash_clear): make function non-static.
  Patch by Greg Price.
  [ruby-core:47970] [Bug #7158]

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@37480 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2012-11-05 15:27:01 +00:00
shirosaki e575070f2f Expose whether two arrays are shared
* array.c (rb_ary_shared_with_p): new function.
  Expose whether two arrays are shared (read-only, C only).

* include/ruby/intern.h (rb_ary_shared_with_p): declare.
  Patch by Greg Price.
  [ruby-core:47970] [Bug #7158]

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@37478 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2012-11-05 15:24:07 +00:00
shirosaki 4d414c9f68 Clarify and explain loaded_feature_path and rb_feature_p
* load.c (loaded_feature_path): clarify and briefly comment
  function.  These clarifications have no effect on the behavior
  of the function.

* load.c (rb_feature_p): explain the search loop.  Especially
  useful because the logic is complicated as described in the
  second paragraph.
  Patch by Greg Price.
  [ruby-core:47970] [Bug #7158]

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@37477 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2012-11-05 15:24:03 +00:00
nobu b9cba0711b load.c: adjust style
* load.c (loaded_feature_path): adjust style.


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@37383 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2012-10-29 09:31:50 +00:00
luislavena 86df08dac6 Improve require/File.expand_path performance on Windows
* configure.in (mingw): add shlwapi to the list of dependency
  libs for Windows.
* win32/Makefile.sub (EXTSOLIBS): ditto.

* internal.h: declare internal functions rb_w32_init_file,
  rb_file_expand_path_internal and rb_file_expand_path_fast.

* file.c (Init_File): invoke Windows initialization rb_w32_init_file

* win32/file.c (rb_file_load_path_internal): new function.
  Windows-specific implementation that replaces file_expand_path.
  [Bug #6836][ruby-core:46996]

* win32/file.c (rb_w32_init_file): new function. Initialize codepage
  cache for faster conversion encodings lookup.

* file.c (file_expand_path): rename to rb_file_expand_path_internal.
  Conditionally exclude from Windows.

* file.c (rb_file_expand_path_fast): new function. delegates to
  rb_file_expand_path_internal without performing a hit to the
  filesystem.

* file.c (file_expand_path_1): use rb_file_expand_path_internal without
  path expansion (used by require).
* file.c (rb_find_file_ext_safe): ditto.
* file.c (rb_find_file_safe): ditto.

* load.c (rb_get_expanded_load_path): use rb_file_expand_path_fast.
* load.c (rb_feature_provided): ditto.

* file.c (rb_file_expand_path): use rb_file_expand_path_internal with
  path expansion.
* file.c (rb_file_absolute_path): ditto.

* test/ruby/test_file_exhaustive.rb: new tests to exercise
  rb_file_expand_path_internal implementation and compliance with
  existing behaviors.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@36811 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2012-08-24 03:44:56 +00:00
nobu c68d29960b load.c: keep encoding of feature name
* file.c (rb_find_file_ext_safe, rb_find_file_safe): default to
  US-ASCII for encdb and transdb.
* load.c (search_required): keep encoding of feature name.  set
  loading path to filesystem encoding.  [Bug #6377][ruby-core:44750]
* ruby.c (add_modules, require_libraries): assume default external
  encoding as well as ARGV.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@36800 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2012-08-23 07:46:12 +00:00
nobu 51f458d4db ThreadShield
* thread.c (ThreadShield): rename from Barrier.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@36320 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2012-07-05 07:00:29 +00:00
naruse 151093b97e * thread.c (rb_threadptr_execute_interrupts_common):
test_signal_requiring of test/ruby/test_signal.rb fail if the sub
  process is killed on waiting IO in lex_io_gets in rb_load_file in
  rb_load_internal in require.
  This is because
  (1) the process receive the killing signal in
      rb_thread_io_blocking_region in rb_read_internal in lex_io_gets.
  (2) set th->errinfo as INT2FIX(TAG_FATAL) at
      rb_threadptr_execute_interrupts_common.
  (3) escape rb_load_file in rb_load_internal and jump to EXEC_TAG()
      without set loaded as TRUE.
  (4) call first rb_exc_raise(GET_THREAD()->errinfo); because loaded
      is FALSE as above. this errinfo should be an exception object
      but this is INT2FIX(TAG_FATAL).
  Don't call first rb_exc_raise if GET_THREAD()->errinfo is Fixnum.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@35625 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2012-05-11 20:39:35 +00:00
nobu 28cc4f7543 * st.c (st_update): pass pointer to key to the callback function.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@35172 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2012-03-29 14:50:20 +00:00
nobu 30cea65767 * st.c (st_update): add existing parameter to the callback function.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@35170 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2012-03-29 07:36:12 +00:00
yugui a157c85a7f * load.c (ruby_init_ext): don't free the given pointer itself.
It is not guaranteed even that the pointer is on heap.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@35058 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2012-03-16 05:45:39 +00:00
nobu 075d98c7dc * error.c (rb_load_fail): should honor encoding.
* load.c (load_failed): ditto.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@34944 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2012-03-07 07:30:31 +00:00
nobu 8e07edf364 * load.c (load_failed): no need to guard fname, it's stored in the exception to be raised.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@34943 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2012-03-07 05:22:43 +00:00
tenderlove d576a25c26 * error.c (rb_loaderror_with_path): Adding the missing file as an
instance variable to the LoadError exception.

* load.c: call rb_loaderror_with_path so that the missing path is
  added to the exception.

* ruby.c: call rb_loaderror rather than raising our own LoadError
  exception.

* include/ruby/intern.h: add declaration for rb_loaderror_with_path.

* test/ruby/test_require.rb: add supporting test for LoadError#path
  method.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@34938 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2012-03-06 23:38:33 +00:00
drbrain 8a5b4ad115 * load.c (rb_f_require): Add note to require for scope of items in the
loaded file.  [ruby-trunk - #5910]


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@34758 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2012-02-23 01:58:01 +00:00
nobu db02621bfb * load.c (load_unlock): update loading table at once.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@34292 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2012-01-13 08:23:43 +00:00
nobu 50c1985555 * load.c (load_unlock): release loading barrier and then remove it
from loading_table if it is not in-use.  [Bug #5754]
* thread.c (rb_barrier_release, rb_barrier_destroy): return
  whether any other threads are waiting on it.


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@34039 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2011-12-14 03:20:02 +00:00
nobu f2fff83e96 * load.c (load_lock): delete the loading barrier if it has been
destroyed.
* thread.c (rb_barrier_wait): return nil for recursive lock
  instead of false, to distinguish it from destroyed barrier.


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@34036 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2011-12-14 01:20:11 +00:00
nobu ab6c8910f4 * load.c (load_unlock): all threads requiring one file should
share same loading barrier, so it must be kept alive while those
  are waiting on it.  [ruby-core:41618] [Bug #5754]


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@34027 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2011-12-13 07:13:31 +00:00
nobu 2e16e8a60e * load.c (rb_feature_p): lazy assigned load_path searched in
loading_table were not expanded, but all features, pushed to
  loading table, are expanded.  a patch by Yura Sokolov
  <funny.falcon AT gmail.com> in [ruby-core:41545]. [Bug #5727]

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@34013 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2011-12-12 08:26:54 +00:00