Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 5 additions & 3 deletions src/hotspot/cpu/x86/c2_stubGenerator_x86_64_string.cpp
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright (c) 2024, 2025, Intel Corporation. All rights reserved.
* Copyright (c) 2024, 2026, Intel Corporation. All rights reserved.
*
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
Expand Down Expand Up @@ -1330,10 +1330,12 @@ static void big_case_loop_helper(bool sizeKnown, int size, Label &noMatch, Label
// Clarification: The BYTE_K compare above compares haystack[(n-32):(n-1)]. We need to
// compare haystack[(k-1):(k-1+31)]. Subtracting either index gives shift value of
// (k + 31 - n): x = (k-1+31)-(n-1) = k-1+31-n+1 = k+31-n.
// When isU is set, similarly, shift is from haystack[(n-32):(n-1)] to [(k-2):(k-2+31)]

if (sizeKnown) {
__ movl(temp2, 31 + size);
__ movl(temp2, (isU ? 30 : 31) + size);
} else {
__ movl(temp2, 31);
__ movl(temp2, isU ? 30 : 31);
__ addl(temp2, needleLen);
}
__ subl(temp2, hsLength);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,13 @@

package java.util.concurrent;

import jdk.internal.misc.Unsafe;

import java.io.IOException;
import java.io.ObjectInputStream;
import java.io.ObjectStreamException;
import java.io.Serial;
import java.io.StreamCorruptedException;
import java.util.AbstractSet;
import java.util.Collection;
import java.util.Iterator;
Expand Down Expand Up @@ -445,4 +452,38 @@ public Spliterator<E> spliterator() {
return Spliterators.spliterator
(al.getArray(), Spliterator.IMMUTABLE | Spliterator.DISTINCT);
}

/**
* De-serialization without data not supported for this class.
*/
@Serial
private void readObjectNoData() throws ObjectStreamException {
throw new StreamCorruptedException("Deserialized CopyOnWriteArraySet requires data");
}

/**
* Reconstitutes the {@code CopyOnWriteArraySet} instance from a stream
* (that is, deserializes it).
* @throws StreamCorruptedException if the object read from the stream is invalid.
*/
@Serial
private void readObject(ObjectInputStream in) throws IOException, ClassNotFoundException {
CopyOnWriteArrayList<E> newAl; // Set during the duplicate check

@SuppressWarnings("unchecked")
CopyOnWriteArrayList<E> inAl = (CopyOnWriteArrayList<E>) in.readFields().get("al", null);

if (inAl == null
|| inAl.getClass() != CopyOnWriteArrayList.class
|| (newAl = new CopyOnWriteArrayList<>()).addAllAbsent(inAl) != inAl.size()) {
throw new StreamCorruptedException("Content is invalid");
}

final Unsafe U = Unsafe.getUnsafe();
U.putReference(
this,
U.objectFieldOffset(CopyOnWriteArraySet.class, "al"),
newAl
);
}
}
Loading
Loading