POV-Ray : Newsgroups : povray.off-topic : Emacs : Re: Emacs Server Time
30 Sep 2024 22:14:57 EDT (-0400)
  Re: Emacs  
From: Darren New
Date: 21 Apr 2009 17:41:35
Message: <49ee3d8f$1@news.povray.org>
Darren New wrote:
> nemesis wrote:
>> It is very difficult to write compilers that generate optimized native 
>> code as good as the ones already provided by mature C compilers that 
>> have been around for ages.
> 
> It depends on the language, of course. 

Here's a good example. Your CPU supports both decimal arithmetic and 
CISC-style opcodes that check array bounds and multiple-dimension-array 
calculations.  Like, say, the VAX.  You want to implement Ada, which 
supports both array bounds checking for multiple-dimension arrays and 
decimal arithmetic.  Those features probably won't be fast if you generate 
portable C, since there's no way to express "check the array bounds and 
either throw an exception or access the memory depending..." nor is there 
any way to say "Add these two strings of BCD digits and give me back a BCD 
number" that can compile down to one instruction.  In other words, on 
machines whose CPUs have been optimized to support what C supports, it's 
hard to outrun C.  On a machine optimized to support FORTH or Scheme, it's 
going to be hard to take a FORTH or Scheme compiler that outputs C and have 
it competitive with native code generation for that processor.

Ada also supports natively threads and interrupt handling, neither of which 
you can generate C to handle. So some languages simply cannot be translated 
to C in any sort of portable way.

-- 
   Darren New, San Diego CA, USA (PST)
   There's no CD like OCD, there's no CD I knoooow!


Post a reply to this message

Copyright 2003-2023 Persistence of Vision Raytracer Pty. Ltd.