Skip to content

Refine SAVE and GUARD_OBJ macros - #358

Closed
nobu wants to merge 1 commit into
ruby:masterfrom
nobu:guard_obj
Closed

nobu wants to merge 1 commit into
ruby:masterfrom
nobu:guard_obj

Conversation

@nobu

@nobu nobu commented Jun 26, 2025

Copy link
Copy Markdown
Member

Get rid of risk of vStack overflow.
As a trade off:

  • the argument of SAVE must be a variable
  • multiple GUARD_OBJ cannot be placed at one line

Get rid of risk of `vStack` overflow.
As a trade off:
- the argument of `SAVE` must be a variable
- multiple `GUARD_OBJ` cannot be placed at one line
@tompng

tompng commented Jun 26, 2025

Copy link
Copy Markdown
Member

I'm planning to remove obj field from struct Real in #344.
This back pointer is the main reason why GUARD_OBJ is needed.

typedef struct {
    VALUE  obj;     /* Back pointer(VALUE) for Ruby object.   */
    size_t MaxPrec;
    size_t Prec;
    SIGNED_VALUE exponent;
    short  sign;
    short  flag;
    DECDIG frac[FLEXIBLE_ARRAY_SIZE];
} Real;

After #344, most GUARD_OBJ can be removed, and we only need few RB_GC_GUARD, I think.

@mrkn mrkn closed this Jul 19, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants