Project

General

Profile

Feature #19474

Updated by eightbitraptor (Matthew Valentine-House) about 1 year ago

[Github PR](https://github.com/ruby/ruby/pull/7393) 

 Since the introduction of variable width allocation with `RVARGC` there are a lot of different `*NEWOBJ*` macros. Currently there are: 
 

 * `RB_RVARGC_NEWOBJ_OF` 
 * `RB_RVARGC_EC_NEWOBJ_OF` 
 * `RB_NEWOBJ_OF`, an alias of `RB_RVARGC_NEWOBJ_OF` 
 * `RB_EC_NEWOBJ_OF`, an alias of `RB_RVARGC_EC_NEWOBJ_OF` 
 * `NEWOBJ_OF`, an alias of `RB_RVARGC_NEWOBJ_OF` 
 * `RVARGC_NEWOBJ_OF`, an alias of `RB_RVARGC_NEWOBJ_OF` 

 This PR merges `RB_RVARGC_NEWOBJ_OF`,`RB_RVARGC_EC_NEWOBJ_OF`, `RVARGC_NEWOBJ_OF`, `RB_NEWOBJ_OF` `RB_RVARGC_NEWOBJ_OF` and `NEWOBJ_OF` `RB_RVARGC_EC_NEWOBJ_OF` into a single macro that takes an execution context the `ec` as an argument (which can be `NULL`; if so then the current execution context is found and used using `GET_EC()`).  

 `NULL`). The resulting single macro has been named `NEWOBJ_OF` renamed to reflect that it should now be `RVARGC_NEWOBJ_OF` as the only way of creating new objects. existing `RVARGC_NEWOBJ_OF` was an alias for `RB_RVARGC_NEWOBJ_OF`. 

 Both `RB_NEWOBJ_OF`, `RB_EC_NEWOBJ_OF` have been removed, as these were just aliases for `RB_RVARGC_NEWOBJ_OF`. 

 `RB_NEWOBJ_OF` and `NEWOBJ_OF` have seperate implementations that been retained as these are part of the public API exposed in `include/ruby/internal/newobj.h` so they are available to extension authors. These have not been modified in any way.

Back