~ chicken-core (chicken-5) 15476160b779120013eccd54fbe5650a2597c31d
commit 15476160b779120013eccd54fbe5650a2597c31d Author: felix <felix@call-with-current-continuation.org> AuthorDate: Fri Jan 14 23:48:33 2011 +0100 Commit: felix <felix@call-with-current-continuation.org> CommitDate: Fri Jan 14 23:48:33 2011 +0100 callback-lambdas are not allowed to be leaf-optimized (reason for a bug reported by David Dreisigmeyer) diff --git a/compiler.scm b/compiler.scm index a9d9f613..a7d08eb5 100644 --- a/compiler.scm +++ b/compiler.scm @@ -1622,6 +1622,8 @@ [lam (first subs)] ) (set! foreign-callback-stubs (cons (apply make-foreign-callback-stub id params) foreign-callback-stubs) ) + ;; mark to avoid leaf-routine optimization + (mark-variable id '##compiler#callback-lambda) (cps-lambda id (first (node-parameters lam)) (node-subexpressions lam) k) ) ) ((##core#inline ##core#inline_allocate ##core#inline_ref ##core#inline_update ##core#inline_loc_ref ##core#inline_loc_update) diff --git a/manual/Acknowledgements b/manual/Acknowledgements index aaa3fdad..0e947ce0 100644 --- a/manual/Acknowledgements +++ b/manual/Acknowledgements @@ -7,47 +7,48 @@ Annis, Marc Baily, Peter Barabas, Jonah Beckford, Arto Bendiken, Kevin Beranek, Peter Bex, Jean-Francois Bignolles, Oivind Binde, Alaric Blagrave-Snellpym, Dave Bodenstab, Fabian Boehlke, T. Kurt Bond, Ashley Bone, Dominique Boucher, Terence Brannon, Roy Bryant, Adam -Buchbinder, Hans Bulfone, Category 5, Taylor Campbell, Naruto Canada, -Mark Carter, Esteban U. Caamano Castro, Semih Cemiloglu, Franklin -Chen, Thomas Chust, Gian Paolo Ciceri, Fulvio Ciriaco, Tobia Conforto, -John Cowan, Grzegorz Chrupala, James Crippen, Tollef Fog Heen, Drew -Hess, Alejandro Forero Cuervo, Peter Danenberg, Linh Dang, Brian -Denheyer, Sean D'Epagnier, "dgym", "Don", Chris Double, Brown Dragon, -Jarod Eells, Petter Egesund, Stephen Eilert, Steve Elkins, Daniel -B. Faken, Will Farr, Graham Fawcett, Marc Feeley, "Fizzie", Matthew -Flatt, Kimura Fuyuki, Tony Garnock-Jones, Martin Gasbichler, Abdulaziz -Ghuloum, Joey Gibson, Stephen C. Gilardi, Mario Domenech Goulart, -Joshua Griffith, Johannes Groedem, Damian Gryski, Andreas Gustafsson, -Sven Hartrumpf, Jun-ichiro itojun Hagino, Ahdi Hargo, Matthias Heiler, -Karl M. Hegbloom, William P. Heinemann, Bill Hoffman, Bruce Hoult, -Hans Huebner, Markus Huelsmann, Goetz Isenmann, Paulo Jabardo, Wietse -Jacobs, David Janssens, Christian Jaeger, Matt Jones, Dale Jordan, -Valentin Kamyshenko, Daishi Kato, Peter Keller, Brad Kind, Ron -Kneusel, Matthias Koeppe, Krysztof Kowalczyk, Andre Kuehne, Todd -R. Kueny Sr, Goran Krampe, David Krentzlin, Ben Kurtz, Micky -Latowicki, John Lenz, Kirill Lisovsky, Juergen Lorenz, Kon Lovett, Lam -Luu, Vitaly Magerya, Leonardo Valeri Manera, Dennis Marti, Charles -Martin, Bob McIsaac, Alain Mellan, Eric Merrit, Perry Metzger, Scott -G. Miller, Mikael, Karel Miklav, Bruce Mitchener, Fadi Moukayed, Chris -Moline, Eric E. Moore, Julian Morrison, Dan Muresan, David N. Murray, -"nicktick", Lars Nilsson, Ian Oversby, "o.t.", Gene Pavlovsky, Levi -Pearson, Jeronimo Pellegrini, Nicolas Pelletier, Derrell Piper, Carlos -Pita, Robin Lee Powell, Alan Post, "Pupeno", Davide Puricelli, -"presto", Doug Quale, Imran Rafique, Eric Raible, Ivan Raikov, Joel -Reymont, Chris Roberts, Eric Rochester, Paul Romanchenko, Andreas -Rottman, David Rush, Lars Rustemeier, Daniel Sadilek, Oskar Schirmer, -Burton Samograd, Reed Sheridan, Ronald Schroeder, Spencer Schumann, -Ivan Shcheklein, Alex Shinn, Ivan Shmakov, "Shmul", Tony Sidaway, -Jeffrey B. Siegal, Andrey Sidorenko, Michele Simionato, Iruata Souza, -Volker Stolz, Jon Strait, Dorai Sitaram, Robert Skeels, Jason -Songhurst, Clifford Stein, David Steiner, Sunnan, Zbigniew Szadkowski, -Rick Taube, Nathan Thern, Mike Thomas, Minh Thu, Christian Tismer, -Andre van Tonder, John Tobey, Henrik Tramberend, Vladimir Tsichevsky, -Neil van Dyke, Sam Varner, Taylor Venable, Sander Vesik, Jaques -Vidrine, Panagiotis Vossos, Shawn Wagner, Peter Wang, Ed Watkeys, Brad -Watson, Thomas Weidner, Goeran Weinholt, Matthew Welland, Drake -Wilson, Joerg Wittenberger, Peter Wright, Mark Wutka, Richard Zidlicky -and Houman Zolfaghari for bug-fixes, tips and suggestions. +Buchbinder, Hans Bulfone, "Category 5", Taylor Campbell, Naruto +Canada, Mark Carter, Esteban U. Caamano Castro, Semih Cemiloglu, +Franklin Chen, Thomas Chust, Gian Paolo Ciceri, Fulvio Ciriaco, Tobia +Conforto, John Cowan, Grzegorz Chrupala, James Crippen, Tollef Fog +Heen, Drew Hess, Alejandro Forero Cuervo, Peter Danenberg, Linh Dang, +Brian Denheyer, Sean D'Epagnier, "dgym", "Don", Chris Double, "Brown +Dragon", David Dreisigmeyer, Jarod Eells, Petter Egesund, Stephen +Eilert, Steve Elkins, Daniel B. Faken, Will Farr, Graham Fawcett, Marc +Feeley, "Fizzie", Matthew Flatt, Kimura Fuyuki, Tony Garnock-Jones, +Martin Gasbichler, Abdulaziz Ghuloum, Joey Gibson, Stephen C. Gilardi, +Mario Domenech Goulart, Joshua Griffith, Johannes Groedem, Damian +Gryski, Andreas Gustafsson, Sven Hartrumpf, Jun-ichiro itojun Hagino, +Ahdi Hargo, Matthias Heiler, Karl M. Hegbloom, William P. Heinemann, +Bill Hoffman, Bruce Hoult, Hans Huebner, Markus Huelsmann, Goetz +Isenmann, Paulo Jabardo, Wietse Jacobs, David Janssens, Christian +Jaeger, Matt Jones, Dale Jordan, Valentin Kamyshenko, Daishi Kato, +Peter Keller, Brad Kind, Ron Kneusel, Matthias Koeppe, Krysztof +Kowalczyk, Andre Kuehne, Todd R. Kueny Sr, Goran Krampe, David +Krentzlin, Ben Kurtz, Micky Latowicki, John Lenz, Kirill Lisovsky, +Juergen Lorenz, Kon Lovett, Lam Luu, Vitaly Magerya, Leonardo Valeri +Manera, Dennis Marti, Charles Martin, Bob McIsaac, Alain Mellan, Eric +Merrit, Perry Metzger, Scott G. Miller, Mikael, Karel Miklav, Bruce +Mitchener, Fadi Moukayed, Chris Moline, Eric E. Moore, Julian +Morrison, Dan Muresan, David N. Murray, "nicktick", Lars Nilsson, Ian +Oversby, "o.t.", Gene Pavlovsky, Levi Pearson, Jeronimo Pellegrini, +Nicolas Pelletier, Derrell Piper, Carlos Pita, Robin Lee Powell, Alan +Post, "Pupeno", Davide Puricelli, "presto", Doug Quale, Imran Rafique, +Eric Raible, Ivan Raikov, Joel Reymont, Chris Roberts, Eric Rochester, +Paul Romanchenko, Andreas Rottman, David Rush, Lars Rustemeier, Daniel +Sadilek, Oskar Schirmer, Burton Samograd, Reed Sheridan, Ronald +Schroeder, Spencer Schumann, Ivan Shcheklein, Alex Shinn, Ivan +Shmakov, "Shmul", Tony Sidaway, Jeffrey B. Siegal, Andrey Sidorenko, +Michele Simionato, Iruata Souza, Volker Stolz, Jon Strait, Dorai +Sitaram, Robert Skeels, Jason Songhurst, Clifford Stein, David +Steiner, Sunnan, Zbigniew Szadkowski, Rick Taube, Nathan Thern, Mike +Thomas, Minh Thu, Christian Tismer, Andre van Tonder, John Tobey, +Henrik Tramberend, Vladimir Tsichevsky, Neil van Dyke, Sam Varner, +Taylor Venable, Sander Vesik, Jaques Vidrine, Panagiotis Vossos, Shawn +Wagner, Peter Wang, Ed Watkeys, Brad Watson, Thomas Weidner, Goeran +Weinholt, Matthew Welland, Drake Wilson, Joerg Wittenberger, Peter +Wright, Mark Wutka, Richard Zidlicky and Houman Zolfaghari for +bug-fixes, tips and suggestions. CHICKEN uses the "irregex" regular expression package written by Alex Shinn. diff --git a/optimizer.scm b/optimizer.scm index 9911fcf3..74c10178 100644 --- a/optimizer.scm +++ b/optimizer.scm @@ -1255,6 +1255,7 @@ ;; - All calls are either to the direct continuation or (tail-) recursive calls. ;; - No allocation, no rest parameter. ;; - The lambda has a known container variable and all it's call-sites are known. + ;; - The lambda is not marked as a callback lambda (define (walk d n dn) (let ([params (node-parameters n)] @@ -1269,7 +1270,11 @@ (and-let* ([val (get db d 'value)] [refs (get-list db d 'references)] [sites (get-list db d 'call-sites)] ) + ;; val must be lambda, since `sites' is set (and (eq? n val) + (not (variable-mark + (first (node-parameters val)) + '##compiler#callback-lambda)) (= (length refs) (length sites)) (scan (first subs) (first llist) d dn (cons d llist)) ) ) ) (transform n d inner-ks hoistable dn allocated)Trap