|
|
Abstract Syntax Trees Rule!
written by Peter William Lount Version 1, 20040624 I must agree with Colin Putney regarding: Essential Code Implemented and Essential Code. Thanks for your post, The next coding revolution?, James. I've taken this Abstract Syntax/Parse Tree approach in the Zoku variant of Smalltalk. Amoung the many advantages is there are no byte codes. Byte code loose information that the compiler could use to produce better optimized native code. There are also many other advantages. I learned about this approach to representing programs and the advantages of no byte codes from a paper about Oberon a many years back. The authors of "A Tree-Based Alternative to Java Byte-Codes" ( P D F ) c l a i m t h a t : " . . . p e r f o r m a n c e p e n a l t i e s a r e n o t a n e c e s s a r y c o n s e q u e n c e o f m a c h i n e - i n d e p e n d e n c e , b u t r e l a t e d t o J a v a s p a r t i c u l a r i n t e r m e d i a t e r e p r e s e n t a t i o n . W e h a v e c o n s t r u c t e d a p r o t o t y p e a n d a r e f u r t h e r d e v e l o p i n g a s o f t w a r e t r a n s p o r t a b i l i t y s c h e m e f o u n d e d o n a t r e e - b a s e d a l t e r n a t i v e t o J a v a b y t e - c o d e s . T h i s t r e e - b a s e d i n t e r m e d i a t e r e p r e s e n t a t i o n i s n o t o n l y t w i c e a s c o m p a c t a s J a v a b y t e - c o d e s , b u t a l s o c o n t a i n s m o r e d e t a i l e d s e m a n t i c i n f o r m a t i o n , s o m e o f w h i c h i s c r i t i c a l f o r a d v a n c e d c o d e o p t i m i z a t i o n s . O u r a r c h i t e c t u r e n o t o n l y p r o v i d e s o n - t h e - f l y c o d e g e n e r a t i o n f r o m t h i s i n t e r m e d i a t e r e p r e s e n t a t i o n , b u t a l s o c o n t i n u o u s r e - o p t i m i z a t i o n o f t h e e x i s t i n g c o d e - b a s e b y a l o w - p r i o r i t y b a c k g r o u n d p r o c e s s . T h e r e - o p t i m i z a t i o n p r o c e s s i s g u i d e d b y u p - t o - t h e - m i n u t e p r o f i l i n g d a t a , l e a d i n g t o s u p e r i o r o p t i m i z a t i o n r e s u l t s . " T h e y g o o n t o c o n c l u d e : " . . . w e h a v e s h o w n , t h a t p o r t a b i l i t y a n d h i g h p e r f o r m a n c e n e e d n o t n e c e s s a r i l y b e i r r e c o n c i l a b l e . W e h a v e p r o p o s e d a n a l t e r n a t i v e i n t e r m e d i a t e r e p r e s e n t a t i o n t h a t i s b a s e d o n a b s t r a c t s y n t a x t r e e s r a t h e r t h a n o n l o w - l e v e l b y t e - c o d e s . T h i s i n t e r m e d i a t e r e p r e s e n t a t i o n , b u n d l e d w i t h a d y n a m i c r u n t i m e o p t i m i z e r a n d a n a d a p t i v e p r o f i l e r , b u i l d s t h e b a s i s f o r a d v a n c e d a n d a g g r e s s i v e o p t i m i z a t i o n s t h a t a r e d i f f i c u l t t o p e r f o r m o n a l o w e r - l e v e l r e p r e s e n t a t i o n m u c h o f e s s e n t i a l i n f o r m a t i o n i s l o s t i n t h e t r a n s i t i o n f r o m s o u r c e c o d e t o b y t e - c o d e s . W e h a v e s h o w n t h a t o u r c u r r e n t v e r s i o n o f t h e p r o p o s e d a r c h i t e c t u r e c a n c o m p e t e w i t h t o d a y s f a s t e s t j u s t - i n - t i m e c o m p i l e r s , a l t h o u g h n o o p t i m i z a t i o n s h a v e y e t b e e n i m p l e m e n t e d . " It's about degrees of freedom, not just in the language syntax, but also in the design and implementation of the virtual machines and object libraries as well. Every degree of freedom has a potental gain. It might also have a cost, that at first might seem like it can't be overcome, however innovation and creative thinking can usually turn up a solution that others haven't thought of yet. Or if they have you can often find a paper about it! ;--) Copyright 1 9 9 9 - 2 0 1 0 b y S m a l l t a l k . o r g "! , A l l R i g h t s R e s e r v e d . |
|