Skip to content
Closed
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
54 changes: 54 additions & 0 deletions substratevm/mx.substratevm/mx_substratevm.py
Original file line number Diff line number Diff line change
Expand Up @@ -2455,3 +2455,57 @@ def svm_libcontainer_namespace(args):
libcontainer_project = mx.project("com.oracle.svm.native.libcontainer")
for src_dir in libcontainer_project.source_dirs():
mx.command_function("svm_namespace")(args + ["--directory", src_dir , "--namespace", "svm_container"])

@mx.command(suite, 'capnp-compile', usage_msg="Compile Cap'n Proto schema files to source code.")
def capnp_compile(args):
capnpcjava_home = os.environ.get('CAPNPROTOJAVA_HOME')
if capnpcjava_home is None or not exists(capnpcjava_home + '/capnpc-java'):
mx.abort('Clone and build capnproto/capnproto-java from GitHub and point CAPNPROTOJAVA_HOME to its path.')
srcdir = 'src/com.oracle.svm.hosted/resources/'
outdir = 'src/com.oracle.graal.pointsto/src/com/oracle/graal/pointsto/heap/'
command = ['capnp', 'compile',
'--import-path=' + capnpcjava_home + '/compiler/src/main/schema/',
'--output=' + capnpcjava_home + '/capnpc-java:' + outdir,
'--src-prefix=' + srcdir,
srcdir + 'SharedLayerSnapshotCapnProtoSchema.capnp']
mx.run(command)
# Remove huge unused schema chunks from generated code
outpath = outdir + 'SharedLayerSnapshotCapnProtoSchemaHolder.java' # name specified in schema
with open(outpath, 'r') as f:
lines = f.readlines()
with open(outpath, 'w') as f:
f.write(
"""/*
* Copyright (c) 2024, 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
* under the terms of the GNU General Public License version 2 only, as
* published by the Free Software Foundation. Oracle designates this
* particular file as subject to the "Classpath" exception as provided
* by Oracle in the LICENSE file that accompanied this code.
*
* 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.
*/
//@formatter:off
//Checkstyle: stop
""")
for line in lines:
if line.startswith("public final class "):
f.write('@SuppressWarnings("all")\n')
if 'public static final class Schemas {' in line:
break
f.write(line)
f.write('}\n')
14 changes: 14 additions & 0 deletions substratevm/mx.substratevm/suite.py
Original file line number Diff line number Diff line change
Expand Up @@ -202,6 +202,15 @@
"path": "mx.substratevm/jar-with-space-in-resource-dir.jar",
"digest": "sha512:270bffd158c92b04b16db147f4ef336dcb4d830bf3503cc25be1227b351597a3254544b3c4a5183dcc53f2f3ab10b282722dbf7f1b5e9d9a2741878a7057eb40",
},

"CAPNPROTO_RUNTIME": {
"digest" : "sha512:94a7776511c344da60a1acdc346c133522a43c239d067d0d5d86c21291e0252a19bd4fa74e4b1d3a93e75dadd41af6557a5d118a1584e39d34c092485ce065b2",
"maven" : {
"groupId" : "org.capnproto",
"artifactId" : "runtime",
"version" : "0.1.16",
},
},
},

"projects": {
Expand Down Expand Up @@ -537,6 +546,7 @@
"sourceDirs": ["src"],
"dependencies": [
"com.oracle.svm.common",
"CAPNPROTO_RUNTIME"
],
"requires" : [
"jdk.internal.vm.ci"
Expand Down Expand Up @@ -1656,6 +1666,9 @@
"java.management": [
"sun.management",
],
"org.graalvm.nativeimage.pointsto": [
"org.capnproto"
]
},
},
"noMavenJavadoc": True,
Expand Down Expand Up @@ -2089,6 +2102,7 @@
"NATIVE_IMAGE_BASE",
],
"exclude": [
# "CAPNPROTO_RUNTIME",
],
"moduleInfo" : {
"name" : "org.graalvm.nativeimage.pointsto",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@
@Platforms(Platform.HOSTED_ONLY.class)
public abstract class ImageHeapConstant implements JavaConstant, TypedConstant, CompressibleConstant, VMConstant {

private static final AtomicInteger currentId = new AtomicInteger(0);
private static final AtomicInteger currentId = new AtomicInteger(1);

public static final VarHandle isReachableHandle = ReflectionUtil.unreflectField(ConstantData.class, "isReachable", MethodHandles.lookup());

Expand Down
Loading