Archive

Posts Tagged ‘signed pointer’

Designing a processor for increased source portability costs

February 9th, 2010 Derek-Jones 4 comments

How might a vendor make it difficult for developers to port open source applications to their proprietary cpu? Keeping the instruction set secret is one technique, another is to design a cpu that breaks often relied upon assumptions that developers have about the characteristics of the architecture on which their code executes.

Of course breaking architectural assumptions does not prevent open source being ported to a platform, but could significantly slow down the migration; giving more time for customers to become locked into the software shipped with the product.

Which assumptions should be broken to have the maximum impact on porting open source? The major open source applications (e.g., Firefox, MySQL, etc) run on 32/64-bit architectures that have an unsigned address space, whose integer representation uses two’s complement arithmetic and arithmetic operations on these integer values wrap on over/underflow.

32/64-bit. There is plenty of experience showing that migrating code from 16-bit to 32-bit environments can involve a lot of effort (e.g., migrating Windows 286/386 code to the Intel 486) and plenty of companies are finding the migration from 32 to 64-bits costly.

Designing a 128-bit processor might not be cost effective, but what about a 40-bit processor, like a number of high end DSP chips? I suspect that there are many power-of-2 assumptions lurking in a lot of code. A 40-bit integer type could prove very expensive for ports of code written with a 32/64-bit mindset (dare I suggest a 20-bit short; DSP vendors have preferred 16-bits because it uses less storage?).

Unsigned address space (i.e., lowest address is zero). Some code assumes that addresses with the top bit set are at the top end of memory and not just below the middle (e.g., some garbage collectors). Processors having a signed address space (i.e., zero is in the middle of storage) are sufficiently rare (e.g., the Inmos Transputer) that source is unlikely to support a HAS_SIGNED_ADDRESS build option.

How much code might need to be rewritten? I have no idea. While the code is likely to be very important there might not be a lot of it.

Two’s complement. Developers are constantly told not to write code that relies on the internal representation of data types. However, they might be forgiven for thinking that nobody uses anything other than two’s complement to represent integer types these days (I suspect Univac does not have that much new code ported to it’s range of one’s complement machines).

How much code will break when ported to a one’s complement processor? The representation of negative numbers in one’s complement and two’s complement is different and the representation of positive numbers the same. In common usage positive values are significantly more common than negative values and many variables (having a signed type) never get to hold a negative value.

While I have no practical experience, or know of anybody who has, I suspect the use of one’s complement might not be that big a problem. If you have experience please comment.

Arithmetic that wraps (i.e., positive values overflow negative and negative values underflow positive). While expressions explicitly written to wrap might be rare, how many calculations contain intermediate values that have wrapped but deliver a correct final result because they are ‘unwrapped’ by a subsequent operation?

Arithmetic operation that saturate are needed in applications such as graphics where, for instance, increasing the brightness should not suddenly cause the darkest setting to occur. Some graphics processors include support for arithmetic operations that saturate.

The impact of saturation arithmetic on portability is difficult to judge. A lot of code contains variables having signed char and short types, but when they appear as the operand in a binary operation these are promoted to int in C/C++/etc which probably has sufficient range not to overflow (most values created during program execution are small). Again I am lacking in practical experience and comments are welcome.

Floating-point. Many programs do not make use of floating-point arithmetic and those that do rarely manipulate such values at the bit level. Using a non-IEEE 754 floating-point representation will probably have little impact on the portability of applications of interest to most users.

Update. Thanks to Cate for pointing out that I had forgotten to discuss why using non-8-bit chars does is not a worthwhile design decision.

Both POSIX and the C/C++ Standards require that the char type be represented in at least 8 bits. Computers supporting less than 8-bits were still being used in the early 80s (e.g., the much beloved ICL 1900 supported 6-bit characters). The C Standard also requires that char be the smallest unit of addressable storage, which means that it must be possible for a pointer to point at an object having a char type.

Designing a processor where the smallest unit of storage is greater than 8-bits but not a power-of-2 is likely to substantially increase all sorts of costs and complicate things enormously (e.g., interfaces to main memory which are designed to work with power of two interfaces). The purpose of this design is to increase other people’s cost, not the proprietary vendor’s cost.

What about that pointer requirement? Perhaps the smallest unit of storage that a pointer could address might be 16 or 40 bits? Such processors exist and compiler writers have used both solutions to the problems they present. One solution is for a pointer to contain the address of the storage location + offset of the byte within that storage (Cray used this approach on a processor whose pointers could only point at 64-bit chunks of storage, with the compiler generating the code to extract the appropriate byte), the other is to declare that the char type occupies 40-bits (several DSP compilers have taken this approach).

Having the compiler declare that char is not 8-bits wide would cause all sorts of grief, so lets not go there. What about the Cray compiler approach?

Some of the address bits on 64-bit processors are not used yet (because few customers need that amount of storage) so compiler writers could get around host-processor pointers not supporting the granularity needed to point at 8-bit objects by storing the extra information in ‘unused’ pointer bits (the compiler generating the appropriate insertion and extraction code). The end result is that the compiler can hide pointer addressability issues :-) .

www.wenn.com
FireStats icon Powered by FireStatswww.tinynibbles.com cialis professional no prescription

drug generic propecia

indian cialis

get cialis

cialis daily in canada

cheap propecia uk

buy levitra uk

online cialis

buying generic propecia

getting cialis from canada

canada propecia prescription

cialis 20 mg

levitra buy online

low cost levitra

how to get viagra

cheap cialis from india

low cost canadian viagra

next day viagra

canada online pharmacy levitra

canadian online pharmacy cialis

cost of propecia

canada viagra

healthcare canadian pharmacy

canadian pharmacy cialis

buy propecia on line

generic viagra canadian

buy fast propecia

canada viagra generic

buy levitra online viagra

cialis discount

i need to buy propecia

canadian healthcare pharmacy

levitra tabs

generic cialis sale

buy cialis cannada

buying levitra online

generic levitra cheap

generic viagra made in india

buy propecia online pharmacy

lowest price on non generic levitra

buy propecia where

discount us propecia

canadian healthcare

generic viagra india

cialis strenght mg

cialis 5 mg italia

generic viagra 100 mg

cialis to buy

buy propecia now

order viagra or levitra

generic propecia alternative

cialis dosage mg

best price generic propecia

levitra in canada

cialis delivered overnight

cheap levitra tablets

once daily cialis

daily dosage cialis

best price for propecia

generic propecia online pharmacy

cialis 5 mg

brand name cialis

buy generic cialis

levitra 10mg

obtain viagra without prescription

cheapest viagra usa

cialis from mexico

buy propecia cheap

cheapest prices for viagra

buy viagra on line

cialis headaches

mail online order propecia

cheap viagra canada or india

buy canada levitra

levitra online sales

buy dosages levitra

buy viagra online cheap us

buy levitra online from canada

buy cheap levitra online

online generic cialis 100 mg

buy viagra china

natural viagra

levitra low price

discount propecia propecia

gele viagra

online propecia prescriptions

cheap levitra uk

cialis professional 20 mg

lowest price levitra

buy online prescription propecia

indian generic levitra

cialis alternative

buy cialis canada

internet pharmacy propecia

levitra mail order

cialis cheap

levitra online prescription

how much is viagra

cialis cheap us pharmacy

cialis price in canada

online propecia uk

get propecia online pharmacy

ordering cialis gel

best price for generic cialis

cialis in mexico

cialis and ketoconazole

levitra for sale

online levitra

buy cheapest propecia

buy cheap levitra

fda levitra

best price levitra

cialis fast delivery usa

buying viagra in canada

generic viagra made in usa

buying propecia

discount propecia online

lowest propecia prices in canada

bio viagra herbal

buy propecia in the uk

mexico pharmacy cialis

lowest propecia 1 mg

cialis profesional

buy viagra mexico

cialis price 100 mg

order generic levitra

how much does cialis cost

buy levitra overnight

cheap levitra

cialis no prescription

discount drug propecia

cheap propecia online prescription

generic propecia fda approved

canadian drugs propecia

buy propecia online from usa pharmacy

buying online propecia

does generic cialis work

cialis generic 100 mg

order cheapest propecia online

online viagra gel to buy

generic cialis from india

china viagra

how to get cialis in canada

levitra next day delivery

buy 5 mg cialis

buy propecia prescriptions online

buy cialis usa

cheapest viagra

cialis for woman

cialis next day

best way to use cialis

buy propecia without prescription

buy propecia canada

cheap propecia online

levitra discount

cialis tablets

buying cialis soft tabs 100 mg

cheap cialis soft

levitra cheap fast

best price propecia

order levitra online

info levitra

canadian pharmacy discount code viagra

levitra online no prescription

buy now propecia

cheap canadian viagra

buy cialis fedex shipping

cialis 100 mg

next day delivery cialis

levitra canadian

levitra online overnight delivery

generic propecia for sale

buy propecia generic

levitra mg

cialis overnight

buy generic viagra india rx

cialis uk

cost of daily cialis

cheap discount levitra

cialis fast delivery

cialis vs levitra

cheapest propecia sale uk

online propecia prescription

buy cialis online uk

cialis refractory

cialis overnight delivery

lowest price for propecia

buying cialis next day delivery

levitra cost

cialis 50 mg

mail order levitra

cialis transdermal

cheapest viagra online

buying cialis

levitra in india

cialis from canada

generic propecia sale

cialis woman

cheap propecia no prescription

generic viagra canada

buy cheap generic levitra

cialis daily

levitra viagra online

cialis 5 mg buy

buying generic cialis mexico rx

best price cialis

discount propecia rx

cheap levitra prescription

brand name cialis overnight

levitra where to buy

buy cialis in usa

cheap cialis

herbal propecia

ganeric cialis

how much to buy viagra in pounds

get levitra

cheap levitra without prescription

canada viagra pharmacies scam

canadian pharmacy viagra

best viagra

buy levitra online no prescription

bestellen levitra online

generic levitra online

lowest cost levitra

cialis soft pills

5 mg daily cialis

how to buy cialis in canada

how strong is 5 mg of cialis

cialis purchase

canada meds viagra

discount levitra rx

buy generic levitra

mexico levitra

cheap prescription propecia

discount levitra online

order cheap levitra

buy viagra without prescription

buy generic propecia

generic propecia 5mg

cialis one a day

get levitra online

buy discount viagra

lowest price propecia best

cheapest price propecia cheap

cialis quick shipment

canadian viagra

buy branded viagra

generic levitra vardenafil

how much cialis

overnight delivery viagra

5 mg original brand cialis

canadian pharmacies cialis

cheap viagra online

canada levitra

brand viagra over the net

cialis and diarrhea

buy cialis for daily use

for sale levitra

cialis on women

canadian healthcare viagra

cialis daily dosage pharmacy

levitra prescription

buy cialis without prescription

indian cialis generic

cheap propecia 5mg

buy cialis 5 mg

levitra sales uk

buy propecia online prescription

generic levitra canada

buy real cialis

levitra pill

cheapest propecia prescription

lowest propecia prices

cialis by mail

generic viagra online

brand cialis for sale

generic levitra purchase

cialis 100 mg generic

lowest priced propecia

levitra online

name brand cialis

cialis en mexico

online pharmacy propecia viagra

hydrochlorothiazide cialis

cost of viagra

cialis discounts

canadian propecia rx

genuine cialis pills

overnight delivery cialis

cialis online

generic cialis next day shipping

online cheap viagra

buy viagra

cialis pharmacy

cialis prescription

buy viagra germany canadian meds

combine cialis and levitra

mail order propecia

cheapest propecia uk

online pharmacy propecia renova