dotgnu-general
[Top][All Lists]
Advanced

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

Re: [DotGNU]Register Based VM's Q.


From: Rhys Weatherley
Subject: Re: [DotGNU]Register Based VM's Q.
Date: Tue, 14 Aug 2001 21:14:22 +1000

Rhys Weatherley wrote:

> All examples that I've seen to date use the same
> registers for storing both integer and pointer quantities.
> When this happens, it becomes possible to put an
> arbitrary integer value in a register, and then dereference
> it as a pointer.  Presto, chango: we've just accessed
> memory that we shouldn't have.

Following up my own message with something that just
occurred to me.

Local variables in Java are "sort of" untyped registers.
They don't actually get a type until the first time they
are assigned to.  The bytecode verifier then uses that
type to check that all future usages are compatible.

So, it may be possible to concoct a register VM that has
untyped registers, but which get types assigned the
first time they are accessed.  A register machine verifier
can then be used to typecheck the code at runtime.

I'm not sure how this would help with RTL though: the
RTL back-end would need to have a very large number
of registers available, because once it had put a specific
type of value in a register, it could never reuse it for
a different type of value.  Java has up to 64k locals.

One more data point to think about.

Cheers,

Rhys.



reply via email to

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