tag:blogger.com,1999:blog-1862878851303132605.post3415146530645707018..comments2023-06-07T10:48:04.238-04:00Comments on Notes on the LHC: Functions in Haskell.SamBhttp://www.blogger.com/profile/06560268240719951351noreply@blogger.comBlogger13125tag:blogger.com,1999:blog-1862878851303132605.post-308119634669375962009-01-23T00:28:00.000-05:002009-01-23T00:28:00.000-05:00jcpetruzza:Yes, it turned out to be impractical.jcpetruzza:<BR/><BR/>Yes, it turned out to be impractical.David Himmelstruphttps://www.blogger.com/profile/12982136700651117492noreply@blogger.comtag:blogger.com,1999:blog-1862878851303132605.post-17712418725769115032009-01-22T20:38:00.000-05:002009-01-22T20:38:00.000-05:00I thought jhc was to use some form of memory regio...I thought jhc was to use some form of memory region inference instead of garbage collection.... whatever happened to that? did it turn out to be impractical?jcpetruzzahttps://www.blogger.com/profile/01921183445658987621noreply@blogger.comtag:blogger.com,1999:blog-1862878851303132605.post-4280699631860980932009-01-20T22:06:00.000-05:002009-01-20T22:06:00.000-05:00I will definitely do some experiments when the NCG...I will definitely do some experiments when the NCG is ready.David Himmelstruphttps://www.blogger.com/profile/12982136700651117492noreply@blogger.comtag:blogger.com,1999:blog-1862878851303132605.post-64431417260332886872009-01-20T20:57:00.000-05:002009-01-20T20:57:00.000-05:00I don't understand which upto you're talking about...I don't understand which upto you're talking about. The one in you example? It does 5 memory writes.<BR/>BTW, doesn't it need to evaluate from and to as well?<BR/>Or does your strictness analysis figure out that it doesn't have to?<BR/><BR/>I suggest you translate these little functions to assembly code, and try with and without saving b. That would be an experiment, rather than opinions (which I'm equally full of :).augustsshttps://www.blogger.com/profile/07327620522294658036noreply@blogger.comtag:blogger.com,1999:blog-1862878851303132605.post-87696204946736343522009-01-20T19:05:00.000-05:002009-01-20T19:05:00.000-05:00augustss:The 'upto' call does some register fiddli...augustss:<BR/><BR/>The 'upto' call does some register fiddling + a write main memory. A stack allocation does a bit less register fiddling + a smaller write to main memory. My point is that a stack allocation is conceptually very similar to the code we're interested in running.<BR/><BR/>I'm betting that function calls are small and numerous, and that machines will get more and more registers over time.David Himmelstruphttps://www.blogger.com/profile/12982136700651117492noreply@blogger.comtag:blogger.com,1999:blog-1862878851303132605.post-36669466016889288972009-01-20T17:39:00.000-05:002009-01-20T17:39:00.000-05:00augustss:He has an AMD64 and it's giving him delus...augustss:<BR/>He has an AMD64 and it's giving him delusions of having enough registers for anything ;-P.SamBhttps://www.blogger.com/profile/06560268240719951351noreply@blogger.comtag:blogger.com,1999:blog-1862878851303132605.post-84227568230354604882009-01-20T17:26:00.000-05:002009-01-20T17:26:00.000-05:00I don't understand. How can a stack allocation be...I don't understand. How can a stack allocation be almost as expensive as the call to upto?<BR/>The call to upto involves a call instruction, a comparison (if the from and to values are boxed this also involves memory loads), then a heap pointer compare, 5 stores to the heap, and some return stuff.<BR/>That's a fair number of instructions, the push and pop of b is maybe at most 10% of those instructions.<BR/>That's assuming 'print a' doesn't need to save b because it's running out of registers. In the X86 it most likely will, so saving b in showMyList will cost you nothing extra.<BR/>Only if 'print' happens to be exceedingly simple would you loose.augustsshttps://www.blogger.com/profile/07327620522294658036noreply@blogger.comtag:blogger.com,1999:blog-1862878851303132605.post-21462531763493531842009-01-20T17:20:00.000-05:002009-01-20T17:20:00.000-05:00Ooops, I take it back. The from variable is obvio...Ooops, I take it back. The from variable is obviously evaluated. No problem there.augustsshttps://www.blogger.com/profile/07327620522294658036noreply@blogger.comtag:blogger.com,1999:blog-1862878851303132605.post-51302941802322859552009-01-20T17:18:00.000-05:002009-01-20T17:18:00.000-05:00How come you put (from+1) in heap[3]?Some global k...How come you put (from+1) in heap[3]?<BR/>Some global kind of strictness analysis could do this, but if it's very conservative I think you'd need to build a closure for (from+1) instead.augustsshttps://www.blogger.com/profile/07327620522294658036noreply@blogger.comtag:blogger.com,1999:blog-1862878851303132605.post-91262769508326522122009-01-20T15:04:00.000-05:002009-01-20T15:04:00.000-05:00As of yet, we only perform a very conservative str...As of yet, we only perform a very conservative strictness analysis. Further exploration of this is needed.David Himmelstruphttps://www.blogger.com/profile/12982136700651117492noreply@blogger.comtag:blogger.com,1999:blog-1862878851303132605.post-88302058380580057052009-01-20T13:23:00.000-05:002009-01-20T13:23:00.000-05:00How aggressive is the strictness analysis?How aggressive is the strictness analysis?Wei Huhttps://www.blogger.com/profile/13683552196436356037noreply@blogger.comtag:blogger.com,1999:blog-1862878851303132605.post-68749404737617736382009-01-20T12:21:00.000-05:002009-01-20T12:21:00.000-05:00Wei Hu:LHC uses whole-program optimizations. If th...Wei Hu:<BR/><BR/>LHC uses whole-program optimizations. If there is more than one possibility for 'lst' then we would look at the tag to determine which function to run. It would look something like this 'case tag of Fupto from to -> upto from to; Fotherfunc a b c -> otherfunc a b c'.<BR/><BR/>Making all function calls explicit means we can use very fast calling conventions.David Himmelstruphttps://www.blogger.com/profile/12982136700651117492noreply@blogger.comtag:blogger.com,1999:blog-1862878851303132605.post-13832736980633096162009-01-20T03:04:00.000-05:002009-01-20T03:04:00.000-05:00Great post. I got one question though.When showMyL...Great post. I got one question though.<BR/><BR/>When showMyList fetches the lst pointer, supposedly lst points to a generic thunk. But here you assumed the thunk must be a call to upto. Did you skip the details for ease of representation, or was there other things I didn't know of?Wei Huhttps://www.blogger.com/profile/13683552196436356037noreply@blogger.com