Skip to content

Commit fc58708

Browse files
committed
Rename OP_BREAK_ATOMIC to OP_BREAK_FRAME
1 parent 34a63c8 commit fc58708

File tree

8 files changed

+45
-45
lines changed

8 files changed

+45
-45
lines changed

include/scratchcpp/virtualmachine.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -79,7 +79,7 @@ enum Opcode
7979
OP_CALL_PROCEDURE, /*! Calls the procedure (custom block) with the index in the argument. */
8080
OP_ADD_ARG, /*!< Adds a procedure (custom block) argument with the value from the last register. */
8181
OP_READ_ARG, /*!< Reads the procedure (custom block) argument with the index in the argument and stores the value in the last register. */
82-
OP_BREAK_ATOMIC, /*!< Breaks current frame at the end of the loop. */
82+
OP_BREAK_FRAME, /*!< Breaks current frame at the end of the loop. */
8383
OP_WARP /*! Runs the script without screen refresh. */
8484
};
8585

@@ -131,7 +131,7 @@ class LIBSCRATCHCPP_EXPORT VirtualMachine
131131
void reset();
132132
void moveToLastCheckpoint();
133133

134-
void stop(bool savePos = true, bool breakAtomic = false, bool goBack = false);
134+
void stop(bool savePos = true, bool breakFrame = false, bool goBack = false);
135135

136136
bool atEnd() const;
137137

src/engine/compiler_p.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,7 @@ void CompilerPrivate::substackEnd()
3939
// Break the frame at the end of the loop so that other scripts can run within the frame
4040
// This won't happen in "warp" scripts
4141
if (!warp)
42-
addInstruction(OP_BREAK_ATOMIC);
42+
addInstruction(OP_BREAK_FRAME);
4343
addInstruction(OP_LOOP_END);
4444
break;
4545
case Compiler::SubstackType::IfStatement:

src/engine/virtualmachine.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -202,11 +202,11 @@ void VirtualMachine::moveToLastCheckpoint()
202202
* \note If the script is set to run without screen refresh, the VM won't stop.
203203
* The only parameter which won't be ignored is goBack.
204204
*/
205-
void VirtualMachine::stop(bool savePos, bool breakAtomic, bool goBack)
205+
void VirtualMachine::stop(bool savePos, bool breakFrame, bool goBack)
206206
{
207207
impl->stop = true;
208208
impl->savePos = savePos && !impl->warp;
209-
impl->atomic = !breakAtomic || impl->warp;
209+
impl->noBreak = !breakFrame || impl->warp;
210210
impl->goBack = goBack;
211211
}
212212

src/engine/virtualmachine_p.cpp

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -98,7 +98,7 @@ const unsigned int VirtualMachinePrivate::instruction_arg_count[] = {
9898
1, // OP_CALL_PROCEDURE
9999
0, // OP_ADD_ARG
100100
1, // OP_READ_ARG
101-
0, // OP_BREAK_ATOMIC
101+
0, // OP_BREAK_FRAME
102102
0 // OP_WARP
103103
};
104104

@@ -189,7 +189,7 @@ unsigned int *VirtualMachinePrivate::run(unsigned int *pos, bool reset)
189189
&&do_call_procedure,
190190
&&do_add_arg,
191191
&&do_read_arg,
192-
&&do_break_atomic,
192+
&&do_break_frame,
193193
&&do_warp
194194
};
195195
assert(pos);
@@ -198,7 +198,7 @@ unsigned int *VirtualMachinePrivate::run(unsigned int *pos, bool reset)
198198
size_t loopCount;
199199
if (reset) {
200200
atEnd = false;
201-
atomic = true;
201+
noBreak = true;
202202
warp = false;
203203
}
204204
DISPATCH();
@@ -319,13 +319,13 @@ do_loop_end : {
319319
pos = l.start;
320320
else
321321
loops.pop_back();
322-
if (!atomic && !warp) {
322+
if (!noBreak && !warp) {
323323
engine->breakFrame();
324324
return pos;
325325
}
326326
DISPATCH();
327327
} else {
328-
if (!atomic && !warp) {
328+
if (!noBreak && !warp) {
329329
engine->breakFrame();
330330
return pos - 1;
331331
}
@@ -698,7 +698,7 @@ do_exec : {
698698
procedureArgTree.clear();
699699
procedureArgs = nullptr;
700700
nextProcedureArgs = nullptr;
701-
if (!atomic)
701+
if (!noBreak)
702702
engine->breakFrame();
703703
if (goBack) {
704704
goBack = false;
@@ -740,8 +740,8 @@ do_exec : {
740740
ADD_RET_VALUE(procedureArgs->operator[](*++pos));
741741
DISPATCH();
742742

743-
do_break_atomic:
744-
atomic = false;
743+
do_break_frame:
744+
noBreak = false;
745745
DISPATCH();
746746

747747
do_warp:

src/engine/virtualmachine_p.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -50,7 +50,7 @@ struct VirtualMachinePrivate
5050
std::vector<std::vector<Value>> procedureArgTree;
5151
std::vector<Value> *procedureArgs = nullptr;
5252
std::vector<Value> *nextProcedureArgs = nullptr;
53-
bool atomic = true;
53+
bool noBreak = true;
5454
bool warp = false;
5555
bool stop = false;
5656
bool savePos = true;

test/blocks/control_blocks_test.cpp

Lines changed: 15 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -204,21 +204,21 @@ TEST_F(ControlBlocksTest, Forever)
204204

205205
compiler.compile(block1);
206206

207-
ASSERT_EQ(compiler.bytecode(), std::vector<unsigned int>({ vm::OP_START, vm::OP_FOREVER_LOOP, vm::OP_NULL, vm::OP_PRINT, vm::OP_BREAK_ATOMIC, vm::OP_LOOP_END, vm::OP_HALT }));
207+
ASSERT_EQ(compiler.bytecode(), std::vector<unsigned int>({ vm::OP_START, vm::OP_FOREVER_LOOP, vm::OP_NULL, vm::OP_PRINT, vm::OP_BREAK_FRAME, vm::OP_LOOP_END, vm::OP_HALT }));
208208
ASSERT_TRUE(compiler.constValues().empty());
209209
ASSERT_TRUE(compiler.variables().empty());
210210
ASSERT_TRUE(compiler.lists().empty());
211211

212212
compiler.compile(block2);
213213

214-
ASSERT_EQ(compiler.bytecode(), std::vector<unsigned int>({ vm::OP_START, vm::OP_FOREVER_LOOP, vm::OP_BREAK_ATOMIC, vm::OP_LOOP_END, vm::OP_HALT }));
214+
ASSERT_EQ(compiler.bytecode(), std::vector<unsigned int>({ vm::OP_START, vm::OP_FOREVER_LOOP, vm::OP_BREAK_FRAME, vm::OP_LOOP_END, vm::OP_HALT }));
215215
ASSERT_TRUE(compiler.constValues().empty());
216216
ASSERT_TRUE(compiler.variables().empty());
217217
ASSERT_TRUE(compiler.lists().empty());
218218

219219
compiler.compile(block3);
220220

221-
ASSERT_EQ(compiler.bytecode(), std::vector<unsigned int>({ vm::OP_START, vm::OP_FOREVER_LOOP, vm::OP_BREAK_ATOMIC, vm::OP_LOOP_END, vm::OP_HALT }));
221+
ASSERT_EQ(compiler.bytecode(), std::vector<unsigned int>({ vm::OP_START, vm::OP_FOREVER_LOOP, vm::OP_BREAK_FRAME, vm::OP_LOOP_END, vm::OP_HALT }));
222222
ASSERT_TRUE(compiler.constValues().empty());
223223
ASSERT_TRUE(compiler.variables().empty());
224224
ASSERT_TRUE(compiler.lists().empty());
@@ -248,7 +248,7 @@ TEST_F(ControlBlocksTest, Repeat)
248248

249249
compiler.compile(block1);
250250

251-
ASSERT_EQ(compiler.bytecode(), std::vector<unsigned int>({ vm::OP_START, vm::OP_CONST, 0, vm::OP_REPEAT_LOOP, vm::OP_NULL, vm::OP_PRINT, vm::OP_BREAK_ATOMIC, vm::OP_LOOP_END, vm::OP_HALT }));
251+
ASSERT_EQ(compiler.bytecode(), std::vector<unsigned int>({ vm::OP_START, vm::OP_CONST, 0, vm::OP_REPEAT_LOOP, vm::OP_NULL, vm::OP_PRINT, vm::OP_BREAK_FRAME, vm::OP_LOOP_END, vm::OP_HALT }));
252252
ASSERT_EQ(compiler.constValues().size(), 1);
253253
ASSERT_EQ(compiler.constValues()[0].toDouble(), 5);
254254
ASSERT_TRUE(compiler.variables().empty());
@@ -306,36 +306,36 @@ TEST_F(ControlBlocksTest, RepeatUntil)
306306

307307
ASSERT_EQ(
308308
compiler.bytecode(),
309-
std::vector<unsigned int>({ vm::OP_START, vm::OP_UNTIL_LOOP, vm::OP_CONST, 0, vm::OP_BEGIN_UNTIL_LOOP, vm::OP_NULL, vm::OP_PRINT, vm::OP_BREAK_ATOMIC, vm::OP_LOOP_END, vm::OP_HALT }));
309+
std::vector<unsigned int>({ vm::OP_START, vm::OP_UNTIL_LOOP, vm::OP_CONST, 0, vm::OP_BEGIN_UNTIL_LOOP, vm::OP_NULL, vm::OP_PRINT, vm::OP_BREAK_FRAME, vm::OP_LOOP_END, vm::OP_HALT }));
310310
ASSERT_EQ(compiler.constValues().size(), 1);
311311
ASSERT_EQ(compiler.constValues()[0].toBool(), false);
312312
ASSERT_TRUE(compiler.variables().empty());
313313
ASSERT_TRUE(compiler.lists().empty());
314314

315315
compiler.compile(block2);
316316

317-
ASSERT_EQ(compiler.bytecode(), std::vector<unsigned int>({ vm::OP_START, vm::OP_UNTIL_LOOP, vm::OP_CONST, 1, vm::OP_BEGIN_UNTIL_LOOP, vm::OP_BREAK_ATOMIC, vm::OP_LOOP_END, vm::OP_HALT }));
317+
ASSERT_EQ(compiler.bytecode(), std::vector<unsigned int>({ vm::OP_START, vm::OP_UNTIL_LOOP, vm::OP_CONST, 1, vm::OP_BEGIN_UNTIL_LOOP, vm::OP_BREAK_FRAME, vm::OP_LOOP_END, vm::OP_HALT }));
318318
ASSERT_EQ(compiler.constValues(), std::vector<Value>({ false, false }));
319319
ASSERT_TRUE(compiler.variables().empty());
320320
ASSERT_TRUE(compiler.lists().empty());
321321

322322
compiler.compile(block3);
323323

324-
ASSERT_EQ(compiler.bytecode(), std::vector<unsigned int>({ vm::OP_START, vm::OP_UNTIL_LOOP, vm::OP_CONST, 2, vm::OP_BEGIN_UNTIL_LOOP, vm::OP_BREAK_ATOMIC, vm::OP_LOOP_END, vm::OP_HALT }));
324+
ASSERT_EQ(compiler.bytecode(), std::vector<unsigned int>({ vm::OP_START, vm::OP_UNTIL_LOOP, vm::OP_CONST, 2, vm::OP_BEGIN_UNTIL_LOOP, vm::OP_BREAK_FRAME, vm::OP_LOOP_END, vm::OP_HALT }));
325325
ASSERT_EQ(compiler.constValues(), std::vector<Value>({ false, false, false }));
326326
ASSERT_TRUE(compiler.variables().empty());
327327
ASSERT_TRUE(compiler.lists().empty());
328328

329329
compiler.compile(block4);
330330

331-
ASSERT_EQ(compiler.bytecode(), std::vector<unsigned int>({ vm::OP_START, vm::OP_UNTIL_LOOP, vm::OP_CONST, 3, vm::OP_BEGIN_UNTIL_LOOP, vm::OP_BREAK_ATOMIC, vm::OP_LOOP_END, vm::OP_HALT }));
331+
ASSERT_EQ(compiler.bytecode(), std::vector<unsigned int>({ vm::OP_START, vm::OP_UNTIL_LOOP, vm::OP_CONST, 3, vm::OP_BEGIN_UNTIL_LOOP, vm::OP_BREAK_FRAME, vm::OP_LOOP_END, vm::OP_HALT }));
332332
ASSERT_EQ(compiler.constValues(), std::vector<Value>({ false, false, false, Value() }));
333333
ASSERT_TRUE(compiler.variables().empty());
334334
ASSERT_TRUE(compiler.lists().empty());
335335

336336
compiler.compile(block5);
337337

338-
ASSERT_EQ(compiler.bytecode(), std::vector<unsigned int>({ vm::OP_START, vm::OP_UNTIL_LOOP, vm::OP_NULL, vm::OP_BEGIN_UNTIL_LOOP, vm::OP_BREAK_ATOMIC, vm::OP_LOOP_END, vm::OP_HALT }));
338+
ASSERT_EQ(compiler.bytecode(), std::vector<unsigned int>({ vm::OP_START, vm::OP_UNTIL_LOOP, vm::OP_NULL, vm::OP_BEGIN_UNTIL_LOOP, vm::OP_BREAK_FRAME, vm::OP_LOOP_END, vm::OP_HALT }));
339339
ASSERT_EQ(compiler.constValues(), std::vector<Value>({ false, false, false, Value() }));
340340
ASSERT_TRUE(compiler.variables().empty());
341341
ASSERT_TRUE(compiler.lists().empty());
@@ -377,7 +377,7 @@ TEST_F(ControlBlocksTest, While)
377377
ASSERT_EQ(
378378
compiler.bytecode(),
379379
std::vector<unsigned int>(
380-
{ vm::OP_START, vm::OP_UNTIL_LOOP, vm::OP_CONST, 0, vm::OP_NOT, vm::OP_BEGIN_UNTIL_LOOP, vm::OP_NULL, vm::OP_PRINT, vm::OP_BREAK_ATOMIC, vm::OP_LOOP_END, vm::OP_HALT }));
380+
{ vm::OP_START, vm::OP_UNTIL_LOOP, vm::OP_CONST, 0, vm::OP_NOT, vm::OP_BEGIN_UNTIL_LOOP, vm::OP_NULL, vm::OP_PRINT, vm::OP_BREAK_FRAME, vm::OP_LOOP_END, vm::OP_HALT }));
381381
ASSERT_EQ(compiler.constValues().size(), 1);
382382
ASSERT_EQ(compiler.constValues()[0].toBool(), false);
383383
ASSERT_TRUE(compiler.variables().empty());
@@ -387,7 +387,7 @@ TEST_F(ControlBlocksTest, While)
387387

388388
ASSERT_EQ(
389389
compiler.bytecode(),
390-
std::vector<unsigned int>({ vm::OP_START, vm::OP_UNTIL_LOOP, vm::OP_CONST, 1, vm::OP_NOT, vm::OP_BEGIN_UNTIL_LOOP, vm::OP_BREAK_ATOMIC, vm::OP_LOOP_END, vm::OP_HALT }));
390+
std::vector<unsigned int>({ vm::OP_START, vm::OP_UNTIL_LOOP, vm::OP_CONST, 1, vm::OP_NOT, vm::OP_BEGIN_UNTIL_LOOP, vm::OP_BREAK_FRAME, vm::OP_LOOP_END, vm::OP_HALT }));
391391
ASSERT_EQ(compiler.constValues(), std::vector<Value>({ false, false }));
392392
ASSERT_TRUE(compiler.variables().empty());
393393
ASSERT_TRUE(compiler.lists().empty());
@@ -396,7 +396,7 @@ TEST_F(ControlBlocksTest, While)
396396

397397
ASSERT_EQ(
398398
compiler.bytecode(),
399-
std::vector<unsigned int>({ vm::OP_START, vm::OP_UNTIL_LOOP, vm::OP_CONST, 2, vm::OP_NOT, vm::OP_BEGIN_UNTIL_LOOP, vm::OP_BREAK_ATOMIC, vm::OP_LOOP_END, vm::OP_HALT }));
399+
std::vector<unsigned int>({ vm::OP_START, vm::OP_UNTIL_LOOP, vm::OP_CONST, 2, vm::OP_NOT, vm::OP_BEGIN_UNTIL_LOOP, vm::OP_BREAK_FRAME, vm::OP_LOOP_END, vm::OP_HALT }));
400400
ASSERT_EQ(compiler.constValues(), std::vector<Value>({ false, false, false }));
401401
ASSERT_TRUE(compiler.variables().empty());
402402
ASSERT_TRUE(compiler.lists().empty());
@@ -405,14 +405,14 @@ TEST_F(ControlBlocksTest, While)
405405

406406
ASSERT_EQ(
407407
compiler.bytecode(),
408-
std::vector<unsigned int>({ vm::OP_START, vm::OP_UNTIL_LOOP, vm::OP_CONST, 3, vm::OP_NOT, vm::OP_BEGIN_UNTIL_LOOP, vm::OP_BREAK_ATOMIC, vm::OP_LOOP_END, vm::OP_HALT }));
408+
std::vector<unsigned int>({ vm::OP_START, vm::OP_UNTIL_LOOP, vm::OP_CONST, 3, vm::OP_NOT, vm::OP_BEGIN_UNTIL_LOOP, vm::OP_BREAK_FRAME, vm::OP_LOOP_END, vm::OP_HALT }));
409409
ASSERT_EQ(compiler.constValues(), std::vector<Value>({ false, false, false, Value() }));
410410
ASSERT_TRUE(compiler.variables().empty());
411411
ASSERT_TRUE(compiler.lists().empty());
412412

413413
compiler.compile(block5);
414414

415-
ASSERT_EQ(compiler.bytecode(), std::vector<unsigned int>({ vm::OP_START, vm::OP_UNTIL_LOOP, vm::OP_NULL, vm::OP_NOT, vm::OP_BEGIN_UNTIL_LOOP, vm::OP_BREAK_ATOMIC, vm::OP_LOOP_END, vm::OP_HALT }));
415+
ASSERT_EQ(compiler.bytecode(), std::vector<unsigned int>({ vm::OP_START, vm::OP_UNTIL_LOOP, vm::OP_NULL, vm::OP_NOT, vm::OP_BEGIN_UNTIL_LOOP, vm::OP_BREAK_FRAME, vm::OP_LOOP_END, vm::OP_HALT }));
416416
ASSERT_EQ(compiler.constValues(), std::vector<Value>({ false, false, false, Value() }));
417417
ASSERT_TRUE(compiler.variables().empty());
418418
ASSERT_TRUE(compiler.lists().empty());
@@ -449,7 +449,7 @@ TEST_F(ControlBlocksTest, ForEach)
449449
ASSERT_EQ(
450450
compiler.bytecode(),
451451
std::vector<unsigned int>(
452-
{ vm::OP_START, vm::OP_CONST, 0, vm::OP_REPEAT_LOOP, vm::OP_REPEAT_LOOP_INDEX1, vm::OP_SET_VAR, 0, vm::OP_NULL, vm::OP_PRINT, vm::OP_BREAK_ATOMIC, vm::OP_LOOP_END, vm::OP_HALT }));
452+
{ vm::OP_START, vm::OP_CONST, 0, vm::OP_REPEAT_LOOP, vm::OP_REPEAT_LOOP_INDEX1, vm::OP_SET_VAR, 0, vm::OP_NULL, vm::OP_PRINT, vm::OP_BREAK_FRAME, vm::OP_LOOP_END, vm::OP_HALT }));
453453
ASSERT_EQ(compiler.constValues().size(), 1);
454454
ASSERT_EQ(compiler.constValues()[0].toDouble(), 5);
455455
ASSERT_EQ(compiler.variables().size(), 1);

test/compiler/compiler_test.cpp

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -494,7 +494,7 @@ TEST_F(CompilerTest, RepeatLoop)
494494
ASSERT_EQ(
495495
compiler.bytecode(),
496496
std::vector<unsigned int>(
497-
{ vm::OP_START, vm::OP_CONST, 0, vm::OP_SET_VAR, 0, vm::OP_CONST, 1, vm::OP_REPEAT_LOOP, vm::OP_CONST, 2, vm::OP_CHANGE_VAR, 0, vm::OP_BREAK_ATOMIC, vm::OP_LOOP_END, vm::OP_HALT }));
497+
{ vm::OP_START, vm::OP_CONST, 0, vm::OP_SET_VAR, 0, vm::OP_CONST, 1, vm::OP_REPEAT_LOOP, vm::OP_CONST, 2, vm::OP_CHANGE_VAR, 0, vm::OP_BREAK_FRAME, vm::OP_LOOP_END, vm::OP_HALT }));
498498
ASSERT_EQ(compiler.variablePtrs().size(), 1);
499499
ASSERT_EQ(compiler.variablePtrs()[0]->toString(), "test");
500500
ASSERT_EQ(compiler.lists().size(), 0);
@@ -523,7 +523,7 @@ TEST_F(CompilerTest, ForeverLoop)
523523
compiler.compile(engine.targetAt(0)->greenFlagBlocks().at(0));
524524
ASSERT_EQ(
525525
compiler.bytecode(),
526-
std::vector<unsigned int>({ vm::OP_START, vm::OP_CONST, 0, vm::OP_SET_VAR, 0, vm::OP_FOREVER_LOOP, vm::OP_CONST, 1, vm::OP_CHANGE_VAR, 0, vm::OP_BREAK_ATOMIC, vm::OP_LOOP_END, vm::OP_HALT }));
526+
std::vector<unsigned int>({ vm::OP_START, vm::OP_CONST, 0, vm::OP_SET_VAR, 0, vm::OP_FOREVER_LOOP, vm::OP_CONST, 1, vm::OP_CHANGE_VAR, 0, vm::OP_BREAK_FRAME, vm::OP_LOOP_END, vm::OP_HALT }));
527527
ASSERT_EQ(compiler.constValues(), std::vector<Value>({ 0, 1 }));
528528
}
529529

@@ -549,7 +549,7 @@ TEST_F(CompilerTest, RepeatUntilLoop)
549549
1,
550550
vm::OP_CHANGE_VAR,
551551
0,
552-
vm::OP_BREAK_ATOMIC,
552+
vm::OP_BREAK_FRAME,
553553
vm::OP_LOOP_END,
554554
vm::OP_HALT }));
555555
ASSERT_EQ(compiler.constValues(), std::vector<Value>({ 0, 1 }));
@@ -578,7 +578,7 @@ TEST_F(CompilerTest, RepeatWhileLoop)
578578
1,
579579
vm::OP_CHANGE_VAR,
580580
0,
581-
vm::OP_BREAK_ATOMIC,
581+
vm::OP_BREAK_FRAME,
582582
vm::OP_LOOP_END,
583583
vm::OP_HALT }));
584584
ASSERT_EQ(compiler.constValues(), std::vector<Value>({ 0, 1 }));
@@ -608,7 +608,7 @@ TEST_F(CompilerTest, RepeatForEachLoop)
608608
2,
609609
vm::OP_CHANGE_VAR,
610610
0,
611-
vm::OP_BREAK_ATOMIC,
611+
vm::OP_BREAK_FRAME,
612612
vm::OP_LOOP_END,
613613
vm::OP_HALT }));
614614
ASSERT_EQ(compiler.constValues(), std::vector<Value>({ 0, 10, 1 }));
@@ -720,7 +720,7 @@ TEST_F(CompilerTest, NestedStatements)
720720
vm::OP_CHANGE_VAR,
721721
0,
722722
vm::OP_ENDIF,
723-
vm::OP_BREAK_ATOMIC,
723+
vm::OP_BREAK_FRAME,
724724
vm::OP_LOOP_END,
725725
vm::OP_ELSE,
726726
vm::OP_CONST,
@@ -738,7 +738,7 @@ TEST_F(CompilerTest, NestedStatements)
738738
vm::OP_CHANGE_VAR,
739739
0,
740740
vm::OP_ENDIF,
741-
vm::OP_BREAK_ATOMIC,
741+
vm::OP_BREAK_FRAME,
742742
vm::OP_LOOP_END,
743743
vm::OP_ENDIF,
744744
vm::OP_HALT }));

test/virtual_machine/virtual_machine_test.cpp

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -237,7 +237,7 @@ TEST(VirtualMachineTest, IfElse)
237237

238238
TEST(VirtualMachineTest, OP_FOREVER_LOOP)
239239
{
240-
static unsigned int bytecode[] = { OP_START, OP_FOREVER_LOOP, OP_BREAK_ATOMIC, OP_LOOP_END, OP_HALT };
240+
static unsigned int bytecode[] = { OP_START, OP_FOREVER_LOOP, OP_BREAK_FRAME, OP_LOOP_END, OP_HALT };
241241

242242
Engine engine;
243243
VirtualMachine vm(nullptr, &engine, nullptr);
@@ -1455,14 +1455,14 @@ TEST(VirtualMachineTest, RunProcedures)
14551455
ASSERT_EQ(vm.registerCount(), 0);
14561456
}
14571457

1458-
TEST(VirtualMachineTest, OP_BREAK_ATOMIC)
1458+
TEST(VirtualMachineTest, OP_BREAK_FRAME)
14591459
{
1460-
static unsigned int bytecode1[] = { OP_START, OP_FOREVER_LOOP, OP_BREAK_ATOMIC, OP_LOOP_END, OP_HALT };
1461-
static unsigned int bytecode2[] = { OP_START, OP_CONST, 1, OP_REPEAT_LOOP, OP_BREAK_ATOMIC, OP_LOOP_END, OP_HALT };
1460+
static unsigned int bytecode1[] = { OP_START, OP_FOREVER_LOOP, OP_BREAK_FRAME, OP_LOOP_END, OP_HALT };
1461+
static unsigned int bytecode2[] = { OP_START, OP_CONST, 1, OP_REPEAT_LOOP, OP_BREAK_FRAME, OP_LOOP_END, OP_HALT };
14621462
static unsigned int bytecode3[] = {
1463-
OP_START, OP_CONST, 0, OP_SET_VAR, 0, OP_UNTIL_LOOP, OP_READ_VAR, 0, OP_CONST, 1, OP_EQUALS, OP_BEGIN_UNTIL_LOOP, OP_BREAK_ATOMIC, OP_CONST, 2, OP_CHANGE_VAR, 0, OP_LOOP_END, OP_HALT
1463+
OP_START, OP_CONST, 0, OP_SET_VAR, 0, OP_UNTIL_LOOP, OP_READ_VAR, 0, OP_CONST, 1, OP_EQUALS, OP_BEGIN_UNTIL_LOOP, OP_BREAK_FRAME, OP_CONST, 2, OP_CHANGE_VAR, 0, OP_LOOP_END, OP_HALT
14641464
};
1465-
static unsigned int bytecode4[] = { OP_START, OP_BREAK_ATOMIC, OP_NULL, OP_EXEC, 0, OP_HALT };
1465+
static unsigned int bytecode4[] = { OP_START, OP_BREAK_FRAME, OP_NULL, OP_EXEC, 0, OP_HALT };
14661466
static BlockFunc functions[] = { &testFunction3 };
14671467
static Value constValues[] = { 0, 10, 1 };
14681468
Value var;
@@ -1524,11 +1524,11 @@ TEST(VirtualMachineTest, OP_BREAK_ATOMIC)
15241524

15251525
TEST(VirtualMachineTest, OP_WARP)
15261526
{
1527-
static unsigned int bytecode1[] = { OP_START, OP_WARP, OP_CONST, 1, OP_REPEAT_LOOP, OP_BREAK_ATOMIC, OP_LOOP_END, OP_HALT };
1527+
static unsigned int bytecode1[] = { OP_START, OP_WARP, OP_CONST, 1, OP_REPEAT_LOOP, OP_BREAK_FRAME, OP_LOOP_END, OP_HALT };
15281528
static unsigned int bytecode2[] = {
1529-
OP_START, OP_WARP, OP_CONST, 0, OP_SET_VAR, 0, OP_UNTIL_LOOP, OP_READ_VAR, 0, OP_CONST, 1, OP_EQUALS, OP_BEGIN_UNTIL_LOOP, OP_BREAK_ATOMIC, OP_CONST, 2, OP_CHANGE_VAR, 0, OP_LOOP_END, OP_HALT
1529+
OP_START, OP_WARP, OP_CONST, 0, OP_SET_VAR, 0, OP_UNTIL_LOOP, OP_READ_VAR, 0, OP_CONST, 1, OP_EQUALS, OP_BEGIN_UNTIL_LOOP, OP_BREAK_FRAME, OP_CONST, 2, OP_CHANGE_VAR, 0, OP_LOOP_END, OP_HALT
15301530
};
1531-
static unsigned int bytecode3[] = { OP_START, OP_WARP, OP_BREAK_ATOMIC, OP_NULL, OP_EXEC, 0, OP_HALT };
1531+
static unsigned int bytecode3[] = { OP_START, OP_WARP, OP_BREAK_FRAME, OP_NULL, OP_EXEC, 0, OP_HALT };
15321532
static BlockFunc functions[] = { &testFunction3 };
15331533
static Value constValues[] = { 0, 10, 1 };
15341534
Value var;

0 commit comments

Comments
 (0)