Common bootstrap

Jim Laskey jlaskey at me.com
Tue Aug 24 13:15:33 PDT 2010


Likely some subtlety I'm missing here.

I meant inherited in the general sense.  Maybe hierarchically blest is a better term.  That is, that during initialization, a subclass copies the bootstrap MH from it's parent class (no instances involved.)  The subclass can still override the bootstrap with a static initializer.  The point is to simplify the launch effort/size/performance in each of the subclasses.

So instead of 

    class LangBaseClass {
	public static CallSite bootstrap(Class caller, String name, MethodType type) {
		...
		return callSite;
	}

	static {
		java.dyn.Linkage.registerBootstrapMethod(LangBaseClass.class, "bootstrap");
	}
    }

    class LangSubClass1 extends LangBaseClass {
	static {
		java.dyn.Linkage.registerBootstrapMethod(LangBaseClass.class, "bootstrap");
	}

        ...

        InvokeDynamic.foo();

    }

    class LangSubclass2 extends LangBaseClass {
	static {
		java.dyn.Linkage.registerBootstrapMethod(LangBaseClass.class, "bootstrap");
	}

        ...

        InvokeDynamic.bar();

    }

...

We have;


    class LangBaseClass {
	public static CallSite bootstrap(Class caller, String name, MethodType type) {
		...
		return callSite;
	}

	static {
		java.dyn.Linkage.registerBootstrapMethod(LangBaseClass.class, "bootstrap");
	}
    }

    class LangSubClass1 extends LangBaseClass {

        ...

        InvokeDynamic.foo();

    }

    class LangSubclass2 extends LangBaseClass {

        ...

        InvokeDynamic.bar();

    }

...

> Date: Tue, 24 Aug 2010 16:01:00 +0200
> From: R?mi Forax <forax at univ-mlv.fr>
> Subject: Re: Common bootstrap
> To: mlvm-dev at openjdk.java.net
> Message-ID: <4C73D09C.60404 at univ-mlv.fr>
> Content-Type: text/plain; charset=ISO-8859-1; format=flowed
> 
> Le 24/08/2010 15:36, Jim Laskey a ?crit :
>> Excuse me for being late in the game but I have a na?ve question.
>> 
>> Why not have the bootstrap method be inherited?  Isn't it likely that a j-lang would have a base class and that often a common bootstrap might be used?  (I'm assuming it's an implementation/security issue, but asking anyway.)
>> 
>> Cheers,
>> 
>> -- Jim
>> 
> 
> Before bootstrapping you have nothing :)
> so you have no object to do a virtual call.
> 
> Attila Szegedi has an interesting answers on how to share/reuse some 
> infrastructure on top of invokedynamic:
> http://wiki.jvmlangsummit.com/images/7/73/Metaobject_Protocol_Meets_Invokedynamic.pdf
> 
> R?mi



More information about the mlvm-dev mailing list