本文整理汇总了C++中VMMethod::GetNumberOfArguments方法的典型用法代码示例。如果您正苦于以下问题:C++ VMMethod::GetNumberOfArguments方法的具体用法?C++ VMMethod::GetNumberOfArguments怎么用?C++ VMMethod::GetNumberOfArguments使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类VMMethod
的用法示例。
在下文中一共展示了VMMethod::GetNumberOfArguments方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: popFrameAndPushResult
void Interpreter::popFrameAndPushResult(vm_oop_t result) {
VMFrame* prevFrame = popFrame();
VMMethod* method = prevFrame->GetMethod();
long numberOfArgs = method->GetNumberOfArguments();
for (long i = 0; i < numberOfArgs; ++i) GetFrame()->Pop();
GetFrame()->Push(result);
}
示例2: testCloneBlock
void CloneObjectsTest::testCloneBlock() {
VMSymbol* methodSymbol = GetUniverse()->NewSymbol("someMethod");
VMMethod* method = GetUniverse()->NewMethod(methodSymbol, 0, 0);
VMBlock* orig = GetUniverse()->NewBlock(method,
GetUniverse()->GetInterpreter()->GetFrame(),
method->GetNumberOfArguments());
VMBlock* clone = orig->Clone();
CPPUNIT_ASSERT((intptr_t)orig != (intptr_t)clone);
CPPUNIT_ASSERT_EQUAL_MESSAGE("class differs!!", orig->clazz, clone->clazz);
CPPUNIT_ASSERT_EQUAL_MESSAGE("objectSize differs!!", orig->objectSize, clone->objectSize);
CPPUNIT_ASSERT_EQUAL_MESSAGE("numberOfFields differs!!", orig->numberOfFields, clone->numberOfFields);
CPPUNIT_ASSERT_EQUAL_MESSAGE("blockMethod differs!!", orig->blockMethod, clone->blockMethod);
CPPUNIT_ASSERT_EQUAL_MESSAGE("context differs!!", orig->context, clone->context);
}
示例3: doPushBlock
void Interpreter::doPushBlock(long bytecodeIndex) {
// Short cut the negative case of #ifTrue: and #ifFalse:
if (currentBytecodes[bytecodeIndexGlobal] == BC_SEND) {
if (GetFrame()->GetStackElement(0) == load_ptr(falseObject) &&
method->GetConstant(bytecodeIndexGlobal) == load_ptr(symbolIfTrue)) {
GetFrame()->Push(load_ptr(nilObject));
return;
} else if (GetFrame()->GetStackElement(0) == load_ptr(trueObject) &&
method->GetConstant(bytecodeIndexGlobal) == load_ptr(symbolIfFalse)) {
GetFrame()->Push(load_ptr(nilObject));
return;
}
}
VMMethod* blockMethod = static_cast<VMMethod*>(method->GetConstant(bytecodeIndex));
long numOfArgs = blockMethod->GetNumberOfArguments();
GetFrame()->Push(GetUniverse()->NewBlock(blockMethod, GetFrame(), numOfArgs));
}
示例4: doReturnNonLocal
void Interpreter::doReturnNonLocal() {
vm_oop_t result = GetFrame()->Pop();
VMFrame* context = GetFrame()->GetOuterContext();
if (!context->HasPreviousFrame()) {
VMBlock* block = static_cast<VMBlock*>(GetFrame()->GetArgument(0, 0));
VMFrame* prevFrame = GetFrame()->GetPreviousFrame();
VMFrame* outerContext = prevFrame->GetOuterContext();
vm_oop_t sender = outerContext->GetArgument(0, 0);
vm_oop_t arguments[] = {block};
popFrame();
// Pop old arguments from stack
VMMethod* method = GetFrame()->GetMethod();
long numberOfArgs = method->GetNumberOfArguments();
for (long i = 0; i < numberOfArgs; ++i)
GetFrame()->Pop();
// check if current frame is big enough for this unplanned send
// #escapedBlock: needs 2 slots, one for self, and one for the block
long additionalStackSlots = 2 - GetFrame()->RemainingStackSize();
if (additionalStackSlots > 0) {
GetFrame()->SetBytecodeIndex(bytecodeIndexGlobal);
// copy current frame into a bigger one, and replace it
SetFrame(VMFrame::EmergencyFrameFrom(GetFrame(), additionalStackSlots));
}
AS_OBJ(sender)->Send(escapedBlock, arguments, 1);
return;
}
while (GetFrame() != context) popFrame();
popFrameAndPushResult(result);
}