Re: Defining anonymous classes

2014-09-05 Thread Remi Forax
On 08/14/2014 12:52 PM, Florian Weimer wrote: Is there an end-user accessible way of defining anonymous classes (by which I mean classes which are kept alive only by explicit references or their instances, and not their class loader)? Searching for the term "anonymous classes&q

Re: Defining anonymous classes

2014-08-25 Thread Mark Roos
>From Charles This is how JRuby has survived for years. A classloader-per-class has a big memory load (ClassLoader has a lot of internal state, classes have a lot of metadata) but with permgen bumped up (or replaced with metaspace as in 8) and a few reuse tricks, it hasn't been a major issue for u

Re: Defining anonymous classes

2014-08-25 Thread Charles Oliver Nutter
On Fri, Aug 15, 2014 at 5:39 PM, John Rose wrote: > If the host-class token were changed to a MethodHandles.Lookup object, we > could restrict the host-class to be one which the user already had > appropriate access to. Seems simple, but of course the rest of the project > is complicated: AP

Re: Defining anonymous classes

2014-08-19 Thread Mark Roos
Hi Raffaello, Sharing one class as a holder for many methods would be worth looking at if the class overhead became significant. Concerns would be in making sure replaced methods are collected and in housekeeping. If John moves to providing a 'method loader' then this would be something to look

Re: Defining anonymous classes

2014-08-19 Thread Raffaello Giulietti
Mark, consider pure code container JVM classes, each one of them holding only a large bunch (say 16K) of static methods, all with synthetic names and the same signature (i.e., number of arguments in case of ST). Initially, the methods are just pre-allocated empty placeholders. As ST methods ar

Re: Defining anonymous classes

2014-08-18 Thread Mark Roos
Hi John Just to keep my use case visible. For my use I convert each Smalltalk method to a Java class ( inheriting from Object ) which only includes static methods. Due to how I handle blocks there is often more than one method in each class. I do invoke static methods from my support classes.

Re: Defining anonymous classes

2014-08-17 Thread Remi Forax
On 08/17/2014 12:55 PM, Florian Weimer wrote: On 08/16/2014 12:39 AM, John Rose wrote: Do you have a use case in mind that could be expressed as a more tightly focused API? My use-case is run-time class generation and avoiding unnecessary retention of classes which are referred to by the ge

Re: Defining anonymous classes

2014-08-17 Thread Florian Weimer
On 08/16/2014 12:39 AM, John Rose wrote: Do you have a use case in mind that could be expressed as a more tightly focused API? My use-case is run-time class generation and avoiding unnecessary retention of classes which are referred to by the generated class. I do not need constant pool pa

Re: Defining anonymous classes

2014-08-16 Thread Remi Forax
On 08/16/2014 12:39 AM, John Rose wrote: On Aug 15, 2014, at 5:03 AM, Florian Weimer wrote: On 08/14/2014 10:15 PM, Mark Roos wrote: Look into sun.Misc.Unsafe [and at defineAnonymousClass(Class, byte[], Object[])] Thanks. Could we turn this into a supported API, with a suitable security

Re: Defining anonymous classes

2014-08-15 Thread John Rose
On Aug 15, 2014, at 5:03 AM, Florian Weimer wrote: > On 08/14/2014 10:15 PM, Mark Roos wrote: >> Look into sun.Misc.Unsafe > > [and at defineAnonymousClass(Class, byte[], Object[])] > > Thanks. Could we turn this into a supported API, with a suitable security > manager check? Hi Florian and

Re: Defining anonymous classes

2014-08-15 Thread Mark Roos
The Java folks will have to answer this, but I have heard that there are thoughts on how to make unsafe safe and portable.  You might ask on the jigsaw list. -Mark > On Aug 15, 2014, at 5:03 AM, "Florian Weimer" wrote: > > On 08/14/2014 10:15 PM, Mark Roos wrote: > > Look into sun.Misc.Unsafe

Re: Defining anonymous classes

2014-08-15 Thread Florian Weimer
On 08/14/2014 10:15 PM, Mark Roos wrote: Look into sun.Misc.Unsafe [and at defineAnonymousClass(Class, byte[], Object[])] Thanks. Could we turn this into a supported API, with a suitable security manager check? I'm surprised there aren't any callers of this method in Fedora. Anonymous cla

Re: Defining anonymous classes

2014-08-14 Thread Mark Roos
Is there an end-user accessible way of defining anonymous classes (by which I mean classes which are kept alive only by explicit references or their instances, and not their class loader)? Searching for the term "anonymous classes" isn't particul

Defining anonymous classes

2014-08-14 Thread Florian Weimer
Is there an end-user accessible way of defining anonymous classes (by which I mean classes which are kept alive only by explicit references or their instances, and not their class loader)? Searching for the term "anonymous classes" isn't particularly revealing due to the Java