summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorNicholas Clark <nick@ccl4.org>2005-11-04 14:47:49 +0000
committerNicholas Clark <nick@ccl4.org>2005-11-04 14:47:49 +0000
commitc9f7ac20cc60b6edea0f8aa7d2d3184bb6978820 (patch)
tree192e5997b0ec472368161087db4e52dab46cf8c2
parentc99a147504afe573a5d485f03e53fd1ac6939325 (diff)
downloadperl-c9f7ac20cc60b6edea0f8aa7d2d3184bb6978820.tar.gz
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
-rw-r--r--mathoms.c10
-rw-r--r--opcode.h4
-rwxr-xr-xopcode.pl1
-rw-r--r--pp_sys.c41
4 files changed, 27 insertions, 29 deletions
diff --git a/mathoms.c b/mathoms.c
index 9ec80e0fbf..bc355e9842 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 e38508ec80..bd53d0c026 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 27f1de9a8d..5b4cd00422 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 9b08cac328..1f10882ec2 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;