MCPcopy Create free account
hub / github.com/GaijinEntertainment/daScript / sv_makeLocalRefCopy

Method sv_makeLocalRefCopy

src/ast/ast_simulate.cpp:445–475  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

443 }
444
445 SimNode * SimulateVisitor::sv_makeLocalRefCopy(const LineInfo & at, uint32_t stackTop, uint32_t offset, ExpressionPtr rE ) {
446 const auto & rightType = *rE->type;
447 DAS_ASSERT ( rightType.canCopy() &&
448 "we are calling makeLocalRefCopy on a type, which can't be copied."
449 "we should not be here, script compiler should have caught this during compilation."
450 "compiler later will likely report internal compilation error.");
451 auto right = getE(rE);
452 // now, call with CMRES
453 if ( rE->rtti_isCall() ) {
454 auto cll = static_cast<ExprCall*>(rE);
455 if ( cll->allowCmresSkip() ) {
456 getCallBase(right)->cmresEval = context.code->makeNode<SimNode_GetLocalRefOff>(rE->at, stackTop, offset);
457 return right;
458 }
459 }
460 // now, invoke with CMRES
461 if ( rE->rtti_isInvoke() ) {
462 auto cll = static_cast<ExprInvoke*>(rE);
463 if ( cll->allowCmresSkip() ) {
464 getCallBase(right)->cmresEval = context.code->makeNode<SimNode_GetLocalRefOff>(rE->at, stackTop, offset);
465 return right;
466 }
467 }
468 // wo standard path
469 auto left = context.code->makeNode<SimNode_GetLocalRefOff>(rE->at, stackTop, offset);
470 if ( rightType.isRef() ) {
471 return context.code->makeNode<SimNode_CopyRefValue>(at, left, right, rightType.getSizeOf());
472 } else {
473 return context.code->makeValueNode<SimNode_Set>(rightType.getR2VType(), at, left, right);
474 }
475 }
476
477 SimNode * SimulateVisitor::sv_makeLocalMove (const LineInfo & at, uint32_t stackTop, ExpressionPtr rE ) {
478 const auto & rightType = *rE->type;

Callers

nothing calls this directly

Calls 5

getCallBaseFunction · 0.85
isRefMethod · 0.80
getR2VTypeMethod · 0.80
canCopyMethod · 0.45
getSizeOfMethod · 0.45

Tested by

no test coverage detected