Commit Graph

3099 Commits

Author SHA1 Message Date
Yukihiro "Matz" Matsumoto 9145aed85e bytes2chars() conversion to fail if target byte offset is not on the character boundary; ref #3067
that means String#index matches first byte of a multi-byte character. this behavior is different
from CRuby, but a compromise for mruby which does not have encoding stuffs.
2016-01-05 18:05:25 +09:00
Yukihiro "Matz" Matsumoto aec825a64c stack_extend before eval_under() 2016-01-04 10:22:38 +09:00
Yukihiro "Matz" Matsumoto aa1f668b80 instance_eval should pass the receiver as a block parameter; close #3029 2016-01-02 22:01:00 +09:00
Yukihiro "Matz" Matsumoto bd462c5edc mruby-fiber: fiber_switch() to use nesting VM when it's called from C API or mrb_funcall(); close #3056 2016-01-02 13:48:45 +09:00
Yukihiro "Matz" Matsumoto 31b8469bff Merge pull request #3067 from ksss/use-memchr
Use memchr for performance
2015-12-31 21:20:51 +09:00
ksss 6c1b6ef7a5 Use memchr for performance
```ruby
s = "b"
str = ("a" * 100 + s)

t = Time.now
str.index(s)
puts Time.now - t
```

before => 0.000788
after  => 0.000508

---

```ruby
s = "b"
str = ("a" * 100 * 1024 * 1024 + s)

t = Time.now
str.index(s)
puts Time.now - t
```

before => 0.225474
after  => 0.008658
2015-12-31 17:52:22 +09:00
Yukihiro "Matz" Matsumoto 3531fe179c GC must scan env from fibers even when it's not yet copied to heap; fix #3063 2015-12-31 00:11:37 +09:00
Kouhei Sutou a561bdb25f Support backtrace after method calls
GitHub: fix #2902, #2917

The current implementation traverses stack to retrieve backtrace. But
stack will be changed when some operations are occurred. It means that
backtrace may be broken after some operations.

This change (1) saves the minimum information to retrieve backtrace when
exception is raised and (2) restores backtrace from the minimum
information when backtrace is needed. It reduces overhead for creating
backtrace Ruby objects.

The space for the minimum information is reused by multiple
exceptions. So memory allocation isn't occurred for each exception.
2015-12-29 20:36:12 +09:00
Kouhei Sutou 1eeeecb08a Fix indent 2015-12-29 14:20:10 +09:00
Yasuhiro Matsumoto 7cc33af2dc fix build on VS2012 2015-12-22 17:46:20 +09:00
Kei Sawada d69b5c3fc7 Add case statement of MRB_TT_SCLASS in mrb_obj_is_kind_of() 2015-12-16 15:54:03 +09:00
Yukihiro "Matz" Matsumoto f54a98ff15 mrb_str_len_to_inum(): fixed a bug with MRB_INT_MIN conversion; fix #3048 2015-12-16 14:49:43 +09:00
Yukihiro "Matz" Matsumoto d18c55fca7 mrb_str_len_to_inum(): fixed a bug with underscores in digits; fix #3049 2015-12-16 14:49:08 +09:00
Yukihiro "Matz" Matsumoto 2a234a93d7 mrb_str_len_to_inum(): string may not be NUL terminated; ref #3043 2015-12-14 10:59:56 +09:00
Yukihiro "Matz" Matsumoto 19c744e14d mrb_str_len_to_inum(): fixed a bug with separating _ in the digits; ref #3043 2015-12-14 10:59:56 +09:00
Yukihiro "Matz" Matsumoto 26a25e1666 mrb_str_len_to_inum: should not raise "string contains null byte" error on "0x"; fix #3043 2015-12-12 16:33:48 +09:00
Yukihiro "Matz" Matsumoto ad333cd191 mrb_str_len_to_inum: converting may not be terminated by NUL; fix #3044 2015-12-12 16:33:48 +09:00
Yukihiro "Matz" Matsumoto 9a21aa2d3c preserve original string for error message 2015-12-01 21:42:07 +09:00
Yukihiro "Matz" Matsumoto ca417dac26 mrb_str_len_to_inum(): inspect string in error message 2015-12-01 21:41:53 +09:00
Yukihiro "Matz" Matsumoto 36fabe104b new API function mrb_string_value_len() 2015-12-01 16:18:01 +09:00
Yukihiro "Matz" Matsumoto 0701236dac mrb_str_to_inum(): should treat null byte in strings properly; fix #3040 2015-12-01 16:11:47 +09:00
Yukihiro "Matz" Matsumoto d3a56a6949 mrb_cstr_to_inum(): should ignore trailing white spaces even when badcheck set 2015-12-01 11:14:22 +09:00
Yukihiro "Matz" Matsumoto dbb8cf637e mrb_str_to_inum(): should raise error when string contains null byte 2015-12-01 11:13:32 +09:00
Yukihiro "Matz" Matsumoto 9f2fca6ebe mrb_str_to_inum(): no need to call mrb_string_value_cstr() here; ref 05411ee 2015-12-01 10:54:00 +09:00
Yukihiro "Matz" Matsumoto 05411ee15e mrb_string_value_cstr() should not raise error for frozen strings
cf. http://qiita.com/tsahara@github/items/b2a442af95ac893e10a1 (Japanese).
2015-12-01 10:45:43 +09:00
Yukihiro "Matz" Matsumoto 5c405dea3d include changed from by quotes ("") to by brackets (<>); close #3032 2015-11-27 17:48:23 +09:00
Yukihiro "Matz" Matsumoto 996417cabf integer range check was moved to mrb_flo_to_fixnum(); ref #3025 2015-11-19 22:49:50 +09:00
murase_syuka ef95dcd390 Bugfix nagative-number lshift() bit overflow 2015-11-18 21:37:17 +09:00
murase_syuka a4d5588101 Bugfix lshift() bit overflow; close #3023 2015-11-18 01:00:46 +09:00
cremno e2e23c66d2 add RUBY_ENGINE_VERSION
RUBY_ENGINE_VERSION is equivalent to MRUBY_VERSION. It would be a
standard way to get the interpreter version (without a case expression).

It's also already defined by CRuby 2.3, JRuby 9000, Opal, and Rubinius.
2015-11-17 00:13:31 +01:00
Yukihiro "Matz" Matsumoto 4440566b95 DISABLE_STDIO/ENABLE_DEBUG macros to rename; close #3014
changes:
 * rename DISABLE_STDIO -> MRB_DISABLE_STDIO
 * rename ENABLE_DEBUG -> MRB_ENABLE_DEBUG_HOOK
 * no more opposite macro definitions (e.g. ENABLE_STDIO, DISABLE_DEBUG).
 * rewrite above macro references throughout the code.
 * update documents
2015-11-17 07:30:34 +09:00
murase_syuka cd1a566002 fix comment 2015-11-16 22:27:42 +09:00
Yukihiro "Matz" Matsumoto d6e1762346 Merge pull request #3004 from cremno/remove-return
remove return
2015-11-08 21:36:54 +09:00
Yukihiro "Matz" Matsumoto d3b323cf2f PR #2521 did not work for singleton classes for non-class objects; fix #3003 2015-11-07 15:51:00 +09:00
cremno e18e2a44f0 remove return
The return type of the mrb_objspace_each_objects function is void.
So this return statement with an expression is unnecessary and
also violates a constraint. From C99 §6.8.6.4:
>A return statement with an expression shall not appear
>in a function whose return type is void.
2015-11-06 18:13:38 +01:00
Yukihiro "Matz" Matsumoto 8bad1954a4 mrb_get_args should consume argument even when type specifier with bang get nil; fix #3002 2015-10-28 09:36:48 +09:00
Yukihiro "Matz" Matsumoto 614927447a mrb_str_concat() may call VM resursively thus may reallocate VM stack; close #3000 2015-10-27 01:06:15 +09:00
Yukihiro "Matz" Matsumoto 727f2485c9 Merge pull request #2999 from sagmor/better-docs
More Docs
2015-10-22 07:10:16 +09:00
Yukihiro "Matz" Matsumoto e5fbf9dfa2 align codedump output for OP_JMP 2015-10-22 00:37:42 +09:00
Yukihiro "Matz" Matsumoto 73fa6486c6 align codedump output for OP_RETURN 2015-10-22 00:36:51 +09:00
furunkel 6b67590fda Merge branch 'master' of https://github.com/mruby/mruby into gc_cleanup 2015-10-21 11:17:58 +02:00
furunkel 0d8012f513 Merge upstream 2015-10-21 11:12:08 +02:00
Yukihiro "Matz" Matsumoto 68ba386213 Merge pull request #2879 from cremno/call-always-frexp-instead-of-frexpl
call always frexp() instead of frexpl()
2015-10-21 10:36:11 +09:00
Seba Gamboa 13b552538a Remove obvious warnings from docs 2015-10-20 12:48:31 -03:00
Seba Gamboa e871b77f41 Increasing docs coverage 2015-10-20 12:16:46 -03:00
furunkel 1c6b1d0155 Prefix mrb_gc_state enum members, make color defines private 2015-10-20 10:54:47 +02:00
Yukihiro "Matz" Matsumoto fc4f0b9be7 do not assert is_dead() during mark phase; close #2825 ref #2996 #2769 2015-10-20 17:06:54 +09:00
furunkel 2b39d87fe8 Remove gc_ prefix of mrb_gc fields 2015-10-19 23:00:07 +02:00
furunkel 2f8b0f66bc Move MRB_GC_ARENA_SIZE to gc.h and fix compiler warnings 2015-10-19 22:43:09 +02:00
furunkel 5c093ed22b Remove segregated value struct declaration 2015-10-19 22:34:47 +02:00