Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Explore how to reduce reachability of CGLIB classes at runtime in AOT mode #29547

Open
sdeleuze opened this issue Nov 22, 2022 · 0 comments
Open
Assignees
Labels
in: core Issues in core modules (aop, beans, core, context, expression) theme: aot An issue related to Ahead-of-time processing

Comments

@sdeleuze
Copy link
Contributor

sdeleuze commented Nov 22, 2022

Spring Framework 6 added support for AOT generation of CGLIB proxies via #28115. We were able to remove a bunch of reachable classes from the reachable code path via #29521, but some CGLIB classes are still reachable via CglibSubclassingInstantiationStrategy, CglibAopProxy, and ObjenesisCglibAopProxy:

org.springframework.cglib.core.AbstractClassGenerator
org.springframework.cglib.core.AbstractClassGenerator$ClassLoaderData
org.springframework.cglib.core.AbstractClassGenerator$ClassLoaderData$1
org.springframework.cglib.core.AbstractClassGenerator$ClassLoaderData$2
org.springframework.cglib.core.AbstractClassGenerator$ClassLoaderData$3
org.springframework.cglib.core.ClassLoaderAwareGeneratorStrategy
org.springframework.cglib.core.CodeGenerationException
org.springframework.cglib.core.CollectionUtils
org.springframework.cglib.core.Constants
org.springframework.cglib.core.DefaultNamingPolicy
org.springframework.cglib.core.ReflectUtils
org.springframework.cglib.core.Signature
org.springframework.cglib.core.SpringNamingPolicy
org.springframework.cglib.core.TypeUtils
org.springframework.cglib.core.WeakCacheKey
org.springframework.cglib.core.internal.LoadingCache
org.springframework.cglib.core.internal.LoadingCache$2
org.springframework.cglib.proxy.CallbackInfo
org.springframework.cglib.proxy.DispatcherGenerator
org.springframework.cglib.proxy.Enhancer
org.springframework.cglib.proxy.Enhancer$EnhancerFactoryData
org.springframework.cglib.proxy.Enhancer$EnhancerKey
org.springframework.cglib.proxy.FixedValueGenerator
org.springframework.cglib.proxy.InvocationHandlerGenerator
org.springframework.cglib.proxy.LazyLoaderGenerator
org.springframework.cglib.proxy.MethodInterceptorGenerator
org.springframework.cglib.proxy.MethodProxy
org.springframework.cglib.proxy.MethodProxy$CreateInfo
org.springframework.cglib.reflect.FastClass$Generator

The purpose of this issue is to explore how to reduce as much as possible those reachable types (first goal is to reduce the memory footprint on native) when running in AOT mode. Would a dedicated InstantiationStrategy make sense at runtime in AOT mode for example?

Note that this might not be straightforward due to the need to initialize and configure the proxy classes, which in turn involves CGLIB-specific types, but it's likely worth a try.

@sdeleuze sdeleuze added in: core Issues in core modules (aop, beans, core, context, expression) theme: aot An issue related to Ahead-of-time processing labels Nov 22, 2022
@sdeleuze sdeleuze added this to the 6.1.x milestone Nov 22, 2022
@sdeleuze sdeleuze self-assigned this Nov 22, 2022
@sdeleuze sdeleuze modified the milestones: 6.1.x, 6.2.x Dec 7, 2023
@sdeleuze sdeleuze modified the milestones: 6.2.x, 6.x Backlog Sep 24, 2024
@jhoeller jhoeller modified the milestones: 6.x Backlog, General Backlog Oct 1, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
in: core Issues in core modules (aop, beans, core, context, expression) theme: aot An issue related to Ahead-of-time processing
Projects
None yet
Development

No branches or pull requests

2 participants