55
55
import java .lang .StackWalker .StackFrame ;
56
56
import java .nio .file .*;
57
57
import java .util .*;
58
+ import java .util .function .*;
58
59
import java .util .stream .*;
59
60
import static java .lang .Math .max ;
60
61
import static java .lang .Math .min ;
@@ -394,6 +395,11 @@ int depth() {
394
395
return d ;
395
396
}
396
397
398
+ boolean traceHas (Predicate <Op > pred ) {
399
+ for (int i = 0 ; i < index ; i ++) if (pred .test (trace [i ])) return true ;
400
+ return false ;
401
+ }
402
+
397
403
String [] expectedStackTrace () {
398
404
var ms = new ArrayList <String >();
399
405
for (int i = index ; i >= 0 ; i --) if (!Op .NON_CALLS .contains (trace [i ])) ms .add (method (trace [i ]).getName ());
@@ -417,13 +423,12 @@ void verifyResult(int result) {
417
423
}
418
424
419
425
boolean shouldPin () {
420
- for (int i = 0 ; i < index ; i ++)
421
- if (trace [i ] == Op .CALL_I_PIN || trace [i ] == Op .CALL_C_PIN ) return true ;
422
- return false ;
426
+ return traceHas (Op .PIN ::contains );
423
427
}
424
428
425
429
void verifyPin (boolean yieldResult ) {
426
430
if (yieldResult ) yields ++;
431
+ if (!yieldResult && traceHas (op -> Op .INTERPRETED .contains (op ) && Op .REFLECTED .contains (op ))) return ;
427
432
assert yieldResult != shouldPin () : "res: " + yieldResult + " shouldPin: " + shouldPin ();
428
433
}
429
434
@@ -439,6 +444,7 @@ boolean shouldThrow() {
439
444
}
440
445
441
446
void captureStack () {
447
+ // Thread.dumpStack();
442
448
if (!VERIFY_STACK ) return ;
443
449
backtrace = Thread .currentThread ().getStackTrace ();
444
450
fbacktrace = StackWalkerHelper .getStackFrames (SCOPE );
@@ -494,7 +500,7 @@ void verifyStack(Object[] observed) {
494
500
verifyStack (
495
501
expectedStackTrace (),
496
502
Arrays .stream (cutStack (observed )).filter (sf -> Fuzz .class .getName ().equals (sfClassName (sf )))
497
- .collect (Collectors .toList ()).toArray (new Object [0 ] ));
503
+ .collect (Collectors .toList ()).toArray (Object []:: new ));
498
504
}
499
505
500
506
static void verifyStack (Object [] expected , Object [] observed ) {
0 commit comments