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

27743 Коммитов

Автор SHA1 Сообщение Дата
ko1 6c6dece7f1 * ext/objspace/objspace.c (ObjectSpace.reachable_objects_from):
internal object support.
  If given object `obj' has references to internal objects
  (such as T_NODE objects), then this method returns instances of
  `ObjectSpace::InternalObjectWrapper' instead of that internal objects.
  This instance contains a refereance to an internal object and you can
  check the type of internal object using
  `ObjectSpace::InternalObjectWrapper#type' method.
  Rdoc of `InternalObjectWrapper' is not prepared yet.
* gc.c (rb_objspace_reachable_objects_from), gc.h: change
  an interface of 'rb_objspace_reachable_objects_from()'
* gc.c, gc.h: add two APIs
  - rb_objspace_markable_object_p(obj): check markable or not.
  - rb_objspace_internal_object_p(obj): check internal or not.



git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@37307 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2012-10-24 00:04:56 +00:00
ko1 e1d772c801 * vm_insnhelper.c (vm_call_method): remove `default' and
add a case for `VM_METHOD_TYPE_UNDEF'.



git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@37306 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2012-10-23 20:53:35 +00:00
ko1 378041cfbf * eval_error.c (error_print), vm_eval.c (eval_string_with_cref),
vm_trace.c (rb_suppress_tracing): use TH_PUSH_TAG() instead of
  PUSH_TAG().



git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@37305 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2012-10-23 20:42:45 +00:00
ko1 a0873931ce * vm_eval.c (vm_call0_body): remove RUBY_VM_CHECK_INTS()
after method invocation using rb_call0().
* vm_eval.c (vm_call0_body): remove default section on top of
  switch statement and add cases for `VM_METHOD_TYPE_CFUNC_FRAMELESS'
  and `VM_METHOD_TYPE_UNDEF'.
* vm_eval.c (vm_call0_body): remove useless brackets.



git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@37304 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2012-10-23 20:34:25 +00:00
tenderlove fe38109ffe Add test for instance_exec receiving a curried proc.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@37303 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2012-10-23 17:46:33 +00:00
nobu a8e25c92f3 test_rubyoptions.rb: --help option
* test/ruby/test_rubyoptions.rb (TestRubyOptions#test_usage): now
  --help shows more lines.  [ruby-core:48072] [Bug #7184]


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@37302 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2012-10-23 16:37:47 +00:00
svn 8642c4af6a * 2012-10-24
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@37301 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2012-10-23 15:54:25 +00:00
nagachika d8d95fcc03 * ChangeLog: fix typos of r37293.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@37300 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2012-10-23 15:54:20 +00:00
ko1 479d8ce5b5 * thread.c (thread_raise_m): check interrupts after Thread#raise
if a target thread is the current thread because the behavior
  of Thread.current.raise is expected to perform same as
  Kernel.raise (by rubyspec).



git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@37299 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2012-10-23 13:37:45 +00:00
nobu 357a5f5ab5 ruby.c: --help option
* ruby.c (usage, process_options): show more info in --help.
  [EXPREIMENTAL] [ruby-core:48072] [Bug #7184]


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@37298 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2012-10-23 08:08:42 +00:00
nobu ec007f72cf ruby-electric.el: fix #198
* misc/ruby-electric.el using variable `last-command-event' instead of
  obsolete `last-command-char', so that work with Emacs trunk.
  a patch by Victor Deryagin <vderyagin AT gmail.com>.


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@37297 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2012-10-23 05:20:45 +00:00
nobu 0249395582 configure.in: no visibility option for older GCC
* configure.in (visibility_option): visibility attribute is not
  available before GCC 4, so do not use -fvisibility option in that
  case.  [ruby-core:48147] [Bug #7205]


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@37296 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2012-10-23 05:06:50 +00:00
ko1 a4f79a6ece Revert the last commit because some tests (in btest) fail
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@37295 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2012-10-23 04:52:20 +00:00
ko1 d41ec2a79a * thread.c (rb_threadptr_raise): check interrupts after
Thread#raise because the behavior of Thread.current.raise is
  expected to perform same as Kernel.raise (by rubyspec).



git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@37294 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2012-10-23 04:33:04 +00:00
ko1 9eba45a72a * vm_core.h, vm_insnhelper.c, vm_eval.c (OPT_CALL_CFUNC_WITHOUT_FRAME):
add a new otpimization and its macro `OPT_CALL_CFUNC_WITHOUT_FRAME'.
  This optimization makes all cfunc method calls `frameless', which
  is fster than ordinal cfunc method call.
  If `frame' is needed (for example, it calls another method with
  `rb_funcall()'), then build a frame. In other words, this
  optimization delays frame building.
  However, to delay the frame building, we need additional overheads:
  (1) Store the last call information.
  (2) Check the delayed frame buidling before the frame is needed.
  (3) Overhead to build a delayed frame.
  rb_thread_t::passed_ci is storage of delayed cfunc call information.
  (1) is lightweight because it is only 1 assignment to `passed_ci'.
  To achieve (2), we modify GET_THREAD() to check `passed_ci' every
  time. It causes 10% overhead on my envrionment.
  This optimization only works for cfunc methods which do not need
  their `frame'.
  After evaluation on my environment, this optimization does not
  effective every time. Because of this evaluation results, this
  optimization is disabled at default.
* vm_insnhelper.c, vm.c: add VM_PROFILE* macros to measure behaviour
  of VM internals. I will extend this feature.
* vm_method.c, method.h: change parameters of the `invoker' function.
  Receive `func' pointer as the first parameter.



git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@37293 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2012-10-23 04:22:31 +00:00
tenderlove 3c73f44c7f * ext/psych/parser.c: just get the constant defined in Ruby.
* ext/psych/lib/psych/syntax_error.rb: Psych::SyntaxError now inherits
  from StandardError rather than SyntaxError.  Thanks Eric Hodel!

* test/psych/test_exception.rb: tests for change.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@37292 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2012-10-22 21:25:02 +00:00
tenderlove 6c6d4568e8 * ext/psych/lib/psych/scalar_scanner.rb: Cache symbols while
tokenizing.  Thanks Kevin Menard!

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@37291 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2012-10-22 21:24:50 +00:00
tenderlove ca0cf16734 * ext/psych/lib/psych/scalar_scanner.rb: Updated the RegExp to catch
Strings earlier in the tokenization process.  Thanks Kevin Menard!

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@37290 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2012-10-22 21:24:36 +00:00
tenderlove b3fb872d9d * ext/psych/lib/psych/visitors/to_ruby.rb: Handle nil tags specially
to avoid slow method_missing calls.  Thanks Kevin Menard!

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@37289 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2012-10-22 21:14:08 +00:00
tenderlove ec3056ae22 * ext/psych/lib/psych/scalar_scanner.rb: Ignore bad timestamps. If
something looks like a timestamp but has an invalid component, treat
  it as a string instead of throwing an ArgumentError.
  Thanks Rhett Sutphin!

* test/psych/test_scalar_scanner.rb: appropriate tests.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@37288 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2012-10-22 21:09:56 +00:00
tenderlove c05952c6a1 * ext/psych/lib/psych/scalar_scanner.rb: Fix scalar_scanner to
understand strings starting with an underscore and containing only
  digits.  Thanks Kelley Reynolds.

* test/psych/test_scalar_scanner.rb: test for fix

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@37287 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2012-10-22 21:06:25 +00:00
svn 1c5ae4b31d * 2012-10-23
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@37286 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2012-10-22 21:02:20 +00:00
tenderlove b00362eb3e * ext/psych/lib/psych.rb: Changed comment in psych.rb to update new
home page for libyaml.  Thanks to Carolyn Ann.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@37285 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2012-10-22 21:02:16 +00:00
svn 155291a852 * 2012-10-22
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@37284 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2012-10-22 00:47:56 +00:00
naruse 900b62a2e9 Supress warnings: unused variables
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@37283 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2012-10-22 00:47:50 +00:00
ktsj f1cbd700e8 * test/ruby/test_settracefunc.rb: remove trailing spaces.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@37282 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2012-10-21 10:16:27 +00:00
ktsj 811d072dcb * vm_trace.c (rb_threadptr_exec_event_hooks, rb_suppress_tracing):
constified.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@37281 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2012-10-21 10:14:29 +00:00
ktsj f21d7d9831 * vm_core.h (rb_vm_t::trace_running): add a new field
`trace_running' to store vm global tracing status.

* vm_trace.c: fix SEGV bug. event_hook was free'd
  even when the hook is still used in another thread.
  [ruby-dev:46141] [Bug #7032]

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@37280 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2012-10-21 10:14:26 +00:00
ktsj 93184600c8 * vm_core.h (rb_vm_t::trace_flag): remove `trace_flag'
which is no longer used.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@37279 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2012-10-21 10:14:24 +00:00
svn 9e3633dfad * 2012-10-21
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@37278 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2012-10-21 09:41:31 +00:00
tadf 2cbb4481bd * ext/date/date_parse.c (date__parse): uses more tight parser if
defined TIGHT_PARSER.  now inactivated; because it introduces
	  incompatibilities and it is a bit slow.


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@37277 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2012-10-21 09:41:25 +00:00
eregon 0ef8222e63 * gc.c: fix typos in documentation.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@37276 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2012-10-20 11:36:46 +00:00
nari c3a46d6aca * include/ruby/ruby.h: add C APIs.
VALUE rb_newobj_of(VALUE klass, VALUE flags)
  #define NEWOBJ_OF(obj,type,klass,flags)
  These allow to change a allocation strategy depending on klass
  or flags.

* gc.c: ditto

* array.c: use new C API.
* bignum.c: ditto
* class.c: ditto
* complex.c: ditto
* ext/socket/ancdata.c: ditto
* ext/socket/option.c: ditto
* hash.c: ditto
* io.c: ditto
* marshal.c: ditto
* numeric.c: ditto
* object.c: ditto
* random.c: ditto
* range.c: ditto
* rational.c: ditto
* re.c: ditto
* string.c: ditto
* struct.c: ditto
  [Feature #7177][Feature #7047]

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@37275 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2012-10-20 06:57:51 +00:00
zzak f1e488e524 * ext/socket/socket.c: Documentation for Socket
Based on a patch by David Albert
  [Bug #7105] [ruby-core:47828]



git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@37274 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2012-10-20 03:51:33 +00:00
zzak dd05478f24 * lib/open-uri.rb: Documentation for OpenURI
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@37273 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2012-10-20 02:01:23 +00:00
svn 167c4781a0 * 2012-10-20
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@37272 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2012-10-19 21:20:37 +00:00
tenderlove fb03eb91fe * hash.c (initialize_copy): unset the default proc if there isn't one
for the target hash, call to_hash, check frozen status.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@37271 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2012-10-19 21:20:33 +00:00
nobu 2fe13f62ef vm.c: pass through thrown objects
* vm.c (rb_vm_jump_tag_but_local_jump): pass through thrown objects.
  [ruby-dev:46234] [Bug #7185]
* vm_eval.c (rb_eval_cmd): if state is non-zero, val should be nil and
  rb_vm_jump_tag_but_local_jump() just jump tag.


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@37270 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2012-10-19 13:22:03 +00:00
eregon b0e40509c3 set encoding to ASCII for appropriate String#unpack modifiers
* pack.c (pack_unpack): set encoding of the
  'H','h','B' and 'B' modifiers to US-ASCII.
* test/ruby/test_pack.rb: tests for the above.
  [ruby-core:47653][Bug #7050]
* test/test_securerandom.rb: tests for SecureRandom.hex
  from tenderlove. [ruby-core:46792][Bug #6799]

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@37269 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2012-10-19 13:13:32 +00:00
ko1 f4dbc7a384 * method.h (rb_method_cfunc_t::invoker): add new field (func ptr)
`invoker'. `invoker' function invoke cfunc body
  (rb_method_cfunc_t::func).
  `invoker' is set at method definition timing.
  With this change, the big `switch' (branch) in `call_cfunc()'
  is no longer needed.
  However, the performance benefit is only a bit.
* vm_core.h (rb_call_info_t::aux::func): add a new field to store
  cfunc body function pointer.
* vm_method.c (call_cfunc_invoker_func): add a new function which
  returns a suitable invoke function.
* vm_method.c (setup_method_cfunc_struct): added.
* vm_method.c (rb_add_method): fix to set `invoker'.
* vm_eval.c (vm_call0_body): catch up above changes.
* vm_insnhelper.c (call_cfunc): removed.
* vm_insnhelper.c (vm_call_cfunc): fix to call cfunc body
  with `invoker' function.



git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@37268 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2012-10-19 10:38:30 +00:00
ko1 0fc7f4bb30 * eval.c, vm_eval.c: use TH_PUSH_TAG() instead of PUSH_TAG().
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@37267 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2012-10-19 07:57:56 +00:00
ko1 e99989bf4f * benchmark/driver.rb: remove unexpected `output'.
(commit miss)



git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@37265 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2012-10-19 02:15:00 +00:00
ko1 3daa9b9f5a * vm_insnhelper.c (vm_search_method): remove needless local variable.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@37264 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2012-10-19 01:24:50 +00:00
ko1 f2a9c42c7a * benchmark/bmx_temp.rb: removed.
This file should not be in repository.



git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@37263 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2012-10-19 01:23:50 +00:00
svn 0801dba3f6 * 2012-10-19
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@37262 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2012-10-19 01:22:12 +00:00
ko1 a31d53ecf5 * benchmark/driver.rb: add new option `--ruby-arg [ARG]'
which is passed as a launch parameter for each ruby's execution.
  ($ ruby [ARG] [File])



git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@37261 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2012-10-19 01:22:08 +00:00
ko1 7e8f558aea * insns.def (opt_send_simple): move the location of
`opt_send_simple' to the place near `send' definition.
  (to take care about icache locality).



git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@37260 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2012-10-18 09:44:19 +00:00
ko1 d0ead20888 * insns.def (send): remove unused condition.
This condition will be true after r37258.
* vm_insnhelper.c (vm_caller_setup_args): remove `UNLIKELY' on
  checking blockiseq (it seems `LIKELY').



git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@37259 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2012-10-18 09:41:55 +00:00
ko1 1486b9cf0a * insns.def (opt_send_simple): introduce new instruction used
when no need to care about block and splat.
* compile.c: use the `opt_send_simple' instruction.



git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@37258 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2012-10-18 08:35:19 +00:00
nobu 6be52625b2 vm_method.c: check arity earlier
* vm_method.c (rb_add_method_cfunc, rb_add_method_cfunc_frameless):
  check arity earlier at definition time.


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@37257 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2012-10-18 07:44:09 +00:00