src/method-proto.lisp: Collect arguments in vanilla delegation trampolines.
authorMark Wooding <mdw@distorted.org.uk>
Fri, 9 Aug 2019 19:36:42 +0000 (20:36 +0100)
committerMark Wooding <mdw@distorted.org.uk>
Sat, 10 Aug 2019 14:46:01 +0000 (15:46 +0100)
In the keyword-arguments overhaul, somehow the case in `make-trampoline'
for trivially `augmenting' the argument list for a vanilla message, as
opposed to hairy varargs or keyword messages, got lost, with the result
that they ended up with no arguments at all.  Needless to say, the C
compiler is unhappy about this.

src/method-proto.lisp
test/test.sod

index d2ab761..034768a 100644 (file)
                          ((keyword-message-p message)
                           (cons (make-argument *sod-key-pointer*
                                                (c-type (* (void :const))))
-                                raw-args))))
+                                raw-args))
+                         (t raw-args)))
         (*keyword-struct-disposition* (if (effective-method-keywords method)
                                           :pointer :null)))
     (codegen-push codegen)
index 848a7d3..429e384 100644 (file)
@@ -161,6 +161,8 @@ static int check_vec(struct vec *v, ...)
 
 [link = SodObject, nick = base]
 class T1Base: SodObject {
+  int plain(int x) { STEP(x); return (x + 1); }
+
   [combination = progn] void aprogn();
   [combination = sum] int asum();
   [combination = and] int aand();
@@ -184,6 +186,7 @@ class T1Base: SodObject {
 
 [link = T1Base, nick = mid]
 class T1Mid: T1Base {
+  int base.plain(int x) { STEP(x - 1); return (CALL_NEXT_METHOD); }
   void base.aprogn() { STEP(1); }
   int base.asum() { return 1; }
   int base.aand() { return 8; }
@@ -215,7 +218,8 @@ code c: tests {
     if (!l) STEP(5);
     v = T1Base_avec(t1);
     if (!v.n) STEP(6);
-    DONE(7);
+    STEP(T1Base_plain(t1, 7)); /* 7, 8 */
+    DONE(9);
   }
   prepare("aggregate, mid");
   { SOD_DECL(T1Mid, t1, NO_KWARGS);
@@ -231,7 +235,8 @@ code c: tests {
     v = T1Base_avec(t1);
     if (!check_vec(&v, 19, -1)) STEP(6);
     free_vec(&v);
-    DONE(7);
+    STEP(T1Base_plain(t1, 8)); /* 7, 8, 9 */
+    DONE(10);
   }
   prepare("aggregate, sub");
   { SOD_DECL(T1Sub, t1, NO_KWARGS);