From db0a78f9d4bd34247281c1f497dec8157b11901b Mon Sep 17 00:00:00 2001 From: Igor Ignatyev Date: Tue, 18 Jun 2019 09:19:57 -0700 Subject: [PATCH 1/7] 8226313: problem list compiler/types/correctness tests Reviewed-by: thartmann --- test/hotspot/jtreg/ProblemList.txt | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/test/hotspot/jtreg/ProblemList.txt b/test/hotspot/jtreg/ProblemList.txt index 136f6de6a5e..ac9ec458d64 100644 --- a/test/hotspot/jtreg/ProblemList.txt +++ b/test/hotspot/jtreg/ProblemList.txt @@ -49,8 +49,8 @@ compiler/jvmci/compilerToVM/GetResolvedJavaTypeTest.java 8158860 generic-all compiler/jvmci/compilerToVM/InvalidateInstalledCodeTest.java 8163894 generic-all compiler/tiered/LevelTransitionTest.java 8067651 generic-all -compiler/types/correctness/CorrectnessTest.java 8225620 solaris-sparcv9 -compiler/types/correctness/OffTest.java 8225620 solaris-sparcv9 +compiler/types/correctness/CorrectnessTest.java 8225670,8225620 generic-all,solaris-sparcv9 +compiler/types/correctness/OffTest.java 8225670,8225620 generic-all,solaris-sparcv9 compiler/c2/Test6852078.java 8194310 generic-all compiler/c2/Test8004741.java 8214904 generic-all From 95a0560a0a8842cd143cc8f7c0515b60d688d4ad Mon Sep 17 00:00:00 2001 From: Alex Menkov Date: Tue, 18 Jun 2019 16:08:31 -0700 Subject: [PATCH 2/7] 8225682: Reference to JNI spec on java.sun.com Reviewed-by: gadams, cjplummer, sspitsyn --- make/data/jdwp/jdwp.spec | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/make/data/jdwp/jdwp.spec b/make/data/jdwp/jdwp.spec index bea43605e0c..2cf53f7c7e3 100644 --- a/make/data/jdwp/jdwp.spec +++ b/make/data/jdwp/jdwp.spec @@ -1,5 +1,5 @@ /* - * Copyright (c) 1998, 2018, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 1998, 2019, 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 @@ -602,7 +602,7 @@ JDWP "Java(tm) Debug Wire Protocol" (Command Signature=1 "Returns the JNI signature of a reference type. " "JNI signature formats are described in the " - "Java Native Inteface Specification" + "Java Native Interface Specification" "

"For primitive classes " "the returned signature is the signature of the corresponding primitive " From 02236557111e00b04cf500387de17bc58d4f4d49 Mon Sep 17 00:00:00 2001 From: Igor Ignatyev Date: Wed, 19 Jun 2019 03:21:38 -0700 Subject: [PATCH 3/7] 8226360: merge entries in hotspot problem lists Reviewed-by: epavlova, kvn --- test/hotspot/jtreg/ProblemList-graal.txt | 18 ++++++------------ test/jdk/ProblemList-graal.txt | 22 ++++------------------ 2 files changed, 10 insertions(+), 30 deletions(-) diff --git a/test/hotspot/jtreg/ProblemList-graal.txt b/test/hotspot/jtreg/ProblemList-graal.txt index e37be5a52ce..a744362144d 100644 --- a/test/hotspot/jtreg/ProblemList-graal.txt +++ b/test/hotspot/jtreg/ProblemList-graal.txt @@ -147,16 +147,16 @@ vmTestbase/vm/mlvm/anonloader/stress/oome/metaspace/Test.java 8186299 gener # jvmti tests vmTestbase/nsk/jvmti/PopFrame/popframe009/TestDescription.java 8195639 generic-all -vmTestbase/nsk/jvmti/ForceEarlyReturn/ForceEarlyReturn001/TestDescription.java 8195674 generic-all -vmTestbase/nsk/jvmti/ForceEarlyReturn/ForceEarlyReturn002/TestDescription.java 8195674 generic-all +vmTestbase/nsk/jvmti/ForceEarlyReturn/ForceEarlyReturn001/TestDescription.java 8195674,8195635 generic-all +vmTestbase/nsk/jvmti/ForceEarlyReturn/ForceEarlyReturn002/TestDescription.java 8195674,8195635 generic-all runtime/appcds/cacheObject/RedefineClassTest.java 8204506 macosx-all -vmTestbase/nsk/jvmti/scenarios/hotswap/HS102/hs102t001/TestDescription.java 8204506 macosx-all +vmTestbase/nsk/jvmti/scenarios/hotswap/HS102/hs102t001/TestDescription.java 8204506,8195635 macosx-all,generic-all vmTestbase/nsk/jvmti/scenarios/hotswap/HS102/hs102t002/TestDescription.java 8204506 macosx-all -vmTestbase/nsk/jvmti/PopFrame/popframe001/TestDescription.java 8207013 generic-all -vmTestbase/nsk/jvmti/PopFrame/popframe003/TestDescription.java 8207013 generic-all -vmTestbase/nsk/jvmti/PopFrame/popframe005/TestDescription.java 8207013 generic-all +vmTestbase/nsk/jvmti/PopFrame/popframe001/TestDescription.java 8207013,8195635 generic-all +vmTestbase/nsk/jvmti/PopFrame/popframe003/TestDescription.java 8207013,8195635 generic-all +vmTestbase/nsk/jvmti/PopFrame/popframe005/TestDescription.java 8207013,8195635 generic-all vmTestbase/nsk/jvmti/StopThread/stopthrd007/TestDescription.java 8207013 generic-all serviceability/jvmti/FieldAccessWatch/FieldAccessWatch.java 8202482 generic-all @@ -181,14 +181,8 @@ vmTestbase/nsk/jdi/stress/serial/forceEarlyReturn001/TestDescription.java vmTestbase/nsk/jdi/stress/serial/forceEarlyReturn002/TestDescription.java 8195635 generic-all vmTestbase/nsk/jdi/stress/serial/mixed002/TestDescription.java 8195635 generic-all vmTestbase/nsk/jdwp/ThreadReference/ForceEarlyReturn/forceEarlyReturn002/forceEarlyReturn002.java 8195635 generic-all -vmTestbase/nsk/jvmti/ForceEarlyReturn/ForceEarlyReturn001/TestDescription.java 8195635 generic-all -vmTestbase/nsk/jvmti/ForceEarlyReturn/ForceEarlyReturn002/TestDescription.java 8195635 generic-all -vmTestbase/nsk/jvmti/PopFrame/popframe001/TestDescription.java 8195635 generic-all -vmTestbase/nsk/jvmti/PopFrame/popframe003/TestDescription.java 8195635 generic-all -vmTestbase/nsk/jvmti/PopFrame/popframe005/TestDescription.java 8195635 generic-all vmTestbase/nsk/jvmti/scenarios/capability/CM01/cm01t007/TestDescription.java 8195635 generic-all vmTestbase/nsk/jvmti/scenarios/capability/CM03/cm03t001/TestDescription.java 8195635 generic-all -vmTestbase/nsk/jvmti/scenarios/hotswap/HS102/hs102t001/TestDescription.java 8195635 generic-all vmTestbase/nsk/jvmti/scenarios/hotswap/HS201/hs201t001/TestDescription.java 8195635 generic-all vmTestbase/nsk/jvmti/scenarios/hotswap/HS201/hs201t002/TestDescription.java 8195635 generic-all vmTestbase/nsk/jvmti/scenarios/hotswap/HS202/hs202t002/hs202t002.java 8195635 generic-all diff --git a/test/jdk/ProblemList-graal.txt b/test/jdk/ProblemList-graal.txt index f9b82c786aa..5bc3355abd1 100644 --- a/test/jdk/ProblemList-graal.txt +++ b/test/jdk/ProblemList-graal.txt @@ -78,27 +78,13 @@ java/lang/Runtime/exec/LotsOfOutput.java 8196611 java/util/concurrent/ScheduledThreadPoolExecutor/BasicCancelTest.java 8196611 generic-all # tests require pop_frame and force_early_return capabilities -com/sun/jdi/RedefineTTYLineNumber.java 8195635 generic-all -com/sun/jdi/RedefineG.java 8195635 generic-all -com/sun/jdi/RedefineCrossStart.java 8195635 generic-all -com/sun/jdi/PopSynchronousTest.java 8195635 generic-all -com/sun/jdi/RedefineTTYLineNumber.java 8195635 generic-all -com/sun/jdi/RedefineG.java 8195635 generic-all -com/sun/jdi/RedefineCrossStart.java 8195635 generic-all -com/sun/jdi/PopSynchronousTest.java 8195635 generic-all -com/sun/jdi/PopAsynchronousTest.java 8195635 generic-all +com/sun/jdi/EarlyReturnTest.java 8195635 generic-all com/sun/jdi/PopAndStepTest.java 8195635 generic-all com/sun/jdi/PopAsynchronousTest.java 8195635 generic-all -com/sun/jdi/PopAndStepTest.java 8195635 generic-all -com/sun/jdi/EarlyReturnTest.java 8195635 generic-all -com/sun/jdi/RedefineTTYLineNumber.java 8195635 generic-all -com/sun/jdi/RedefineG.java 8195635 generic-all -com/sun/jdi/RedefineCrossStart.java 8195635 generic-all com/sun/jdi/PopSynchronousTest.java 8195635 generic-all -com/sun/jdi/PopAsynchronousTest.java 8195635 generic-all -com/sun/jdi/PopAndStepTest.java 8195635 generic-all -com/sun/jdi/EarlyReturnTest.java 8195635 generic-all -com/sun/jdi/EarlyReturnTest.java 8195635 generic-all +com/sun/jdi/RedefineCrossStart.java 8195635 generic-all +com/sun/jdi/RedefineG.java 8195635 generic-all +com/sun/jdi/RedefineTTYLineNumber.java 8195635 generic-all # Next JFR tests fail with Graal. Assuming 8193210. jdk/jfr/event/compiler/TestCodeSweeper.java 8193210 generic-all From 3b22c24b74199f0fd4cf166681b44887aa35534c Mon Sep 17 00:00:00 2001 From: Tobias Hartmann Date: Wed, 19 Jun 2019 12:24:26 +0200 Subject: [PATCH 4/7] 8226381: ProblemList java/lang/reflect/PublicMethods/PublicMethodsTest.java Put test on AOT ProblemList. Reviewed-by: iignatyev --- test/jdk/ProblemList-aot.txt | 1 + 1 file changed, 1 insertion(+) diff --git a/test/jdk/ProblemList-aot.txt b/test/jdk/ProblemList-aot.txt index bb012e0e70e..79d29818a35 100644 --- a/test/jdk/ProblemList-aot.txt +++ b/test/jdk/ProblemList-aot.txt @@ -30,3 +30,4 @@ java/lang/invoke/VarHandles/VarHandleTestByteArrayAsShort.java 8222445 windows-x64 java/lang/invoke/VarHandles/VarHandleTestByteArrayAsChar.java 8222445 windows-x64 java/lang/invoke/VarHandles/VarHandleTestAccessBoolean.java 8222445 windows-x64 +java/lang/reflect/PublicMethods/PublicMethodsTest.java 8226309 generic-all From 9b2f151f3035f4ba6be651237f38050d6e0f881c Mon Sep 17 00:00:00 2001 From: Tobias Hartmann Date: Wed, 19 Jun 2019 12:25:12 +0200 Subject: [PATCH 5/7] 8226382: ProblemList java/lang/constant/MethodTypeDescTest.java Put test on AOT ProblemList. Reviewed-by: iignatyev --- test/jdk/ProblemList-aot.txt | 1 + 1 file changed, 1 insertion(+) diff --git a/test/jdk/ProblemList-aot.txt b/test/jdk/ProblemList-aot.txt index 79d29818a35..3a3edbd69c0 100644 --- a/test/jdk/ProblemList-aot.txt +++ b/test/jdk/ProblemList-aot.txt @@ -31,3 +31,4 @@ java/lang/invoke/VarHandles/VarHandleTestByteArrayAsShort.java 8222445 windows- java/lang/invoke/VarHandles/VarHandleTestByteArrayAsChar.java 8222445 windows-x64 java/lang/invoke/VarHandles/VarHandleTestAccessBoolean.java 8222445 windows-x64 java/lang/reflect/PublicMethods/PublicMethodsTest.java 8226309 generic-all +java/lang/constant/MethodTypeDescTest.java 8225349 windows-x64 From b304a5798085ea817d4a0ebcaa5442367c61ed5a Mon Sep 17 00:00:00 2001 From: Harold Seigel Date: Wed, 19 Jun 2019 08:42:15 -0400 Subject: [PATCH 6/7] 8225789: Empty method parameter type should generate ClassFormatError Check for an empty name when verifying unqualified names Reviewed-by: lfoltan, coleenp --- .../share/classfile/classFileParser.cpp | 3 +- .../classFileParserBug/EmptyUnqName.jasm | 43 +++++++++++++++++ .../classFileParserBug/TestEmptyUnqName.java | 46 +++++++++++++++++++ .../jtreg/runtime/verifier/TestSigParse.java | 2 +- 4 files changed, 92 insertions(+), 2 deletions(-) create mode 100644 test/hotspot/jtreg/runtime/classFileParserBug/EmptyUnqName.jasm create mode 100644 test/hotspot/jtreg/runtime/classFileParserBug/TestEmptyUnqName.java diff --git a/src/hotspot/share/classfile/classFileParser.cpp b/src/hotspot/share/classfile/classFileParser.cpp index 1583441e7e1..ed4398b1e1c 100644 --- a/src/hotspot/share/classfile/classFileParser.cpp +++ b/src/hotspot/share/classfile/classFileParser.cpp @@ -4956,6 +4956,7 @@ void ClassFileParser::verify_legal_utf8(const unsigned char* buffer, bool ClassFileParser::verify_unqualified_name(const char* name, unsigned int length, int type) { + if (length == 0) return false; // Must have at least one char. for (const char* p = name; p != name + length; p++) { switch(*p) { case '.': @@ -5105,7 +5106,7 @@ const char* ClassFileParser::skip_over_field_signature(const char* signature, int newlen = c - (char*) signature; bool legal = verify_unqualified_name(signature, newlen, LegalClass); if (!legal) { - classfile_parse_error("Class name contains illegal character " + classfile_parse_error("Class name is empty or contains illegal character " "in descriptor in class file %s", CHECK_0); return NULL; diff --git a/test/hotspot/jtreg/runtime/classFileParserBug/EmptyUnqName.jasm b/test/hotspot/jtreg/runtime/classFileParserBug/EmptyUnqName.jasm new file mode 100644 index 00000000000..1654d098316 --- /dev/null +++ b/test/hotspot/jtreg/runtime/classFileParserBug/EmptyUnqName.jasm @@ -0,0 +1,43 @@ +/* + * Copyright (c) 2019, 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. + */ + +super public class EmptyUnqName version 56:0 { + + public Method "":"()V" stack 1 locals 1 { + aload_0; + invokespecial Method java/lang/Object."":"()V"; + return; + } + + public static Method main:"([Ljava/lang/String;)V" stack 2 locals 1 { + getstatic Field java/lang/System.out:"Ljava/io/PrintStream;"; + ldc String "Testing method param types"; + invokevirtual Method java/io/PrintStream.println:"(Ljava/lang/String;)V"; + return; + } + + public static Method func:"(L;)V" stack 0 locals 1 { + return; + } + +} // end Class EmptyUnqName diff --git a/test/hotspot/jtreg/runtime/classFileParserBug/TestEmptyUnqName.java b/test/hotspot/jtreg/runtime/classFileParserBug/TestEmptyUnqName.java new file mode 100644 index 00000000000..8c94982bb77 --- /dev/null +++ b/test/hotspot/jtreg/runtime/classFileParserBug/TestEmptyUnqName.java @@ -0,0 +1,46 @@ +/* + * Copyright (c) 2019, 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. + */ + +/* + * @test + * @bug 8225789 + * @summary Test that an unqualified name of "L;" causes a ClassFormatError exception. + * @compile EmptyUnqName.jasm + * @run main/othervm -Xverify:remote TestEmptyUnqName + */ + +public class TestEmptyUnqName { + public static void main(String args[]) throws Throwable { + + System.out.println("Regression test for bug 8225789"); + + try { + Class newClass = Class.forName("EmptyUnqName"); + throw new RuntimeException("Expected ClassFormatError exception not thrown"); + } catch (java.lang.ClassFormatError e) { + if (!e.getMessage().contains("Class name is empty or contains illegal character")) { + throw new RuntimeException("Wrong ClassFormatError: " + e.getMessage()); + } + } + } +} diff --git a/test/hotspot/jtreg/runtime/verifier/TestSigParse.java b/test/hotspot/jtreg/runtime/verifier/TestSigParse.java index 0cddfa649ab..df710162637 100644 --- a/test/hotspot/jtreg/runtime/verifier/TestSigParse.java +++ b/test/hotspot/jtreg/runtime/verifier/TestSigParse.java @@ -63,7 +63,7 @@ public class TestSigParse { throw new RuntimeException("Expected ClasFormatError exception not thrown"); } catch (java.lang.ClassFormatError e) { String eMsg = e.getMessage(); - if (!eMsg.contains("Class name contains illegal character")) { + if (!eMsg.contains("Class name is empty or contains illegal character")) { throw new RuntimeException("Unexpected exception: " + eMsg); } } From f66bd2d52e48a6604c0f5239890cd50b6cce4f5c Mon Sep 17 00:00:00 2001 From: Andrew Haley Date: Tue, 18 Jun 2019 16:15:15 +0100 Subject: [PATCH 7/7] 8225716: G1 GC: Undefined behaviour in G1BlockOffsetTablePart::block_at_or_preceding Reviewed-by: kbarrett, tschatzl --- src/hotspot/share/gc/g1/g1BlockOffsetTable.cpp | 6 ------ src/hotspot/share/gc/g1/g1BlockOffsetTable.hpp | 7 ++----- src/hotspot/share/gc/g1/g1BlockOffsetTable.inline.hpp | 10 ++++++++-- 3 files changed, 10 insertions(+), 13 deletions(-) diff --git a/src/hotspot/share/gc/g1/g1BlockOffsetTable.cpp b/src/hotspot/share/gc/g1/g1BlockOffsetTable.cpp index 154869cb511..52e976c9444 100644 --- a/src/hotspot/share/gc/g1/g1BlockOffsetTable.cpp +++ b/src/hotspot/share/gc/g1/g1BlockOffsetTable.cpp @@ -391,8 +391,6 @@ G1BlockOffsetTablePart::print_on(outputStream* out) { #endif // !PRODUCT HeapWord* G1BlockOffsetTablePart::initialize_threshold_raw() { - assert(!G1CollectedHeap::heap()->is_in_reserved(_bot->_offset_array), - "just checking"); _next_offset_index = _bot->index_for_raw(_space->bottom()); _next_offset_index++; _next_offset_threshold = @@ -401,8 +399,6 @@ HeapWord* G1BlockOffsetTablePart::initialize_threshold_raw() { } void G1BlockOffsetTablePart::zero_bottom_entry_raw() { - assert(!G1CollectedHeap::heap()->is_in_reserved(_bot->_offset_array), - "just checking"); size_t bottom_index = _bot->index_for_raw(_space->bottom()); assert(_bot->address_for_index_raw(bottom_index) == _space->bottom(), "Precondition of call"); @@ -410,8 +406,6 @@ void G1BlockOffsetTablePart::zero_bottom_entry_raw() { } HeapWord* G1BlockOffsetTablePart::initialize_threshold() { - assert(!G1CollectedHeap::heap()->is_in_reserved(_bot->_offset_array), - "just checking"); _next_offset_index = _bot->index_for(_space->bottom()); _next_offset_index++; _next_offset_threshold = diff --git a/src/hotspot/share/gc/g1/g1BlockOffsetTable.hpp b/src/hotspot/share/gc/g1/g1BlockOffsetTable.hpp index fa7a84ad4ff..0ef0b140dc3 100644 --- a/src/hotspot/share/gc/g1/g1BlockOffsetTable.hpp +++ b/src/hotspot/share/gc/g1/g1BlockOffsetTable.hpp @@ -52,7 +52,7 @@ private: // Array for keeping offsets for retrieving object start fast given an // address. - u_char* _offset_array; // byte array keeping backwards offsets + volatile u_char* _offset_array; // byte array keeping backwards offsets void check_offset(size_t offset, const char* msg) const { assert(offset <= BOTConstants::N_words, @@ -64,10 +64,7 @@ private: // For performance these have to devolve to array accesses in product builds. inline u_char offset_array(size_t index) const; - void set_offset_array_raw(size_t index, u_char offset) { - _offset_array[index] = offset; - } - + inline void set_offset_array_raw(size_t index, u_char offset); inline void set_offset_array(size_t index, u_char offset); inline void set_offset_array(size_t index, HeapWord* high, HeapWord* low); diff --git a/src/hotspot/share/gc/g1/g1BlockOffsetTable.inline.hpp b/src/hotspot/share/gc/g1/g1BlockOffsetTable.inline.hpp index 186f135e0d4..fba285d851e 100644 --- a/src/hotspot/share/gc/g1/g1BlockOffsetTable.inline.hpp +++ b/src/hotspot/share/gc/g1/g1BlockOffsetTable.inline.hpp @@ -29,6 +29,7 @@ #include "gc/g1/heapRegion.hpp" #include "gc/shared/memset_with_concurrent_readers.hpp" #include "gc/shared/space.hpp" +#include "runtime/atomic.hpp" inline HeapWord* G1BlockOffsetTablePart::block_start(const void* addr) { if (addr >= _space->bottom() && addr < _space->end()) { @@ -51,7 +52,11 @@ inline HeapWord* G1BlockOffsetTablePart::block_start_const(const void* addr) con u_char G1BlockOffsetTable::offset_array(size_t index) const { check_index(index, "index out of range"); - return _offset_array[index]; + return Atomic::load(&_offset_array[index]); +} + +void G1BlockOffsetTable::set_offset_array_raw(size_t index, u_char offset) { + Atomic::store(offset, &_offset_array[index]); } void G1BlockOffsetTable::set_offset_array(size_t index, u_char offset) { @@ -71,7 +76,8 @@ void G1BlockOffsetTable::set_offset_array(size_t left, size_t right, u_char offs check_index(right, "right index out of range"); assert(left <= right, "indexes out of order"); size_t num_cards = right - left + 1; - memset_with_concurrent_readers(&_offset_array[left], offset, num_cards); + memset_with_concurrent_readers + (const_cast (&_offset_array[left]), offset, num_cards); } // Variant of index_for that does not check the index for validity.