progs/fun/funt.sc
changeset 958 fddf099a82f8
parent 956 ae9782e62bdd
child 976 e9eac62928f5
--- a/progs/fun/funt.sc	Tue Nov 28 11:45:48 2023 +0000
+++ b/progs/fun/funt.sc	Sat Dec 02 21:37:04 2023 +0000
@@ -98,12 +98,12 @@
     compile_expT(a2, env, name) ++
     l"$if_end"
   }
-  case Call(n, args) => if (name == n) { 
+  case Call(n, args) => if (name == n) { // can apply tail-call optimisation
     val stores = args.zipWithIndex.map { case (x, y) => i"istore $y" } 
     args.map(a => compile_expT(a, env, "")).mkString ++
     stores.reverse.mkString ++ 
     i"goto ${n}_Start" 
-  } else {
+  } else { // normal call
     val is = "I" * args.length
     args.map(a => compile_expT(a, env, "")).mkString ++
     i"invokestatic XXX/XXX/${n}(${is})I"