|
15 | 15 | import org.graalvm.options.OptionDescriptor;
|
16 | 16 | import org.graalvm.options.OptionValues;
|
17 | 17 | import org.truffleruby.shared.options.OptionsCatalog;
|
| 18 | +import com.oracle.truffle.api.TruffleLogger; |
18 | 19 |
|
19 | 20 | import com.oracle.truffle.api.TruffleLanguage.Env;
|
20 | 21 |
|
@@ -118,5 +119,110 @@ public static boolean areOptionsCompatible(OptionValues one, OptionValues two) {
|
118 | 119 | one.get(OptionsCatalog.SHARED_OBJECTS_DEBUG_KEY).equals(two.get(OptionsCatalog.SHARED_OBJECTS_DEBUG_KEY)) &&
|
119 | 120 | one.get(OptionsCatalog.SHARED_OBJECTS_FORCE_KEY).equals(two.get(OptionsCatalog.SHARED_OBJECTS_FORCE_KEY));
|
120 | 121 | }
|
| 122 | + |
| 123 | + public static boolean areOptionsCompatibleOrLog(TruffleLogger logger, LanguageOptions oldOptions, LanguageOptions newOptions) { |
| 124 | + Object oldValue; |
| 125 | + Object newValue; |
| 126 | + |
| 127 | + oldValue = oldOptions.FROZEN_STRING_LITERALS; |
| 128 | + newValue = newOptions.FROZEN_STRING_LITERALS; |
| 129 | + if (!newValue.equals(oldValue)) { |
| 130 | + logger.fine("not reusing pre-initialized context: --frozen-string-literals differs, was: " + oldValue + " and is now: " + newValue); |
| 131 | + return false; |
| 132 | + } |
| 133 | + |
| 134 | + oldValue = oldOptions.DEFAULT_LAZY; |
| 135 | + newValue = newOptions.DEFAULT_LAZY; |
| 136 | + if (!newValue.equals(oldValue)) { |
| 137 | + logger.fine("not reusing pre-initialized context: --lazy-default differs, was: " + oldValue + " and is now: " + newValue); |
| 138 | + return false; |
| 139 | + } |
| 140 | + |
| 141 | + oldValue = oldOptions.LAZY_TRANSLATION_USER; |
| 142 | + newValue = newOptions.LAZY_TRANSLATION_USER; |
| 143 | + if (!newValue.equals(oldValue)) { |
| 144 | + logger.fine("not reusing pre-initialized context: --lazy-translation-user differs, was: " + oldValue + " and is now: " + newValue); |
| 145 | + return false; |
| 146 | + } |
| 147 | + |
| 148 | + oldValue = oldOptions.BACKTRACES_OMIT_UNUSED; |
| 149 | + newValue = newOptions.BACKTRACES_OMIT_UNUSED; |
| 150 | + if (!newValue.equals(oldValue)) { |
| 151 | + logger.fine("not reusing pre-initialized context: --backtraces-omit-unused differs, was: " + oldValue + " and is now: " + newValue); |
| 152 | + return false; |
| 153 | + } |
| 154 | + |
| 155 | + oldValue = oldOptions.LAZY_TRANSLATION_LOG; |
| 156 | + newValue = newOptions.LAZY_TRANSLATION_LOG; |
| 157 | + if (!newValue.equals(oldValue)) { |
| 158 | + logger.fine("not reusing pre-initialized context: --lazy-translation-log differs, was: " + oldValue + " and is now: " + newValue); |
| 159 | + return false; |
| 160 | + } |
| 161 | + |
| 162 | + oldValue = oldOptions.LOG_DYNAMIC_CONSTANT_LOOKUP; |
| 163 | + newValue = newOptions.LOG_DYNAMIC_CONSTANT_LOOKUP; |
| 164 | + if (!newValue.equals(oldValue)) { |
| 165 | + logger.fine("not reusing pre-initialized context: --constant-dynamic-lookup-log differs, was: " + oldValue + " and is now: " + newValue); |
| 166 | + return false; |
| 167 | + } |
| 168 | + |
| 169 | + oldValue = oldOptions.LAZY_BUILTINS; |
| 170 | + newValue = newOptions.LAZY_BUILTINS; |
| 171 | + if (!newValue.equals(oldValue)) { |
| 172 | + logger.fine("not reusing pre-initialized context: --lazy-builtins differs, was: " + oldValue + " and is now: " + newValue); |
| 173 | + return false; |
| 174 | + } |
| 175 | + |
| 176 | + oldValue = oldOptions.LAZY_TRANSLATION_CORE; |
| 177 | + newValue = newOptions.LAZY_TRANSLATION_CORE; |
| 178 | + if (!newValue.equals(oldValue)) { |
| 179 | + logger.fine("not reusing pre-initialized context: --lazy-translation-core differs, was: " + oldValue + " and is now: " + newValue); |
| 180 | + return false; |
| 181 | + } |
| 182 | + |
| 183 | + oldValue = oldOptions.BASICOPS_INLINE; |
| 184 | + newValue = newOptions.BASICOPS_INLINE; |
| 185 | + if (!newValue.equals(oldValue)) { |
| 186 | + logger.fine("not reusing pre-initialized context: --basic-ops-inline differs, was: " + oldValue + " and is now: " + newValue); |
| 187 | + return false; |
| 188 | + } |
| 189 | + |
| 190 | + oldValue = oldOptions.PROFILE_ARGUMENTS; |
| 191 | + newValue = newOptions.PROFILE_ARGUMENTS; |
| 192 | + if (!newValue.equals(oldValue)) { |
| 193 | + logger.fine("not reusing pre-initialized context: --profile-arguments differs, was: " + oldValue + " and is now: " + newValue); |
| 194 | + return false; |
| 195 | + } |
| 196 | + |
| 197 | + oldValue = oldOptions.HASH_PACKED_ARRAY_MAX; |
| 198 | + newValue = newOptions.HASH_PACKED_ARRAY_MAX; |
| 199 | + if (!newValue.equals(oldValue)) { |
| 200 | + logger.fine("not reusing pre-initialized context: --hash-packed-array-max differs, was: " + oldValue + " and is now: " + newValue); |
| 201 | + return false; |
| 202 | + } |
| 203 | + |
| 204 | + oldValue = oldOptions.SHARED_OBJECTS_ENABLED; |
| 205 | + newValue = newOptions.SHARED_OBJECTS_ENABLED; |
| 206 | + if (!newValue.equals(oldValue)) { |
| 207 | + logger.fine("not reusing pre-initialized context: --shared-objects differs, was: " + oldValue + " and is now: " + newValue); |
| 208 | + return false; |
| 209 | + } |
| 210 | + |
| 211 | + oldValue = oldOptions.SHARED_OBJECTS_DEBUG; |
| 212 | + newValue = newOptions.SHARED_OBJECTS_DEBUG; |
| 213 | + if (!newValue.equals(oldValue)) { |
| 214 | + logger.fine("not reusing pre-initialized context: --shared-objects-debug differs, was: " + oldValue + " and is now: " + newValue); |
| 215 | + return false; |
| 216 | + } |
| 217 | + |
| 218 | + oldValue = oldOptions.SHARED_OBJECTS_FORCE; |
| 219 | + newValue = newOptions.SHARED_OBJECTS_FORCE; |
| 220 | + if (!newValue.equals(oldValue)) { |
| 221 | + logger.fine("not reusing pre-initialized context: --shared-objects-force differs, was: " + oldValue + " and is now: " + newValue); |
| 222 | + return false; |
| 223 | + } |
| 224 | + |
| 225 | + return true; |
| 226 | + } |
121 | 227 | }
|
122 | 228 | // @formatter:on
|
0 commit comments