This is the mail archive of the kawa@sources.redhat.com mailing list for the Kawa project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: Problem with --full-tailcalls using CVS


Jim White wrote:
Found a problem with --full-tailcalls with the CVS version of Kawa:
I checked in to CVS the attached patch.

Been doing some benchmarking and there is a big speed improvement from the 1.6.99 release to the current CVS for normal code (computing Sterling numbers, lots of numeric computation and arrays). Huge hit from turning on --full-tailcalls (one-half to one-third the speed) either way though.
Yes.  While I expect --full-tailcalls to be slower, it could probably
be optimized quite a bit.  However, before doing that I'd like to
get a handle on precisely how it should be modified to handle
(a) full continuations, and
(b) generic (or multi-) methods.
--
	--Per Bothner
per@bothner.com   http://www.bothner.com/per/
--- ConsumerTarget.java~	Thu Jun 27 12:26:37 2002
+++ ConsumerTarget.java	Fri Sep 20 13:44:17 2002
@@ -46,6 +46,7 @@
     CodeAttr code = comp.getCode();
     String methodName = null;
     Method method = null;
+    boolean islong = false;
     if (stackType instanceof PrimType)
       {
 	char sig = stackType.getSignature().charAt(0);
@@ -53,9 +54,9 @@
 	  {
 	  case 'B': case 'S': case 'I':
 	    methodName = "writeInt";  break;
-	  case 'J':	methodName = "writeLong";  break;
+	  case 'J':	methodName = "writeLong";  islong = true; break;
 	  case 'F':	methodName = "writeFloat";  break;
-	  case 'D':	methodName = "writeDouble";  break;
+	  case 'D':	methodName = "writeDouble"; islong = true; break;
 	  case 'C':	methodName = "writeChar";  break;
 	  case 'Z':	methodName = "writeBoolean";  break;
 	  case 'V':     return;
@@ -73,8 +74,20 @@
 	    return;
 	  }
       }
-    code.emitLoad(consumer);
-    code.emitSwap();
+    if (islong)
+      {
+	code.pushScope();
+	Variable temp = code.addLocal(stackType);
+	code.emitStore(temp);
+	code.emitLoad(consumer);
+	code.emitLoad(temp);
+	code.popScope();
+      }
+    else
+      {
+	code.emitLoad(consumer);
+	code.emitSwap();
+      }
     if (method == null && methodName != null)
       method = Compilation.typeConsumer.getDeclaredMethod(methodName, 1);
     if (method != null)

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]