Make die() always expand to Perl_die_nocontext()

See 03f24b8a082948e5b437394fa33d0af08d7b80b6 for the motivation.

This commit changes plain die() to not use a thread context parameter.
It and die_nocontext() now behave identically.
This commit is contained in:
Karl Williamson 2025-09-12 14:58:37 -06:00 committed by Karl Williamson
parent e6d5a81fed
commit c14d142701
6 changed files with 10 additions and 13 deletions

View File

@ -87,7 +87,6 @@ my $item_flags_re = qr/[dD fF mM nN oO pT uU Wx;]/xx;
# This is a copy of the list in regen/embed.pl. # This is a copy of the list in regen/embed.pl.
my @have_compatibility_macros = qw( my @have_compatibility_macros = qw(
deb deb
die
form form
load_module load_module
mess mess

View File

@ -1029,7 +1029,7 @@ ETXdp |char * |delimcpy_no_escape \
|const int delim \ |const int delim \
|NN I32 *retlen |NN I32 *retlen
Cp |void |despatch_signals Cp |void |despatch_signals
Adfpr |OP * |die |NULLOK const char *pat \ AMdfpr |OP * |die |NULLOK const char *pat \
|... |...
Adpr |OP * |die_sv |NN SV *baseex Adpr |OP * |die_sv |NN SV *baseex
: Used in util.c : Used in util.c

View File

@ -30,7 +30,6 @@
#if !defined(MULTIPLICITY) #if !defined(MULTIPLICITY)
/* undefined symbols, point them back at the usual ones */ /* undefined symbols, point them back at the usual ones */
# define Perl_deb_nocontext Perl_deb # define Perl_deb_nocontext Perl_deb
# define Perl_die_nocontext Perl_die
# define Perl_form_nocontext Perl_form # define Perl_form_nocontext Perl_form
# define Perl_load_module_nocontext Perl_load_module # define Perl_load_module_nocontext Perl_load_module
# define Perl_mess_nocontext Perl_mess # define Perl_mess_nocontext Perl_mess
@ -78,7 +77,6 @@
# if defined(MULTIPLICITY) && !defined(PERL_NO_SHORT_NAMES) && \ # if defined(MULTIPLICITY) && !defined(PERL_NO_SHORT_NAMES) && \
!defined(PERL_WANT_VARARGS) !defined(PERL_WANT_VARARGS)
# define deb Perl_deb_nocontext # define deb Perl_deb_nocontext
# define die Perl_die_nocontext
# define form Perl_form_nocontext # define form Perl_form_nocontext
# define load_module Perl_load_module_nocontext # define load_module Perl_load_module_nocontext
# define mess Perl_mess_nocontext # define mess Perl_mess_nocontext
@ -914,7 +912,6 @@
# if !defined(MULTIPLICITY) || defined(PERL_CORE) || \ # if !defined(MULTIPLICITY) || defined(PERL_CORE) || \
defined(PERL_WANT_VARARGS) defined(PERL_WANT_VARARGS)
# define deb(...) Perl_deb(aTHX_ __VA_ARGS__) # define deb(...) Perl_deb(aTHX_ __VA_ARGS__)
# define die(...) Perl_die(aTHX_ __VA_ARGS__)
# define form(...) Perl_form(aTHX_ __VA_ARGS__) # define form(...) Perl_form(aTHX_ __VA_ARGS__)
# define load_module(a,b,...) Perl_load_module(aTHX_ a,b,__VA_ARGS__) # define load_module(a,b,...) Perl_load_module(aTHX_ a,b,__VA_ARGS__)
# define mess(...) Perl_mess(aTHX_ __VA_ARGS__) # define mess(...) Perl_mess(aTHX_ __VA_ARGS__)

View File

@ -42,7 +42,6 @@ BEGIN {
# to never happen, so not worth coding automatic synchronization. # to never happen, so not worth coding automatic synchronization.
my @have_compatibility_macros = qw( my @have_compatibility_macros = qw(
deb deb
die
form form
load_module load_module
mess mess

6
util.c
View File

@ -1787,9 +1787,9 @@ These behave the same as L</croak>, except for the return type.
They should be used only where the C<OP *> return type is required. They should be used only where the C<OP *> return type is required.
They never actually return. They never actually return.
The two forms differ only in that C<die_nocontext> does not take a thread The reasons for the existence of C<die_nocontext> are no longer applicable.
context (C<aTHX>) parameter, so is used in situations where the caller doesn't die() can now be used in all circumstances. C<Perl_die_nocontext> might be
already have the thread context. useful when compiling with C<PERL_NO_SHORT_NAMES>.
=cut =cut
*/ */

10
util.h
View File

@ -11,14 +11,16 @@
#ifndef PERL_UTIL_H_ #ifndef PERL_UTIL_H_
#define PERL_UTIL_H_ #define PERL_UTIL_H_
/* Calling Perl_croak_nocontext instead of plain Perl_croak is one less /* Calling Perl_(croak|die)_nocontext instead of plain Perl_(croak|die) is one
* argument to pass under threads, so each instance takes up fewer bytes (but * less argument to pass under threads, so each instance takes up fewer bytes
* the nocontext function has to derive the thread context itself, taking more * (but the nocontext function has to derive the thread context itself, taking
* time). We trade time for less space here, because time is rarely a * more time). We trade time for less space here, because time is rarely a
* critical resource when you are about to throw an exception. */ * critical resource when you are about to throw an exception. */
#define croak(...) Perl_croak_nocontext(__VA_ARGS__) #define croak(...) Perl_croak_nocontext(__VA_ARGS__)
#define die(...) Perl_die_nocontext(__VA_ARGS__)
#ifndef MULTIPLICITY #ifndef MULTIPLICITY
# define Perl_croak_nocontext Perl_croak # define Perl_croak_nocontext Perl_croak
# define Perl_die_nocontext Perl_die
#endif #endif
#ifdef VMS #ifdef VMS