I think of assembler as the preferred language for efficient recursive algorithms; as Gil points out, we already have standard macros to implement saving status as we chain deeper and restoring status as we climb back out. And we can avoid getmains at every level by acquiring memory for a stack as we enter the algorithm or using the hardware stack. It could be argued that assembler could implement recursion better because it would allow more levels due to the ability to code for minimal stack requirements and flexibility in stack location.
Gary Weinhold Senior Application Architect DATAKINETICS | Data Performance & Optimization Phone: +1.613.523.5500 x216<tel:+1.613.523.5500%20x216> Email: weinh...@dkl.com<mailto:weinh...@dkl.com> [http://www.dkl.com/wp-content/uploads/2015/07/dkl_logo.png]<http://www.dkl.com/> Visit us online at www.DKL.com<http://www.dkl.com/> [http://www.dkl.com/wp-content/uploads/2015/08/banner.png]<http://www.dkl.com/mailsig> E-mail Notification: The information contained in this email and any attachments is confidential and may be subject to copyright or other intellectual property protection. If you are not the intended recipient, you are not authorized to use or disclose this information, and we request that you notify us by reply mail or telephone and delete the original message from your mail system. __________ On 2018-02-07 09:50, Paul Gilmartin wrote: On 2018-02-06, at 23:34:29, Bernd Oppolzer wrote: Something important about these AVL trees which would make an ASSEMBLER implementation difficult (not impossible, of course) is the recursive nature of the problem. The searching is done using a recursive function which calls itself as often as the tree has levels. With ASSEMBLER, you would either have to change the algorithm or you would have to do all the bookkeeping of the recursive calls yourself (which both is about the same effort). Maybe you already have an existing mechanism for providing automatic variables in ASSEMBLER ... but you will still have to take care to stack the return addresses (and maybe base registers) of the search function ... Don't dynamically opbtained work areas and chained register save areas provide that function? -- gil