/* * Copyright (c) 2016, 2022, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it * under the terms of the GNU General Public License version 2 only, as * published by the Free Software Foundation. * * This code is distributed in the hope that it will be useful, but WITHOUT * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License * version 2 for more details (a copy is included in the LICENSE file that * accompanied this code). * * You should have received a copy of the GNU General Public License version * 2 along with this work; if not, write to the Free Software Foundation, * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. * * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA * or visit www.oracle.com if you need additional information or have any * questions.
*/
TestJFRIntrinsic() throws Exception { // the intrinsic is premised on this class being loaded already - the event writer object is massaged heavily before returning
eventWriterClazz = Class.forName("jdk.jfr.internal.event.EventWriter", true, TestJFRIntrinsic.class.getClassLoader());
}
int[] lvls = getAvailableCompilationLevels(); for (int i : lvls) { if (!WHITE_BOX.enqueueMethodForCompilation(method, i)) { thrownew RuntimeException("Failed to enqueue method on level: " + i);
}
if (WHITE_BOX.isMethodCompiled(method)) {
NMethod nm = NMethod.get(method, false); if (nm.comp_level != i) { thrownew RuntimeException("Failed to compile on correct level: " + i);
}
System.out.println("Compiled " + method + " on level " + i);
}
}
}
/* below is copied from CompilerUtil in hotspot test lib, removed this when it's moved */
/** * Returns available compilation levels * * @return int array with compilation levels
*/ publicstaticint[] getAvailableCompilationLevels() { if (!WhiteBox.getWhiteBox().getBooleanVMFlag("UseCompiler")) { returnnewint[0];
} if (WhiteBox.getWhiteBox().getBooleanVMFlag("TieredCompilation")) { Long flagValue = WhiteBox.getWhiteBox()
.getIntxVMFlag("TieredStopAtLevel"); int maxLevel = flagValue.intValue(); return IntStream.rangeClosed(1, maxLevel).toArray();
} else { if (Platform.isServer() && !Platform.isEmulatedClient()) { returnnewint[]{4};
} if (Platform.isClient() || Platform.isMinimal() || Platform.isEmulatedClient()) { returnnewint[]{1};
}
} returnnewint[0];
}
/** * Returns maximum compilation level available * @return an int value representing maximum compilation level available
*/ publicstaticint getMaxCompilationLevel() { return Arrays.stream(getAvailableCompilationLevels())
.max()
.getAsInt();
}
}
Messung V0.5
¤ Dauer der Verarbeitung: 0.16 Sekunden
(vorverarbeitet)
¤
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.