🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: comp.lang.misc
Article #1940

Re: Aggressive optimization

#1940
From: Dan Bernstein
Date: Tue, 06 Nov 1990 20:48
23 lines
1433 bytes
In article <6PX6-O@xds13.ferranti.com> peter@ficc.ferranti.com (Peter da Silva) writes:
> What's wrong with:
> 	if(array_a_and_array_b_overlap)
> 		use_safe_code
> 	else
> 		use_fast_code_that_doesn't_work_for_aliased_arrays.

Yes, that's what I've been trying to convince Jim of for most of this
year. Note that it cannot be implemented portably in C---remember my
question a while back in comp.lang.c about whether there was any way to
detect whether a pointer was within a given array[n]? The answer is that
there isn't, and you need a language extension to do it right.

However, a smart compiler can perform this optimization automatically. In
most cases it can do the test at compile time, and generate calls to
either the fast compiled version or the slow compiled version. I don't
know why Jim repeatedly insists this is impossible.

> The whole alias problem is a compiler technology problem.

Exactly.

---Dan
Technical Details
Message-ID: <7177:Nov620:48:1590@kramden.acf.nyu.edu>
Path: arc1-ca.pugleaf.net!utzoo!utgpu!news-server.csri.toronto.edu!rutgers!att!linac!pacific.mps.ohio-state.edu!zaphod.mps.ohio-state.edu!wuarchive!udel!haven!adm!cmcl2!kramden.acf.nyu.edu!brnstnd
References: <2701@l.cc.purdue.edu> <5009@lanl.gov> <6PX6-O@xds13.ferranti.com>

Show Full Headers
Complete Article Headers
Path: arc1-ca.pugleaf.net!utzoo!utgpu!news-server.csri.toronto.edu!rutgers!att!linac!pacific.mps.ohio-state.edu!zaphod.mps.ohio-state.edu!wuarchive!udel!haven!adm!cmcl2!kramden.acf.nyu.edu!brnstnd
From: brnstnd@kramden.acf.nyu.edu (Dan Bernstein)
Newsgroups: comp.lang.misc
Subject: Re: Aggressive optimization
Message-ID: <7177:Nov620:48:1590@kramden.acf.nyu.edu>
Date: 6 Nov 90 20:48:15 GMT
References: <2701@l.cc.purdue.edu> <5009@lanl.gov> <6PX6-O@xds13.ferranti.com>
Organization: IR
Lines: 23