changeset 50:9bd3c5219505

- minor test code fix - doc - cleanups
author cslag
date Sun, 20 Dec 2015 15:38:14 +0100
parents 4388e27eadd7
children 9e9d6a90492a
files doc/manual/callconvs/callconv_arm32.tex doc/manual/manual_dyncall_api.tex dyncall/dyncall.3 dyncall/dyncall_call_arm32_arm_armhf.S dyncallback/dyncall_callback_arm32_arm_gas.S test/ellipsis/ellipsis.cc test/ellipsis/main.cc
diffstat 7 files changed, 14 insertions(+), 7 deletions(-) [+]
line wrap: on
line diff
--- a/doc/manual/callconvs/callconv_arm32.tex	Sun Dec 20 00:12:06 2015 +0100
+++ b/doc/manual/callconvs/callconv_arm32.tex	Sun Dec 20 15:38:14 2015 +0100
@@ -338,7 +338,8 @@
 \item first 16 single-precision, or 8 double-precision arguments are passed via s0-s15 or d0-d7, respectively (note that since s and d registers are aliased, already used ones are skipped)
 \item subsequent parameters are pushed onto the stack (in right to left order, such that the stack pointer points to the first of the remaining parameters)
 \item note that as soon one floating point parameter is passed via the stack, subsequent single precision floating point parameters are also pushed onto the stack even if there are still free S* registers
-\item if the callee takes the address of one of the parameters and uses it to address other parameters (e.g. varargs) it has to copy - in its prolog - the first four words to a reserved stack area adjacent to the other parameters on the stack @@@?check spilling of float args, also
+\item floating point vararg parameters (only doubles, b/c of promotion) are pushed onth the stack, never passed via registers
+\item if the callee takes the address of one of the parameters and uses it to address other parameters (e.g. varargs) it has to copy - in its prolog - the first four words (for first 4 integer arguments) to a reserved stack area adjacent to the other parameters on the stack
 \item parameters \textless=\ 32 bits are passed as 32 bit words
 \item structures and unions are passed by value, with the first four words of the parameters in r0-r3 @@@?check doc
 \item if return value is a structure, a pointer pointing to the return value's space is passed in r0, the first parameter in r1, etc. (see {\bf return values})
--- a/doc/manual/manual_dyncall_api.tex	Sun Dec 20 00:12:06 2015 +0100
+++ b/doc/manual/manual_dyncall_api.tex	Sun Dec 20 15:38:14 2015 +0100
@@ -220,10 +220,13 @@
 void dcReset(DCCallVM* vm);
 \end{lstlisting}
 
-Resets the internal stack of arguments and prepares it for the selected mode.
+
+Resets the internal stack of arguments and prepares it for a new call.
 This function should be called after setting the call mode (using dcMode), but
 prior to binding arguments to the CallVM. Use it also when reusing a CallVM, as
 arguments don't get flushed automatically after a function call invocation.\\
+Note: you should also call this function after initial creation of the a CallVM
+object, as dcNewCallVM doesn't do this, implicitly.\\
 
 \subsection{Argument binding}
 
--- a/dyncall/dyncall.3	Sun Dec 20 00:12:06 2015 +0100
+++ b/dyncall/dyncall.3	Sun Dec 20 15:38:14 2015 +0100
@@ -114,10 +114,12 @@
 silently ignored.
 .Pp
 .Fn dcReset
-resets the internal stack of arguments and prepares it for the selected mode.
+resets the internal stack of arguments and prepares it for a new call.
 This function should be called after setting the call mode (using dcMode), but
 prior to binding arguments to the CallVM. Use it also when reusing a CallVM, as
 arguments don't get flushed automatically after a function call invocation.
+Note: you should also call this function after initial creation of the a CallVM
+object, as dcNewCallVM doesn't do this, implicitly.
 .Pp
 .Fn dcArgBool ,
 .Fn dcArgChar ,
--- a/dyncall/dyncall_call_arm32_arm_armhf.S	Sun Dec 20 00:12:06 2015 +0100
+++ b/dyncall/dyncall_call_arm32_arm_armhf.S	Sun Dec 20 15:38:14 2015 +0100
@@ -61,7 +61,7 @@
 	/* Load 16 single-precision registers (= 8 double-precision registers). */
 	fldmiad	r3, {d0-d7}
 
-	sub	r2 , r2 , #16	
+	sub	r2 , r2 , #16	/* skip spill area */
 	cmp     r2, #0
 	ble	armhf_call
 
--- a/dyncallback/dyncall_callback_arm32_arm_gas.S	Sun Dec 20 00:12:06 2015 +0100
+++ b/dyncallback/dyncall_callback_arm32_arm_gas.S	Sun Dec 20 15:38:14 2015 +0100
@@ -33,7 +33,7 @@
 /* sizes */
 /* .set DCThunk_size   ,   8 */
 /* .set DCArgs_size    ,  24 */ /* for EABI/ATPCS/... */
-/* .set DCArgs_size    ,  76 */ /* for armhf          */
+/* .set DCArgs_size    ,  96 */ /* for armhf          */
 /* .set DCCallback_size,  20 */
 .set DCValue_size   ,   8
 
--- a/test/ellipsis/ellipsis.cc	Sun Dec 20 00:12:06 2015 +0100
+++ b/test/ellipsis/ellipsis.cc	Sun Dec 20 15:38:14 2015 +0100
@@ -45,8 +45,8 @@
 template<> void g(DCchar value, int pos) { mValue[pos].c = value; }
 template<> void g(DCshort value, int pos) { mValue[pos].s = value; }
 template<> void g(DCint value, int pos) { mValue[pos].i = value; }
-template<> void g(DClong value, int pos) { mValue[pos].l = value; }
-template<> void g(DClonglong value, int pos) { mValue[pos].L = value; }
+template<> void g(DClong value, int pos) { mValue[pos].j = value; }
+template<> void g(DClonglong value, int pos) { mValue[pos].l = value; }
 template<> void g(DCfloat value, int pos) { mValue[pos].f = value; }
 template<> void g(DCdouble value, int pos) { mValue[pos].d = value; }
 template<> void g(DCpointer value, int pos) { mValue[pos].p = value; }
--- a/test/ellipsis/main.cc	Sun Dec 20 00:12:06 2015 +0100
+++ b/test/ellipsis/main.cc	Sun Dec 20 15:38:14 2015 +0100
@@ -89,6 +89,7 @@
   assert( dcGetError(pCall) == DC_ERROR_NONE );
  
   dcMode(pCall, DC_CALL_C_ELLIPSIS);
+  dcReset(pCall);
   
   assert( dcGetError(pCall) == DC_ERROR_NONE );