Commit Graph

11372 Commits

Author SHA1 Message Date
KOBAYASHI Shuji a3ec6ede76 Add y.tab.c to remove Bison from build dependencies; ref 4ce3997c
I sometimes see Bison related problems in setting up build environments.
Therefore to remove Bison from build time dependencies, add `y.tab.c`
generated by Bison to the repository.

The reduction of dependency at build time also reduces the labor and time
for setup and installation in CI.

In addition, a path in `#line` directive is converted to a relative path so
that its path is constant regardless of development environments.
2020-05-25 23:26:30 +09:00
Yukihiro "Matz" Matsumoto 6803ddb8e2 Use the newer bison on GitHub actions macOS; ref #4903
`Windows-MinGW` and `Windows-VC` also requires updates.
2020-05-24 23:12:27 +09:00
Takeshi Watanabe 4ce3997ca4 Start GitHub Actions; close #4903 2020-05-24 22:34:28 +09:00
Yukihiro "Matz" Matsumoto 93e78fcde1 Merge pull request #5006 from mame/fix-send-with-splat-args
Do not destruct rest arguments for __send__
2020-05-24 08:31:06 +09:00
Yusuke Endoh 6f4c585bd7 Do not destruct rest arguments for __send__
Formerly, `__send__(*args)` modified `args` with `Array#shift`.
This bug affects optcarrot.

This changeset avoids the array destruction by using
`args = args[1, len-1]`.
2020-05-24 01:25:03 +09:00
Yukihiro "Matz" Matsumoto 47ea60814b Merge pull request #5003 from shuujii/retry-rake--m-on-AppVeyor
Retry `rake -m` on AppVeyor [skip travis]
2020-05-20 13:49:10 +09:00
KOBAYASHI Shuji 86223b6eca Retry rake -m on AppVeyor [skip travis]
The following error occurs when using `rake -m` on AppVeyor:

  ```
  fatal error C1041: cannot open program database 'C:\projects\mruby\vc140.pdb'; if multiple CL.EXE write to the same .PDB file, please use /FS
  ```

Therefore, the issue is solved by not creating the PDB file. It is expected
to be somewhat faster by not generating debugging information (I don't think
debugging information is necessary for normal CI).
2020-05-20 13:32:23 +09:00
Yukihiro "Matz" Matsumoto d79147fe5d Revert "Use rake -m (multi-task) to appveyor.yml."
This reverts commit ac68c90800.
`rake -m` does not work for VisualC.
2020-05-19 22:42:19 +09:00
Yukihiro "Matz" Matsumoto ac68c90800 Use rake -m (multi-task) to appveyor.yml. 2020-05-19 17:37:17 +09:00
Yukihiro "Matz" Matsumoto 82194c01ca Merge pull request #5002 from RoryO/master
Adding warnings for mrb_load functions leaking RProc objects
2020-05-19 17:34:56 +09:00
Rory OConnell 69bc477b43 Adding warnings for mrb_load functions leaking RProc objects 2020-05-19 01:07:49 -07:00
Yukihiro "Matz" Matsumoto 3655d4e0f4 Merge pull request #5000 from shuujii/unify-eql-receiver-in-Hash-according-to-Ruby
Unify `eql?` receiver in `Hash` according to Ruby
2020-05-15 23:42:19 +09:00
KOBAYASHI Shuji bc929656fb Unify eql? receiver in Hash according to Ruby
### Example

  ```ruby
  # example.rb
  class A
    def eql?(o)
      p self.class
      super
    end
    def hash
      1
    end
  end

  class B < A; end

  h = {A.new => 1}
  h[B.new]
  ```

#### Before this patch:

  ```console
  $ bin/mruby example.rb
  A
  ```

#### After this patch (same as Ruby)

  ```console
  $ bin/mruby example.rb
  B
  ```
2020-05-15 21:17:24 +09:00
Yukihiro "Matz" Matsumoto 4aba93c969 Rename C function mrb_proc_lambda. 2020-05-15 15:55:35 +09:00
Yukihiro "Matz" Matsumoto 49d97d6051 Add pread/pwrite support on __MACH__ (MacOS) in addition to __unix__. 2020-05-15 12:31:18 +09:00
Yukihiro "Matz" Matsumoto 484577670f Remove YYERROR_VERBOSE which no longer supported since bison 3.6.
Instead we added `%define parse.error verbose`.
2020-05-15 12:30:13 +09:00
Yukihiro "Matz" Matsumoto d64c4d64e6 Make off_t handling simpler; #4872 #4939
The newer `clang` warns implicit float conversions.
2020-05-11 10:14:25 +09:00
Yukihiro "Matz" Matsumoto 846af371c0 Merge pull request #4998 from dearblue/special-vars
Get an irep symbol if it's `OP_GETSV` or `OP_SETSV`
2020-05-11 09:59:23 +09:00
Yukihiro "Matz" Matsumoto 38b4483f9d Merge pull request #4999 from dearblue/opcode-doc
Update `doc/opcode.md` [ci skip]
2020-05-11 09:58:11 +09:00
dearblue bb2512641f Update doc/opcode.md [ci skip]
The difference of `include/mruby/ops.h` is applied.

- OP_NOP - update semantics
- OP_GETSV - update semantics
- OP_SETSV - update semantics
- OP_GETUPVAR - update prefix
- OP_SETUPVAR - update prefix
- OP_JMPIF - update operands and semantics
- OP_JMPNOT - update operands and semantics
- OP_JMPNIL - add entry
- OP_ONERR - update semantics
- OP_POPERR - update prefix
- OP_EPOP - update prefix
- OP_SENDB - update semantics
- OP_ADD - update prefix and operands
- OP_ADDI - update operands and semantics
- OP_SUB - update prefix and operands
- OP_SUBI - update semantics
- OP_MUL - update prefix and operands
- OP_DIV - update prefix and operands
- OP_EQ - update prefix and operands
- OP_LT - update prefix and operands
- OP_LE - update prefix and operands
- OP_GT - update prefix and operands
- OP_GE - update prefix and operands
- OP_ARYDUP - add entry
- OP_INTERN - add entry
- OP_HASHCAT - add entry
- OP_ERR - update semantics
2020-05-10 20:34:10 +09:00
dearblue bd60ad98eb Get an irep symbol if it's OP_GETSV or OP_SETSV 2020-05-10 20:15:55 +09:00
Yukihiro "Matz" Matsumoto 7826af38ac Merge pull request #4997 from dearblue/byteorder
Remove byteorder constants; ref 87576b8
2020-05-09 23:01:02 +09:00
Yukihiro "Matz" Matsumoto 84d842ea5c Merge pull request #4996 from dearblue/loadi16
Fix boundary check for `OP_LOADI16`; ref fa8668c
2020-05-09 22:41:23 +09:00
dearblue f6c2662632 Remove byteorder constants; ref 87576b8
The `FLAG_BYTEORDER_NATIVE` and `FLAG_BYTEORDER_NONATIVE` are no longer
needed.
2020-05-09 22:30:05 +09:00
dearblue e2aecacaeb Fix boundary check for OP_LOADI16; ref fa8668c
It was making a negative integer if the highest-order bit of a 16-bit
integer was 1.

no patched:

```ruby
p 0x7fff  # => 32767
p 0x8000  # => -32768
p 0xffff  # => -1
p 0x10000 # => 65536
```
2020-05-09 21:12:31 +09:00
Yukihiro "Matz" Matsumoto 8cdf6a87ed Merge pull request #4995 from shuujii/fix-some-Hash-methods-are-inconsistent-with-values
Fix some `Hash` methods are inconsistent with `values`
2020-05-09 18:59:22 +09:00
KOBAYASHI Shuji 181f7b97d6 Fix some Hash methods are inconsistent with values
Inconsistent when hash has duplicate key.

### Example

  ```ruby
  # example.rb
  keys = (1..3).map{[_1]}
  h = keys.to_h{[_1, _1[0]]}
  keys[0][0] = 2
  p h.values
  p h.each_value.to_a
  p h
  ```

#### Before this patch:

  ```console
  $ bin/mruby example.rb
  [1, 2, 3]
  [1, 1, 3]
  {[2]=>1, [2]=>1, [3]=>3}
  ```

#### After this patch (same as Ruby)

  ```console
  $ bin/mruby example.rb
  [1, 2, 3]
  [1, 2, 3]
  {[2]=>1, [2]=>2, [3]=>3}
  ```
2020-05-09 15:27:42 +09:00
Yukihiro "Matz" Matsumoto 3491372a1d Update doc/opcode.md for operand signs. [ci skip] 2020-05-07 18:41:43 +09:00
Yukihiro "Matz" Matsumoto 03b0741994 Remove unnecessary sprintf test that fails since 91368c1. 2020-05-07 10:31:49 +09:00
Yukihiro "Matz" Matsumoto a87f0b158d Update README.md to address old bison problem on macOS. 2020-05-07 10:17:38 +09:00
Yukihiro "Matz" Matsumoto e82b8b7bf8 Update cmpnum document.
`cmpnum` function may return `nil` on error.
2020-05-07 08:38:46 +09:00
Yukihiro "Matz" Matsumoto 91368c117c Avoid mrb_funcall if MRB_UFT8_STRING is not set. 2020-05-07 08:38:46 +09:00
Yukihiro "Matz" Matsumoto 87576b819e Remove endian information/flags from compiled binary format.
Since `mruby 2.0`, compiled bytecode no longer depends on the
endian of the machine.
2020-05-07 08:38:46 +09:00
Yukihiro "Matz" Matsumoto 48c473a0c4 Remove -e/-E options from mrbc.
You don't have to specify endian since `mruby 2.0`.
2020-05-07 08:38:46 +09:00
Yukihiro "Matz" Matsumoto 87d77c13f5 Update compiled binary format version for OP_LOADI16. 2020-05-07 08:38:46 +09:00
Yukihiro "Matz" Matsumoto 4188219620 Update doc/opcode.md to reflect the latest bytecode.
- Add `OP_LOADI16`
- Update keyword argument related ops (e.g. OP_KEY_P, etc.)
- Fix some wrong descriptions
2020-05-07 08:38:46 +09:00
Yukihiro "Matz" Matsumoto fa8668c77d Add a new instruction OP_LOADI16.
Which loads 16bit integer to the register. The instruction number should
be reorder on massive instruction refactoring. The instruction is added
for `mruby/c` which had performance issue with `OP_EXT`. With this
instruction, `mruby/c` VM can just raise errors on `OP_EXT` extension
instructions.
2020-05-07 08:38:46 +09:00
Yukihiro "Matz" Matsumoto 47f5f887e8 Fix wrong line number before comment line; fix #4993 2020-05-07 08:38:46 +09:00
Yukihiro "Matz" Matsumoto c143d87e7c Remove mrb_run from MRB_API; #4488
`mrb_run` requires to push callinfo stack before calling, which is very
hard from outside of `vm.c`. So there should be virtually no correct
usage of the function, hence the cause of #4488. We removed it.

You can use `mrb_top_run(mrb, proc, self, 0)` instead of
`mrb_run(mrb, proc self)`.
2020-05-07 08:38:46 +09:00
Yukihiro "Matz" Matsumoto 2fcdd3f8eb Add assertion as originally intended; ref #4986 2020-05-07 08:38:46 +09:00
Yukihiro "Matz" Matsumoto 8c0dc55af8 Update doc/guides/compile.md to note the bison failure on Mac. 2020-05-07 08:38:46 +09:00
Yukihiro "Matz" Matsumoto 8c04379a4c Merge pull request #4990 from komainu8/enable-method-t-struct-on-32bit-linux
Enable MRB_METHOD_T_STRUCT by default on 32bit GUN/Linux
2020-05-05 22:57:40 +09:00
Horimoto Yasuhiro a5bfe548d7 Enable MRB_METHOD_T_STRUCT by default on 32bit GUN/Linux
Because we can't use the highest 2 bits of function pointers.
2020-05-04 15:34:16 +09:00
Yukihiro "Matz" Matsumoto 84aad39940 Merge pull request #4987 from shuujii/avoid-changing-directory-in-mruby-io-test
Avoid changing directory in `mruby-io` test
2020-04-30 17:13:11 +09:00
Yukihiro "Matz" Matsumoto c89ca5ebb8 Merge pull request #4988 from shuujii/refine-.travis.yml
Refine `.travis.yml`
2020-04-30 17:12:36 +09:00
KOBAYASHI Shuji 1a4b86233f Refine .travis.yml
* Disable automatic update and clean up on `brew install` (install time
  160 sec -> 5 sec).
* Avoid using deprecated keys.
2020-04-30 13:42:24 +09:00
Yukihiro "Matz" Matsumoto 69a487c407 Merge pull request #4984 from dearblue/break-to_s
Sorting the list of gems at build time by name
2020-04-30 08:38:33 +09:00
Yukihiro "Matz" Matsumoto f32c73ad1f Merge pull request #4986 from dearblue/assert-io
Avoid comparing pointers and integers
2020-04-29 18:34:40 +09:00
Yukihiro "Matz" Matsumoto a343439973 Merge pull request #4985 from dearblue/print-gems
Makes `mrb_any_to_s()` accept an object whose class is `NULL`
2020-04-29 18:34:03 +09:00
KOBAYASHI Shuji aeb86d953e Avoid changing directory in mruby-io test 2020-04-29 17:48:01 +09:00