File tree Expand file tree Collapse file tree 1 file changed +11
-1
lines changed
substratevm/src/com.oracle.svm.hosted/src/com/oracle/svm/hosted/imagelayer Expand file tree Collapse file tree 1 file changed +11
-1
lines changed Original file line number Diff line number Diff line change 6565import com .oracle .svm .core .util .VMError ;
6666import com .oracle .svm .hosted .FeatureImpl ;
6767import com .oracle .svm .hosted .FeatureImpl .BeforeCompilationAccessImpl ;
68+ import com .oracle .svm .hosted .code .FactoryMethod ;
6869import com .oracle .svm .hosted .image .NativeImage ;
6970import com .oracle .svm .hosted .image .NativeImageCodeCache ;
7071import com .oracle .svm .hosted .meta .HostedMetaAccess ;
@@ -264,11 +265,20 @@ void installBuilderModules(Set<Module> newCoreTypes) {
264265 public void recordVirtualCallTarget (HostedMethod caller , HostedMethod callee ) {
265266 Module callerModule = caller .getDeclaringClass ().getJavaClass ().getModule ();
266267 Module calleeModule = callee .getDeclaringClass ().getJavaClass ().getModule ();
267- if (!(builderModules .contains (callerModule ) || builderModules .contains (calleeModule ) )) {
268+ if (!(builderModules .contains (callerModule ) && ! isFactoryMethod ( caller )) && ! builderModules .contains (calleeModule )) {
268269 virtualCallTargets .add (callee );
269270 }
270271 }
271272
273+ /**
274+ * {@link FactoryMethod FactoryMethods} outline the allocation and call to the original
275+ * constructor. Hence, whether the call is included or not should be based exclusively on the
276+ * callee.
277+ */
278+ private static boolean isFactoryMethod (HostedMethod caller ) {
279+ return caller .getWrapped ().getWrapped () instanceof FactoryMethod ;
280+ }
281+
272282 public void registerDeclaredDispatchInfo (HostedType type , List <HostedMethod > declaredMethods ) {
273283 var dispatchTable = new HostedDispatchTable ();
274284 dispatchTable .type = type ;
You can’t perform that action at this time.
0 commit comments