[Top][All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: String/Hashtable bootstrapping problem

From: Etienne M. Gagnon
Subject: Re: String/Hashtable bootstrapping problem
Date: Fri, 06 Jul 2001 12:32:43 -0400
User-agent: Mozilla/5.0 (X11; U; Linux 2.4.5-586tsc i586; en-US; rv:0.9.1) Gecko/20010620

Hi Patrick.

The String/Hashtable problem is, as you identified, a "bootstrapping" problem. It is not at all necessary to make "intern()" a native method, or to eliminate the recursive dependency between Hashtable and String. The solution is to have a special "bootstrapping" mode in your VM. While your VM is in that mode, it keeps its own internal table of Strings created through LDC. At the end of the bootstrapping stage, the VM registers all Strings withing its own table into String's intern table by calling intern() on these string objects.

The idea is to try to touch to as little as possible things while bootstrapping so that it becomes less likely to get a duplicate String within both the internal table and String's one. If you really want to make sure, you could trap any call to String.intern() in the bootstrapping stage, if if there's one, abort. In other words, String.intern() would be prohibited in the bootstrapping mode. Personally, I decided to simply verify manually that such a call does not happen, instead of hacking such a trap into the bootstrapping code.

Hope this helps.

| Étienne M. Gagnon                    mailto:address@hidden |
| Professeur adjoint            Téléphone: (514) 987-3000 poste 8215 |
| Bureau: PK-4930                        Télécopieur: (514) 987-8477 |
| Département d'informatique, UQÀM |
| Auteur de SableVM                 |
| et de SableCC                     |
| Etienne M. Gagnon                    mailto:address@hidden |
| Assistant Professor                Phone: (514) 987-3000 ext. 8215 |
| Office: PK-4930                                Fax: (514) 987-8477 |
| Department of Computer Science, UQAM |
| Author of SableVM                 |
| and SableCC                       |

reply via email to

[Prev in Thread] Current Thread [Next in Thread]