Skip to content

Commit e2ed2d7

Browse files
author
Datadog Syncup Service
committed
Merge branch 'upstream-master'
2 parents 047d99f + 6711e13 commit e2ed2d7

File tree

32 files changed

+32
-255
lines changed

32 files changed

+32
-255
lines changed

src/hotspot/share/jfr/leakprofiler/sampling/objectSampler.cpp

Lines changed: 22 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -258,12 +258,25 @@ void ObjectSampler::add(HeapWord* obj, size_t allocated, traceid thread_id, bool
258258
// quick reject, will not fit
259259
return;
260260
}
261-
sample = _list->reuse(_priority_queue->pop());
261+
ObjectSample* popped = _priority_queue->pop();
262+
size_t popped_span = popped->span();
263+
ObjectSample* previous = popped->prev();
264+
sample = _list->reuse(popped);
265+
assert(sample != nullptr, "invariant");
266+
if (previous != nullptr) {
267+
push_span(previous, popped_span);
268+
sample->set_span(span);
269+
} else {
270+
// The removed sample was the youngest sample in the list, which means the new sample is now the youngest
271+
// sample. It should cover the spans of both.
272+
sample->set_span(span + popped_span);
273+
}
262274
} else {
263275
sample = _list->get();
276+
assert(sample != nullptr, "invariant");
277+
sample->set_span(span);
264278
}
265279

266-
assert(sample != nullptr, "invariant");
267280
signal_unresolved_entry();
268281
sample->set_thread_id(thread_id);
269282
if (virtual_thread) {
@@ -278,7 +291,6 @@ void ObjectSampler::add(HeapWord* obj, size_t allocated, traceid thread_id, bool
278291
sample->set_stack_trace_hash(stacktrace_hash);
279292
}
280293

281-
sample->set_span(allocated);
282294
sample->set_object(cast_to_oop(obj));
283295
sample->set_allocated(allocated);
284296
sample->set_allocation_time(JfrTicks::now());
@@ -305,14 +317,18 @@ void ObjectSampler::remove_dead(ObjectSample* sample) {
305317
ObjectSample* const previous = sample->prev();
306318
// push span onto previous
307319
if (previous != nullptr) {
308-
_priority_queue->remove(previous);
309-
previous->add_span(sample->span());
310-
_priority_queue->push(previous);
320+
push_span(previous, sample->span());
311321
}
312322
_priority_queue->remove(sample);
313323
_list->release(sample);
314324
}
315325

326+
void ObjectSampler::push_span(ObjectSample* sample, size_t span) {
327+
_priority_queue->remove(sample);
328+
sample->add_span(span);
329+
_priority_queue->push(sample);
330+
}
331+
316332
ObjectSample* ObjectSampler::last() const {
317333
return _list->last();
318334
}

src/hotspot/share/jfr/leakprofiler/sampling/objectSampler.hpp

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -64,6 +64,7 @@ class ObjectSampler : public CHeapObj<mtTracing> {
6464
void add(HeapWord* object, size_t size, traceid thread_id, bool virtual_thread, const JfrBlobHandle& bh, JavaThread* thread);
6565
void scavenge();
6666
void remove_dead(ObjectSample* sample);
67+
void push_span(ObjectSample* sample, size_t span);
6768

6869
const ObjectSample* item_at(int index) const;
6970
ObjectSample* item_at(int index);

src/java.base/share/classes/module-info.java

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -291,7 +291,6 @@
291291
java.security.jgss,
292292
jdk.naming.dns;
293293
exports sun.net.util to
294-
java.desktop,
295294
java.net.http,
296295
jdk.jconsole,
297296
jdk.sctp;

src/java.base/share/classes/sun/net/util/URLUtil.java

Lines changed: 0 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -25,10 +25,7 @@
2525

2626
package sun.net.util;
2727

28-
import java.io.IOException;
2928
import java.net.URL;
30-
import java.net.URLPermission;
31-
import java.security.Permission;
3229
import java.util.Locale;
3330

3431
/**
@@ -87,27 +84,5 @@ public static String urlNoFragString(URL url) {
8784

8885
return strForm.toString();
8986
}
90-
91-
public static Permission getConnectPermission(URL url) throws IOException {
92-
String urlStringLowerCase = url.toString().toLowerCase(Locale.ROOT);
93-
if (urlStringLowerCase.startsWith("http:") || urlStringLowerCase.startsWith("https:")) {
94-
return getURLConnectPermission(url);
95-
} else if (urlStringLowerCase.startsWith("jar:http:") || urlStringLowerCase.startsWith("jar:https:")) {
96-
String urlString = url.toString();
97-
int bangPos = urlString.indexOf("!/");
98-
urlString = urlString.substring(4, bangPos > -1 ? bangPos : urlString.length());
99-
@SuppressWarnings("deprecation")
100-
URL u = new URL(urlString);
101-
return getURLConnectPermission(u);
102-
// If protocol is HTTP or HTTPS than use URLPermission object
103-
} else {
104-
return url.openConnection().getPermission();
105-
}
106-
}
107-
108-
private static Permission getURLConnectPermission(URL url) {
109-
String urlString = url.getProtocol() + "://" + url.getAuthority() + url.getPath();
110-
return new URLPermission(urlString);
111-
}
11287
}
11388

src/java.desktop/macosx/classes/com/apple/laf/AquaUtils.java

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,6 @@
3838
import sun.awt.AppContext;
3939

4040
import sun.lwawt.macosx.CPlatformWindow;
41-
import sun.reflect.misc.ReflectUtil;
4241
import sun.swing.SwingUtilities2;
4342

4443
import com.apple.laf.AquaImageFactory.SlicedImageControl;
@@ -174,7 +173,6 @@ static class RecyclableSingletonFromDefaultConstructor<T> extends RecyclableSing
174173
@SuppressWarnings("deprecation")
175174
T getInstance() {
176175
try {
177-
ReflectUtil.checkPackageAccess(clazz);
178176
return clazz.newInstance();
179177
} catch (ReflectiveOperationException ignored) {
180178
}

src/java.desktop/share/classes/com/sun/beans/finder/ClassFinder.java

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -24,8 +24,6 @@
2424
*/
2525
package com.sun.beans.finder;
2626

27-
import static sun.reflect.misc.ReflectUtil.checkPackageAccess;
28-
2927
/**
3028
* This is utility class that provides {@code static} methods
3129
* to find a class with the specified name using the specified class loader.
@@ -56,7 +54,6 @@ public final class ClassFinder {
5654
* @see Thread#getContextClassLoader()
5755
*/
5856
public static Class<?> findClass(String name) throws ClassNotFoundException {
59-
checkPackageAccess(name);
6057
try {
6158
ClassLoader loader = Thread.currentThread().getContextClassLoader();
6259
if (loader == null) {
@@ -95,7 +92,6 @@ public static Class<?> findClass(String name) throws ClassNotFoundException {
9592
* @see Class#forName(String,boolean,ClassLoader)
9693
*/
9794
public static Class<?> findClass(String name, ClassLoader loader) throws ClassNotFoundException {
98-
checkPackageAccess(name);
9995
if (loader != null) {
10096
try {
10197
return Class.forName(name, false, loader);

src/java.desktop/share/classes/com/sun/beans/finder/ConstructorFinder.java

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,6 @@
3030
import java.lang.reflect.Modifier;
3131

3232
import static com.sun.beans.util.Cache.Kind.SOFT;
33-
import static sun.reflect.misc.ReflectUtil.isPackageAccessible;
3433

3534
/**
3635
* This utility class provides {@code static} methods
@@ -81,7 +80,7 @@ public static Constructor<?> findConstructor(Class<?> type, Class<?>...args) thr
8180
throw new NoSuchMethodException("Abstract class cannot be instantiated: "
8281
+ type.getName());
8382
}
84-
if (!Modifier.isPublic(type.getModifiers()) || !isPackageAccessible(type)) {
83+
if (!Modifier.isPublic(type.getModifiers())) {
8584
throw new NoSuchMethodException("Class is not accessible: " + type.getName());
8685
}
8786
PrimitiveWrapperMap.replacePrimitivesWithWrappers(args);

src/java.desktop/share/classes/com/sun/beans/finder/FieldFinder.java

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -27,8 +27,6 @@
2727
import java.lang.reflect.Field;
2828
import java.lang.reflect.Modifier;
2929

30-
import static sun.reflect.misc.ReflectUtil.isPackageAccessible;
31-
3230
/**
3331
* This utility class provides {@code static} methods
3432
* to find a public field with specified name
@@ -62,7 +60,7 @@ public static Field findField(Class<?> type, String name) throws NoSuchFieldExce
6260
throw new NoSuchFieldException("Field '" + name + "' is not public");
6361
}
6462
type = field.getDeclaringClass();
65-
if (!Modifier.isPublic(type.getModifiers()) || !isPackageAccessible(type)) {
63+
if (!Modifier.isPublic(type.getModifiers())) {
6664
throw new NoSuchFieldException("Field '" + name + "' is not accessible");
6765
}
6866
return field;

src/java.desktop/share/classes/com/sun/beans/finder/MethodFinder.java

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,6 @@
3434
import java.util.Arrays;
3535

3636
import static com.sun.beans.util.Cache.Kind.SOFT;
37-
import static sun.reflect.misc.ReflectUtil.isPackageAccessible;
3837

3938
/**
4039
* This utility class provides {@code static} methods
@@ -79,7 +78,7 @@ public static Method findMethod(Class<?> type, String name, Class<?>...args) thr
7978

8079
try {
8180
Method method = CACHE.get(signature);
82-
return (method == null) || isPackageAccessible(method.getDeclaringClass()) ? method : CACHE.create(signature);
81+
return (method == null) ? method : CACHE.create(signature);
8382
}
8483
catch (SignatureException exception) {
8584
throw exception.toNoSuchMethodException("Method '" + name + "' is not found");
@@ -138,7 +137,7 @@ public static Method findAccessibleMethod(Method method) throws NoSuchMethodExce
138137
if (!FinderUtils.isExported(type)) {
139138
throw new NoSuchMethodException("Method '" + method.getName() + "' is not accessible");
140139
}
141-
if (Modifier.isPublic(type.getModifiers()) && isPackageAccessible(type)) {
140+
if (Modifier.isPublic(type.getModifiers())) {
142141
return method;
143142
}
144143
if (Modifier.isStatic(method.getModifiers())) {

src/java.desktop/share/classes/com/sun/beans/introspect/ClassInfo.java

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -31,8 +31,6 @@
3131

3232
import com.sun.beans.util.Cache;
3333

34-
import static sun.reflect.misc.ReflectUtil.checkPackageAccess;
35-
3634
public final class ClassInfo {
3735
private static final ClassInfo DEFAULT = new ClassInfo(null);
3836
private static final Cache<Class<?>,ClassInfo> CACHE
@@ -48,7 +46,6 @@ public static ClassInfo get(Class<?> type) {
4846
return DEFAULT;
4947
}
5048
try {
51-
checkPackageAccess(type);
5249
return CACHE.get(type);
5350
} catch (SecurityException exception) {
5451
return DEFAULT;

0 commit comments

Comments
 (0)