cvsuser 03/10/02 06:56:27
Modified: . build_nativecall.pl call_list.txt nci_test.c
t/pmc nci.t
Log:
update nci signatures for nci.t; more tests
Revision Changes Path
1.26 +4 -1 parrot/build_nativecall.pl
Index: build_nativecall.pl
===================================================================
RCS file: /cvs/public/parrot/build_nativecall.pl,v
retrieving revision 1.25
retrieving revision 1.26
diff -u -w -r1.25 -r1.26
--- build_nativecall.pl 25 Sep 2003 15:34:37 -0000 1.25
+++ build_nativecall.pl 2 Oct 2003 13:56:24 -0000 1.26
@@ -121,7 +121,7 @@
/* nci.c
* Copyright: 2001-2003 The Perl Foundation. All Rights Reserved.
* CVS Info
- * $Id: build_nativecall.pl,v 1.25 2003/09/25 15:34:37 dan Exp $
+ * $Id: build_nativecall.pl,v 1.26 2003/10/02 13:56:24 leo Exp $
* Overview:
* Native Call Interface routines. The code needed to build a
* parrot to C call frame is in here
@@ -248,6 +248,9 @@
};
/s/ && do {my $regnum = $reg_ref->{i}++;
return "(short)INT_REG($regnum)";
+ };
+ /c/ && do {my $regnum = $reg_ref->{i}++;
+ return "(char)INT_REG($regnum)";
};
/2/ && do {my $regnum = $reg_ref->{i}++;
return "(short*)&INT_REG($regnum)";
1.16 +98 -88 parrot/call_list.txt
Index: call_list.txt
===================================================================
RCS file: /cvs/public/parrot/call_list.txt,v
retrieving revision 1.15
retrieving revision 1.16
diff -u -w -r1.15 -r1.16
--- call_list.txt 25 Sep 2003 15:34:37 -0000 1.15
+++ call_list.txt 2 Oct 2003 13:56:24 -0000 1.16
@@ -21,115 +21,115 @@
# I - Parrot_Interp param
#
#Return params
-i
-i i
-i d
-i t
-i ii
-f is
-d d
-i p
-v v
-p p
-p i
-i v
-f v
-l v
-s v
+#p b
c v
+c
+d d
d v
-p v
-v piiii
-i pppp
-i ppi
-p It
-i 4i
+f is
+f v
i 4
i 42p
+i 4i
+i d
+i i
+i ii
+i ii4
+i ii4i
+i iiii
+i iiilsp
+i iil
+i iili
+i iip
+i iit
+i iiti
+i ilsp
+i iti
+i l
+i li
i lp
i lsp
-i pll
-i ilsp
-i pl
-#p b
-p iiiiii
-p pii
-i p333333
+i p
+i p33
i p333
+i p333333
+i p4
+i p42p
+i p4i
+i pb
i pi
i pii
+i pii4
+i pii4i
+i piii
+i piiiiii
+i piiilsp
+i piil
+i piili
+i piit
+i piiti
+i pilsp
i pit
+i pl
+i pli
+i pll
+i pllllllll
+i plp
+i plsp
i pp
-l p
-t pi
-i p33
-t i
-t ii
-t v
-t
-i ti
-i l
-v l
-v illllllll
-l
+i ppi
+i ppiiiiiiii
+i pppp
+i psp
+i pt
+i pti
+i s
+i s22
i s222
i sp
-i ppiiiiiiii
-v p
-p piiii
-c
-v
-i li
-v pl
-p
-i ssss
i sss
-l pi
-i iil
-i ii4i
-i ii4
-i iiti
-i iit
-i iiilsp
-i iiii
-i iili
+i ssss
+i t
+i ti
+i v
+i
+l 33l
l ii
-i piil
-i pii4i
-i pii4
-i piiti
-i piit
-i piiilsp
-i piili
+l l4
+l p
+l p33l
+l pi
l pii
+l v
+l
+p It
+p b
+p i
p ii
-p tpp
p iiii
-i s22
-i piiiiii
-i iip
-i s
-i iti
+p iiiiii
+p p
+p pii
+p piiii
+p tpp
+p v
+p
+s v
+t i
+t ii
+t pi
t t
+t v
+t
v i
-i p4i
-i p4
-i pti
-i pt
-i p42p
-i plp
-i plsp
-i pllllllll
-i pilsp
-i psp
-i pli
+v illllllll
+v l
+v p
v pi
-i piii
-l l4
-l p33l
-l 33l
-p b
-i pb
+v piiii
+v pl
+v v
+v
# These are needed for parrotio.pmc
i IP
@@ -138,3 +138,13 @@
i IPii
i IPiii
i IPt
+
+# the following are use by t/pmc/nci.t
+f ff
+i sc
+s sc
+c sc
+i iii
+i i3
+t b
+t B
1.6 +21 -0 parrot/nci_test.c
Index: nci_test.c
===================================================================
RCS file: /cvs/public/parrot/nci_test.c,v
retrieving revision 1.5
retrieving revision 1.6
diff -u -w -r1.5 -r1.6
--- nci_test.c 23 Sep 2003 07:09:36 -0000 1.5
+++ nci_test.c 2 Oct 2003 13:56:24 -0000 1.6
@@ -41,6 +41,21 @@
s[1] = ((char*) p)[0];
return s;
}
+
+static char b[] = "xx worked\n";
+char *nci_tb(void *p) {
+ b[0] = ((char*) p)[1];
+ b[1] = ((char*) p)[0];
+ return b;
+}
+
+static char B[] = "xx done\n";
+char *nci_tB(void **p) {
+ B[0] = (*(char**) p)[1];
+ B[1] = (*(char**) p)[0];
+ return B;
+}
+
void * nci_pp(void *p) {
return p;
}
@@ -52,6 +67,12 @@
int nci_i4i(long * l, int i) {
return (int) (*l * i);
+}
+
+int nci_ii3(int a, int *b) {
+ int r = a * *b;
+ *b = 4711;
+ return r;
}
#ifdef TEST
1.15 +39 -1 parrot/t/pmc/nci.t
Index: nci.t
===================================================================
RCS file: /cvs/public/parrot/t/pmc/nci.t,v
retrieving revision 1.14
retrieving revision 1.15
diff -u -w -r1.14 -r1.15
--- nci.t 30 Sep 2003 10:22:02 -0000 1.14
+++ nci.t 2 Oct 2003 13:56:27 -0000 1.15
@@ -1,4 +1,4 @@
-use Parrot::Test tests => 11;
+use Parrot::Test tests => 14;
use Parrot::Config;
print STDERR $PConfig{jitcpuarch}, " JIT CPU\n";
@@ -339,6 +339,44 @@
end
CODE
42
+OUTPUT
+
+output_is(<<'CODE', <<'OUTPUT', "nci_i_i3");
+ loadlib P1, "libnci"
+ dlfunc P0, P1, "nci_ii3", "ii3"
+ set I5, 6
+ set I6, 7
+ invoke
+ print I5
+ print "\n"
+ print I6
+ print "\n"
+ end
+CODE
+42
+4711
+OUTPUT
+
+output_is(<<'CODE', <<'OUTPUT', "nci_t_b");
+ loadlib P1, "libnci"
+ dlfunc P0, P1, "nci_tb", "tb"
+ set S5, "ko\n"
+ invoke
+ print S5
+ end
+CODE
+ok worked
+OUTPUT
+
+output_is(<<'CODE', <<'OUTPUT', "nci_t_B");
+ loadlib P1, "libnci"
+ dlfunc P0, P1, "nci_tB", "tB"
+ set S5, "ko\n"
+ invoke
+ print S5
+ end
+CODE
+ok done
OUTPUT
} # SKIP