Skip to content

Commit

Permalink
@iklam comments and copyright update
Browse files Browse the repository at this point in the history
  • Loading branch information
calvinccheung committed Mar 8, 2024
1 parent 092171f commit 38d64c1
Show file tree
Hide file tree
Showing 17 changed files with 36 additions and 48 deletions.
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright (c) 2016, 2023, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2016, 2024, 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
Expand All @@ -25,7 +25,7 @@

package java.lang.invoke;

import jdk.internal.misc.CDS;
//import jdk.internal.misc.CDS;
import jdk.internal.org.objectweb.asm.ClassWriter;
import jdk.internal.org.objectweb.asm.Opcodes;
import sun.invoke.util.Wrapper;
Expand Down Expand Up @@ -323,13 +323,12 @@ static Map<String, byte[]> generateHolderClasses(Stream<String> traces) {
builder.addCallSiteType(methodType);
} else {
MethodType mt = HolderClassBuilder.asMethodType(methodType);
// Work around JDK-8327499
if (HolderClassBuilder.checkInvokerTypeParams(mt)) {
builder.addInvokerType(methodType);
} else {
if (CDS.isDumpingArchive()) {
PlatformLogger.getLogger("java.lang.invoke")
.warning("Invalid LF_RESOLVE " + parts[1] + " " + parts[2] + " " + parts[3]);
}
PlatformLogger.getLogger("java.lang.invoke")
.warning("Invalid LF_RESOLVE " + parts[1] + " " + parts[2] + " " + parts[3]);
}
}
} else if (parts[1].contains("DirectMethodHandle")) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -135,7 +135,7 @@ static void traceLambdaForm(String name, MethodType type, Class<?> holder, Membe
(resolvedMember != null ? " (success)" : " (fail)"));
}
if (CDS.isDumpingClassList()) {
CDS.traceLambdaFormInvoker("[LF_RESOLVE]", holder.getName(), name, shortenSignature(basicTypeSignature(type)), type);
CDS.traceLambdaFormInvoker("[LF_RESOLVE]", holder.getName(), name, shortenSignature(basicTypeSignature(type)));
}
}

Expand Down
15 changes: 2 additions & 13 deletions src/java.base/share/classes/jdk/internal/misc/CDS.java
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,6 @@
import java.util.stream.Stream;

import jdk.internal.access.SharedSecrets;
import java.lang.invoke.MethodType;

public class CDS {
private static final boolean isDumpingClassList;
Expand Down Expand Up @@ -110,21 +109,11 @@ public static boolean isDumpingStaticArchive() {
*/
public static native long getRandomSeedForDumping();

/**
* Checks if the lambda form invoker is archivable. This is to avoid RuntimeException
* during CDS archive dumping.
*/
private static boolean isInvokerArchivable(MethodType mt, String holder) {
final int lastParam = mt.parameterCount() - 1;
return ((mt.parameterCount() >= 2 && mt.parameterType(0) == Object.class
&& mt.parameterType(lastParam) == Object.class) || isValidHolderName(holder));
}

/**
* log lambda form invoker holder, name and method type
*/
public static void traceLambdaFormInvoker(String prefix, String holder, String name, String type, MethodType mt) {
if (isDumpingClassList && isInvokerArchivable(mt, holder)) {
public static void traceLambdaFormInvoker(String prefix, String holder, String name, String type) {
if (isDumpingClassList) {
logLambdaFormInvoker(prefix + " " + holder + " " + name + " " + type);
}
}
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
#!/bin/bash
# Copyright (c) 2020, 2023, Oracle and/or its affiliates. All rights reserved.
# Copyright (c) 2020, 2024, 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
Expand Down Expand Up @@ -31,7 +31,7 @@ do
fname="$i$name_suffix"
cat << EOF > $fname
/*
* Copyright (c) 2020, 2023, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2020, 2024, 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
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright (c) 2020, 2023, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2020, 2024, 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
Expand All @@ -21,7 +21,7 @@
* questions.
*
*/
// this file is auto-generated by ./CDSMHTest_generate.sh. Do not edit manually.
// this file is auto-generated by CDSMHTest_generate.sh. Do not edit manually.

/*
* @test
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright (c) 2020, 2023, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2020, 2024, 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
Expand All @@ -21,7 +21,7 @@
* questions.
*
*/
// this file is auto-generated by ./CDSMHTest_generate.sh. Do not edit manually.
// this file is auto-generated by CDSMHTest_generate.sh. Do not edit manually.

/*
* @test
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright (c) 2020, 2023, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2020, 2024, 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
Expand All @@ -21,7 +21,7 @@
* questions.
*
*/
// this file is auto-generated by ./CDSMHTest_generate.sh. Do not edit manually.
// this file is auto-generated by CDSMHTest_generate.sh. Do not edit manually.

/*
* @test
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright (c) 2020, 2023, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2020, 2024, 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
Expand All @@ -21,7 +21,7 @@
* questions.
*
*/
// this file is auto-generated by ./CDSMHTest_generate.sh. Do not edit manually.
// this file is auto-generated by CDSMHTest_generate.sh. Do not edit manually.

/*
* @test
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright (c) 2020, 2023, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2020, 2024, 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
Expand All @@ -21,7 +21,7 @@
* questions.
*
*/
// this file is auto-generated by ./CDSMHTest_generate.sh. Do not edit manually.
// this file is auto-generated by CDSMHTest_generate.sh. Do not edit manually.

/*
* @test
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright (c) 2020, 2023, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2020, 2024, 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
Expand All @@ -21,7 +21,7 @@
* questions.
*
*/
// this file is auto-generated by ./CDSMHTest_generate.sh. Do not edit manually.
// this file is auto-generated by CDSMHTest_generate.sh. Do not edit manually.

/*
* @test
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
#!/bin/bash
# Copyright (c) 2020, 2023, Oracle and/or its affiliates. All rights reserved.
# Copyright (c) 2020, 2024, 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
Expand Down Expand Up @@ -31,7 +31,7 @@ do
fname="$i$name_suffix"
cat << EOF > $fname
/*
* Copyright (c) 2020, 2022, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2020, 2024, 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
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright (c) 2020, 2022, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2020, 2024, 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
Expand All @@ -21,7 +21,7 @@
* questions.
*
*/
// this file is auto-generated by ./CDSMHTest_generate.sh. Do not edit manually.
// this file is auto-generated by CDSMHTest_generate.sh. Do not edit manually.

/*
* @test
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright (c) 2020, 2022, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2020, 2024, 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
Expand All @@ -21,7 +21,7 @@
* questions.
*
*/
// this file is auto-generated by ./CDSMHTest_generate.sh. Do not edit manually.
// this file is auto-generated by CDSMHTest_generate.sh. Do not edit manually.

/*
* @test
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright (c) 2020, 2022, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2020, 2024, 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
Expand All @@ -21,7 +21,7 @@
* questions.
*
*/
// this file is auto-generated by ./CDSMHTest_generate.sh. Do not edit manually.
// this file is auto-generated by CDSMHTest_generate.sh. Do not edit manually.

/*
* @test
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright (c) 2020, 2022, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2020, 2024, 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
Expand All @@ -21,7 +21,7 @@
* questions.
*
*/
// this file is auto-generated by ./CDSMHTest_generate.sh. Do not edit manually.
// this file is auto-generated by CDSMHTest_generate.sh. Do not edit manually.

/*
* @test
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright (c) 2020, 2022, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2020, 2024, 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
Expand All @@ -21,7 +21,7 @@
* questions.
*
*/
// this file is auto-generated by ./CDSMHTest_generate.sh. Do not edit manually.
// this file is auto-generated by CDSMHTest_generate.sh. Do not edit manually.

/*
* @test
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright (c) 2020, 2022, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2020, 2024, 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
Expand All @@ -21,7 +21,7 @@
* questions.
*
*/
// this file is auto-generated by ./CDSMHTest_generate.sh. Do not edit manually.
// this file is auto-generated by CDSMHTest_generate.sh. Do not edit manually.

/*
* @test
Expand Down

0 comments on commit 38d64c1

Please sign in to comment.