Skip to content

Commit bc86e80

Browse files
Fix a bug in the IsolateArgumentParser.
1 parent 9e633aa commit bc86e80

File tree

2 files changed

+11
-8
lines changed

2 files changed

+11
-8
lines changed

substratevm/src/com.oracle.svm.core/src/com/oracle/svm/core/IsolateArgumentParser.java

+10-7
Original file line numberDiff line numberDiff line change
@@ -192,7 +192,10 @@ public void verifyOptionValues() {
192192
}
193193

194194
private static boolean shouldValidate(RuntimeOptionKey<?> option) {
195-
if (SubstrateOptions.UseSerialGC.getValue()) {
195+
if (!option.hasBeenSet()) {
196+
/* Workaround for one specific Truffle language that does something weird. */
197+
return false;
198+
} else if (SubstrateOptions.UseSerialGC.getValue()) {
196199
/* The serial GC supports changing the heap size at run-time to some degree. */
197200
return option != SubstrateGCOptions.MinHeapSize && option != SubstrateGCOptions.MaxHeapSize && option != SubstrateGCOptions.MaxNewSize;
198201
}
@@ -230,12 +233,10 @@ private static Object getOptionValue(int index) {
230233
}
231234

232235
private static void validate(RuntimeOptionKey<?> option, Object oldValue) {
233-
if (option.hasBeenSet()) {
234-
Object newValue = option.getValue();
235-
if (newValue == null || !newValue.equals(oldValue)) {
236-
throw new IllegalArgumentException(
237-
"The option '" + option.getName() + "' can't be changed after isolate creation. Old value: " + oldValue + ", new value: " + newValue);
238-
}
236+
Object newValue = option.getValue();
237+
if (newValue == null || !newValue.equals(oldValue)) {
238+
throw new IllegalArgumentException(
239+
"The option '" + option.getName() + "' can't be changed after isolate creation. Old value: " + oldValue + ", new value: " + newValue);
239240
}
240241
}
241242

@@ -344,6 +345,8 @@ private static boolean atojulong(CCharPointer s, CLongPointer result) {
344345
}
345346

346347
CCharPointerPointer tailPtr = (CCharPointerPointer) StackValue.get(CCharPointer.class);
348+
349+
LibC.setErrno(0);
347350
UnsignedWord n = LibC.strtoull(s, tailPtr, 10);
348351
if (LibC.errno() != 0) {
349352
return false;

substratevm/src/com.oracle.svm.core/src/com/oracle/svm/core/graal/snippets/CEntryPointSnippets.java

+1-1
Original file line numberDiff line numberDiff line change
@@ -227,13 +227,13 @@ private static int createIsolate(CEntryPointCreateIsolateParameters providedPara
227227
if (!validPageSize) {
228228
return CEntryPointErrors.PAGE_SIZE_CHECK_FAILED;
229229
}
230-
CLongPointer parsedArgs = StackValue.get(IsolateArgumentParser.getStructSize());
231230
CEntryPointCreateIsolateParameters parameters = providedParameters;
232231
if (parameters.isNull() || parameters.version() < 1) {
233232
parameters = StackValue.get(CEntryPointCreateIsolateParameters.class);
234233
parameters.setReservedSpaceSize(WordFactory.zero());
235234
parameters.setVersion(1);
236235
}
236+
CLongPointer parsedArgs = StackValue.get(IsolateArgumentParser.getStructSize());
237237
IsolateArgumentParser.parse(parameters, parsedArgs);
238238
if (parameters.reservedSpaceSize().equal(0)) {
239239
parameters.setReservedSpaceSize(WordFactory.unsigned(parsedArgs.read(IsolateArgumentParser.getOptionIndex(SubstrateGCOptions.ReservedAddressSpaceSize))));

0 commit comments

Comments
 (0)