cvsuser 04/08/09 00:42:58
Modified: classes unmanagedstruct.pmc
config/gen/config_h config_h.in
docs/pdds pdd16_native_call.pod
docs running.pod
t/pmc nci.t
Log:
[perl #30995] [PATCH] NCI for non-x86 platforms
The unmanagedstruct tried to dereference unaligned pointers.
(a) in unmanagedstruct.pmc fixed ret_int to align properly (the main
thing was to separate INTVAL and int cases, but I added some other
types while I was at it)
(b) config.h.in: added SHORT_SIZE and INT_SIZE to support (a)
(c) nci.t: the test assumed that (char)(3*64) would be -64 and therefore
explicitly abs()ed the result - that the result would be 192 was not
expected at all.
(d) pdd16_native_call.pod: added a note about signedness of the C char.
Not that anyone ever reads documentation.
[perl #30996] [PATCH] trace prettyprinting
I added more decoding of the arguments for parrot -t, and added a little
bit of documentation for it.
[perl #31000] [PATCH] to go on top of perl #30995
To accommodate even more sizeof() combinations and to avoid duplicate
Courtesy of Jarkko Hietaniemi <[EMAIL PROTECTED]>
cases in those, ummm, cases.
Revision Changes Path
1.45 +25 -2 parrot/classes/unmanagedstruct.pmc
Index: unmanagedstruct.pmc
===================================================================
RCS file: /cvs/public/parrot/classes/unmanagedstruct.pmc,v
retrieving revision 1.44
retrieving revision 1.45
diff -u -w -r1.44 -r1.45
--- unmanagedstruct.pmc 29 Jul 2004 09:12:38 -0000 1.44
+++ unmanagedstruct.pmc 9 Aug 2004 07:42:41 -0000 1.45
@@ -1,6 +1,6 @@
/*
Copyright: 2001-2003 The Perl Foundation. All Rights Reserved.
-$Id: unmanagedstruct.pmc,v 1.44 2004/07/29 09:12:38 leo Exp $
+$Id: unmanagedstruct.pmc,v 1.45 2004/08/09 07:42:41 leo Exp $
=head1 NAME
@@ -214,10 +214,33 @@
{
switch (type) {
case enum_type_INTVAL:
- case enum_type_int:
return *(INTVAL*) p;
+#if INT_SIZE == 4
+ case enum_type_int32:
+ case enum_type_uint32:
+#endif
+#if INT_SIZE == 8
+ case enum_type_int64:
+ case enum_type_uint64:
+#endif
+ case enum_type_int:
+ return *(int*) p;
+#if (LONG_SIZE == 4) && !(INT_SIZE == 4) /* Unlikely combination. */
+ case enum_type_int32:
+ case enum_type_uint32:
+#endif
+#if (LONG_SIZE == 8) && !(INT_SIZE == 8)
+ case enum_type_int64:
+ case enum_type_uint64:
+#endif
+ case enum_type_long:
+ case enum_type_ulong:
+ return *(long*) p;
+#if SHORT_SIZE == 2
case enum_type_int16:
case enum_type_uint16:
+#endif
+ /* If SHORT_SIZE != 2 getting int16s requires extra tricks. */
case enum_type_short:
return *(short*) p;
case enum_type_uint8:
1.23 +2 -0 parrot/config/gen/config_h/config_h.in
Index: config_h.in
===================================================================
RCS file: /cvs/public/parrot/config/gen/config_h/config_h.in,v
retrieving revision 1.22
retrieving revision 1.23
diff -u -w -r1.22 -r1.23
--- config_h.in 13 Apr 2004 14:18:20 -0000 1.22
+++ config_h.in 9 Aug 2004 07:42:44 -0000 1.23
@@ -65,6 +65,8 @@
#define NUMVAL_SIZE ${nvsize}
#define OPCODE_T_SIZE ${opcode_t_size}
#define PTR_SIZE ${ptrsize}
+#define SHORT_SIZE ${shortsize}
+#define INT_SIZE ${intsize}
#define LONG_SIZE ${longsize}
#define HUGEINTVAL_SIZE ${hugeintvalsize}
1.10 +7 -2 parrot/docs/pdds/pdd16_native_call.pod
Index: pdd16_native_call.pod
===================================================================
RCS file: /cvs/public/parrot/docs/pdds/pdd16_native_call.pod,v
retrieving revision 1.9
retrieving revision 1.10
diff -u -w -r1.9 -r1.10
--- pdd16_native_call.pod 30 Apr 2004 16:05:37 -0000 1.9
+++ pdd16_native_call.pod 9 Aug 2004 07:42:47 -0000 1.10
@@ -1,5 +1,5 @@
# Copyright: 2001-2004 The Perl Foundation. All Rights Reserved.
-# $Id: pdd16_native_call.pod,v 1.9 2004/04/30 16:05:37 leo Exp $
+# $Id: pdd16_native_call.pod,v 1.10 2004/08/09 07:42:47 leo Exp $
=head1 NAME
@@ -62,18 +62,23 @@
=item c
Char. This is an integer type, taken from (or put into) an I register.
+NOTE: it might be signed or unsigned because that is how an unadorned
+C 'char' works.
=item s
-short. An integer type, taken from or put into an I register
+short. An integer type, taken from or put into an I register.
+It is always signed, not unsigned.
=item i
int. An integer type.
+It is always signed, not unsigned.
=item l
long. An integer type. You know the drill.
+It is always signed, not unsigned.
=item f
1.21 +5 -1 parrot/docs/running.pod
Index: running.pod
===================================================================
RCS file: /cvs/public/parrot/docs/running.pod,v
retrieving revision 1.20
retrieving revision 1.21
diff -u -w -r1.20 -r1.21
--- running.pod 28 Feb 2004 00:30:39 -0000 1.20
+++ running.pod 9 Aug 2004 07:42:55 -0000 1.21
@@ -1,5 +1,5 @@
# Copyright: 2001-2004 The Perl Foundation. All Rights Reserved.
-# $Id: running.pod,v 1.20 2004/02/28 00:30:39 mikescott Exp $
+# $Id: running.pod,v 1.21 2004/08/09 07:42:55 leo Exp $
=head1 NAME
@@ -60,6 +60,10 @@
C<parrot> also has several debugging and tracing flags; see the
usage description (generated by C<parrot -h>) for details.
+For example C<parrot -t> will trace the execution of the Parrot
+opcodes. The values of the registers are shown as they are before
+the opcode is executed.
+
=item B<make test>
C<make test> will compile anything that needs to be compiled and run
1.44 +16 -7 parrot/t/pmc/nci.t
Index: nci.t
===================================================================
RCS file: /cvs/public/parrot/t/pmc/nci.t,v
retrieving revision 1.43
retrieving revision 1.44
diff -u -w -r1.43 -r1.44
--- nci.t 9 May 2004 08:45:14 -0000 1.43
+++ nci.t 9 Aug 2004 07:42:58 -0000 1.44
@@ -1,6 +1,6 @@
#! perl -w
# Copyright: 2001-2003 The Perl Foundation. All Rights Reserved.
-# $Id: nci.t,v 1.43 2004/05/09 08:45:14 leo Exp $
+# $Id: nci.t,v 1.44 2004/08/09 07:42:58 leo Exp $
=head1 NAME
@@ -12,8 +12,8 @@
=head1 DESCRIPTION
-Tests the NCI PMC. These are all skipped unless JIT CPU architecture is
-i386 and the F<libnci.so> library is found.
+Tests the NCI PMC. These are all skipped unless the F<libnci.so>
+library is found.
=cut
@@ -174,11 +174,10 @@
dlfunc P0, P1, "nci_csc", "csc"
print "dlfunced\n"
set I0, 1 # prototype used - unchecked
- set I5, 64
- set I6, 3
+ set I5, 6
+ set I6, 7
invoke
- abs I5 # 3 * 64 as char may be signed/unsigned
- ne I5, 64, nok_1
+ ne I5, 42, nok_1
print "ok 1\n"
ne I0, 0, nok_2 # test return value convention
ne I1, 1, nok_2
@@ -192,6 +191,16 @@
print "\n"
end
nok_2: print "nok 2\n"
+ print I0
+ print "\n"
+ print I1
+ print "\n"
+ print I2
+ print "\n"
+ print I3
+ print "\n"
+ print I4
+ print "\n"
end
CODE
loaded