incubator-kato-spec mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Stuart Monteith <stuk...@stoo.me.uk>
Subject Re: Replacing ImagePointer references in the Java Runtime API - first pass
Date Mon, 11 Jan 2010 10:39:42 GMT
Hi,
     I've just been wondering, what's the difference between a Handle 
and, for example, the
JavaObject that generated it?

Regards,
     Stuart

Steve Poole wrote:
> The Handle interface below is at the core of my proposal for a replacement
> for places where ImagePointer is used in the JavaRuntime API.    Though it's
> not all of it -  the JavaRuntime interface is also updated:
>
> The getObjectByAddress(long) method is replaced with a
> getObjectByHandle(handle) method.
>
> A new  Handle createHandle(EntityType type,long reference) method has been
> added to allow for the creation of these handles from external form data.
> EntityType is an enum of Java Runtime API types  (currently only javaobject,
> javaclass, monitor)
>
> These changes are in the codebase and seem to work ok.  We do need to
> resolve the getAddress() method on JavaLocation to determine what it's form
> should be.
>
> Also - what else could we call this other than Handle?  (I don't really want
> to use the pointer word but handle seems so old fashioned :-))
>
> ---
> javax.tools.diagnostics.runtime.java.Handle :
>
> /**
>   * Describes a smart pointer that can be used to extract
>   * a reference to an entity within a JavaRuntime instance
>   * and can be presented to the same JavaRuntime instance to
>   * reconstitute a semantically equivilent version of the original
>   * entity.
>   *
>   * The handle is expected to be used to facilitate round tripping
>   * where identity information about the entity needs to recorded outside of
> a
>   * the analysing program (perhaps in a database) and then, at some later
>   * stage , the original object needs to be recovered.
>   *
>   *
>   */
> public interface Handle {
>
>      /**
>       * Returns an implementation specific reference number that
>       * can be used (in conjunction with a type specification) to
>       * recreate the relevant API entity from a dump.
>       *
>       * @return reference number
>       */
>      public long getAddress();
>
>      /**
>       * Returns an enumeration that indicates the type of object that
>       * this handle refers to. Never returns null.
>       *
>       */
>      public EntityType getType();
>
> }
>
>
>    

-- 
Stuart Monteith
http://blog.stoo.me.uk/


Mime
View raw message