@@ -7291,7 +7291,62 @@ void TR_InvariantArgumentPreexistence::processIndirectCall(TR::Node *node, TR::T
7291
7291
7292
7292
// Quit if class is not compatible with the method
7293
7293
if (resolvedMethod && receiverInfo->getClass () && !classIsCompatibleWithMethod (receiverInfo->getClass (), resolvedMethod))
7294
+ {
7295
+ if (trace ())
7296
+ traceMsg (comp (), " PREX: - Receiver type incompatible with method \n " );
7297
+
7294
7298
return ;
7299
+ }
7300
+
7301
+ TR::MethodSymbol *methSymbol = node->getSymbol ()->getMethodSymbol ();
7302
+ if (methSymbol->isInterface ())
7303
+ {
7304
+ // Interface type signatures can't be trusted most places in bytecode, so
7305
+ // only transform interface calls when we have a class bound for the
7306
+ // receiver.
7307
+ TR_OpaqueClassBlock *klass = receiverInfo->getClass ();
7308
+ if (klass == NULL || TR::Compiler->cls .isInterfaceClass (comp (), klass))
7309
+ {
7310
+ if (trace ())
7311
+ {
7312
+ traceMsg (
7313
+ comp (),
7314
+ " PREX: - No class type bound for interface call receiver\n " );
7315
+ }
7316
+
7317
+ return ;
7318
+ }
7319
+
7320
+ TR_ResolvedMethod *caller = node->getSymbolReference ()->getOwningMethod (comp ());
7321
+ TR::Method *callee = methSymbol->getMethod ();
7322
+ bool aotOk = true ;
7323
+ TR_OpaqueClassBlock *iface = fe ()->getClassFromSignature (
7324
+ callee->classNameChars (), callee->classNameLength (), caller, aotOk);
7325
+
7326
+ if (iface == NULL )
7327
+ {
7328
+ if (trace ())
7329
+ {
7330
+ traceMsg (
7331
+ comp (),
7332
+ " PREX: - Failed to identify interface for interface call\n " );
7333
+ }
7334
+
7335
+ return ;
7336
+ }
7337
+
7338
+ if (fe ()->isInstanceOf (klass, iface, true , true , true ) != TR_yes)
7339
+ {
7340
+ if (trace ())
7341
+ {
7342
+ traceMsg (
7343
+ comp (),
7344
+ " PREX: - Insufficient class type bound for interface call receiver\n " );
7345
+ }
7346
+
7347
+ return ;
7348
+ }
7349
+ }
7295
7350
7296
7351
//
7297
7352
// Step 2: Transform
@@ -7395,7 +7450,6 @@ void TR_InvariantArgumentPreexistence::processIndirectCall(TR::Node *node, TR::T
7395
7450
TR::ClassTableCriticalSection processIndirectCall (comp ()->fe ());
7396
7451
TR::SymbolReference *symRef = node->getSymbolReference ();
7397
7452
TR_PersistentCHTable * chTable = comp ()->getPersistentInfo ()->getPersistentCHTable ();
7398
- TR::MethodSymbol *methSymbol = node->getSymbol ()->getMethodSymbol ();
7399
7453
if (methSymbol->isInterface () || methodSymbol)
7400
7454
{
7401
7455
TR_ResolvedMethod * method = NULL ;
@@ -7414,8 +7468,16 @@ void TR_InvariantArgumentPreexistence::processIndirectCall(TR::Node *node, TR::T
7414
7468
{
7415
7469
if (comp ()->getPersistentInfo ()->getRuntimeAssumptionTable ()->getAssumptionCount (RuntimeAssumptionOnClassExtend) < 100000 )
7416
7470
method = chTable->findSingleInterfaceImplementer (receiverInfo->getClass (), node->getSymbolReference ()->getCPIndex (), node->getSymbolReference ()->getOwningMethod (comp ()), comp ());
7417
- // if (method)
7418
- // fprintf(stderr, "%s assumptios=%d\n", comp()->signature(), comp()->getPersistentInfo()->getRuntimeAssumptionTable()->getAssumptionCount(RuntimeAssumptionOnClassExtend));
7471
+ if (method == NULL )
7472
+ {
7473
+ if (trace ())
7474
+ {
7475
+ traceMsg (
7476
+ comp (),
7477
+ " PREX: - Failed to find interface callee\n " );
7478
+ }
7479
+ return ;
7480
+ }
7419
7481
}
7420
7482
else
7421
7483
{
0 commit comments