[svn:parrot] r43609 - in trunk: t/pmc tools/build

plobsing at svn.parrot.org plobsing at svn.parrot.org
Tue Jan 26 22:00:46 UTC 2010


Author: plobsing
Date: Tue Jan 26 22:00:45 2010
New Revision: 43609
URL: https://trac.parrot.org/parrot/changeset/43609

Log:
fix return (possibly smaller) native types from NCI and add test for returning
signed shorts (which demonstrated the issue)

Modified:
   trunk/t/pmc/nci.t
   trunk/tools/build/nativecall.pl

Modified: trunk/t/pmc/nci.t
==============================================================================
--- trunk/t/pmc/nci.t	Tue Jan 26 20:48:02 2010	(r43608)
+++ trunk/t/pmc/nci.t	Tue Jan 26 22:00:45 2010	(r43609)
@@ -566,12 +566,12 @@
   print "loaded\n"
   dlfunc P0, P1, "nci_ssc", "ssc"
   print "dlfunced\n"
-  set I5, 2
+  set I5, -2
   set I6, 3
   set_args "0,0", I5, I6
   get_results "0", I5
   invokecc P0
-  ne I5, 6, nok_1
+  ne I5, -6, nok_1
   print "ok 1\n"
   end
 nok_1: print "nok 1\n"

Modified: trunk/tools/build/nativecall.pl
==============================================================================
--- trunk/tools/build/nativecall.pl	Tue Jan 26 20:48:02 2010	(r43608)
+++ trunk/tools/build/nativecall.pl	Tue Jan 26 22:00:45 2010	(r43609)
@@ -49,12 +49,12 @@
              "    }\n" .
              "    Parrot_pcc_fill_returns_from_c_args(interp, call_object, \"P\", final_destination);",
     },
-    i => { as_proto => "int",    sig_char => "I" },
-    l => { as_proto => "long",   sig_char => "I" },
-    c => { as_proto => "char",   sig_char => "I" },
-    s => { as_proto => "short",  sig_char => "I" },
-    f => { as_proto => "float",  sig_char => "N" },
-    d => { as_proto => "double", sig_char => "N" },
+    i => { as_proto => "int",    sig_char => "I", return_type => "INTVAL" },
+    l => { as_proto => "long",   sig_char => "I", return_type => "INTVAL" },
+    c => { as_proto => "char",   sig_char => "I", return_type => "INTVAL" },
+    s => { as_proto => "short",  sig_char => "I", return_type => "INTVAL" },
+    f => { as_proto => "float",  sig_char => "N", return_type => "FLOATVAL" },
+    d => { as_proto => "double", sig_char => "N", return_type => "FLOATVAL" },
     t => { as_proto => "char *",
            other_decl => "STRING *final_destination;",
            ret_assign => "final_destination = Parrot_str_new(interp, return_data, 0);\n    Parrot_pcc_fill_returns_from_c_args(interp, call_object, \"S\", final_destination);",


More information about the parrot-commits mailing list