From: Nicholas Clark Date: Fri, 4 Nov 2005 14:47:49 +0000 (+0000) Subject: Merge msgsnd, msgrcv with Perl_pp_shmwrite(). X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=commitdiff_plain;h=c9f7ac20cc60b6edea0f8aa7d2d3184bb6978820;p=p5sagit%2Fp5-mst-13.2.git Merge msgsnd, msgrcv with Perl_pp_shmwrite(). "Perfection is achieved not when there's nothing more to add, but when there's nothing left to remove" (Antoine de Saint-Exupéry) p4raw-id: //depot/perl@25990 --- diff --git a/mathoms.c b/mathoms.c index 9ec80e0..bc355e9 100644 --- a/mathoms.c +++ b/mathoms.c @@ -971,6 +971,16 @@ PP(pp_fteexec) return pp_ftrread(); } +PP(pp_msgsnd) +{ + return pp_shmwrite(); +} + +PP(pp_msgrcv) +{ + return pp_shmwrite(); +} + U8 * Perl_uvuni_to_utf8(pTHX_ U8 *d, UV uv) { diff --git a/opcode.h b/opcode.h index e38508e..bd53d0c 100644 --- a/opcode.h +++ b/opcode.h @@ -1070,8 +1070,8 @@ EXT Perl_ppaddr_t PL_ppaddr[] /* or perlvars.h */ MEMBER_TO_FPTR(Perl_pp_shmwrite), MEMBER_TO_FPTR(Perl_pp_semget), /* Perl_pp_msgget */ MEMBER_TO_FPTR(Perl_pp_semctl), /* Perl_pp_msgctl */ - MEMBER_TO_FPTR(Perl_pp_msgsnd), - MEMBER_TO_FPTR(Perl_pp_msgrcv), + MEMBER_TO_FPTR(Perl_pp_shmwrite), /* Perl_pp_msgsnd */ + MEMBER_TO_FPTR(Perl_pp_shmwrite), /* Perl_pp_msgrcv */ MEMBER_TO_FPTR(Perl_pp_semget), MEMBER_TO_FPTR(Perl_pp_semctl), MEMBER_TO_FPTR(Perl_pp_semop), diff --git a/opcode.pl b/opcode.pl index 27f1de9..5b4cd00 100755 --- a/opcode.pl +++ b/opcode.pl @@ -72,6 +72,7 @@ my @raw_alias = ( Perl_pp_link => ['symlink'], Perl_pp_ftrread => [qw(ftrwrite ftrexec fteread ftewrite fteexec)], + Perl_pp_shmwrite => [qw(msgsnd msgrcv)], ); while (my ($func, $names) = splice @raw_alias, 0, 2) { diff --git a/pp_sys.c b/pp_sys.c index 9b08cac..1f10882 100644 --- a/pp_sys.c +++ b/pp_sys.c @@ -4430,40 +4430,27 @@ PP(pp_sleep) } /* Shared memory. */ +/* Merged with some message passing. */ PP(pp_shmwrite) { #if defined(HAS_MSG) || defined(HAS_SEM) || defined(HAS_SHM) dSP; dMARK; dTARGET; - I32 value = (I32)(do_shmio(PL_op->op_type, MARK, SP) >= 0); - SP = MARK; - PUSHi(value); - RETURN; -#else - return pp_semget(); -#endif -} - -/* Message passing. */ + const int op_type = PL_op->op_type; + I32 value; -PP(pp_msgsnd) -{ -#if defined(HAS_MSG) || defined(HAS_SEM) || defined(HAS_SHM) - dSP; dMARK; dTARGET; - I32 value = (I32)(do_msgsnd(MARK, SP) >= 0); - SP = MARK; - PUSHi(value); - RETURN; -#else - return pp_semget(); -#endif -} + switch (op_type) { + case OP_MSGSND: + value = (I32)(do_msgsnd(MARK, SP) >= 0); + break; + case OP_MSGRCV: + value = (I32)(do_msgrcv(MARK, SP) >= 0); + break; + default: + value = (I32)(do_shmio(op_type, MARK, SP) >= 0); + break; + } -PP(pp_msgrcv) -{ -#if defined(HAS_MSG) || defined(HAS_SEM) || defined(HAS_SHM) - dSP; dMARK; dTARGET; - I32 value = (I32)(do_msgrcv(MARK, SP) >= 0); SP = MARK; PUSHi(value); RETURN;