summaryrefslogtreecommitdiffhomepage
AgeCommit message (Collapse)Author
2021-07-05Make `LocalJumpError` a direct subclass of `StandardError`.Yukihiro "Matz" Matsumoto
To be compatible with CRuby.
2021-07-04codegen.c: jump address should be generated by `gen_jmpdst()`.Yukihiro "Matz" Matsumoto
2021-07-03ops.h: made terms consistent.Yukihiro "Matz" Matsumoto
- `Lit` -> `Pool` - `SEQ` -> `Irep`
2021-07-03Update `.git-blame-ignore-revs` to skip a reformatting commit.Yukihiro "Matz" Matsumoto
2021-07-03doc/opcode.md: table reformatted.Yukihiro "Matz" Matsumoto
2021-07-03vm.c: `OP_DEF` to push a symbol to `a` register.Yukihiro "Matz" Matsumoto
The code generator no longer need to emit `OP_LOADSYM` after `OP_DEF`. `doc/opcode.md` is also updated.
2021-07-02vm.c: need to adjust `pc` for `OP_EXT[123]`.Yukihiro "Matz" Matsumoto
2021-07-02error.c: `mrb_obj_as_string` and `mrb_inspect` may return non-object (`undef`).Yukihiro "Matz" Matsumoto
2021-07-01AUTHORS: update.Yukihiro "Matz" Matsumoto
2021-06-30Revert "Remove `OP_EXT[123]` from operands."Yukihiro "Matz" Matsumoto
This reverts commit fd10c7231906ca48cb35892d2a86460004b62249. I thought it was OK to restrict index value within 1 byte, but in some cases index value could be 16 bits (2 bytes). I had several ideas to address the issue, but reverting `fd10c72` is the easiest way. The biggest reason is `mruby/c` still supports `OP_EXT[123]`, so that they don't need any additional work.
2021-06-29string.rb: `upto` to break when the string length is longer than `end`.Yukihiro "Matz" Matsumoto
2021-06-29Merge pull request #5497 from dearblue/drop-upperYukihiro "Matz" Matsumoto
Drop unnecessary upper procs linked from class/module/def syntax
2021-06-29Merge pull request #5498 from dearblue/ruby-warnsYukihiro "Matz" Matsumoto
Avoid warnings with `ruby -cw`
2021-06-28Avoid warnings with `ruby -cw`dearblue
```console % for rb in `git ls-files '*/mrblib/*.rb' 'mrblib'`; do ruby30 -cw $rb > /dev/null; done mrbgems/mruby-array-ext/mrblib/array.rb:389: warning: assigned but unused variable - ary mrbgems/mruby-array-ext/mrblib/array.rb:663: warning: assigned but unused variable - len mrbgems/mruby-hash-ext/mrblib/hash.rb:119: warning: possibly useless use of a variable in void context mrbgems/mruby-hash-ext/mrblib/hash.rb:259: warning: assigned but unused variable - keys mrbgems/mruby-io/mrblib/io.rb:229: warning: literal in condition mrbgems/mruby-io/mrblib/io.rb:280: warning: literal in condition mrbgems/mruby-string-ext/mrblib/string.rb:347: warning: assigned but unused variable - len mrbgems/mruby-toplevel-ext/mrblib/toplevel.rb:2: warning: parentheses after method name is interpreted as an argument list, not a decomposed argument ```
2021-06-28Drop unnecessary upper procs linked from class/module/def syntaxdearblue
It does not need to hold an anonymous proc for constant search. Also, this change can be expected to cause an anonymous proc to be GC'd. This is useful for metaprogramming that makes heavy use of the `class`/`module`/`def` syntax in the `class_eval`/`eval` method. Example: - code ```ruby p ObjectSpace.count_objects String.class_eval do def a end end p ObjectSpace.count_objects String.class_eval do eval <<~CODE def b end CODE end p ObjectSpace.count_objects ``` - result of building mruby-head (d63c0df6b) with `build_config/default.rb` ``` {:TOTAL=>1024, :FREE=>262, :T_PROC=>495, :T_ENV=>61, ...} {:TOTAL=>1024, :FREE=>259, :T_PROC=>497, :T_ENV=>62, ...} {:TOTAL=>1024, :FREE=>255, :T_PROC=>500, :T_ENV=>63, ...} ``` - result of building mruby with this patch and `build_config/default.rb` ``` {:TOTAL=>1024, :FREE=>264, :T_PROC=>494, :T_ENV=>60, ...} {:TOTAL=>1024, :FREE=>262, :T_PROC=>495, :T_ENV=>61, ...} {:TOTAL=>1024, :FREE=>261, :T_PROC=>496, :T_ENV=>61, ...} ```
2021-06-28Merge pull request #5493 from dearblue/binding.2Yukihiro "Matz" Matsumoto
Fixed finding variables from `proc` in `binding.eval` failed
2021-06-27Merge pull request #5495 from dearblue/eval.2Yukihiro "Matz" Matsumoto
Fixed finding variables defined in the upper proc failed
2021-06-26Fixed finding variables from `proc` in `binding.eval` faileddearblue
Previously the following code did not produce the expected results: ```ruby bx = binding block = bx.eval("a = 1; proc { a }") bx.eval("a = 2") p block.call # Expect 2 but return 1 due to a bug ``` The previous implementation of `Binding#eval` evaluated the code and then merged the top layer variables. This patch will parse and expand the variable space before making a call to `eval`. This means that the call to `Binding#eval` will do the parsing twice. In addition, the following changes will be made: - Make `mrb_parser_foreach_top_variable()`, `mrb_binding_extract_proc()` and `mrb_binding_extract_env()` functions private global functions. - Remove the `posthook` argument from `mrb_exec_irep()`. The `posthook` argument was introduced to implement the `binding` method. This patch is unnecessary because it uses a different implementation method. ref #5362 fixed #5491
2021-06-26Merge pull request #5494 from dearblue/eval.1Yukihiro "Matz" Matsumoto
Fix memory leak in `Kernel#eval`
2021-06-26Fixed finding variables defined in the upper proc faileddearblue
If no new variable was defined in the `eval` method, the variable was hidden from the nested `eval` method. ```ruby a = 1 p eval %(b = 2; eval %(a)) # => 1 (good) p eval %(eval %(a)) # => undefined method 'a' (NoMethodError) ``` This issue has occurred since mruby 3.0.0.
2021-06-26Fix memory leak in `Kernel#eval`dearblue
The `mrbc_context` remained unreleased when the `mrb_parse_nstring()` function returned `NULL`.
2021-06-25class.c: call `method_added` hooks on alias definitions; #2339Yukihiro "Matz" Matsumoto
2021-06-24class.c: call hook methods on method definitions; close #2339Yukihiro "Matz" Matsumoto
- `Module#method_added` - `BasicObject#singleton_method_added`
2021-06-24Remove unused build configuration file `benchmark/build_config_cc.rb`.Yukihiro "Matz" Matsumoto
2021-06-23Merge pull request #5492 from jbampton/add-file-contents-sorter-pre-commitYukihiro "Matz" Matsumoto
Add official pre-commit file-contents-sorter
2021-06-23Add official pre-commit file-contents-sorterJohn Bampton
Remove unneeded bash script sort-codespell-wordlist.sh https://github.com/pre-commit/pre-commit-hooks#file-contents-sorter
2021-06-22Rename two files for consistency; close #5488Yukihiro "Matz" Matsumoto
* android_arm64-v8a.rb -> android_arm64_v8a.rb * no-float.rb -> host-nofloat.rb
2021-06-22Merge pull request #5487 from jbampton/lint-markdownYukihiro "Matz" Matsumoto
Enable markdownlint rules MD003,MD005,MD007
2021-06-22Merge pull request #5489 from jbampton/pre-commit-autoupdateYukihiro "Matz" Matsumoto
pre-commit autoupdate
2021-06-22pre-commit autoupdateJohn Bampton
https://pre-commit.com/#pre-commit-autoupdate
2021-06-22Enable markdownlint rules MD003,MD005,MD007John Bampton
Lint Markdown https://github.com/DavidAnson/markdownlint#rules--aliases
2021-06-21numeric.c: add optional `ndigits` argument to rounding methods.Yukihiro "Matz" Matsumoto
- `truncate` - `floor` - `ceil` `round` already takes `ndigits`.
2021-06-21Merge pull request #5486 from dearblue/alloc-castfreeYukihiro "Matz" Matsumoto
Added `MRB_OBJ_ALLOC()` macro that does not require a cast
2021-06-20Use `MRB_VTYPE_FOREACH()` in `src/object.c`dearblue
2021-06-20Added `MRB_OBJ_ALLOC()` macro that does not require a castdearblue
The `MRB_OBJ_ALLOC()` macro function returns a pointer of the type corresponding to the constant literal defined in `enum mrb_vtype`.
2021-06-19Merge branch 'dearblue-block_given'Yukihiro "Matz" Matsumoto
2021-06-19codegen.c: stop `uninitialized` warning.Yukihiro "Matz" Matsumoto
2021-06-19Added `MRB_API` function to get block arguments info.dearblue
- ` mrb_block_given_p()` -- The name comes from CRuby's `rb_block_given_p ()` At the same time, it applies to `f_instance_eval()` and `f_class_eval()` of `mruby-eval`.
2021-06-19Merge pull request #5484 from jbampton/enable-markdownlint-ruleYukihiro "Matz" Matsumoto
Enable markdownlint rule MD046 code-block-style
2021-06-19Enable markdownlint rule MD046 code-block-styleJohn Bampton
Fix C Markdown code block style
2021-06-18Merge pull request #5434 from jbampton/add-markdownlint-rules-as-commentsYukihiro "Matz" Matsumoto
Add the rules to the markdownlint config file as comments
2021-06-18Merge pull request #5483 from ↵Yukihiro "Matz" Matsumoto
mruby/dependabot/github_actions/actions/upload-artifact-2.2.4 build(deps): bump actions/upload-artifact from 2.2.3 to 2.2.4
2021-06-17build(deps): bump actions/upload-artifact from 2.2.3 to 2.2.4dependabot[bot]
Bumps [actions/upload-artifact](https://github.com/actions/upload-artifact) from 2.2.3 to 2.2.4. - [Release notes](https://github.com/actions/upload-artifact/releases) - [Commits](https://github.com/actions/upload-artifact/compare/v2.2.3...v2.2.4) --- updated-dependencies: - dependency-name: actions/upload-artifact dependency-type: direct:production update-type: version-update:semver-patch ... Signed-off-by: dependabot[bot] <[email protected]>
2021-06-17variable.c: add `skip` argument to skip `base` class in lookup.Yukihiro "Matz" Matsumoto
`mrb_vm_const_get` function looks up the constant first in the base class, so that fallback `const_get` need not to search from the base.
2021-06-17variable.c: refactor `mrb_vm_const_get` function.Yukihiro "Matz" Matsumoto
2021-06-17variable.c: skip prepended module for constant lookup.Yukihiro "Matz" Matsumoto
```ruby module M FOO = 'm' end class A FOO = 'a' prepend M end class B < A def foo p FOO end end B.new.foo # should print `m` not `a` ```
2021-06-17class.c: use `MRB_FLAG_TEST()` macro.Yukihiro "Matz" Matsumoto
2021-06-17Merge pull request #5480 from jbampton/add-more-pre-commit-hooksYukihiro "Matz" Matsumoto
Add two more pre-commit hooks
2021-06-17Merge pull request #5482 from jbampton/standardize-backtick-commandsYukihiro "Matz" Matsumoto
Standardize commands inside backticks
2021-06-17Standardize commands inside backticksJohn Bampton
Remove whitespace