<?xml version="1.0" encoding="UTF-8"?>
<!-- generator="wordpress/1.5.2" -->
<rss version="2.0" 
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
>

<channel>
	<title>Airs - Ian Lance Taylor</title>
	<link>http://www.airs.com/blog</link>
	<description>Ian Lance Taylor</description>
	<pubDate>Sat, 17 May 2008 01:15:38 +0000</pubDate>
	<generator>http://wordpress.org/?v=1.5.2</generator>
	<language>en</language>

		<item>
		<title>Monotheism</title>
		<link>http://www.airs.com/blog/archives/193</link>
		<comments>http://www.airs.com/blog/archives/193#comments</comments>
		<pubDate>Sat, 17 May 2008 01:15:38 +0000</pubDate>
		<dc:creator>Ian Lance Taylor</dc:creator>
		
	<category>Philosophy</category>
		<guid>http://www.airs.com/blog/archives/193</guid>
		<description><![CDATA[	When I was in grade school we were taught that monotheism was a historical advance, comparable to agriculture or other notable inventions.  For example, we learned that Akenhaten was a significant figure because he was the first historical figure to advocate monotheism, although it was later repudiated by his successor Tutankhaten aka Tutankhamun aka [...]]]></description>
			<content:encoded><![CDATA[	<p>When I was in grade school we were taught that monotheism was a historical advance, comparable to agriculture or other notable inventions.  For example, we learned that Akenhaten was a significant figure because he was the first historical figure to advocate monotheism, although it was later repudiated by his successor Tutankhaten aka Tutankhamun aka King Tut.  (Akenhaten lived about two centuries before the first historical evidence of Judaism; Freud suggested that Moses was actually a monotheistic priest during the reign of Akenhaten).  Even in grade school this argument seemed vaguely suspect to me.  The advantages of agriculture seem clear, the advantages of monotheism less so.</p>
	<p>These days I do see monotheism as something of an advance.  The earliest cultures we know of believed in gods who were much like people, albeit people who were both powerful and sometimes unpredictable.  In some cases the gods were simply ancestors.  I think this is a natural consequence of our tendency to attribute events to causes.  When we want to understand the weather, our impulse is to give it a personality and motivations.  It&#8217;s only a small step to think that there is a powerful person&#8211;a god&#8211;who controls the weather.</p>
	<p>This then becomes an obstacle to actually understanding what is happening.  If you already have an explanation for the weather, and your explanation inherently incorporates unpredictability, there is little purpose to looking for a deeper explanation.  Since I do think that scientific thought is an advance in human culture, it follows that these early religions prevented advances.</p>
	<p>Monotheism reduces the mass of gods to just one.  This god still controls the weather, but now there is just one entity that you have to understand.  It becomes possible to seriously think about god&#8217;s will and hope to reach some conclusions about it.  As thinking progresses, the god becomes more abstract&mdash;created the whole world, pays attention to everything&mdash;and it becomes easier to think in terms of fixed laws rather than whims.  It&#8217;s still a big step to get to science, but it&#8217;s more feasible, and monotheism may be a necessary stopping point.</p>
	<p>I was reminded of this line of thought while reading about the Gospel of Judas.  Today I don&#8217;t see how it&#8217;s possible to see Judas as anything but a patsy&mdash;hence his lyric from Jesus Christ Superstar &#8220;I only did what you wanted me to.&#8221;  The Gospel of Judas doesn&#8217;t really present him that way, but it does suggest that Judas was himself a human sacrifice to Christ.  This was, after all, a time when animal sacrifices to the gods were routine, though not a practice of the Christians.  The Gospel of Judas was an alternate view of the Christ story, one that was suppressed by the early church as they coalesced on a single view of the religion.  Ditching the Gospel of Judas was a good move, since it seems pretty complicated.  Anyhow, reading about it reminded me that there is a lot of contingency in the religions that we have today.  Monotheism may have been an advance in retrospect, but, unlike agriculture, it wasn&#8217;t an advance at the time.  I don&#8217;t see any reason to think that things could not have gone otherwise.
</p>
]]></content:encoded>
			<wfw:commentRSS>http://www.airs.com/blog/archives/193/feed/</wfw:commentRSS>
	</item>
		<item>
		<title>Layered Programming</title>
		<link>http://www.airs.com/blog/archives/192</link>
		<comments>http://www.airs.com/blog/archives/192#comments</comments>
		<pubDate>Thu, 15 May 2008 01:18:30 +0000</pubDate>
		<dc:creator>Ian Lance Taylor</dc:creator>
		
	<category>Programming</category>
		<guid>http://www.airs.com/blog/archives/192</guid>
		<description><![CDATA[	Many programs today are written at a very high level.  They are run in an interpreted environment, not a compiler.  Often many different components running in different interpreted environments are hooked together.  HTML and XML, for example, started out as markup languages, but now they are often also used as components of [...]]]></description>
			<content:encoded><![CDATA[	<p>Many programs today are written at a very high level.  They are run in an interpreted environment, not a compiler.  Often many different components running in different interpreted environments are hooked together.  HTML and XML, for example, started out as markup languages, but now they are often also used as components of programs hooking together the output of different servers.</p>
	<p>Computer programming has always been based on layering and abstraction.  The processor abtracts the transistor, the traditional programming language abstracts the processor, the kernel abstracts the hardware.  What seems fairly new to me is the speed at which these layers change and their complexity.  New ideas are implemented in the form of extensive libraries.  Each library can be learned in isolation, but there is no unifying principle across libraries.</p>
	<p>It is becoming increasingly difficult to be a systems expert.  When I learned to program, it was possible to understand your entire program from the source code, in whatever language, down to the machine code.  When writing a modern Ajax application, that is simply impossible.  There are too many different interpreters.  There is too much code involved.  Even fixing on a new base level above the processor&#8211;perhaps the browser&#8211;doesn&#8217;t help.  This all leads to decreased performance, which is sometimes important, and decreased security, which is often important.</p>
	<p>We can&#8217;t go back.  What I wonder is whether we will again cohere to a programming model which can be understood at all relevant layers.  Or whether things are just going to get increasingly complicated.
</p>
]]></content:encoded>
			<wfw:commentRSS>http://www.airs.com/blog/archives/192/feed/</wfw:commentRSS>
	</item>
		<item>
		<title>Peer Review</title>
		<link>http://www.airs.com/blog/archives/191</link>
		<comments>http://www.airs.com/blog/archives/191#comments</comments>
		<pubDate>Wed, 14 May 2008 00:53:44 +0000</pubDate>
		<dc:creator>Ian Lance Taylor</dc:creator>
		
	<category>Programming</category>
		<guid>http://www.airs.com/blog/archives/191</guid>
		<description><![CDATA[	Peer review can be a useful technique when programming.  It ensures that at least one other person has read the code.  It can catch dumb bugs and help ensure that the code is not unnecessarily obscure.  Several popular programming methodologies use it.  (Pair programming has the same benefits.)
	Peer review has one [...]]]></description>
			<content:encoded><![CDATA[	<p>Peer review can be a useful technique when programming.  It ensures that at least one other person has read the code.  It can catch dumb bugs and help ensure that the code is not unnecessarily obscure.  Several popular programming methodologies use it.  (Pair programming has the same benefits.)</p>
	<p>Peer review has one obvious disadvantage: it slows down coding.  In order for peer review to be meaningful, you have to present digestible chunks for review.  And that<br />
mean waiting for the review, or using some sort of patch management to permit continued coding until the review is complete and to incorporate changes suggested by the review.</p>
	<p>I generally have not worked on project that require peer review.  The gcc project requires maintainer approval of all changes, but maintainers are permitted to commit their own changes without review.  I can see the advantages of a peer review system, provided there is some mechanism to ensure that reviews happen quickly.  If reviews can linger, then projects can stall very quickly.</p>
	<p>gcc has a difficult enough time getting patches reviewed as it is.  It&#8217;s hard to recommend anything which would make it slower.  One approach that might make it more acceptable would be to say that if a maintainer writes a patch, the peer review can be done by anybody&#8211;it would not have to be another maintainer.  That is, require a reviewer for every patch, but only require that either the author or the reviewer be a maintainer.</p>
	<p>I&#8217;m not sure whether this would be a good idea or not.  It would be good to improve the quality of the gcc code base, but the quality is not so bad that drastic measures are required.  Only a small additional cost would be acceptable.
</p>
]]></content:encoded>
			<wfw:commentRSS>http://www.airs.com/blog/archives/191/feed/</wfw:commentRSS>
	</item>
		<item>
		<title>Iron Man</title>
		<link>http://www.airs.com/blog/archives/190</link>
		<comments>http://www.airs.com/blog/archives/190#comments</comments>
		<pubDate>Tue, 13 May 2008 06:19:37 +0000</pubDate>
		<dc:creator>Ian Lance Taylor</dc:creator>
		
	<category>Movies</category>
		<guid>http://www.airs.com/blog/archives/190</guid>
		<description><![CDATA[	I&#8217;ve always liked Iron Man.  Tony Stark has a simple comic book story: a smart guy, who doesn&#8217;t think very much about what he&#8217;s doing, is nearly killed.  The experience changes him&#8211;but not all that much.  He&#8217;s a superhero because he&#8217;s addicted to action, because he feels the need to justify his [...]]]></description>
			<content:encoded><![CDATA[	<p>I&#8217;ve always liked Iron Man.  Tony Stark has a simple comic book story: a smart guy, who doesn&#8217;t think very much about what he&#8217;s doing, is nearly killed.  The experience changes him&#8211;but not all that much.  He&#8217;s a superhero because he&#8217;s addicted to action, because he feels the need to justify his survival, and because he needs the armor to keep himself alive.  He doesn&#8217;t have any special powers&#8211;he&#8217;s just very inventive.</p>
	<p>Tony Stark&#8217;s alcoholism wasn&#8217;t introduced until the character had been around for a long time.  Stan Lee created Iron Man in 1963 (script by his brother, Larry Leiber, and art by Don Heck and Jack Kirby).  The alcoholism was introduced in the 1980s by David Michelinie and Bob Layton.  However, even though it came so much later, it fit the character so well that it has never been forgotten.  Denny O&#8217;Neill later picked it up for a long run on the character in which Stark loses everything and his friend Rhodey takes over as Iron Man.</p>
	<p>Iron Man is a natural hero for an engineer: a smart, intuitive guy who succeeds entirely  on his own wits.  He&#8217;s also, of course, handsome, suave, ultra wealthy, self confident&#8211;in fact, overly confident.  I don&#8217;t think anybody could really identify with Tony Stark, which probably hurts his sales.  But he&#8217;s a believable character at the core, more believable than many superheroes.</p>
	<p>I didn&#8217;t have high hopes for the movie which just came out, but I&#8217;m happy to say that it captures the character very well and was also a very good movie.  They changed the details of the comic book story, but kept all the essential elements.  In fact, it&#8217;s early days yet, but right now I think it was one of the best superhero movies that&#8217;s been made, right up there with the first Tim Burton Batman movie.  Unusually, the ordinary life sequences were better than the action sequences&#8211;something which only works because Iron Man is such a plausible character at the core.  That said, the special effects were excellent, and really conveyed the power of the armored suit.</p>
	<p>If you&#8217;re a comic book fan, sit through all the credits until the very end, to see the short setup for the sequel (if you&#8217;re not a comic book fan, though, the setup probably won&#8217;t make any sense).
</p>
]]></content:encoded>
			<wfw:commentRSS>http://www.airs.com/blog/archives/190/feed/</wfw:commentRSS>
	</item>
		<item>
		<title>Linker relro</title>
		<link>http://www.airs.com/blog/archives/189</link>
		<comments>http://www.airs.com/blog/archives/189#comments</comments>
		<pubDate>Sat, 10 May 2008 01:16:44 +0000</pubDate>
		<dc:creator>Ian Lance Taylor</dc:creator>
		
	<category>Programming</category>
		<guid>http://www.airs.com/blog/archives/189</guid>
		<description><![CDATA[	gcc, the GNU linker, and the glibc dynamic linker cooperate to implement an idea called read-only relocations, or relro.  This permits the linker to designate a part of an executable or (more commonly) a shared library as being read-only after dynamic relocations have been applied.
	This may be used for read-only global variables which are [...]]]></description>
			<content:encoded><![CDATA[	<p>gcc, the GNU linker, and the glibc dynamic linker cooperate to implement an idea called read-only relocations, or relro.  This permits the linker to designate a part of an executable or (more commonly) a shared library as being read-only after dynamic relocations have been applied.</p>
	<p>This may be used for read-only global variables which are initialized to something which requires a relocation, such as the address of a function or a different global variable.  Because the global variable requires a runtime initialization in the form of a dynamic relocation, it can not be placed in a read-only segment.  However, because it is declared to be constant, and therefore may not be changed by the program, the dynamic linker can mark it as read-only after the dynamic relocation has been applied.</p>
	<p>For some targets this technique may also be used for the PLT or parts of the GOT.</p>
	<p>Making these pages read-only helps catch some cases of memory corruption, and making the PLT in particular read-only helps prevent some types of buffer overflow exploits.</p>
	<p>The first step is in gcc.  When gcc sees a variable which is constant but requires a dynamic relocation, it puts it into a section named <code>.data.rel.ro</code> (this functionality unfortunately relies on magic section names).  A variable which requires a dynamic relocation against a local symbol is put into a <code>.data.rel.ro.local</code> section; this helps group such variables together, so that the dynamic linker may apply the relocations, which will always be <code>RELATIVE</code> relocations, more efficiently, especially when using <code>combreloc</code>.</p>
	<p>The linker groups <code>.data.rel.ro</code> and <code>.data.rel.ro.local</code> sections as usual.  The new step is that the linker then emits a <code>PT_GNU_RELRO</code> program segment which covers these sections.  If the PLT and/or GOT can be read-only after dynamic relocations, they are put next to the <code>.data.rel.ro</code> sections and also become part of the new segment.  This segment will enclosed within a <code>PT_LOAD</code> segment.  The <code>p_vaddr</code> field of the <code>PT_GNU_RELRO</code> segment gives the virtual address of the start of the read-only after dynamic relocations code, and the <code>p_memsz</code> field gives its length.</p>
	<p>When the dynamic linker sees a <code>PT_GNU_RELRO</code> segment, it uses <code>mprotect</code> to mark the pages as read-only after the dynamic relocations have been applied.  Of course this only works if the segment does in fact cover an entire page.  The linker will try to force this to happen.</p>
	<p>Note that the current dynamic linker code will only work correctly if the <code>PT_GNU_RELRO</code> segment starts on a page boundary.  This is because the dynamic linker rounds the <code>p_vaddr</code> field down to the previous page boundary.  If there is anything on the page which should not be read-only, the program is likely to fail at runtime.  So in effect the linker must only emit a <code>PT_GNU_RELRO</code> segment if it ensures that it starts on a page boundary.</p>
	<p>I see this as a relatively minor security benefit.  It is not an optimization as far as I can see.  I am documenting it here as part of my general documentation of obscure linker features.  The current description of this feature in the GNU linker manual is rather obscure.
</p>
]]></content:encoded>
			<wfw:commentRSS>http://www.airs.com/blog/archives/189/feed/</wfw:commentRSS>
	</item>
		<item>
		<title>Rent Control</title>
		<link>http://www.airs.com/blog/archives/188</link>
		<comments>http://www.airs.com/blog/archives/188#comments</comments>
		<pubDate>Fri, 09 May 2008 07:12:30 +0000</pubDate>
		<dc:creator>Ian Lance Taylor</dc:creator>
		
	<category>Money</category>
		<guid>http://www.airs.com/blog/archives/188</guid>
		<description><![CDATA[	My home city, Cambridge, Massachusetts, used to have rent control.  It was generally supported in the city, but it was voted out in a statewide referendum in 1994.
	The statewide referendum was a bit of a crock; only three cities in the state had any form of rent control (Cambridge, Boston, and Brookline).  Rent [...]]]></description>
			<content:encoded><![CDATA[	<p>My home city, Cambridge, Massachusetts, used to have rent control.  It was generally supported in the city, but it was voted out in a statewide referendum in 1994.</p>
	<p>The statewide referendum was a bit of a crock; only three cities in the state had any form of rent control (Cambridge, Boston, and Brookline).  Rent control, like historical preservation, is something which local communities should be able to decide for themselves.  I don&#8217;t think it was appropriate for it to be removed by referendum.</p>
	<p>In my opinion, the general effect of removing rent control in Cambridge was negative.  Over a period of several years rents increased steadily.  Many long-time residents were forced to leave the city.  The city became less diverse.  Harvard Square turned into an outdoor shopping mall.  From my perspective as a long-time city resident, these were not changes that I wanted to happen.</p>
	<p>The arguments against rent control are that it is unfair to landlors, and it discourages them from investing in the building.  As far as I can see these arguments do not apply to rent control in a steady state.  They only applies to discussions about creating rent control for the first time or about removing it.  Unexpectedly removing rent control amounts to a windfall for landlords.  This doesn&#8217;t mean it can&#8217;t be done, but it does mean that arguments about fairness and investment don&#8217;t apply.</p>
	<p>Rent control can introduce some perverse incentives.  If rent control is written such that the rent can only increase when people move, people have a strong incentive to stay.  A fair rent control law has to maintain similar rents for similar apartments across the area.  Then people will be willing to move, at least within the area.</p>
	<p>In some cases it may be appropriate to have an income component to rent control, so that lower income people can rent apartments.  In order to make this fair to the landlord, the difference in rent needs to be supplied by the city out of property tax revenue.  If the renter&#8217;s income increase, the rent should also increase up to a point.  However, the rent should increase more slowly than the renter&#8217;s income after taxes, to avoid a perverse incentive to keep income low.</p>
	<p>Used wisely, rent control can encourage a more diverse community, and that should be a choice open to the people living in that community.</p>
	<p>I&#8217;m not going to argue that the Cambridge rent control system was used wisely.  It was not too bad overall, but in my view the rent control advocates were arrogant and refused to consider even legitimate concerns of the landlords.  Had they been willing to discuss issues more openly and fairly, the statewide referendum effort would probably not have been launched in the first place.</p>
	<p>The city I live in now, Berkeley, California, still has rent control.  However, I don&#8217;t know too much about the details.  I do know that the eviction policy seems unfair to landlords.  It is apparently very difficult to evict renters, taking many months or even years.  Eviction control is required due to an unfortunate state law, which permits rents to be adjusted when a tenant leaves.  This gives landlords an incentive to push tenants out frequently in order to raise rents.  As noted above, it also gives tenants a perverse incentive to stay longer than they otherwise would.  However, the effect of the current eviction control rules seems to be that tenants are permitted to stay for many months even if they fail to pay their rent.  This seems unfair.  However, as I said, I&#8217;m not familiar with the details as I was in Cambridge.
</p>
]]></content:encoded>
			<wfw:commentRSS>http://www.airs.com/blog/archives/188/feed/</wfw:commentRSS>
	</item>
		<item>
		<title>GCC in C++</title>
		<link>http://www.airs.com/blog/archives/187</link>
		<comments>http://www.airs.com/blog/archives/187#comments</comments>
		<pubDate>Wed, 07 May 2008 01:13:34 +0000</pubDate>
		<dc:creator>Ian Lance Taylor</dc:creator>
		
	<category>Programming</category>
		<guid>http://www.airs.com/blog/archives/187</guid>
		<description><![CDATA[	It is time to start using C++ in gcc.  gcc was originally written in C.  C++ has now advanced to the point where we can reasonably take advantage of the new features that it provides.  The most obvious advantage would be in data structures.  gcc implements data structures which are awkward [...]]]></description>
			<content:encoded><![CDATA[	<p>It is time to start using C++ in gcc.  gcc was originally written in C.  C++ has now advanced to the point where we can reasonably take advantage of the new features that it provides.  The most obvious advantage would be in data structures.  gcc implements data structures which are awkward to use for different types.  With C++ they could become much simpler.  The target structure is naturally implemented as a base class, which would simplify target code.  The double-wide integer values could be naturally represented as a small class with operators, again simplifying the code and making it easier to understand.</p>
	<p>This would be an easy transition, as the code is already almost completely written in the shared subset of C and C++.  One of the arguments against converting to C++ is that the code would be less efficient, but it&#8217;s not as though the C code would become less efficient because we were compiling with a C++ compiler.  Certainly we would have to pay close attention to efficiency with new changes, but that is no different from what we do today.</p>
	<p>The other argument against C++ is that the language has too many complicated features.  I think that gcc&#8217;s review system will ensure that new code is at least as readable as the old code.  In any case programmers these days learn C++ in school.  It is not so complex that gcc developers can not understand it.</p>
	<p>The only real technical difficulty I see is that we would have to make bootstrapping work with the right libstdc++.  I&#8217;m sure this is possible.  We would also have to explicitly make sure that new versions of gcc can be compiled with old versions of gcc.  This would be an addition to the release testing.</p>
	<p>In the past Richard Stallman has objected to using C++ for gcc.  I don&#8217;t know who he feels about it today.  However, I believe that this sort of decision should be made by the actual developers.</p>
	<p>If anybody has a principled argument against using C++ for gcc, I would very much like to hear it.
</p>
]]></content:encoded>
			<wfw:commentRSS>http://www.airs.com/blog/archives/187/feed/</wfw:commentRSS>
	</item>
		<item>
		<title>Linker combreloc</title>
		<link>http://www.airs.com/blog/archives/186</link>
		<comments>http://www.airs.com/blog/archives/186#comments</comments>
		<pubDate>Tue, 06 May 2008 06:02:13 +0000</pubDate>
		<dc:creator>Ian Lance Taylor</dc:creator>
		
	<category>Programming</category>
		<guid>http://www.airs.com/blog/archives/186</guid>
		<description><![CDATA[	The GNU linker has a -z combreloc option, which is enabled by default (it can be turned off via -z nocombreloc).  I just implemented this in gold as well.  This option directs the linker to sort the dynamic relocations.  The sorting is done in order to optimize the dynamic linker.
	The dynamic linker [...]]]></description>
			<content:encoded><![CDATA[	<p>The GNU linker has a <code>-z combreloc</code> option, which is enabled by default (it can be turned off via <code>-z nocombreloc</code>).  I just implemented this in gold as well.  This option directs the linker to sort the dynamic relocations.  The sorting is done in order to optimize the dynamic linker.</p>
	<p>The dynamic linker in glibc uses a one element cache when processing relocs: if a relocation refers to the same symbol as the previous relocation, then the dynamic linker reuses the value rather than looking up the symbol again.  Thus the dynamic linker gets the best results if the dynamic relocations are sorted so that all dynamic relocations for a given dynamic symbol are adjacent.</p>
	<p>Other than that, the linker sorts together all relative relocations, which don&#8217;t have symbols.  Two relative relocations, or two relocations against the same symbol, are sorted by the address in the output file.  This tends to optimize paging and caching when there are two references from the same page.</p>
	<p>This may seem like a micro-optimization, but it can have a real effect on program startup time, especially if the program has lots of shared libraries.  I&#8217;ve seen a case where a program starts up 16% faster because the relocations were sorted.
</p>
]]></content:encoded>
			<wfw:commentRSS>http://www.airs.com/blog/archives/186/feed/</wfw:commentRSS>
	</item>
		<item>
		<title>GCC Garbage</title>
		<link>http://www.airs.com/blog/archives/185</link>
		<comments>http://www.airs.com/blog/archives/185#comments</comments>
		<pubDate>Fri, 02 May 2008 15:24:57 +0000</pubDate>
		<dc:creator>Ian Lance Taylor</dc:creator>
		
	<category>Programming</category>
		<guid>http://www.airs.com/blog/archives/185</guid>
		<description><![CDATA[	gcc uses garbage collection internally during the course of a compilation.  I wasn&#8217;t too involved with gcc at the time that garbage collection was introduced, but I certainly saw the problems that it was trying to solve.  Before garbage collection, gcc allocated memory using obstacks.  An obstack is a memory allocation pool [...]]]></description>
			<content:encoded><![CDATA[	<p>gcc uses garbage collection internally during the course of a compilation.  I wasn&#8217;t too involved with gcc at the time that garbage collection was introduced, but I certainly saw the problems that it was trying to solve.  Before garbage collection, gcc allocated memory using obstacks.  An obstack is a memory allocation pool in which if you free an object you also free all more recently allocated objects.  Obstacks are still used in gcc today.  The issue before garbage collection was introduced was that all allocation was done on the current default obstack.  There were several different obstacks with different lifetimes, and code would change the default back and forth.  There was also code to copy data structures from one obstack to another in order to make it more permanent.  It was very easy to introduce errors in which objects in a more permanent obstack pointed to objects in a more temporary obstack.  This then lead to  unpredictable memory crashes.</p>
	<p>We can draw some lessons from this.  If you are going to use memory pools in a complicated program, you must not use a default memory pool.  All memory allocation must use an explicitly named pool.  Otherwise you are going to get confused and the result will be dangling pointers.</p>
	<p>Another lesson is that memory allocation is hard, but then we already knew that.  Using a garbage collector resolves the memory allocation problem.  However, you pay a fairly heavy price.  Is it a price which gcc can afford to pay?</p>
	<p>One answer is to observe that gcc&#8217;s garbage collector includes a ggc_free function.  This function frees memory in the garbage collector.  It is basically an assertion that there are no pointers to the memory.  Any use of gcc_free in gcc&#8217;s code base is a case where the price of garbage collection was considered to be too high.  Note that systems which are fully dedicated to garbage collection do not provide any equivalent to ggc_free.  I count 24 uses of ggc_free in gcc&#8217;s code base today.  Clearly in at least some cases developers feel that the cost of garbage collection is too high.</p>
	<p>The question gcc faces is: is the garbage collector too expensive in all cases?  Should we go back to explicit memory management&#8211;but this time with explicitly named pools, to avoid the problems of default obstacks?  The answers are complicated by the fact that the implementation of pre-compiled headers is tied into the implementation of garbage collection.</p>
	<p>Another way to ask the question is: if garbage collection is not too expensive, then why not write gcc in Java?  The natural response would be that using Java would be too expensive&#8211;the compiler would be too slow.  But the main reason that Java is slower than C++ is not the bytecode system&#8211;modern JIT technology is competitive with compilation to machine code; the slowness of Java is a result of garbage collection.
</p>
]]></content:encoded>
			<wfw:commentRSS>http://www.airs.com/blog/archives/185/feed/</wfw:commentRSS>
	</item>
		<item>
		<title>Raise the Gas Tax</title>
		<link>http://www.airs.com/blog/archives/184</link>
		<comments>http://www.airs.com/blog/archives/184#comments</comments>
		<pubDate>Fri, 02 May 2008 07:43:45 +0000</pubDate>
		<dc:creator>Ian Lance Taylor</dc:creator>
		
	<category>Politics</category>
		<guid>http://www.airs.com/blog/archives/184</guid>
		<description><![CDATA[	I see that both McCain and Clinton are suggesting that the gas tax should be abolished for the summer.  Obama is resisting that, though he voted in favor of a similar proposal back in 2000 as a state senator.
	Dropping the gas tax would be hideously irresponsible.  The U.S. must start weaning itself off [...]]]></description>
			<content:encoded><![CDATA[	<p>I see that both McCain and Clinton are suggesting that the gas tax should be abolished for the summer.  Obama is resisting that, though he voted in favor of a similar proposal back in 2000 as a state senator.</p>
	<p>Dropping the gas tax would be hideously irresponsible.  The U.S. must start weaning itself off of oil as fast as possible.  This is true both because burning oil increases carbon dioxide in the atmosphere and because relying on oil makes us dependent on countries with large oil reserves, and most of those countries are not our friends.</p>
	<p>Dropping the price now will send people the message that when gas gets too expensive, the government will act.  That is the exact wrong message.  The message we need to send is that gas is going to get more and more expensive, and that people should use less.</p>
	<p>If we are concerned about the effects of gas prices on poor people, then we should develop relief specifically for poor people, such as gas stamps by analogy to food stamps.  Or better public transportation.</p>
	<p>Side note: it&#8217;s interesting that this election will almost certainly be the first one to elect a sitting senator since Kennedy in 1960.  Traditionally senators do not do well in presidential politics.
</p>
]]></content:encoded>
			<wfw:commentRSS>http://www.airs.com/blog/archives/184/feed/</wfw:commentRSS>
	</item>
	</channel>
</rss>
