Older blog entries for rmathew (starting at number 106)

R.I.P.: Old Bytecode Verifier
The old bytecode verifier used by the GCJ compiler has now finally been removed. It was a small and straightforward verifier but had a few bugs that made it difficult to use GCJ with random JARs. At the same time, the newer bytecode verifier (written in C++) used by the GCJ interpreter gij had far fewer bugs and could handle almost all JARs found in the wild. Since no one was fixing the bugs in the old verifier, GCJ could not work with many JARs for a long time and thus was unusable for a large number of potential users. Bryce made the new bytecode verifier work with the GCJ compiler to support the work on the new Binary Compatibility ABI. After some time I made the new verifier the default for even the old C++ ABI.

I feel guilty and sad now because once upon a time I had resolved to fix some of these bugs but never actually got around to fixing them. I had studied the source code and had read several papers on bytecode verification, especially some of the excellent ones by Alessandro Coglio, but never implemented any of the techniques. Not good.

Scratching An Itch: Terry Laurenzo, GCJ and Generics
One of the stumbling blocks in supporting generics in native programs created by GCJ is the fact that the C++ method-name-mangling used by GCJ does not encode the return type of the method and thus cannot support the Java 1.5 kludge for implementing generics (PR9861).

Terry was just another bloke who was trying to make his program work with GCJ when he hit this issue. Unlike most other blokes however, he has decided to do something about it. Cool!

Sabbatical
VikGup takes a sabbatical for three months starting next week. I really envy him and I wish I could do the same.

Sabbaticals might be quite common in the west, but here in India they are very rare. Even when people want to take sabbaticals, many a time they are discouraged. I hope more people take off on sabbaticals like VikGup has done so that employers and family realise that it is OK, and actually quite healthy, to take a sabbatical.

Have fun VikGup!

PS: Is Mohan back?

McCarthy-ism
I have been meaning to check out Lisp (or one of its dialects) for a very long time now. I first came across functional languages (via Standard ML) when we studied Principles of Programming Languages (PoPL) at college. PoPL was also responsible for introducing us to declarative programming (via Prolog). I found these two styles of programming very difficult to grasp as I had been programming with imperative languages (BASIC, Pascal and C) for around 4 years by then. The unfortunate part was that by the time we "got it", the semester was over and we moved on to other things. I told myself at that time that I would learn Lisp and Prolog on my own "soon".

Almost eleven years have passed since then and I still have not come around to actually learning these languages and the programming styles associated with them. Lisp at least keeps appearing on my radar every now and then. The urge to learn it becomes particularly strong when I read about the ravings of the early oldskool hackers in Steven Levy's "Hackers" or one of Paul Graham's articles on Lisp or SICP. Tromey's recent blog entries have once again aroused my interest in Lisp.

Instead of continuing to procrastinate, I want to start learning Lisp now. I think I would start by reading "Practical Common Lisp". I also hope to be able to understand the origins of Lisp by reading John McCarthy's original paper on Lisp. I hope to be able to overcome my revulsion for seeing so many parantheses in even the most trivial of programs.

GoF Honoured by ACM SIGPLAN
The authors of "Design Patterns" have been honoured by ACM SIGPLAN this year with the "Programming Languages Achievement Award". I personally think that this award is justly deserved. Their book has had a strong influence on the way I approach designing a program. I would gladly recommend this book to any programmer - you do yourself a disservice if you haven't read this book yet, for whatever reason.

Unfortunately, I see either a rampant abuse of Design Patterns ("Let's see how many design patterns we can fit into our design for this project") or a refusal to accept that they can have any merit besides being useful in impressing your PHB. Whether by diktat or by choice, if you are trying to come up with an object-oriented design for a project, it helps tremendously to know how other people have solved some of the specific problems in a way that allows the design to remain flexible while solving the immediate constraints. The flexibilities are precisely what come in handy in the face of ever-changing requirements. A secondary benefit is being able to use a common vocabulary to describe parts of your design to others, who can then immediately grasp what you are trying to do.

Prelinking
I have now become yet another fan of pre-linking. It works wonders on the startup times of most applications. Many thanks to Jakub Jelinek for creating prelink for Linux.
28 Jul 2005 (updated 28 Jul 2005 at 09:43 UTC) »
100 Inane Ramblings
I have put in more than 100 inane entries into my Advogato diary by now.

Here is a nice weblog entry (try to ignore the awfully distracting background image) by James Gosling talking about the problems in "correctly" implementing sin() and other trigonometric functions in Java.

Yumpee had pointed me to some nice papers by some of his fellow Googlers a while ago. They make for some great reading. Try to at least read the papers on Google FS, MapReduce and Sawzall (in that order).

Some day, I hope to be able to decipher what Graydon says about programming languages.

GCC v/s glibc
I had configured and built GCC 3.4.4 with "--with-arch=pentium3" and was happily using it for everything till I decided to compile glibc 2.3.5 with it. The build failed with a weird assembler error message as noted in glibc bug-701. That bug however, had been been closed unceremoniously and marked a duplicate of bug-333, which itself looks unnecessarily obnoxious.

After a bit of poking around, I found out that GCC pre-defines "__i686" if "-march=pentium3" is used (see $GCC_SRC_DIR/gcc/config/i386/i386.h) and this was causing the problem with glibc (see $GLIBC_SRC_DIR/sysdeps/i386/elf/setjmp.S). So I had to explicitly use "-march=i386" with GCC to be able to compile glibc. However, "make check" still fails. I will now build and install a vanilla GCC 3.4.4 and see if that is able to properly build glibc.

By the way, glibc 2.3.5 can not be built with GCC 4.0.1, though Dan Kegel seems to have patches to enable you to do it. It can not be built with anything lower than GCC 3.2 either.

Miscellany
I come back from a two-week vacation in Bhopal and find that GNU Classpath crosses a million lines of source code and that Tom has done the big GNU Classpath merge into libgcj that should make importing changes from GNU Classpath much easier than before. I also found out that people were still discussing the semantics of overflow of signed integers in C on the GCC list and that Zack Weinberg has left GCC development.

Daniel Berlin has set up an automated patch queue for GCC patches. All you have to do now is to include a line like:

:ADDPATCH java:
in your patch message and it would be added to the patch queue for the area "java". Cool!

Nvu, the new incarnation of Mozilla Composer and a standalone program like Firefox and Thunderbird, has reached version 1.0. I took it for a spin and was able to easily create a few nice-looking HTML documents. Apparently it also supports CSS, XHTML, etc. but I don't know much about them yet to find out how good it is at supporting them.

After having ignored all this while the RSS and other feed aggregation capabilities of Mozilla Thunderbird, I now find this feature absolutely indispensible and liberating. Now I can waste even more of my time reading weblogs and sites that I otherwise would not have bothered to visit with such regularity.

Barry Andrews became yet another person to let out a primal cry of joy and pride after he successfully built GCJ 4.0.1 for Win32 by following my document. Based on his suggestions, I have refactored the document a bit and have highlighted some of the more important points.

Projects for GCJ
Here are some random projects for GCJ of varying complexity that I would personally like to see implemented as soon as possible:
  • Generics - Although Ken Arnold says generics are a mistake, they are still very useful in my personal opinion and GCJ should be able to handle them. Of course, it would mean fixing PR9861 first.

  • Assembler - a Java assembler is a very useful tool to have, especially when you want to create invalid class files to test bytecode verification. We should either get Jasmin integrated into Classpath Tools, or create one ourselves. The latter option would be eased if we could get ASM integrated into Classpath Tools via Archit Shah's work on a new RMI compiler (which is still waiting to be checked in for some reason).

  • JIT Interpreter - I think QEMU's portable dynamic translation is a really nifty idea and it seems to work rather well judging by the speed at which QEMU emulates a guest operating system. This can perhaps be used by gij to implement a "real" JIT.

GCC Developers' Summit
The proceedings of the 2005 GCC Developers' Summit are now available (PDF). As usual, they make for very interesting reading. I was particularly interested in reading Vladimir Makarov's paper on the new register allocator infrastructure that he is working on since register allocation, especially for register-starved architectures like x86-32, is GCC's Achille's Heel. It seems that the new Tree-SSA infrastructure particularly aggravates the register pressure.

Dan Kegel also maintained a diary of his visit to the summit.

97 older entries...

New Advogato Features

New HTML Parser: The long-awaited libxml2 based HTML parser code is live. It needs further work but already handles most markup better than the original parser.

Keep up with the latest Advogato features by reading the Advogato status blog.

If you're a C programmer with some spare time, take a look at the mod_virgule project page and help us with one of the tasks on the ToDo list!