/[svn]/linuxsampler/trunk/src/scriptvm/ScriptVM.cpp
ViewVC logotype

Diff of /linuxsampler/trunk/src/scriptvm/ScriptVM.cpp

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

revision 3221 by schoenebeck, Fri May 26 18:30:42 2017 UTC revision 3260 by schoenebeck, Wed May 31 21:07:44 2017 UTC
# Line 117  namespace LinuxSampler { Line 117  namespace LinuxSampler {
117                  else                  else
118                      return 1;                      return 1;
119              }              }
120    
121                case STMT_SYNC: {
122                    #if DEBUG_SCRIPTVM_CORE
123                    _printIndents(depth);
124                    printf("-> STMT_SYNC\n");
125                    #endif
126                    SyncBlock* syncStmt = (SyncBlock*) statement;
127                    if (syncStmt->statements())
128                        return _requiredMaxStackSizeFor( syncStmt->statements() ) + 1;
129                    else
130                        return 1;
131                }
132          }          }
133    
134          return 1; // actually just to avoid compiler warning          return 1; // actually just to avoid compiler warning
# Line 356  namespace LinuxSampler { Line 368  namespace LinuxSampler {
368          ctx->instructionsCount = 0;          ctx->instructionsCount = 0;
369          StmtFlags_t flags = STMT_SUCCESS;          StmtFlags_t flags = STMT_SUCCESS;
370          int instructionsCounter = 0;          int instructionsCounter = 0;
371            int synced = m_autoSuspend ? 0 : 1;
372    
373          int& frameIdx = ctx->stackFrame;          int& frameIdx = ctx->stackFrame;
374          if (frameIdx < 0) { // start condition ...          if (frameIdx < 0) { // start condition ...
# Line 432  namespace LinuxSampler { Line 445  namespace LinuxSampler {
445                          ctx->pushStack(                          ctx->pushStack(
446                              whileStmt->statements()                              whileStmt->statements()
447                          );                          );
448                          if (flags == STMT_SUCCESS && m_autoSuspend &&                          if (flags == STMT_SUCCESS && !synced &&
449                              instructionsCounter > SCRIPTVM_MAX_INSTR_PER_CYCLE_SOFT)                              instructionsCounter > SCRIPTVM_MAX_INSTR_PER_CYCLE_SOFT)
450                          {                          {
451                              flags = StmtFlags_t(STMT_SUSPEND_SIGNALLED);                              flags = StmtFlags_t(STMT_SUSPEND_SIGNALLED);
# Line 441  namespace LinuxSampler { Line 454  namespace LinuxSampler {
454                      } else ctx->popStack();                      } else ctx->popStack();
455                      break;                      break;
456                  }                  }
457    
458                    case STMT_SYNC: {
459                        #if DEBUG_SCRIPTVM_CORE
460                        _printIndents(frameIdx);
461                        printf("-> STMT_SYNC\n");
462                        #endif
463                        SyncBlock* syncStmt = (SyncBlock*) frame.statement;
464                        if (!frame.subindex++ && syncStmt->statements()) {
465                            ++synced;
466                            ctx->pushStack(
467                                syncStmt->statements()
468                            );
469                        } else {
470                            ctx->popStack();
471                            --synced;
472                        }
473                        break;
474                    }
475              }              }
476    
477              if (flags == STMT_SUCCESS && m_autoSuspend &&              if (flags == STMT_SUCCESS && !synced &&
478                  instructionsCounter > SCRIPTVM_MAX_INSTR_PER_CYCLE_HARD)                  instructionsCounter > SCRIPTVM_MAX_INSTR_PER_CYCLE_HARD)
479              {              {
480                  flags = StmtFlags_t(STMT_SUSPEND_SIGNALLED);                  flags = StmtFlags_t(STMT_SUSPEND_SIGNALLED);

Legend:
Removed from v.3221  
changed lines
  Added in v.3260

  ViewVC Help
Powered by ViewVC