| Age | Commit message (Collapse) | Author |
|
|
|
To unify the style of messages.
|
|
|
|
|
|
This is an experimental changes in Ruby 2.7.
|
|
For efficiency with `MRB_WORD_BOXING` (implement type predicate macros for
all `enum mrb_vtype`).
|
|
|
|
The binary sizes (gems are only `mruby-bin-mruby`) are reduced slightly in
my environment than before the introduction of new specifiers/modifiers
(5116789a) with this change.
------------+-------------------+-------------------+--------
BINARY | BEFORE (5116789a) | AFTER (This PR) | RATIO
------------+-------------------+-------------------+--------
mruby | 593416 bytes | 593208 bytes | -0.04%
libmruby.a | 769048 bytes | 767264 bytes | -0.23%
------------+-------------------+-------------------+--------
BTW, I accidentally changed `tasks/toolchains/visualcpp.rake` at #4613,
so I put it back.
|
|
Before this patch:
$ bin/mruby -e 'p Module.new.freeze.dup.frozen?' #=> true
After this patch (same as Ruby):
$ bin/mruby -e 'p Module.new.freeze.dup.frozen?' #=> false
|
|
This method is defined in `mruby-metaprog` gem.
|
|
|
|
Before this patch:
p (class << Object.new.freeze; self end).frozen? #=> false
sc = class << (o=Object.new); self end; o.freeze; p sc.frozen? #=> false
After this patch / Ruby:
p (class << Object.new.freeze; self end).frozen? #=> true
sc = class << (o=Object.new); self end; o.freeze; p sc.frozen? #=> true
|
|
|
|
Functions to add prototypes to headers:
* mrb_ary_splice()
* mrb_notimplement()
* mrb_vformat()
* mrb_cstr_to_dbl()
* mrb_cstr_to_inum()
Functions to be made `static` (`MRB_API` was not needed):
* mrb_mod_module_function()
* mrb_obj_hash()
* mrb_str_len_to_inum()
Functions to remove `MRB_API` from definitions (referenced from within `libmruby`):
* mrb_mod_cv_defined()
* mrb_mod_cv_get()
* mrb_f_send()
|
|
|
|
We have added internal convenience method `__to_str` which
does string type check.
The issue #3854 was fixed but fundamental flaw of lack of stack
depth check along with fibers still remains. Use `MRB_GC_FIXED_ARENA`
for workaround.
|
|
The ISO standard does not include implicit type conversion using
`to_int`. This implicit conversion often causes vulnerability.
There will be no more attacks like #4120.
In addition, we have added internal convenience method `__to_int` which
does type check and conversion (from floats).
|
|
But `BasicObject#__send__` is still available from the core.
|
|
|
|
We assume meta-programming is less used in embedded environments.
We have moved following methods:
* Kernel module
global_variables, local_variables, singleton_class,
instance_variables, instance_variables_defined?, instance_variable_get,
instance_variable_set, methods, private_methods, public_methods,
protected_methods, singleton_methods, define_singleton_methods
* Module class
class_variables, class_variables_defined?, class_variable_get,
class_variable_set, remove_class_variable, included_modules,
instance_methods, remove_method, method_removed, constants
* Module class methods
constants, nesting
Note:
Following meta-programming methods are kept in the core:
* Module class
alias_method, undef_method, ancestors, const_defined?, const_get,
const_set, remove_const, method_defined?, define_method
* Toplevel object
define_method
`mruby-metaprog` gem is linked by default (specified in default.gembox).
When it is removed, it will save 40KB (stripped:8KB) on x86-64
environment last time I measured.
|
|
`mrb_iv_p` -> `mrb_iv_name_sym_p`
`mrb_iv_check` -> `mrb_iv_name_sym_check`
|
|
Renamed flag macro names as well:
`MRB_FLAG_IS_FROZEN` -> `MRB_FL_OBJ_FROZEN`
`MRB_FLAG_IS_PREPENDED` -> `MRB_FL_CLASS_IS_PREPENDED`
`MRB_FLAG_IS_ORIGIN` -> `MRB_FL_CLASS_IS_ORIGIN`
`MRB_FLAG_IS_INHERITED` -> `MRB_FL_CLASS_IS_INHERITED`
|
|
|
|
|
|
Copying all flags from the original object may overwrite the clone's
flags e.g. the embedded flag.
|
|
|
|
Since `TT_ICLASS` is a internal object that should never be revealed
to Ruby world.
|
|
|
|
This information is not mandatory but causes a lot of problems in the
past due to infinite recursion by redefining `to_str`, `inspect` etc.
|
|
Now the method tables (in classes/modules and caches) keeps C function
pointers without wrapping in `struct RProc` objects. For the sake of
portability, `mrb_method_t` is represented by the struct and union, but
if the most significant bit of the pointer is not used by the platform,
`mrb_method_t` should be packed in `uintptr_t` to reduce memory usage.
`MRB_METHOD_TABLE_INLINE` is turned on by default for linux.
|
|
pandax381-mrb_without_float
|
|
Make `block_given?` to search for the top of the scope first.
The top of the scope means either:
* the top method body
* the enclosing class body
* the top-level
The special case is the method defined by `define_method` with a
block as in #3841. In cases like this, the method body (given by
a block) is not considered as the top of the scope. You need to use
`&block` in the block parameter if you want to know if a block is
given to the method.
This commit also changes the behavior of `MRB_PROC_SCOPE` flag.
Now it is only set if the `proc` is either a class body or a method
body defined in Ruby. It is no longer set for a block that given to
`define_method`.
|
|
When `block_given?` is called from a block given to `define_method`
as a method body, the `bidx` may not be within `env` saved closure.
In this case, it causes heap buffer overflow.
|
|
|
|
Instead of `irep` links, we added a `upper` link to `struct RProc`.
To make a space for the `upper` link, we moved `target_class` reference.
If a `Proc` does not have `env`, `target_class` is saved in an `union`
shared with `env` (if a `Proc` has env, you can tell it by `MRB_PROC_ENV_P()).
Otherwise `target_class` is referenced from `env->c`. We removed links
in `env` as well.
This change removes 2 members from `mrb_irep` struct, thus saving 2
words per method/proc/block. This also fixes potential memory leaks
due to the circular references caused by a link from `mrb_irep`.
|
|
|
|
'int', possible loss of data
|
|
Instead of `irep -> proc` chain, we use `irep -> irep` chain to
avoid GC bugs like #3804. We added `target_class` reference to
`mrb_irep` struct. That means one more word consumption per `irep`.
|
|
|
|
|
|
|
|
|
|
|
|
Instead of preserving a backtrace in `mrb_state`, `mrb_exc_set`
keeps packed backtrace in an exception object. `#backtrace` unpacks
it to an array of strings.
|
|
|
|
|
|
|
|
|
|
Note this is a temporary fix. Error message generation
(including `inspect`) should be deferred until its use.
|
|
The change may reduce flexibility, but I believe no one wants
that level of flexibility here.
|