Language extensions ?
Robin Garner
robin.garner@iname.com
Thu Mar 27 03:49:00 GMT 2003
I'd like to ask whether the gcj team is amenable at all to the idea of adding some language extensions that would make system programming in java possible/easier.
I am working at the moment to port a memory management toolkit called JMTk from Jikes RVM to gcj so that I can use it in another language runtime. Since this is a memory management toolkit, it requires an address type, and lots of C-like flexibility in referencing memory.
Jikes RVM provides a "magic" mechanism, specifically there is a VM_Address class, which looks from a java source point of view as an object with a single private int field, with methods for doing arithmetic, comparison etc. At runtime, the jit compiler intercepts object instances and methods and directly replaces them with the appropriate machine code for dealing directly with addresses.
Of course in an ahead-of-time compiled environment, I have to use int/long directly depending on the address width of the target architecture, and use native methods for doing type-casts etc.
What would be _really_ nice would be if gcj provided an address type as an extension to the language, and allowed unsafe casts, pointer arithmetic etc. in ways similar to Modula 3 and C# (at least until java saw the light :).
What would be almost as nice would be the addition of unsigned integer types, because doing an unsigned comparison on a signed int is slow, and this kind of operation happens in write barriers quite frequently. Calling a native method would brobably be even worse.
There are two parts to the question, really, firstly, whether this would be something the gcj team would be interested in picking up if this language extension was made, and secondly whether someone on the team would be willing to make it (as I have my hands full enough at the moment with JMTk and ghc runtimes).
Of course suggestions about alternative ways of achieving my aims gladly accepted !
I guess another question is whether gcj would be interested in using JMTk for memory management ? At the moment there isn't a conservative collector (like boehm) in gcj, but is that absolutely necessary ?
-- Robin
--
__________________________________________________________
Sign-up for your own FREE Personalized E-mail at Mail.com
http://www.mail.com/?sr=signup
More information about the Java
mailing list