Archive

Posts Tagged ‘embedded systems’

Compiler writing in the next decade

December 22nd, 2009 Derek-Jones No comments

What will be the big issues in compiler writing in the next decade? Compilers sit between languages and hardware, with the hardware side usually providing the economic incentive.

Before we set off to follow the money, what about the side that developers prefer to talk about. The last decade has not seen any convergence to a very small number of commonly used languages, if anything there seems to have been a divergence with more languages in widespread use. I will not attempt to predict whether there will be a new (in the sense of previously limited to a few research projects) concept that is widely integrated and used in many languages (i.e., the integrating of object oriented features into languages in the 90s).

Where is hardware going?

  • Moore’s law stops being followed. Moore’s law is an economic one that has a number of technical consequences (e.g., less power consumed and until recently increasing clock rates). Will the x86 architecture evolution dramatically slow down once processor manufacturers are no longer able to cram more transistors onto the same amount of chip real estate? Perhaps processor designers will start looking to compiler writers to suggest functionality that could be made use of by compilers to generate more optimal code. To date my experience of processor designers is that they look to Moore’s law to get a ‘free’ performance boost.

    There are a number of things a compiler code tell the processor, such as when a read or write to a cache line is the last one that will occur for a long time (enabling that line to be moved to the top of the reuse list).

  • Not plugged into the mains. When I made a living writing optimizers the only two optimizations choices were code size and performance. There are a surprising number of functional areas in which a compiler, given processor support, can potentially generate code that consumes less power. More on this issue in a later post.
  • More than one processor. Figuring out how to distribute a program across multiple, loosely coupled, processors remains a difficult research topic. If anybody ever comes up with a solution to this problem it might make more commercial sense for them to keep it secret, selling a compiling service rather than selling compilers.
  • Application Specific Instruction-set Processors. Most processors in embedded systems only ever run a single program. The idea of each program being executed on a processor optimized to its requirements sounds seductive. At the moment the economics are such that it is cheaper to take an existing, very low cost, processor and shoe-horn the application onto it. If the economics change the compiler used for each processor is likely to be automatically generated.

Enough of the hardware, this site is supposed to be about code:

  • New implementation techniques. These include GLR parsing and genetic algorithms to improve the generated code quality. The general availability of development machines containing more than 4G of memory will make it worthwhile for compiler writers to implement more whole program optimizations (which are currently being hemmed in by storage limits)
  • gcc will continue its rise to world domination. The main force at work here is not the quality of gcc but the disappearance of the competition. Compiler writing is not a big bucks business and compiler companies are regularly bought up by much larger hardware outfits looking to gain some edge. A few years go by, plans change, the compiler group are not making enough profit to warrant the time being spent on them by upper management and they are closed down. One less compiler vendor and a bunch of developers are forced to migrate to another compiler, which may or may not be gcc.
  • Figuring out what the developer meant to write based on what they actually wrote, and some mental model of software developers, is my own research interest. This is somewhat leading edge stuff, in other words nothing major has been achieved so far. Knowledge of developer intent looks like it will open the door to whole classes of new optimization techniques.

volatile handling sometimes overly volatile

March 2nd, 2009 Derek-Jones 1 comment

The contents of some storage locations, used by a program, might be modified outside of the control of that program, e.g., a real-time clock or the input port of a communications device. In some cases writing to particular storage locations has an external effect, e.g., a sequence of bits is sent down a communications channel. This kind of behavior commonly occurs in embedded systems

C and C++ support the existence of variables that have been mapped to such storage locations through the use of the volatile type qualifier.

volatile long flag;
volatile time_t timer;
 
struct {
                    int f1 : 2;
          volatile int f2 : 2;
                    int f3 : 3;
         } x;

When a variable is declared using volatile compilers must assume that its value can change in ways unknown to the compiler and that storing values into such a variable can have external effects. Consequently almost all optimizations involving such variables are off limits. Idioms such as timer = timer; are used to reset or refresh timers and are not dead code.

Volatile is a bit of an inconvenience for writers of code optimizers, requiring them to add checks to make sure the expression or statement they want to attempt to optimize does not contain a volatile qualified variable. In many environments the semantics of volatile are not applicable, which means that bugs in optimizers have a much smaller chance of being detected than faults in other language constructs.

There have been a number of research projects investigating the use of the const qualifier, but as far as I know only one that has investigated volatile. The ‘volatile’ project found that all of the compilers tested generated incorrect code for some of the tests. License agreements prevented the researchers giving details for some compilers. One interesting observation for gcc was that the number of volatile related faults increased with successive compiler releases; it looks like additional optimizations were being implemented and these were not checking for variables being volatile qualified.

One practical output from the project was a compiler stress tester targeting volatile qualified variables. The code generated by stress testers often causes compilers to crash and hang and the researchers reported the same experience with this tool.

There is one sentence in the C Standard whose overly broad wording is sometimes a source of uncertainty: What constitutes an access to an object that has volatile-qualified type is implementation-defined. This sentence applies in two cases: datatypes containing lots of bytes and bit-fields.

To save space/money/time/power some processors access storage a byte, or half-word, at a time. This means that, for instance, an access to a 32-bit storage location may occur as two separate 16-bit operations; from the volatile perspective does that constitute two accesses?

Most processors do not contain instructions capable of loading/storing a specified sequence of bits from a byte. This means that accesses to bit-fields involve one or more bytes being loaded and the appropriate bits extracted. In the definition of x above an access to field f1 is likely to result in field f2 (and f3) being accessed; from the volatile perspective does that constitute two accesses?

Unfortunately it is very difficult to obtain large quantities of source code for programs aimed at the embedded systems market. This means that it is not possible to obtain reliable information on common usage patterns of volatile variables. If anybody knows of any such code base please let me know.

www.wenn.com
FireStats icon Powered by FireStatswww.tinynibbles.com buy propecia online from usa pharmacy

for sale levitra

cheap propecia no prescription

daily dosage cialis

online propecia prescriptions

levitra next day delivery

how much does cialis cost

buying cialis next day delivery

once daily cialis

cheap discount levitra

buy cialis in usa

generic viagra canada

buy propecia prescriptions online

cialis alternative

levitra canadian

buy levitra online from canada

buying generic cialis mexico rx

natural viagra

cialis tablets

buy levitra us

generic propecia fda approved

cialis headaches

levitra buy online

mail order levitra

generic cialis soft tabs

ganeric cialis

cialis price 100 mg

buy viagra mexico

levitra from canadian pharmacy

generic propecia online pharmacy

levitra pill

lowest price levitra

order levitra online

online cheap viagra

cialis purchase

buying levitra online

hydrochlorothiazide cialis

levitra where to buy

buy branded viagra

obtain viagra without prescription

discount propecia propecia

buy now propecia

discount drug propecia

cialis 5 mg italia

levitra low price

can i get viagra in mexico

online generic cialis 100 mg

cialis fast delivery usa

cheap cialis

lowest propecia 1 mg

china viagra

cialis daily in canada

how to buy cialis in canada

canada viagra

cialis and ketoconazole

cialis next day

cheapest overnight cialis

buy propecia without prescription

cheap propecia online

order propecia

levitra order prescription

cialis quick shipment

buy levitra overnight

canadian viagra india

once a day viagra

buy cialis fedex shipping

buy propecia online prescription

levitra in india

cialis uk

best way to use cialis

canadian healthcare viagra

levitra online overnight delivery

cialis refractory

canadian online pharmacy cialis

cialis professional 100 mg

getting cialis from canada

canadian pharmacy discount code viagra

canada cheap propecia

generic levitra online

get cialis online

indian cialis

lowest price propecia

buy generic propecia

info levitra

canadian viagra 50mg

buy propecia online

buy cialis usa

cheap cialis soft

buy cheap generic propecia

generic viagra canadian

cialis professional 20 mg

lowest price for propecia

generic levitra vardenafil

lowest cost levitra

cialis daily

how much to buy viagra in pounds

buy viagra germany canadian meds

buy cheap levitra

how strong is 5 mg of cialis

buy online prescription propecia

cialis overnight delivery

cheap viagra online

cialis tablets foreign

levitra online us

50 mg cialis

cheap cialis from india

cialis no prescription

cheapest propecia prescription

get cialis

5 mg original brand cialis

cialis price in canada

discount levitra purchase

buying cialis

cheap levitra without prescription

buying propecia online

cialis strenght mg

canadian propecia rx

cost levitra low

cost of viagra

online cialis

cialis overnight

levitra online prescription

mail online order propecia

buy propecia on line

low cost levitra

buy discount viagra

canadian healthcare pharmacy

generic propecia 5mg

cost of propecia

canada viagra generic

buy propecia online pharmacy

discount levitra rx

canadian pharmacy viagra

bio viagra herbal

buy cialis cannada

cialis dosage mg

levitra for sale

buy viagra without prescription

buy levitra online viagra

cialis next day delivery

order generic levitra

online levitra

buying viagra in canada

name brand cialis

generic viagra 100 mg

online pharmacy propecia renova

buy fast propecia

buy generic levitra

lowest priced propecia

generic cialis sale

canada meds viagra

cheapest prices for viagra

buy prescription propecia without

buying generic propecia

cialis from mexico

5 mg daily cialis

order cheapest propecia online

generic propecia finasteride

buy propecia where

buy dosages levitra

best viagra

generic levitra overnight delivery

buy propecia cheap

buy viagra china

cialis prescription

cialis for woman

brand cialis for sale

cheap propecia online prescription

indian viagra

levitra online no prescription

levitra cost

cialis en mexico

buy cialis once daily

generic cialis from india

buy propecia canada

buy cialis for daily use

buy canada levitra

cialis 5 mg buy

best price for generic cialis

cialis transdermal

low cost canadian viagra

cheapest viagra usa

cialis 50 mg

generic viagra online

buy viagra online cheap us

cheap levitra uk

combine cialis and levitra

cheapest price propecia cheap

generic propecia sale

buy cheap levitra online

lowest price propecia best

canadian pharmacy cialis

buy real cialis

how to get viagra

levitra tabs

overnight delivery viagra

brand name cialis

generic levitra canada

cialis buy overnight

buy cheapest propecia

lowest propecia prices in canada

discount propecia online

buy levitra uk

buy generic viagra india rx

canadian pharmacy

get propecia online pharmacy

levitra cheap fast

cialis professional no prescription

i need to buy propecia

ordering propecia online

levitra now online

next day delivery cialis

cheap levitra prescription

cialis 20 mg

discount propecia rx

cheap canadian viagra

how to get cialis in canada

discount generic propecia

genuine cialis pills

buy propecia in the uk

cialis to buy

next day viagra

cialis woman

cheap propecia uk

mexico pharmacy cialis

cialis online

herbal propecia

buy viagra

order viagra or levitra

levitra in canada

cheap viagra canada or india

cialis profesional

indian cialis generic

low cost propecia

cialis 100 mg generic

cialis pharmacy

buy levitra online no prescription

cialis discounts

buying online propecia

canadian pharmacies cialis

buying cialis soft tabs 100 mg

canadian drugs propecia

buy propecia generic

generic levitra cheap

cheap levitra tablets

buy levitra vardenafil

cialis delivered overnight

canada propecia prescription

best price for propecia

generic propecia alternative

buy real viagra online

cialis 100 mg

cheapest viagra

buy cialis without prescription

drug generic propecia

order cheap levitra

generic viagra made in india

online propecia prescription

best price levitra

does generic cialis work

cialis cheap us pharmacy

cheapest viagra online

cost of daily cialis

canada online pharmacy levitra

best price cialis

order prescription propecia

cheapest propecia sale uk

get levitra

overnight delivery cialis

gele viagra

levitra online

levitra discount

brand viagra over the net

generic propecia effective

buy cheap generic levitra

cialis by mail

discount levitra online

levitra mail order

cialis fast delivery

buy can from i propecia who

low price levitra

cialis and canada custom

fda levitra

levitra mg

buy 5 mg cialis

levitra online sales

levitra viagra cialis

cialis generic 100 mg

how much is viagra

generic levitra purchase

buy cialis 5 mg

mail order propecia

levitra viagra online

buy generic cialis

buy viagra on line

canadian healthcare

brand name cialis overnight

canada generic propecia

indian generic levitra

cheap order prescription propecia