cvsuser 04/02/24 06:38:07
Modified: include/parrot packfile.h
pf pf_items.c
src packfile.c
Log:
try to fix Tru64 native PBC issues
Revision Changes Path
1.57 +3 -3 parrot/include/parrot/packfile.h
Index: packfile.h
===================================================================
RCS file: /cvs/public/parrot/include/parrot/packfile.h,v
retrieving revision 1.56
retrieving revision 1.57
diff -u -w -r1.56 -r1.57
--- packfile.h 19 Feb 2004 01:23:08 -0000 1.56
+++ packfile.h 24 Feb 2004 14:38:03 -0000 1.57
@@ -1,6 +1,6 @@
/* packfile.h
*
-* $Id: packfile.h,v 1.56 2004/02/19 01:23:08 scog Exp $
+* $Id: packfile.h,v 1.57 2004/02/24 14:38:03 leo Exp $
*
* History:
* Rework by Melvin; new bytecode format, make bytecode portable.
@@ -203,8 +203,8 @@
INTVAL eval_nr; /* nr. of eval cs */
INTVAL need_wordsize;
INTVAL need_endianize;
- opcode_t (*fetch_op)(opcode_t);
- INTVAL (*fetch_iv)(INTVAL);
+ opcode_t (*fetch_op)(unsigned char *);
+ INTVAL (*fetch_iv)(unsigned char *);
void (*fetch_nv)(unsigned char *, unsigned char *);
};
1.6 +31 -9 parrot/pf/pf_items.c
Index: pf_items.c
===================================================================
RCS file: /cvs/public/parrot/pf/pf_items.c,v
retrieving revision 1.5
retrieving revision 1.6
diff -u -w -r1.5 -r1.6
--- pf_items.c 4 Feb 2004 15:48:37 -0000 1.5
+++ pf_items.c 24 Feb 2004 14:38:05 -0000 1.6
@@ -1,6 +1,6 @@
/*
Copyright: 2001-2003 The Perl Foundation. All Rights Reserved.
-$Id: pf_items.c,v 1.5 2004/02/04 15:48:37 mikescott Exp $
+$Id: pf_items.c,v 1.6 2004/02/24 14:38:05 leo Exp $
=head1 NAME
@@ -114,12 +114,28 @@
cvt_num12_num8(b, src);
fetch_buf_le_8(dest, b);
}
+static opcode_t
+fetch_op_test(unsigned char *b)
+{
+ union {
+ unsigned char buf[4];
+ opcode_t o;
+ } u;
+ fetch_buf_le_4(u.buf, b);
+ return u.o;
+}
/*
* opcode fetch helper function
+ *
+ * This is mostly wrong
+ *
+ * - it doesn't consider the endianess of the packfile
+ * - should be separated into several different fetch functions
+ *
*/
static opcode_t
-fetch_op_mixed(opcode_t b)
+fetch_op_mixed(unsigned char *b)
{
#if OPCODE_T_SIZE == 4
union {
@@ -127,6 +143,10 @@
opcode_t o[2];
} u;
#else
+ union {
+ unsigned char buf[4];
+ opcode_t o;
+ } u;
opcode_t o;
#endif
@@ -145,8 +165,10 @@
fetch_buf_be_8(u.buf, (unsigned char *) b);
return u.o[0]; /* or u.o[1] */
# else
- o = fetch_op_be(b);
- return o & 0xffffffff;
+ /* fetch 4 bytes from a LE pbc, result 8 byte LE opcode_t */
+ u.o = 0;
+ fetch_buf_le_4(u.buf, b);
+ return u.o;
# endif
#endif
@@ -171,7 +193,7 @@
#if TRACE_PACKFILE == 2
PIO_eprintf(NULL, "PF_fetch_opcode: Reordering.\n");
#endif
- o = (pf->fetch_op)(**stream);
+ o = (pf->fetch_op)(*((unsigned char **)stream));
*((unsigned char **) (stream)) += pf->header->wordsize;
return o;
}
@@ -231,7 +253,7 @@
INTVAL i;
if (!pf || pf->fetch_iv == NULL)
return *(*stream)++;
- i = (pf->fetch_iv)(**stream);
+ i = (pf->fetch_iv)(*((unsigned char **)stream));
/* XXX assume sizeof(opcode_t) == sizeof(INTVAL) on the
* machine producing this PBC
*/
@@ -566,7 +588,7 @@
if(pf->header->byteorder != PARROT_BIGENDIAN) {
pf->need_endianize = 1;
if (pf->header->wordsize == sizeof(opcode_t))
- pf->fetch_op = fetch_op_le;
+ pf->fetch_op = (opcode_t (*)unsigned char*)fetch_op_le;
else {
pf->need_wordsize = 1;
pf->fetch_op = fetch_op_mixed;
@@ -582,13 +604,13 @@
if(pf->header->byteorder != PARROT_BIGENDIAN) {
pf->need_endianize = 1;
if (pf->header->wordsize == sizeof(opcode_t)) {
- pf->fetch_op = fetch_op_be;
+ pf->fetch_op = (opcode_t (*)(unsigned char*))fetch_op_be;
}
else {
pf->need_wordsize = 1;
pf->fetch_op = fetch_op_mixed;
}
- pf->fetch_iv = fetch_iv_be;
+ pf->fetch_iv = (opcode_t (*)(unsigned char*))fetch_iv_be;
if (pf->header->floattype == 0)
pf->fetch_nv = fetch_buf_be_8;
else if (pf->header->floattype == 1)
1.143 +3 -3 parrot/src/packfile.c
Index: packfile.c
===================================================================
RCS file: /cvs/public/parrot/src/packfile.c,v
retrieving revision 1.142
retrieving revision 1.143
diff -u -w -r1.142 -r1.143
--- packfile.c 23 Feb 2004 21:14:23 -0000 1.142
+++ packfile.c 24 Feb 2004 14:38:07 -0000 1.143
@@ -2,7 +2,7 @@
Copyright (C) 2001-2002 Gregor N. Purdy. All rights reserved.
This program is free software. It is subject to the same license as
Parrot itself.
-$Id: packfile.c,v 1.142 2004/02/23 21:14:23 leo Exp $
+$Id: packfile.c,v 1.143 2004/02/24 14:38:07 leo Exp $
=head1 NAME
@@ -813,8 +813,8 @@
PackFile_Segment_new_seg(&pf->directory,
PF_DIR_SEG, DIRECTORY_SEGMENT_NAME, 0);
pf->directory = *pf->dirp;
- pf->fetch_op = (opcode_t (*)(opcode_t)) NULLfunc;
- pf->fetch_iv = (INTVAL (*)(INTVAL)) NULLfunc;
+ pf->fetch_op = (opcode_t (*)(unsigned char*)) NULLfunc;
+ pf->fetch_iv = (INTVAL (*)(unsigned char*)) NULLfunc;
pf->fetch_nv = (void (*)(unsigned char *, unsigned char *)) NULLfunc;
return pf;
}