Skip to content

Commit 24ac023

Browse files
committed
[GR-71040] Minor clean-ups related to Project Terminus
PullRequest: graal/22479
2 parents 26f7161 + 5f293a7 commit 24ac023

File tree

3 files changed

+33
-4
lines changed

3 files changed

+33
-4
lines changed

compiler/src/jdk.graal.compiler/src/jdk/graal/compiler/java/LambdaUtils.java

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -180,6 +180,16 @@ public static String capturingClass(String className) {
180180
return className.split(LambdaUtils.SERIALIZATION_TEST_LAMBDA_CLASS_SPLIT_PATTERN)[0];
181181
}
182182

183+
/**
184+
* Checks if the passed class is a lambda class.
185+
*
186+
* @param type the type to be checked
187+
* @return true if type is a lambda class, false instead
188+
*/
189+
public static boolean isLambdaClass(ResolvedJavaType type) {
190+
return isLambdaClassName(type.toClassName());
191+
}
192+
183193
/**
184194
* Checks if the passed class is lambda class.
185195
*

substratevm/src/com.oracle.svm.graal/src/com/oracle/svm/graal/RuntimeCPUFeatureRegion.java

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -233,17 +233,20 @@ private RuntimeCPUFeatureRegion() {
233233
* <p>
234234
* All arguments must be compile-time constant.
235235
*/
236-
public static native RuntimeCPUFeatureRegion enter(@ConstantNodeParameter Enum<?> arg0);
236+
public static native RuntimeCPUFeatureRegion enterSet(@ConstantNodeParameter EnumSet<?> features);
237237

238-
public static native RuntimeCPUFeatureRegion enterSet(@ConstantNodeParameter EnumSet<?> arg0);
238+
/**
239+
* @see #enterSet(EnumSet)
240+
*/
241+
public static native RuntimeCPUFeatureRegion enter(@ConstantNodeParameter Enum<?> arg0);
239242

240243
/**
241-
* @see #enter(Enum)
244+
* @see #enterSet(EnumSet)
242245
*/
243246
public static native <T extends Enum<T>> RuntimeCPUFeatureRegion enter(@ConstantNodeParameter Enum<T> arg0, @ConstantNodeParameter Enum<T> arg1);
244247

245248
/**
246-
* @see #enter(Enum)
249+
* @see #enterSet(EnumSet)
247250
*/
248251
public static native <T extends Enum<T>> RuntimeCPUFeatureRegion enter(@ConstantNodeParameter Enum<T> arg0, @ConstantNodeParameter Enum<T> arg1, @ConstantNodeParameter Enum<T> arg2);
249252

substratevm/src/com.oracle.svm.util/src/com/oracle/svm/util/JVMCIReflectionUtil.java

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -210,4 +210,20 @@ public static List<ResolvedJavaField> getAllFields(ResolvedJavaType declaringCla
210210
System.arraycopy(instanceFields, 0, allFields, staticFields.length, instanceFields.length);
211211
return Collections.unmodifiableList(Arrays.asList(allFields));
212212
}
213+
214+
/**
215+
* Gets the package name for a {@link ResolvedJavaType}. This is the same as calling
216+
* {@link Class#getPackageName()} on the underlying class.
217+
* <p>
218+
* Implementation derived from {@link Class#getPackageName()}.
219+
*/
220+
public static String getPackageName(ResolvedJavaType type) {
221+
ResolvedJavaType c = type.isArray() ? type.getElementalType() : type;
222+
if (c.isPrimitive()) {
223+
return "java.lang";
224+
}
225+
String cn = c.toClassName();
226+
int dot = cn.lastIndexOf('.');
227+
return (dot != -1) ? cn.substring(0, dot).intern() : "";
228+
}
213229
}

0 commit comments

Comments
 (0)