1
0
Fork 0
mirror of https://github.com/ruby/ruby.git synced 2022-11-09 12:17:21 -05:00

* vm_exec.h, tool/instruction.rb: not an error, but a BUG if stack

overflow checking failed just before/after the beginning of an
  instruction. It should be treated as a BUG.
  Please tell us if your code cause BUG with this problem.
  This check will removed soon (for performance).



git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@42194 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
ko1 2013-07-26 10:28:26 +00:00
parent d462261395
commit 621da98309
3 changed files with 14 additions and 2 deletions

View file

@ -1,3 +1,11 @@
Fri Jul 26 19:25:17 2013 Koichi Sasada <ko1@atdot.net>
* vm_exec.h, tool/instruction.rb: not an error, but a BUG if stack
overflow checking failed just before/after the beginning of an
instruction. It should be treated as a BUG.
Please tell us if your code cause BUG with this problem.
This check will removed soon (for performance).
Fri Jul 26 18:30:14 2013 Koichi Sasada <ko1@atdot.net>
* array.c (ary_memcpy): cast to int to suppress a warning.

View file

@ -692,7 +692,7 @@ class RubyVM
n = 0
push_ba.each {|pushs| n += pushs.length}
commit " CHECK_VM_STACK_OVERFLOW(REG_CFP, #{n});" if n > 0
commit " CHECK_VM_STACK_OVERFLOW_FOR_INSN(REG_CFP, #{n});" if n > 0
push_ba.each{|pushs|
pushs.each{|r|
commit " PUSH(SCREG(#{r}));"
@ -842,7 +842,7 @@ class RubyVM
each_footer_stack_val(insn){|v|
n += 1 unless v[2]
}
commit " CHECK_VM_STACK_OVERFLOW(REG_CFP, #{n});" if n > 0
commit " CHECK_VM_STACK_OVERFLOW_FOR_INSN(REG_CFP, #{n});" if n > 0
each_footer_stack_val(insn){|v|
if v[2]
commit " SCREG(#{v[2]}) = #{v[1]};"

View file

@ -169,5 +169,9 @@ default: \
#endif
#define SCREG(r) (reg_##r)
#define CHECK_VM_STACK_OVERFLOW_FOR_INSN(cfp, margin) \
if ((VALUE *)((char *)(((VALUE *)(cfp)->sp) + (margin)) + sizeof(rb_control_frame_t)) >= ((VALUE *)(cfp))) { \
rb_bug("CHECK_VM_STACK_OVERFLOW_FOR_INSN: should not overflow here. Please contact ruby-core/dev with your (a part of) script. This check will be removed soon."); \
} while (0);
#endif /* RUBY_VM_EXEC_H */