1827 Commits

Author SHA1 Message Date
mimaki a2841fd9a8 Update version to 3.4.0RC. 2025-03-10 14:42:59 +09:00
Yukihiro "Matz" Matsumoto fb56fecf51 class.h: remove macros no longer used 2025-03-07 17:17:50 +09:00
Yukihiro "Matz" Matsumoto 889f09f8b7 class.c: move visibility flags from classes/modules to callinfo 2025-03-07 17:17:50 +09:00
Yukihiro "Matz" Matsumoto 37fb59bdac class.h: rename macros for clarity
- MRB_SET_VISIBILITY -> MRB_CLASS_SET_VISIBILITY
- MRB_VISIBILITY -> MRB_CLASS_VISIBILITY
2025-03-07 17:17:49 +09:00
Yukihiro "Matz" Matsumoto 43da490a1e class.c: alias should keep the visibility of the original 2025-03-07 17:17:48 +09:00
Yukihiro "Matz" Matsumoto 6f2409adf3 Revert "proc.h: define visibility flags for RProc"
This reverts commit 7948373c7d2a019b0eed6ca6dfcb4d6e503b75d8.
2025-03-07 17:17:47 +09:00
Yukihiro "Matz" Matsumoto 29cb270ef4 proc.h: define visibility flags for RProc
Visibility status should be store in Procs (that represent scopes), not
classes. Since classes can be reopened or can be accessed recursively.
2025-03-07 17:17:46 +09:00
Yukihiro "Matz" Matsumoto ca20017ac9 class.c: implement mrb_define_private_method() 2025-03-07 17:17:36 +09:00
Yukihiro "Matz" Matsumoto fdf71d8f2d class.c: first step to private methods; #1835
Now each method entry holds visibility information in flag bits.
2025-03-07 17:17:34 +09:00
dearblue b86c220384 Avoid array object creation with “unknown keyword” error
It is sufficient to return the first element.
2025-02-02 21:02:03 +09:00
dearblue a981f5aed7 Add more const qualifier for RProc 2025-01-20 22:25:50 +09:00
Yukihiro "Matz" Matsumoto c18cd60c4b string.h: remove unused flag unset macros 2025-01-12 23:13:27 +09:00
Yukihiro "Matz" Matsumoto 0098654e1f string.h: rename MRB_STR_EMBED_LEN_BITS (use plurality for bit width) 2025-01-12 23:13:26 +09:00
Yukihiro "Matz" Matsumoto 8c184d4566 string.h: move flag definitions for readability 2025-01-12 23:13:26 +09:00
Yukihiro "Matz" Matsumoto e75654a991 string.h (RSTR_SET_TYPE): simplify macro definition 2025-01-12 23:13:26 +09:00
Yukihiro "Matz" Matsumoto 8276143f03 object.h: remove MRB_SET_FROZEN_FLAG/MRB_UNSET_FROZEN_FLAG macros
Simple `o->frozen = 1/0` now works.
2025-01-07 13:56:30 +09:00
Yukihiro "Matz" Matsumoto c11d18e426 object.h: unify MRB_FROZEN_P() and mrb_frozen_p() 2025-01-07 11:24:58 +09:00
Yukihiro "Matz" Matsumoto 21003746df object.h: separate frozen flag to the independent bit-field
So that other flag operation do not break frozen flag.
2025-01-07 07:44:10 +09:00
Yukihiro "Matz" Matsumoto 6f8bfed18e object.h: change gccolor type to unsigned int
I was uncomfortable with the combination of an integer with a size
specification (uint32_t) and a bit field.
2025-01-06 13:56:58 +09:00
Yukihiro "Matz" Matsumoto 0e79f6b34b include/object.h: rename color to gccolor
To clarify the color is for garbage collection.
2025-01-03 19:12:40 +09:00
Yukihiro "Matz" Matsumoto 4582cc8579 string.c: rename type setting macro 2025-01-03 09:29:43 +09:00
Yukihiro "Matz" Matsumoto b0127f0cdd mruby-string-ext (str_b): add a new method String#b
The method makes the receiver binary-mode, but in mruby, which is
virtually no meaning.
2025-01-02 18:45:50 +09:00
Yukihiro "Matz" Matsumoto 59d1fcfa02 include/proc/h: add 2 new constants for the future 2024-12-29 18:04:40 +09:00
Yukihiro "Matz" Matsumoto d13e6ff8c9 include/presym.h: MRB_GVSYM() for global variables is now available 2024-12-14 16:03:35 +09:00
Yukihiro "Matz" Matsumoto 77e08c9193 ops.h: rename OP_LOADI to OP_LOADI8
OP_LOADI stores an 8 bit integer to a register, so we renamed the
instruction name to describe the behavior more precisely, like
OP_LOADI16 and OP_LOADI32.
2024-12-01 19:16:54 +09:00
Yukihiro "Matz" Matsumoto e05dbf7bbc mruby-compiler (mrb_irep_remove_lv): remove the function altogether
Recent changes make mrb_irep_remove_lv() used no longer.  Removing this
function would not make any compatibility issue, since it's an internal
function.
2024-11-29 17:09:44 +09:00
Yukihiro "Matz" Matsumoto bd5ece3a26 dump.h: remove obsolete flag DUMP_DEBUG_INFO 2024-11-29 07:39:26 +09:00
Yukihiro "Matz" Matsumoto 4751e385c3 dump.h: add new dump flag MRB_DUMP_NO_LVAR 2024-11-29 07:38:47 +09:00
Yukihiro "Matz" Matsumoto 16ae9e6ed9 Merge pull request #6397 from wataash/boxno-set-value 2024-11-01 11:11:39 +09:00
Wataru Ashihara b1d299f88b boxing_no.h: rename BOXNIX_SET_VALUE -> BOXNO_SET_VALUE
boxing_nix.h was renamed to boxing_no.h on
https://github.com/mruby/mruby/commit/df4c298e3b280b11add8502f1602cefc246655dd
2024-10-31 16:01:05 +09:00
Yukihiro "Matz" Matsumoto 49525fa207 mempool.c: renamed from pool.c
To avoid confusion with pools in irep, we renamed region-based memory
manager from pool to mempool.

- rename pool.c to mempool.c
- separate mempool.h
- rename all mrb_pool to mrb_mempool

So if someone is using pool.c functions (I suppose no one does though),
they need to rename all `mrb_pool` to `mrb_mempool` and include
`mruby/mempool.h` header at the top.
2024-10-31 14:06:10 +09:00
Yukihiro "Matz" Matsumoto 62ef5db13e irep.h: rename mrb_pool_value to mrb_irep_pool
mrb_pool_value is a structure that represents a value in the irep
literal pool and is unrelated to mrb_pool, which performs region-based
memory management. It has been renamed mrb_irep_pool to avoid confusion.
2024-10-29 20:34:53 +09:00
Yukihiro "Matz" Matsumoto 2436b32f1f irep.h: reformat comments 2024-10-29 20:34:52 +09:00
dearblue f9151e0bd9 Fixed argument forwarding in instance_exec
However, on C, there is no easy way to pass keyword arguments.
Therefore, when called `Kernel#instance_exec` on C, keyword arguments are converted to positional arguments.
This is a limitation of current mruby.

fixed #6389
2024-10-24 21:20:46 +09:00
siery 1a426e245f part 2: Fix indentation to include break after function return type 2024-10-17 22:26:20 +02:00
siery 7d694df717 Fix indentation to include break after function return type 2024-10-17 21:11:11 +02:00
Yukihiro "Matz" Matsumoto fa68e634a7 variable.c (mrb_exc_const_get): E_XXX_ERROR should not call const_missing
As #6359 pointed out, calling const_missing hook from E_XXX_ERROR (that
calls mrb_exc_get_id()) can be an attack vector.  Since E_XXX_ERROR is
supposed to be a defined error class, we think that the situation where
it is undefined and the const_missing hook is called should be detected
as an error; fix #6359
2024-10-15 21:09:48 +09:00
siery c8203b2d52 Fix typo 2024-10-11 05:08:46 +02:00
Yukihiro "Matz" Matsumoto d6fa7772a0 mruby.h (mrb_method_t): avoid unnamed union
It caused errors in the pedantic-mode of GCC.
2024-09-26 00:07:03 +09:00
John Bampton e12da35645 Fix spelling 2024-09-24 00:14:24 +10:00
dearblue 1f933c21e3 Revert "Perform pseudo binary search with mrb_type()"
This reverts commit e76bebe836 (#6309).

Because it crashes limited to gcc13 -O3.
ref. #6358.

Also, benchmark tests have shown that revert tends to be preferable in this time.
2024-09-22 10:51:12 +09:00
Yukihiro "Matz" Matsumoto bdbf8536a7 mruby-bigint: rename add_d and sub_d to add_n and sub_n respectively
`_n` suffix represents `no_normalize`.
2024-09-15 03:02:41 +09:00
Yukihiro "Matz" Matsumoto 704ad87150 Merge pull request #6338 from dearblue/proc-align 2024-09-12 06:43:42 +09:00
dearblue 8b495cdfda Cancel the warning disablement
Suppress warnings for 0-length sequences is not required.

By commit f1a02dff58, it was introduced.
By commit 24939723d7, pseudo-variable length arrays are now used and the warning suppression is no longer needed.
By commit e8841fbf58, moved the intervening code.
2024-09-10 21:07:43 +09:00
dearblue 42513d61fd Need to place static proc objects into 8-byte alignments
Static proc objects defined as methods may be placed in 4-byte alignments in 32-bit environments.
This may be misinterpreted as an immediate value depending on the address.

Since C11 and C++11 have additional language features for byte alignment, corresponding compilers use them to define the `mrb_alignas()` macro.
For earlier compilers, they use their own extensions to define the `mrb_alignas()` macro.

GCC supports `__attribute__((aligned(alignment)))` since at least version 2.95.3 (1999).
https://gcc.gnu.org/onlinedocs/gcc-2.95.3/gcc_4.html#IDX305
According to GPT-4, support was added in version 2.7 (1995).

It is not known which version of Visual C++ added support for `__declspec(align(n))`.
According to GPT-4, at least Visual C++ 6.0 (1998) seems to support it.
Also, the documentation of past Intel C/C++ compilers that support `__declspec(align(n))` makes reference to support with Visual C++ 4.2 (1996).
https://www.intel.com/content/dam/www/public/ijkk/jp/ja/documents/developer/ccomp40j.pdf
2024-09-01 20:28:34 +09:00
Yukihiro "Matz" Matsumoto 44908e5cba mruby-rational: support bigint numerators & denominators 2024-08-16 15:12:03 +09:00
Hoshiumi Arata da54da1923 Fix mrb_ro_data_p on Intel Mac 2024-08-13 17:27:08 +09:00
dearblue e76bebe836 Perform pseudo binary search with mrb_type() 2024-07-21 21:58:18 +09:00
Yukihiro "Matz" Matsumoto fcab7ef377 numeric.c (int_div): fixed a bug regarding bigint / non-integer
Non-integer means Complex or Rational.
2024-07-15 21:35:42 +09:00
dearblue ad576f1e75 Revert "Delegate the care of a directly given block from cipop() to cipush()"
This reverts commit ad2e626e7a.

Because of the changes made by #6282, the following code caused a problem.

```ruby
b = proc { break "BAD!" }
p self.tap { b.call }
# (expected)    => break from proc-closure (LocalJumpError)
# (after #6282) => "BAD!"
```

I revived the `mrb_callinfo::blk` field to fix this, but it did not overcome the following problem.

```ruby
def m(&b); b = b.clone; GC.start; b.call; end
p m { break "OK!" }
# (expected)    => "OK!"
# (revived blk) => break from proc-closure (LocalJumpError)
```
2024-06-30 21:01:45 +09:00