Skip to content
Snippets Groups Projects
Commit a8d861a2 authored by Lukas Stadler's avatar Lukas Stadler
Browse files

[GR-2737] Read values only once in FastROptions.

parents ba1a804c 2a6f3434
Branches
No related tags found
No related merge requests found
...@@ -81,8 +81,9 @@ public enum FastROptions { ...@@ -81,8 +81,9 @@ public enum FastROptions {
public boolean getBooleanValue() { public boolean getBooleanValue() {
assert isBoolean; assert isBoolean;
if (value instanceof Boolean) { Object v = value;
return (Boolean) value; if (v instanceof Boolean) {
return (boolean) v;
} else { } else {
CompilerDirectives.transferToInterpreter(); CompilerDirectives.transferToInterpreter();
System.out.println("boolean option value expected with " + name() + " - forgot +/- ?"); System.out.println("boolean option value expected with " + name() + " - forgot +/- ?");
...@@ -93,8 +94,9 @@ public enum FastROptions { ...@@ -93,8 +94,9 @@ public enum FastROptions {
public String getStringValue() { public String getStringValue() {
assert !isBoolean; assert !isBoolean;
if (value == null || value instanceof String) { Object v = value;
return (String) value; if (v == null || v instanceof String) {
return (String) v;
} else { } else {
CompilerDirectives.transferToInterpreter(); CompilerDirectives.transferToInterpreter();
System.out.println("string option value expected with " + name()); System.out.println("string option value expected with " + name());
...@@ -105,13 +107,14 @@ public enum FastROptions { ...@@ -105,13 +107,14 @@ public enum FastROptions {
public int getNonNegativeIntValue() { public int getNonNegativeIntValue() {
assert !isBoolean; assert !isBoolean;
if (value instanceof Integer) { Object v = value;
return (Integer) value; if (v instanceof Integer) {
return (Integer) v;
} }
CompilerDirectives.transferToInterpreterAndInvalidate(); CompilerDirectives.transferToInterpreterAndInvalidate();
if (value instanceof String) { if (v instanceof String) {
try { try {
int res = Integer.decode((String) value); int res = Integer.decode((String) v);
if (res >= 0) { if (res >= 0) {
value = res; value = res;
return res; return res;
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment