From: | billms@nixon.icsl.ucla.edu (Bill Mangione-Smith) |
Newsgroups: | comp.lang.java,comp.lang.c++,comp.compilers |
Date: | 8 May 1996 00:28:37 -0400 |
Organization: | School of Engineering & Applied Science, UCLA. |
References: | 96-05-036 96-05-049 |
Keywords: | Java |
Drinie@xs4all.nl (Rinie Kervel) writes:
>Is it possible (and will Sun allow it) to extend the JVM to support
>pointer arithmetic.
dodd@csl.sri.com (Chris Dodd) writes:
No need, the JVM already supports pointer arithmetic. That is,
there's nothing in the VM that prevents you from doing an `add'
instruction on a pointer and an integer.
The `security' in java-enabled browsers an the like comes from a
security scanner that scans through the byte-code looking for
things like pointer arithmetic. If it finds any, the code is
rejected. Once the code is past the securty, no further checking
is done.
Actually, after re-reading parts of the spec, I'm fairly sure this is
not true. The August 21 release specifically says that jvm programs
must respect typing, and the typed instructions specifically reflect
this as well. The current implementation uses a load-time scanner for
type checking, but if you circumvent this you are still technically
breaking a key aspect of the VM. A seperate, though completely
compliant, virtual machine could shoot down your code as illegal at
runtime by using type flags on the stack. The spec says that this is
not necessary (and it isn't if load time checking is done) but it
certainly is one legal way to do the type checks.
Bill
--
Return to the
comp.compilers page.
Search the
comp.compilers archives again.