* parse.y (parser_number_literal_suffix): return bit set of found
suffixes.
* parse.y (parser_set_number_literal, parser_set_integer_literal):
split from parser_number_literal_suffix to set yyvlal.
* parse.y (parser_yylex): parse rational number literal with decimal
point precisely.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@42332 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
statement, and call rb_bug() if an unknown type is passed to
negate_lit(). [ruby-core:56316] [Bug #8717]
* bootstraptest/test_literal_suffix.rb (assert_equal): add test
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@42323 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
examine that "1if true" and "1rescue nil" are recognized as 1.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@42315 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
to rationalize a Float instance with a precision.
* rational.c (rb_flt_rationalize): new public C function to
rationalize a Float instance. A precision is calculated from
the given float number.
* include/ruby/intern.h: Add rb_flt_rationalize_with_prec and
rb_flt_rationalize.
* parse.y: implement number literal suffixes, 'r' and 'i'.
[ruby-core:55096] [Feature #8430]
* bootstraptest/test_literal_suffix.rb: add tests for parser to scan
number literals with the above tsuffixes.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@42311 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
remove tests for $SAFE=4.
* lib/pp.rb: use taint instead of untrust to avoid warnings when
$VERBOSE is set to true.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@41269 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
A script "[print(1)]; print(2)" should output "12".
However, the compiler had eliminted "[print(1)]" expression
because it is void expression (unused array).
Of course, side-effect should be remained.
This issue is reported by Masaya Tarui.
* bootstraptest/test_literal.rb: add a test.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@38751 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* io.c (rb_cloexec_fcntl_dupfd) Use an emulation with dup(2) when
fcntl(2) and/or F_DUPFD is unavailable.
Suggested by akr.
* configure.in (HAVE_FCNTL): NativeClient does not provide fcntl(2).
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@38713 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
to point block.
[ruby-core:41038] [ruby-trunk - Bug #5634]
* vm.c (rb_vm_make_proc): No need to make Proc object here.
* bootstraptest/test_proc.rb: add tests.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@37898 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
threads.
This benchmark seems consuming long time on travis-ci
several times (and make `failure').
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@37859 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
ci->argc and ci->blockptr before and after method invocations
because these method dispatches override call_info.
* bootstraptest/test_method.rb: add tests for this fix.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@37641 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* vm.c (rb_vm_rewrite_ep_in_errinfo): rewrite all catch points in
errinfo, not only the topmost frame. based on the patch by
ktsj (Kazuki Tsujimoto) in [ruby-dev:45656]. [Bug #6460]
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@37430 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
this method call needs splat argument because cahced functions
(vm_call_attrset, vm_call_ivar, vm_call_cfunc_fast_(unary|binary))
do not check an arity.
* bootstraptest/test_method.rb: add a test to check an above issue.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@37199 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
remove checkincludearray instruction and
add new instruction checkmatch.
This change is to solve
[Bug #4438] "rescue args type check omitted".
* iseq.c: increment ISEQ_MAJOR_VERSION because removal of
checkincludearray instruction.
* vm_core.h: add several definitions for
the checkmatch instruction.
* vm_insnhelper.c (check_match): added.
* bootstraptest/test_exception.rb: add a test.
* test/ruby/test_exception.rb: ditto.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@36658 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* class.c (rb_special_singleton_class_of): utility function.
* vm_eval.c (eval_under): special deal for class variable scope with
instance_eval.
* vm_eval.c (rb_obj_instance_eval, rb_obj_instance_exec): allow method
definition in instance_eval of special constants. [ruby-core:28324]
[Bug #2788]
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@36647 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* bootstraptest/runner.rb (show_progress): refine error output. do not
count non-empty error message, but just warn.
* bootstraptest/runner.rb (error): show errors immediately if tty.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@36319 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
th->base_block is information for (a) parsing, (b) compiling
and (c) setting up the frame to execute the program passed by
`eval' method. For example, (1) parser need to know up-level
variables to detect it is variable or method without paren.
Befor (a), (b) and (c), VM set th->base_block by passed bindng
(or previous frame information). After execute (a), (b) and (c),
VM should clear th->base_block. However, if (a), (b) or (c)
raises an exception, then th->base_block is not cleared.
Problem is that the uncleared value th->balo_block is used for
irrelevant iseq compilation. It causes SEGV or critical error.
I tried to solve this problem: to clear them before exception,
but finally I found out that it is difficult to do it (Ruby
program can be run in many places).
Because of this background, I set th->base_block before
compiling iseq and restore it after compiling.
Basically, th->base_block is dirty hack (similar to global
variable) and this patch is also dirty.
* bootstraptest/test_eval.rb: add a test for above.
* internal.h: remove unused decl.
* iseq.c (rb_iseq_compile_with_option): add base_block parameter.
set th->base_block before compation and restore it after
compilation.
* ruby.c (require_libraries): pass 0 as base_block instead of
setting th->base_block
* tool/compile_prelude.rb (prelude_eval): apply above changes.
* vm.c, vm_eval.c: ditto.
* vm_core.h: add comments.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@36179 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* bootstraptest/runner.rb (main): add --color option to the help
message.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@36093 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Divide big array (or hash) literals into several blocks and
concatetene them. There was a problem that a big array (hash)
literal causes SystemStackError exception (stack overflow)
because VM push all contents of the literal onto VM stack to
make an array (or hash). To solve this issue, we make several
arrays (hashes) and concatenate them to make a big array (hash)
object.
??
* compile.c (iseq_compile_each, setup_args): use modified
compile_array.
* vm.c (m_core_hash_from_ary, m_core_hash_merge_ary,
m_core_hash_merge_ptr): added for above change.
* id.c (Init_id), parse.y: add core method ids.
* bootstraptest/test_literal.rb: add simple tests.
* bootstraptest/test_eval.rb: remove rescue clause to catch
SystemStackError exception.
* test/ruby/test_literal.rb: add tests to check no stack overflow.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@35306 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
just before calling rb_call0.
* bootstraptest/test_flow.rb: add a test for above.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@34113 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
fixes: Bug #2729
a patch from Kazuki Tsujimoto <kazuki@callcc.net>
This problem is caused by changing dfp (dynamic env pointer)
from saved dfp. Saved dfp is pointed env in VM stack. However,
the dfp can be moved because VM copies env from VM stack to
the heap. At this copying, dfp was also changed. To solve this
problem, I'll try to change throw mechanism (not save target dfp,
but save target cfp).
* bootstraptest/test_flow.rb: add a test for above.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@33064 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Fixes Bug #4648.
The patch is contributed by Kazuki Tsujimoto.
* bootstraptest/test_proc.rb: add tests for above.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@32495 b2dd03c8-39d4-4d8f-98ff-823fe69b080e