Skip to content

don't call vivifier macros Perl_error_log/Perl_debug_log in a loop #23356

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 1 commit into
base: blead
Choose a base branch
from

Conversation

bulk88
Copy link
Contributor

@bulk88 bulk88 commented Jun 5, 2025

  • macros Perl_error_log/Perl_debug_log internally call exported function PerlIO_stderr(my_perl) which may or may not call Newxz() or calloc(). A naive person would think these macros are PL_something my_perl->Isomething vars or they are C image globals vars. These 2 macros are not simple data var derefs, but are in fact vivifing function calls. Probably 20-30 years, before PerlIO was invented, I will guess Perl_error_log/Perl_debug_log where just "#define Perl_error_log 2".
  • Fix this by caching the PerlIO * ptrs to C autos.
  • Why the PerlIO API is NULL ptr, and why these vivifier function calls need to be called everywhere in all of core, at all PL_phases of execution, is beyond the scope of this commit.

  • This set of changes does not require a perldelta entry.

- macros Perl_error_log/Perl_debug_log internally call exported
  function PerlIO_stderr(my_perl) which may or may not call Newxz() or
  calloc(). A naive person would think these macros are PL_something
  my_perl->Isomething vars or they are C image globals vars. These 2 macros
  are not simple data var derefs, but are in fact vivifing function calls.
  Probably 20-30 years, before PerlIO was invented, I will guess
  Perl_error_log/Perl_debug_log where just "#define  Perl_error_log  2".
- Fix this by caching the PerlIO * ptrs to C autos.
- Why the PerlIO API is NULL ptr, and why these vivifier function calls
  need to be called everywhere in all of core, at all PL_phases of
  execution, is beyond the scope of this commit.
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.

1 participant