@@ -265,8 +265,8 @@ void FlatVariables::schedule_jit_variables(bool schedule_force,
265
265
// We have to force scheduling of undefined variables, in order to
266
266
// handle variables initialized with ``empty``.
267
267
if (schedule_force ||
268
- (opaque_mask && (*opaque_mask)[i - layout_index]) ||
269
- jit_var_state (index ) == VarState::Undefined) {
268
+ (opaque_mask && (*opaque_mask)[i - layout_index]) /* ||
269
+ jit_var_state(index) == VarState::Undefined */ ) {
270
270
// Returns owning reference
271
271
index = jit_var_schedule_force (index , &rv);
272
272
} else {
@@ -286,16 +286,22 @@ void FlatVariables::schedule_jit_variables(bool schedule_force,
286
286
}
287
287
288
288
if (info.state == VarState::Literal) {
289
- // Special case, where the variable is a literal. This should not
290
- // occur, as all literals are made opaque in beforehand, however it
291
- // is nice to have a fallback.
289
+ // Special case, where the variable is a literal.
292
290
layout.literal = info.literal ;
293
- // Store size in index variable, as this is not used for literals
291
+ // Store size in index variable, as this is not used for literals.
294
292
layout.index = info.size ;
295
293
layout.vt = (uint32_t ) info.type ;
296
294
layout.literal_index = index ;
297
295
298
296
layout.flags |= (uint32_t ) LayoutFlag::Literal;
297
+ } else if (info.state == VarState::Undefined) {
298
+ // Special case, where the variable is a literal.
299
+ // Store size in index variable, as this is not used for literals.
300
+ layout.index = info.size ;
301
+ layout.vt = (uint32_t ) info.type ;
302
+ layout.literal_index = index ;
303
+
304
+ layout.flags |= (uint32_t ) LayoutFlag::Undefined;
299
305
} else {
300
306
layout.index = this ->add_jit_index (index );
301
307
layout.vt = (uint32_t ) info.type ;
@@ -408,7 +414,8 @@ uint32_t FlatVariables::construct_jit_index(uint32_t prev_index) {
408
414
409
415
uint32_t index ;
410
416
VarType vt;
411
- if (layout.flags & (uint32_t ) LayoutFlag::Literal) {
417
+ if ((layout.flags & (uint32_t ) LayoutFlag::Literal) ||
418
+ (layout.flags & (uint32_t ) LayoutFlag::Undefined)) {
412
419
index = layout.literal_index ;
413
420
jit_var_inc_ref (index );
414
421
vt = (VarType) layout.vt ;
@@ -1255,7 +1262,9 @@ FlatVariables::~FlatVariables() {
1255
1262
state_lock_guard guard;
1256
1263
for (uint32_t i = 0 ; i < layout.size (); ++i) {
1257
1264
Layout &l = layout[i];
1258
- if (l.flags & (uint32_t ) LayoutFlag::Literal && l.literal_index ) {
1265
+ if (((l.flags & (uint32_t ) LayoutFlag::Literal) ||
1266
+ (l.flags & (uint32_t ) LayoutFlag::Undefined)) &&
1267
+ l.literal_index ) {
1259
1268
jit_var_dec_ref (l.literal_index );
1260
1269
}
1261
1270
}
@@ -1279,12 +1288,12 @@ bool log_diff_variable(LogLevel level, const FlatVariables &curr,
1279
1288
const VarLayout &curr_l = curr.var_layout [slot];
1280
1289
const VarLayout &prev_l = prev.var_layout [slot];
1281
1290
1282
- if (curr_l.vt != prev_l.vt ){
1291
+ if (curr_l.vt != prev_l.vt ) {
1283
1292
jit_log (level, " %s: The variable type changed from %u to %u." ,
1284
1293
path.c_str (), prev_l.vt , curr_l.vt );
1285
1294
return false ;
1286
1295
}
1287
- if (curr_l.size_index != prev_l.size_index ){
1296
+ if (curr_l.size_index != prev_l.size_index ) {
1288
1297
jit_log (level,
1289
1298
" %s: The size equivalence class of the variable changed from "
1290
1299
" %u to %u." ,
@@ -1321,7 +1330,8 @@ bool log_diff(LogLevel level, const FlatVariables &curr,
1321
1330
}
1322
1331
1323
1332
if (curr_l.flags & (uint32_t ) LayoutFlag::JitIndex &&
1324
- !(curr_l.flags & (uint32_t ) LayoutFlag::Literal)) {
1333
+ !(curr_l.flags & (uint32_t ) LayoutFlag::Literal) &&
1334
+ !(curr_l.flags & (uint32_t ) LayoutFlag::Undefined)) {
1325
1335
uint32_t slot = curr_l.index ;
1326
1336
if (!log_diff_variable (level, curr, prev, path, slot))
1327
1337
return false ;
0 commit comments