Support COPY opcde
This commit is contained in:
@@ -2540,6 +2540,12 @@ PycRef<ASTNode> BuildFromCode(PycRef<PycCode> code, PycModule* mod)
|
|||||||
curblock->append(new ASTStore(values, new ASTSubscr(dest, slice)));
|
curblock->append(new ASTStore(values, new ASTSubscr(dest, slice)));
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
case Pyc::COPY_A:
|
||||||
|
{
|
||||||
|
PycRef<ASTNode> value = stack.top(operand);
|
||||||
|
stack.push(value);
|
||||||
|
}
|
||||||
|
break;
|
||||||
default:
|
default:
|
||||||
fprintf(stderr, "Unsupported opcode: %s (%d)\n", Pyc::OpcodeName(opcode), opcode);
|
fprintf(stderr, "Unsupported opcode: %s (%d)\n", Pyc::OpcodeName(opcode), opcode);
|
||||||
cleanBuild = false;
|
cleanBuild = false;
|
||||||
|
18
FastStack.h
18
FastStack.h
@@ -32,11 +32,21 @@ public:
|
|||||||
m_stack[m_ptr--] = nullptr;
|
m_stack[m_ptr--] = nullptr;
|
||||||
}
|
}
|
||||||
|
|
||||||
PycRef<ASTNode> top() const
|
PycRef<ASTNode> top(int i = 1) const
|
||||||
{
|
{
|
||||||
if (m_ptr > -1)
|
if (i > 0) {
|
||||||
return m_stack[m_ptr];
|
int idx = m_ptr + 1 - i;
|
||||||
else
|
if ((m_ptr > -1) && (idx >= 0))
|
||||||
|
return m_stack[idx];
|
||||||
|
else {
|
||||||
|
#ifdef BLOCK_DEBUG
|
||||||
|
fprintf(stderr, "insufficient values on stack\n");
|
||||||
|
#endif
|
||||||
|
return nullptr;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
fprintf(stderr, "incorrect operand %i\n", i);
|
||||||
return nullptr;
|
return nullptr;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user