// This test checks that values (e.g. induction variable) are properly set for SuspendCheck // environment in the SIMD loop; by causing asynchronous deoptimization in debuggable mode we // we observe the values. publicclass SimdLoop implements Runnable { staticfinalint numberOfThreads = 2; volatilestaticboolean sExitFlag = false; volatilestaticboolean sEntered = false; int threadIndex;
SimdLoop(int index) {
threadIndex = index;
}
publicstaticvoid main() throws Exception { finalThread[] threads = newThread[numberOfThreads]; for (int t = 0; t < threads.length; t++) {
threads[t] = newThread(new SimdLoop(t));
threads[t].start();
} for (Thread t : threads) {
t.join();
}
// On Arm64: // These loops are likely to be vectorized; when deoptimizing to interpreter the induction // variable i will be set to wrong value (== 0). // // Copy-paste instead of nested loop is here to avoid extra loop suspend check. for (int i = 0; i < kArraySize; i++) {
array[i]++;
} for (int i = 0; i < kArraySize; i++) {
array[i]++;
} for (int i = 0; i < kArraySize; i++) {
array[i]++;
} for (int i = 0; i < kArraySize; i++) {
array[i]++;
}
// We might have managed to execute the whole loop before deoptimizeAll() happend. if (sExitFlag) {
Main.assertIsInterpreted();
} // Regression: the value of the induction variable might have been set to 0 when // deoptimizing causing to have another array[0]++.
expectEqual(array[0], 4);
}
publicvoid run() { if (threadIndex == 0) { while (!sEntered) { Thread.yield();
}
Die Informationen auf dieser Webseite wurden
nach bestem Wissen sorgfältig zusammengestellt. Es wird jedoch weder Vollständigkeit, noch Richtigkeit,
noch Qualität der bereit gestellten Informationen zugesichert.
Bemerkung:
Die farbliche Syntaxdarstellung und die Messung sind noch experimentell.