Skip to content

factor out 3 high usage COND_*() API croak() messages on Win32 #23344

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 May 31, 2025

  • high usage in perl5xx.dll and because these are macros, high usage in both P5P/.git and CPAN XS .dll of a certain category.
  • pthreads variants of COND_*(), have error messages that are too long and too detailed for me to think its worth it in this commit. They pass a minimum of 2 arguments best case scenario, __ FILE ___ and __ LINE __. In addition, it isn't my native OS. Changing the pthread variants is best for another day.
  • C sym names are spelled as short as possible to not waste space in each .dll file's Import table. Embedding C literal "COND_WAIT" in each XS .dll vs importing const global data var "PL_COND_WAIT" through the PE symbol table, for such a short string, starts to have a trade off debate. See PR associated with this commit for details & rejected optimizations.

"COND_WAIT"10+6_pading_to_eight+7_load_eff_addr_PIC_U32+5_call_fn_PIC_U32

is very close in size to

"Perl_die_cwait"15+4_PIC_RVA+4_PIC_RVA+5_call_PIC_U32

but

5_call_PIC_U32 x 5 call_sites_per_dll

is smaller vs

(7_load_eff_addr_PIC_U32 + 5_call_fn_PIC_U32 ) x 5 call_sites_per_dll

I also considered a PL_die_cond[3] array of 3 function pointers for a short time, but IIRC some permutation of (MSVC || GCC || Both) && (C89_C99 || C++ || Both) prohibits declspec noreturn or attribute noreturn on a function pointer [data] type. No return vtable methods are plain illegal or longer version "this TC ballot proposal was already rejected 10x, you are now rejected" [that dev is an idiot].

Even if I know how to get MSVC or GCC to break its own C/C++ grammar and machine code generate rules, to truly eliminate the stack cleanup epilog after each no return function pointer call. That war crime I did doesn't look like best-in-class production quality C code, so I'm not putting what I did in a PR intended for widespread use FOSS SW.


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

- high usage in perl5xx.dll and because these are macros, high usage in
  both P5P/.git and CPAN XS .dll of a certain category.
- pthreads variants of COND_*(), have error messages that are too long
  and too detailed for me to think its worth it in this commit. They pass
  a minimum of 2 arguments best case scenario, __FILE__ and __LINE__.
  In addition, it isn't my native OS. Changing the pthread variants is
  best for another day.
- C sym names are spelled as short as possible to not waste space in each
  .dll file's Import table. Embedding C literal "COND_WAIT" in each XS .dll
  vs importing const global data var "PL_COND_WAIT" through the PE symbol
  table, for such a short string, starts to have a trade off debate.
  See PR associated with this commit for details & rejected optimizations.
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