Skip to content

[GR-64492] Move TruffleFromLibGraal annotation processor to compiler suite. #11069

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 3 commits into from
Apr 25, 2025
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
5 changes: 3 additions & 2 deletions compiler/mx.compiler/suite.py
Original file line number Diff line number Diff line change
Expand Up @@ -484,6 +484,7 @@
"sourceDirs" : ["src"],
"workingSets" : "Graal",
"javaCompliance" : "21+",
"checkstyle" : "jdk.graal.compiler",
"dependencies" : [
"GRAAL",
"GRAAL_MANAGEMENT",
Expand All @@ -504,7 +505,7 @@
],
},
"annotationProcessors" : [
"truffle:TRUFFLE_LIBGRAAL_PROCESSOR",
"GRAAL_PROCESSOR",
],
},

Expand All @@ -513,6 +514,7 @@
"sourceDirs" : ["src"],
"workingSets" : "Graal",
"javaCompliance" : "21+",
"checkstyle" : "jdk.graal.compiler",
"dependencies" : [
"sdk:NATIVEIMAGE_LIBGRAAL",
],
Expand Down Expand Up @@ -701,7 +703,6 @@
"sdk:NATIVEIMAGE_LIBGRAAL",
"sdk:COLLECTIONS",
"sdk:JNIUTILS",
"sdk:NATIVEBRIDGE",
"truffle:TRUFFLE_COMPILER"
],
"maven": False,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -94,7 +94,7 @@ public final class HostedLibGraalClassLoader extends ClassLoader implements LibG
/**
* A resource located in the jimage file or on the module path.
*/
static abstract class Resource {
abstract static class Resource {
final String name;

Resource(String name) {
Expand Down Expand Up @@ -381,7 +381,7 @@ protected Enumeration<URL> findResources(String name) throws IOException {
* A {@link URLStreamHandler} for use with URLs returned by
* {@link HostedLibGraalClassLoader#findResource(String)}.
*/
private class ImageURLStreamHandler extends URLStreamHandler {
private final class ImageURLStreamHandler extends URLStreamHandler {
@Override
public URLConnection openConnection(URL u) {
String protocol = u.getProtocol();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -89,10 +89,10 @@ protected void dumpHeap(String outputFile, boolean live) throws IOException {
Files.delete(path);
}
hotspotMXBean.dumpHeap(outputFile, live);
} catch (RuntimeException re) {
throw re;
} catch (Exception exp) {
throw new RuntimeException(exp);
} catch (IOException | RuntimeException e) {
throw e;
} catch (Exception e) {
throw new RuntimeException(e);
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,3 +5,4 @@ jdk.graal.compiler.lir.processor.SyncPortProcessor
jdk.graal.compiler.core.match.processor.MatchProcessor
jdk.graal.compiler.options.processor.OptionProcessor
jdk.graal.compiler.serviceprovider.processor.ServiceProviderProcessor
jdk.graal.compiler.libgraal.truffle.TruffleFromLibGraalProcessor
Original file line number Diff line number Diff line change
@@ -1,44 +1,30 @@
/*
* Copyright (c) 2018, 2023, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2018, 2025, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* The Universal Permissive License (UPL), Version 1.0
* 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.
*
* Subject to the condition set forth below, permission is hereby granted to any
* person obtaining a copy of this software, associated documentation and/or
* data (collectively the "Software"), free of charge and under any and all
* copyright rights in the Software, and any and all patent rights owned or
* freely licensable by each licensor hereunder covering either (i) the
* unmodified Software as contributed to or provided by such licensor, or (ii)
* the Larger Works (as defined below), to deal in both
* 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).
*
* (a) the Software, and
* 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.
*
* (b) any piece of software and/or hardware listed in the lrgrwrks.txt file if
* one is included with the Software each a "Larger Work" to which the Software
* is contributed by such licensors),
*
* without restriction, including without limitation the rights to copy, create
* derivative works of, display, perform, and distribute the Software and make,
* use, sell, offer for sale, import, export, have made, and have sold the
* Software and the Larger Work(s), and to sublicense the foregoing rights on
* either these or other terms.
*
* This license is subject to the following condition:
*
* The above copyright notice and either this complete permission notice or at a
* minimum a reference to the UPL must be included in all copies or substantial
* portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
* SOFTWARE.
* 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.
*/
package com.oracle.truffle.libgraal.processor;
package jdk.graal.compiler.libgraal.truffle;

import jdk.graal.compiler.processor.AbstractProcessor;

import java.io.PrintWriter;
import java.util.ArrayList;
Expand Down Expand Up @@ -67,17 +53,17 @@
import javax.lang.model.util.ElementFilter;

/**
* Processor for the {@code jdk.graal.compiler.truffle.common.hotspot.libgraal.TruffleFromLibGraal}
* Processor for the {@code com.oracle.truffle.compiler.hotspot.libgraal.TruffleFromLibGraal}
* annotation that generates code to push JNI arguments to the stack and make a JNI call
* corresponding to a
* {@code jdk.graal.compiler.truffle.common.hotspot.libgraal.TruffleFromLibGraal.Id}. This helps
* mitigate bugs where incorrect arguments are pushed for a JNI call. Given the low level nature of
* {@code org.graalvm.nativeimage.StackValue}, it's very hard to use runtime assertion checking.
* corresponding to a {@code com.oracle.truffle.compiler.hotspot.libgraal.TruffleFromLibGraal.Id}.
* This helps mitigate bugs where incorrect arguments are pushed for a JNI call. Given the low level
* nature of {@code org.graalvm.nativeimage.StackValue}, it's very hard to use runtime assertion
* checking.
*/
@SupportedAnnotationTypes({
"com.oracle.truffle.compiler.hotspot.libgraal.TruffleFromLibGraal",
"com.oracle.truffle.compiler.hotspot.libgraal.TruffleFromLibGraalRepeated"})
public class TruffleFromLibGraalProcessor extends BaseProcessor {
public class TruffleFromLibGraalProcessor extends AbstractProcessor {

/**
* Captures the info defined by a
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -117,7 +117,7 @@ public interface LibGraalSupport {
* Dumps the heap to {@code outputFile} in hprof format.
*
* @param live if true, performs a full GC first so that only live objects are dumped
* @throws IOException if an IO error occurred dyring dumping
* @throws IOException if an IO error occurred during dumping
* @throws UnsupportedOperationException if this operation is not supported.
*/
void dumpHeap(String outputFile, boolean live) throws IOException;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -494,7 +494,7 @@ public static List<String> getInputArguments() {
* Dumps the heap to {@code outputFile} in hprof format.
*
* @param live if true, performs a full GC first so that only live objects are dumped
* @throws IOException if an IO error occurred dyring dumping
* @throws IOException if an IO error occurred during dumping
* @throws UnsupportedOperationException if this operation is not supported.
*/
public static void dumpHeap(String outputFile, boolean live) throws IOException, UnsupportedOperationException {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ public abstract class JMXService {
* Dumps the heap to {@code outputFile} in hprof format.
*
* @param live if true, performs a full GC first so that only live objects are dumped
* @throws IOException if an IO error occurred dyring dumping
* @throws IOException if an IO error occurred during dumping
*/
protected abstract void dumpHeap(String outputFile, boolean live) throws IOException;
}
25 changes: 1 addition & 24 deletions truffle/mx.truffle/suite.py
Original file line number Diff line number Diff line change
Expand Up @@ -318,7 +318,7 @@
"jdk.internal.access",
],
},
"annotationProcessors" : ["TRUFFLE_DSL_PROCESSOR", "TRUFFLE_LIBGRAAL_PROCESSOR"],
"annotationProcessors" : ["TRUFFLE_DSL_PROCESSOR"],
"checkstyle" : "com.oracle.truffle.api",
"javaCompliance" : "17+",
"workingSets" : "API,Truffle",
Expand Down Expand Up @@ -1367,18 +1367,6 @@
"graalCompilerSourceEdition": "ignore",
},

"com.oracle.truffle.libgraal.processor" : {
"subDir" : "src",
"sourceDirs" : ["src"],
"requires" : [
"java.compiler",
"jdk.management"
],
"checkstyle" : "com.oracle.truffle.api",
"jacoco" : "exclude",
"javaCompliance" : "17+",
},

"org.graalvm.shadowed.org.json" : {
# shaded org.json/json
"subDir" : "src",
Expand Down Expand Up @@ -2075,17 +2063,6 @@
"graalCompilerSourceEdition": "ignore",
},

"TRUFFLE_LIBGRAAL_PROCESSOR" : {
"subDir" : "src",
"dependencies" : ["com.oracle.truffle.libgraal.processor"],
"distDependencies" : [],
"description" : "The Truffle libgraal processor is shared across Truffle and the compiler to generate code for the compiler bridge.",
"allowsJavadocWarnings": True,
"maven": {
"tag": ["default", "public"],
},
},

"TRUFFLE_SL" : {
"subDir" : "src",
"moduleInfo" : {
Expand Down

This file was deleted.

Loading
Loading