------- Forwarded Message
Date: 02 Apr 2002 06:24:19 +0000
From: [EMAIL PROTECTED]
To: [EMAIL PROTECTED]
Subject: cvs commit: parrot/io io.c io_win32.c
cvsuser 02/04/01 22:24:19
Modified: . core.ops embed.c interpreter.c runops_cores.c
include/parrot interpreter.h
io io.c io_win32.c
Log:
Added macros for working with the interpreter->flags structure, following
the _SET/_CLEAR/_TEST convention from pdd07.
Changed all the things which were directly accessing ->flags to use these
macros instead. This gave me one place to put a hint comment to lclint,
which was complaining about bitwise operations on a non-unsigned variable
(apparently the enum type is signed by default). I've set it to ignore this
by adding a /*@i1*/ to the appropriate lines.
Revision Changes Path
1.117 +8 -8 parrot/core.ops
Index: core.ops
===================================================================
RCS file: /cvs/public/parrot/core.ops,v
retrieving revision 1.116
retrieving revision 1.117
diff -u -w -r1.116 -r1.117
--- core.ops 2 Apr 2002 03:54:27 -0000 1.116
+++ core.ops 2 Apr 2002 06:24:14 -0000 1.117
@@ -2063,8 +2063,8 @@
=cut
inline op debug(in INT) {
- if ($1 != 0) { interpreter->flags |= PARROT_DEBUG_FLAG; }
- else { interpreter->flags &= ~PARROT_DEBUG_FLAG; }
+ if ($1 != 0) { Interp_flags_SET(interpreter, PARROT_DEBUG_FLAG); }
+ else { Interp_flags_CLEAR(interpreter, PARROT_DEBUG_FLAG); }
restart NEXT();
}
@@ -2078,8 +2078,8 @@
=cut
inline op bounds(in INT) {
- if ($1 != 0) { interpreter->flags |= PARROT_BOUNDS_FLAG; }
- else { interpreter->flags &= ~PARROT_BOUNDS_FLAG; }
+ if ($1 != 0) { Interp_flags_SET(interpreter, PARROT_BOUNDS_FLAG); }
+ else { Interp_flags_CLEAR(interpreter, PARROT_BOUNDS_FLAG); }
restart NEXT();
}
@@ -2093,8 +2093,8 @@
=cut
inline op profile(in INT) {
- if ($1 != 0) { interpreter->flags |= PARROT_PROFILE_FLAG; }
- else { interpreter->flags &= ~PARROT_PROFILE_FLAG; }
+ if ($1 != 0) { Interp_flags_SET(interpreter, PARROT_PROFILE_FLAG); }
+ else { Interp_flags_CLEAR(interpreter, PARROT_PROFILE_FLAG); }
restart NEXT();
}
@@ -2108,8 +2108,8 @@
=cut
inline op trace(in INT) {
- if ($1 != 0) { interpreter->flags |= PARROT_TRACE_FLAG; }
- else { interpreter->flags &= ~PARROT_TRACE_FLAG; }
+ if ($1 != 0) { Interp_flags_SET(interpreter, PARROT_TRACE_FLAG); }
+ else { Interp_flags_CLEAR(interpreter, PARROT_TRACE_FLAG); }
restart NEXT();
}
1.19 +11 -10 parrot/embed.c
Index: embed.c
===================================================================
RCS file: /cvs/public/parrot/embed.c,v
retrieving revision 1.18
retrieving revision 1.19
diff -u -w -r1.18 -r1.19
--- embed.c 9 Mar 2002 00:59:56 -0000 1.18
+++ embed.c 2 Apr 2002 06:24:14 -0000 1.19
@@ -1,7 +1,7 @@
/* embed.c
* Copyright: (When this is determined...it will go here)
* CVS Info
- * $Id: embed.c,v 1.18 2002/03/09 00:59:56 josh Exp $
+ * $Id: embed.c,v 1.19 2002/04/02 06:24:14 josh Exp $
* Overview:
* The Parrot embedding interface.
* Data Structure and Algorithms:
@@ -41,7 +41,8 @@
Parrot_setflag(struct Parrot_Interp *interpreter, Parrot_flag flag,
Parrot_flag_val value)
{
- interpreter->flags |= flag;
+ if (value) Interp_flags_SET(interpreter, flag);
+ else Interp_flags_CLEAR(interpreter, flag);
}
void
@@ -166,29 +167,29 @@
INTVAL i;
PMC *userargv;
- if (interpreter->flags & PARROT_DEBUG_FLAG) {
+ if (Interp_flags_TEST(interpreter, PARROT_DEBUG_FLAG)) {
fprintf(stderr, "*** Parrot VM: Debugging enabled. ***\n");
- if (interpreter->flags & PARROT_BOUNDS_FLAG) {
+ if (Interp_flags_TEST(interpreter, PARROT_BOUNDS_FLAG)) {
fprintf(stderr, "*** Parrot VM: Bounds checking enabled. ***\n")
;
}
- if (interpreter->flags & PARROT_PREDEREF_FLAG) {
+ if (Interp_flags_TEST(interpreter, PARROT_PREDEREF_FLAG)) {
fprintf(stderr, "*** Parrot VM: Predereferencing enabled. ***\n"
);
}
- if (interpreter->flags & PARROT_JIT_FLAG) {
+ if (Interp_flags_TEST(interpreter, PARROT_JIT_FLAG)) {
fprintf(stderr, "*** Parrot VM: JIT enabled. ***\n");
}
}
#if !defined(JIT_CAPABLE) || !JIT_CAPABLE
- if (interpreter->flags & PARROT_JIT_FLAG) {
+ if (Interp_flags_TEST(interpreter, PARROT_JIT_FLAG)) {
fprintf(stderr,
"Parrot VM: Platform " JIT_ARCHNAME " is not JIT-capable.\n"
);
exit(1);
}
#endif
- if (interpreter->flags & PARROT_DEBUG_FLAG) {
+ if (Interp_flags_TEST(interpreter, PARROT_DEBUG_FLAG)) {
fprintf(stderr,
"*** Parrot VM: Setting up ARGV array in P0. Current argc:
%d ***\n",
argc);
@@ -197,7 +198,7 @@
userargv = pmc_new(interpreter, enum_class_PerlArray);
for (i = 0; i < argc; i++) {
- if (interpreter->flags & PARROT_DEBUG_FLAG) {
+ if (Interp_flags_TEST(interpreter, PARROT_DEBUG_FLAG)) {
fprintf(stderr, "\t" INTVAL_FMT ": %s\n", i, argv[i]);
}
@@ -252,7 +253,7 @@
);
}
- if (interpreter->flags & PARROT_DEBUG_FLAG) {
+ if (Interp_flags_TEST(interpreter, PARROT_DEBUG_FLAG)) {
fprintf(stderr, "\
*** Parrot VM: Dumping GC info ***\n\
\tTotal memory allocated: %u\n\
1.82 +8 -8 parrot/interpreter.c
Index: interpreter.c
===================================================================
RCS file: /cvs/public/parrot/interpreter.c,v
retrieving revision 1.81
retrieving revision 1.82
diff -u -w -r1.81 -r1.82
--- interpreter.c 2 Apr 2002 04:46:44 -0000 1.81
+++ interpreter.c 2 Apr 2002 06:24:14 -0000 1.82
@@ -1,7 +1,7 @@
/* interpreter.c
* Copyright: (When this is determined...it will go here)
* CVS Info
- * $Id: interpreter.c,v 1.81 2002/04/02 04:46:44 sfink Exp $
+ * $Id: interpreter.c,v 1.82 2002/04/02 06:24:14 josh Exp $
* Overview:
* The interpreter api handles running the operations
* Data Structure and Algorithms:
@@ -409,20 +409,20 @@
interpreter->resume_flag = 1;
while (interpreter->resume_flag) {
- int which = 0;
+ unsigned int which = 0;
opcode_t *pc = (opcode_t *)
interpreter->code->byte_code + interpreter->resume_offset;
interpreter->resume_offset = 0;
interpreter->resume_flag = 0;
- which |= interpreter->flags & PARROT_BOUNDS_FLAG ? 0x01 : 0x00;
- which |= interpreter->flags & PARROT_PROFILE_FLAG ? 0x02 : 0x00;
- which |= interpreter->flags & PARROT_TRACE_FLAG ? 0x04 : 0x00;
+ which |= (Interp_flags_TEST(interpreter, PARROT_BOUNDS_FLAG)) ? 0x0
1 : 0x00;
+ which |= (Interp_flags_TEST(interpreter, PARROT_PROFILE_FLAG)) ? 0x0
2 : 0x00;
+ which |= (Interp_flags_TEST(interpreter, PARROT_TRACE_FLAG)) ? 0x0
4 : 0x00;
core = which ? runops_slow_core : runops_fast_core;
- if ((interpreter->flags & PARROT_PROFILE_FLAG) != 0) {
+ if (Interp_flags_TEST(interpreter, PARROT_PROFILE_FLAG)) {
unsigned int i;
if (interpreter->profile == NULL) {
@@ -436,7 +436,7 @@
}
}
- if ((interpreter->flags & PARROT_PREDEREF_FLAG) != 0) {
+ if (Interp_flags_TEST(interpreter, PARROT_PREDEREF_FLAG)) {
offset = pc - (opcode_t *)interpreter->code->byte_code;
if (!interpreter->prederef_code) {
@@ -454,7 +454,7 @@
runops_prederef(interpreter, pc,
interpreter->prederef_code + offset);
}
- else if ((interpreter->flags & PARROT_JIT_FLAG) != 0) {
+ else if (Interp_flags_TEST(interpreter, PARROT_JIT_FLAG)) {
#if !JIT_CAPABLE
internal_exception(JIT_UNAVAILABLE,
"Error: PARROT_JIT_FLAG is set, but interpret
er is not JIT_CAPABLE!\n");
1.16 +5 -5 parrot/runops_cores.c
Index: runops_cores.c
===================================================================
RCS file: /cvs/public/parrot/runops_cores.c,v
retrieving revision 1.15
retrieving revision 1.16
diff -u -w -r1.15 -r1.16
--- runops_cores.c 2 Apr 2002 04:46:44 -0000 1.15
+++ runops_cores.c 2 Apr 2002 06:24:14 -0000 1.16
@@ -1,7 +1,7 @@
/* runops_cores.c
* Copyright: (When this is determined...it will go here)
* CVS Info
- * $Id: runops_cores.c,v 1.15 2002/04/02 04:46:44 sfink Exp $
+ * $Id: runops_cores.c,v 1.16 2002/04/02 06:24:14 josh Exp $
* Overview:
* The switchable runops cores.
* Data Structure and Algorithms:
@@ -63,12 +63,12 @@
code_size = interpreter->code->byte_code_size / sizeof(opcode_t);
code_end = interpreter->code->byte_code + code_size;
- if (interpreter->flags & PARROT_TRACE_FLAG) {
+ if (Interp_flags_TEST(interpreter, PARROT_TRACE_FLAG)) {
trace_op(interpreter, code_start, code_end, pc);
}
while (pc && pc >= code_start && pc < code_end) {
- if (interpreter->flags & PARROT_PROFILE_FLAG) {
+ if (Interp_flags_TEST(interpreter, PARROT_PROFILE_FLAG)) {
interpreter->profile[*pc].numcalls++;
lastpc = pc;
starttime = Parrot_floatval_time();
@@ -76,10 +76,10 @@
DO_OP(pc, interpreter);
- if (interpreter->flags & PARROT_TRACE_FLAG) {
+ if (Interp_flags_TEST(interpreter, PARROT_TRACE_FLAG)) {
trace_op(interpreter, code_start, code_end, pc);
}
- if (interpreter->flags & PARROT_PROFILE_FLAG) {
+ if (Interp_flags_TEST(interpreter, PARROT_PROFILE_FLAG)) {
interpreter->profile[*lastpc].time +=
Parrot_floatval_time() - starttime;
}
1.39 +5 -1 parrot/include/parrot/interpreter.h
Index: interpreter.h
===================================================================
RCS file: /cvs/public/parrot/include/parrot/interpreter.h,v
retrieving revision 1.38
retrieving revision 1.39
diff -u -w -r1.38 -r1.39
--- interpreter.h 22 Mar 2002 20:24:05 -0000 1.38
+++ interpreter.h 2 Apr 2002 06:24:16 -0000 1.39
@@ -1,7 +1,7 @@
/* interpreter.h
* Copyright: (When this is determined...it will go here)
* CVS Info
- * $Id: interpreter.h,v 1.38 2002/03/22 20:24:05 dan Exp $
+ * $Id: interpreter.h,v 1.39 2002/04/02 06:24:16 josh Exp $
* Overview:
* The interpreter api handles running the operations
* Data Structure and Algorithms:
@@ -25,6 +25,10 @@
PARROT_PREDEREF_FLAG = 0x10, /* We're using the prederef runops */
PARROT_JIT_FLAG = 0x20 /* We're using the jit runops */
} Interp_flags;
+
+#define Interp_flags_SET(interp, flag) (/*@i1@*/ (interp)->flags |= (flag)
)
+#define Interp_flags_CLEAR(interp, flag) (/*@i1@*/ (interp)->flags &= ~(flag
))
+#define Interp_flags_TEST(interp, flag) (/*@i1@*/ (interp)->flags & (flag))
#if defined(PARROT_IN_CORE)
1.21 +2 -2 parrot/io/io.c
Index: io.c
===================================================================
RCS file: /cvs/public/parrot/io/io.c,v
retrieving revision 1.20
retrieving revision 1.21
diff -u -w -r1.20 -r1.21
--- io.c 23 Mar 2002 21:27:31 -0000 1.20
+++ io.c 2 Apr 2002 06:24:18 -0000 1.21
@@ -1,7 +1,7 @@
/* io.c
* Copyright: (When this is determined...it will go here)
* CVS Info
- * $Id: io.c,v 1.20 2002/03/23 21:27:31 mrjoltcola Exp $
+ * $Id: io.c,v 1.21 2002/04/02 06:24:18 josh Exp $
* Overview:
* This is the Parrot IO subsystem API. Generic IO stuff
* goes here, each specific layer goes in its own file...
@@ -128,7 +128,7 @@
internal_exception(PIO_ERROR, "PIO init std handles failed.");
}
- if ((interpreter->flags & PARROT_DEBUG_FLAG) != 0) {
+ if (Interp_flags_TEST(interpreter, PARROT_DEBUG_FLAG)) {
PIO_puts(interpreter, PIO_STDERR(interpreter),
"PIO: IO system initialized.\n");
}
1.16 +2 -2 parrot/io/io_win32.c
Index: io_win32.c
===================================================================
RCS file: /cvs/public/parrot/io/io_win32.c,v
retrieving revision 1.15
retrieving revision 1.16
diff -u -w -r1.15 -r1.16
--- io_win32.c 28 Mar 2002 08:02:17 -0000 1.15
+++ io_win32.c 2 Apr 2002 06:24:18 -0000 1.16
@@ -1,7 +1,7 @@
/* io_win32.c
* Copyright: (When this is determined...it will go here)
* CVS Info
- * $Id: io_win32.c,v 1.15 2002/03/28 08:02:17 josh Exp $
+ * $Id: io_win32.c,v 1.16 2002/04/02 06:24:18 josh Exp $
* Overview:
* This is the Parrot IO OS layer for Win32 platforms.
* Data Structure and Algorithms:
@@ -132,7 +132,7 @@
PIOHANDLE fd;
type = PIO_TYPE_FILE;
# if 0
- if ((interpreter->flags & PARROT_DEBUG_FLAG) != 0) {
+ if ((Interp_flags_TEST(interpreter, PARROT_DEBUG_FLAG)) != 0) {
fprintf(stderr, "PIO_win32_open: %s\n", spath);
}
# endif
------- End of Forwarded Message