mirror of
https://github.com/amyinspace/MagicSetEditor2.git
synced 2026-06-10 04:57:00 -04:00
Script cleanup for standards-compliance (not going out of bounds on vectors).
I_POP is no longer considered a binary instruction because all other binary instructions expect the stack to have at least two elements - adding a manual check is kludgy Added I_TAILCALL to accomodate indended optimizations git-svn-id: svn://svn.code.sf.net/p/magicseteditor/code/trunk@1417 0fc631ac-6414-0410-93d0-97cfa31319b6
This commit is contained in:
@@ -99,7 +99,11 @@ ScriptValueP Script::dependencies(Context& ctx, const Dependency& dep) const {
|
||||
static const unsigned int INVALID_ADDRESS = 0x03FFFFFF;
|
||||
|
||||
unsigned int Script::addInstruction(InstructionType t) {
|
||||
assert( t == I_JUMP || t == I_JUMP_IF_NOT || t == I_LOOP || t == I_LOOP_WITH_KEY);
|
||||
assert( t == I_JUMP
|
||||
|| t == I_JUMP_IF_NOT
|
||||
|| t == I_LOOP
|
||||
|| t == I_LOOP_WITH_KEY
|
||||
|| t == I_POP);
|
||||
Instruction i = {t, {INVALID_ADDRESS}};
|
||||
instructions.push_back(i);
|
||||
return getLabel() - 1;
|
||||
@@ -179,7 +183,6 @@ String Script::dumpInstr(unsigned int pos, Instruction i) const {
|
||||
break;
|
||||
case I_BINARY: ret += _("binary\t");
|
||||
switch (i.instr2) {
|
||||
case I_POP: ret += _("pop"); break;
|
||||
case I_ITERATOR_R: ret += _("iterator_r"); break;
|
||||
case I_MEMBER: ret += _("member"); break;
|
||||
case I_ADD: ret += _("+"); break;
|
||||
@@ -210,6 +213,8 @@ String Script::dumpInstr(unsigned int pos, Instruction i) const {
|
||||
}
|
||||
break;
|
||||
case I_DUP: ret += _("dup"); break;
|
||||
case I_POP: ret += _("pop"); break;
|
||||
case I_TAILCALL: ret += _("tailcall"); break;
|
||||
}
|
||||
// arg
|
||||
switch (i.instr) {
|
||||
|
||||
Reference in New Issue
Block a user