Skip to content

Commit 3ba1184

Browse files
export diff between labsjdk-ce-21 and upstream based on jdk-21+30
1 parent 6af0af5 commit 3ba1184

File tree

6 files changed

+1154
-8
lines changed

6 files changed

+1154
-8
lines changed

.ci/add.js

Lines changed: 57 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,57 @@
1+
/*
2+
* Copyright (c) 2023, Oracle and/or its affiliates. All rights reserved.
3+
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
4+
*
5+
* This code is free software; you can redistribute it and/or modify it
6+
* under the terms of the GNU General Public License version 2 only, as
7+
* published by the Free Software Foundation.
8+
*
9+
* This code is distributed in the hope that it will be useful, but WITHOUT
10+
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
11+
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
12+
* version 2 for more details (a copy is included in the LICENSE file that
13+
* accompanied this code).
14+
*
15+
* You should have received a copy of the GNU General Public License version
16+
* 2 along with this work; if not, write to the Free Software Foundation,
17+
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
18+
*
19+
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
20+
* or visit www.oracle.com if you need additional information or have any
21+
* questions.
22+
*/
23+
24+
/**
25+
* Example of an add function that gets specialized to doubles
26+
* if run with --optimize flag set
27+
*/
28+
29+
function add(a,b) {
30+
return a + b;
31+
}
32+
33+
34+
function bench() {
35+
var sum = 1;
36+
for (var x = 0 ; x < 10e8/2 ; x ++) {
37+
sum *= add(x,x + 1);
38+
}
39+
return sum;
40+
}
41+
42+
print("doing first run");
43+
var d = new Date;
44+
print(bench());
45+
d = new Date - d;
46+
print("first run took " + d + " ms");
47+
48+
// invalidate add, replace it with something else
49+
add = function(a,b) {
50+
return b + a;
51+
}
52+
53+
print("doing second run");
54+
var d = new Date;
55+
print(bench());
56+
d = new Date - d;
57+
print("second run took " + d + " ms");

.ci/check_devkit_versions.py

Lines changed: 95 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,95 @@
1+
#
2+
# ----------------------------------------------------------------------------------------------------
3+
#
4+
# Copyright (c) 2023, Oracle and/or its affiliates. All rights reserved.
5+
# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
6+
#
7+
# This code is free software; you can redistribute it and/or modify it
8+
# under the terms of the GNU General Public License version 2 only, as
9+
# published by the Free Software Foundation. Oracle designates this
10+
# particular file as subject to the "Classpath" exception as provided
11+
# by Oracle in the LICENSE file that accompanied this code.
12+
#
13+
# This code is distributed in the hope that it will be useful, but WITHOUT
14+
# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
15+
# FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
16+
# version 2 for more details (a copy is included in the LICENSE file that
17+
# accompanied this code).
18+
#
19+
# You should have received a copy of the GNU General Public License version
20+
# 2 along with this work; if not, write to the Free Software Foundation,
21+
# Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
22+
#
23+
# Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
24+
# or visit www.oracle.com if you need additional information or have any
25+
# questions.
26+
#
27+
# ----------------------------------------------------------------------------------------------------
28+
29+
"""
30+
Checks that each devkit mentioned in ci.jsonnet corresponds to a devkit mentioned in make/conf/jib-profiles.js
31+
This is based on pattern matching to avoid the need for a jsonnet and JavaScript parser.
32+
It exists to ensure ci.jsonnet is updated when a relevant devit is updated in jib-profiles.js.
33+
"""
34+
35+
import re
36+
from os.path import dirname, join
37+
38+
repo_dir = dirname(dirname(__file__))
39+
ci_jsonnet_path = join(repo_dir, 'ci.jsonnet')
40+
jib_profiles_path = join(repo_dir, 'make', 'conf', 'jib-profiles.js')
41+
42+
def load_jib_devkits():
43+
"""
44+
Gets the devkits referred to in jib-profiles.js. For example:
45+
46+
var devkit_platform_revisions = {
47+
linux_x64: "gcc10.3.0-OL6.4+1.0",
48+
macosx: "Xcode12.4+1.0",
49+
windows_x64: "VS2019-16.9.3+1.0",
50+
linux_aarch64: "gcc10.3.0-OL7.6+1.0",
51+
linux_arm: "gcc8.2.0-Fedora27+1.0",
52+
linux_ppc64le: "gcc8.2.0-Fedora27+1.0",
53+
linux_s390x: "gcc8.2.0-Fedora27+1.0"
54+
};
55+
56+
"""
57+
devkits = set()
58+
devkit_platform_revisions_re = re.compile(r'var devkit_platform_revisions *= *{([^}]+)}')
59+
with open(jib_profiles_path) as fp:
60+
jib_profiles = fp.read()
61+
devkit_platform_revisions = re.search(r'var devkit_platform_revisions *= *{([^}]+)}', jib_profiles).group(1)
62+
for entry in devkit_platform_revisions.split(','):
63+
if len(entry.strip().split('?')) == 2 :
64+
multiple_devkit = entry.strip().split('?')[1].split(':')
65+
devkits.add(multiple_devkit[0].strip()[1:-1])
66+
devkits.add(multiple_devkit[1].strip()[1:-1])
67+
else :
68+
devkit = entry.strip().split(':')[1]
69+
devkit = devkit.strip()[1:-1] # strip surrounding ""
70+
devkits.add(devkit)
71+
return devkits
72+
73+
def load_ci_devkits():
74+
"""
75+
Gets the devkits referred to in ci.jsonnet. For example:
76+
77+
"devkit:gcc10.3.0-OL7.6+1" : "==0"
78+
79+
"""
80+
81+
devkits = set()
82+
devkit_re = re.compile(r'"devkit:([^"]+)" *: *"==([\d]+)"')
83+
with open(ci_jsonnet_path) as fp:
84+
ci_jsonnet = fp.read()
85+
for match in devkit_re.finditer(ci_jsonnet):
86+
if not match.group(1).endswith(':musl'):
87+
devkits.add('.'.join(match.group(1, 2)))
88+
return devkits
89+
90+
jib_devkits = load_jib_devkits()
91+
ci_devkits = load_ci_devkits()
92+
undefined_devkits = ci_devkits - jib_devkits
93+
if undefined_devkits:
94+
msg = 'Devkits found in {} that are not defined in {}: {}'.format(ci_jsonnet_path, jib_profiles_path, ', '.join(undefined_devkits))
95+
raise SystemExit(msg)

0 commit comments

Comments
 (0)