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.

Etienne
-- 
+--------------------------------------------------------------------+
| �tienne M. Gagnon                    mailto:[EMAIL PROTECTED] |
| 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          http://www.info.uqam.ca/ |
| Auteur de SableVM                          http://www.sablevm.org/ |
| et de SableCC                              http://www.sablecc.org/ |
+--------------------------------------------------------------------+
| Etienne M. Gagnon                    mailto:[EMAIL PROTECTED] |
| Assistant Professor                Phone: (514) 987-3000 ext. 8215 |
| Office: PK-4930                                Fax: (514) 987-8477 |
| Department of Computer Science, UQAM      http://www.info.uqam.ca/ |
| Author of SableVM                          http://www.sablevm.org/ |
| and SableCC                                http://www.sablecc.org/ |
+--------------------------------------------------------------------+


_______________________________________________
Classpath mailing list
[EMAIL PROTECTED]
http://mail.gnu.org/mailman/listinfo/classpath

Reply via email to