|
30 | 30 | import java.util.stream.Stream;
|
31 | 31 |
|
32 | 32 | import org.graalvm.collections.Pair;
|
33 |
| -import org.graalvm.nativeimage.ProcessProperties; |
34 | 33 |
|
35 | 34 | import com.oracle.objectfile.debugentry.ArrayTypeEntry;
|
36 | 35 | import com.oracle.objectfile.debugentry.ClassEntry;
|
|
39 | 38 | import com.oracle.objectfile.debugentry.PointerToTypeEntry;
|
40 | 39 | import com.oracle.objectfile.debugentry.PrimitiveTypeEntry;
|
41 | 40 | import com.oracle.objectfile.debugentry.TypeEntry;
|
| 41 | +import com.oracle.svm.core.SubstrateOptions; |
42 | 42 | import com.oracle.svm.core.SubstrateUtil;
|
43 | 43 | import com.oracle.svm.core.graal.meta.RuntimeConfiguration;
|
44 | 44 | import com.oracle.svm.core.meta.SharedMethod;
|
45 | 45 | import com.oracle.svm.core.meta.SharedType;
|
46 | 46 | import com.oracle.svm.core.option.RuntimeOptionKey;
|
47 | 47 |
|
| 48 | +import jdk.graal.compiler.api.replacements.Fold; |
48 | 49 | import jdk.graal.compiler.code.CompilationResult;
|
49 | 50 | import jdk.graal.compiler.debug.DebugContext;
|
50 | 51 | import jdk.graal.compiler.options.Option;
|
@@ -73,18 +74,19 @@ public static class Options {
|
73 | 74 |
|
74 | 75 | public static Path getRuntimeSourceDestDir() {
|
75 | 76 | String sourceDestDir = RuntimeSourceDestDir.getValue();
|
76 |
| - if (sourceDestDir != null) { |
77 |
| - return Path.of(sourceDestDir); |
78 |
| - } |
79 |
| - Path result = Path.of("sources"); |
80 |
| - Path exeDir = Path.of(ProcessProperties.getExecutableName()).getParent(); |
81 |
| - if (exeDir != null) { |
82 |
| - result = exeDir.resolve(result); |
83 |
| - } |
84 |
| - return result; |
| 77 | + /* |
| 78 | + * If not set, use source cache root from the native image debug info. This makes sure |
| 79 | + * the cachePath is the same as in the native image debug info. |
| 80 | + */ |
| 81 | + return sourceDestDir != null ? Path.of(sourceDestDir) : getHostedSourceCacheRoot(); |
85 | 82 | }
|
86 | 83 | }
|
87 | 84 |
|
| 85 | + @Fold |
| 86 | + static Path getHostedSourceCacheRoot() { |
| 87 | + return SubstrateOptions.getDebugInfoSourceCacheRoot(); |
| 88 | + } |
| 89 | + |
88 | 90 | private final SharedMethod sharedMethod;
|
89 | 91 | private final CompilationResult compilation;
|
90 | 92 | private final long codeAddress;
|
|
0 commit comments