213 |
|
|
214 |
InstrScript_parse(context); |
InstrScript_parse(context); |
215 |
dmsg(2,("Allocating %lld bytes of global int VM memory.\n", context->globalIntVarCount * sizeof(vmint))); |
dmsg(2,("Allocating %lld bytes of global int VM memory.\n", context->globalIntVarCount * sizeof(vmint))); |
216 |
|
dmsg(2,("Allocating %lld bytes of global real VM memory.\n", context->globalRealVarCount * sizeof(vmfloat))); |
217 |
|
dmsg(2,("Allocating %lld bytes of global unit factor VM memory.\n", context->globalUnitFactorCount * sizeof(vmfloat))); |
218 |
dmsg(2,("Allocating %lld of global VM string variables.\n", context->globalStrVarCount)); |
dmsg(2,("Allocating %lld of global VM string variables.\n", context->globalStrVarCount)); |
219 |
if (!context->globalIntMemory) |
if (!context->globalIntMemory) |
220 |
context->globalIntMemory = new ArrayList<vmint>(); |
context->globalIntMemory = new ArrayList<vmint>(); |
221 |
if (!context->globalRealMemory) |
if (!context->globalRealMemory) |
222 |
context->globalRealMemory = new ArrayList<vmfloat>(); |
context->globalRealMemory = new ArrayList<vmfloat>(); |
223 |
|
if (!context->globalUnitFactorMemory) |
224 |
|
context->globalUnitFactorMemory = new ArrayList<vmfloat>(); |
225 |
if (!context->globalStrMemory) |
if (!context->globalStrMemory) |
226 |
context->globalStrMemory = new ArrayList<String>(); |
context->globalStrMemory = new ArrayList<String>(); |
227 |
context->globalIntMemory->resize(context->globalIntVarCount); |
context->globalIntMemory->resize(context->globalIntVarCount); |
228 |
context->globalRealMemory->resize(context->globalRealVarCount); |
context->globalRealMemory->resize(context->globalRealVarCount); |
229 |
|
context->globalUnitFactorMemory->resize(context->globalUnitFactorCount); |
230 |
memset(&((*context->globalIntMemory)[0]), 0, context->globalIntVarCount * sizeof(vmint)); |
memset(&((*context->globalIntMemory)[0]), 0, context->globalIntVarCount * sizeof(vmint)); |
231 |
memset(&((*context->globalRealMemory)[0]), 0, context->globalRealVarCount * sizeof(vmfloat)); |
memset(&((*context->globalRealMemory)[0]), 0, context->globalRealVarCount * sizeof(vmfloat)); |
232 |
|
for (vmint i = 0; i < context->globalUnitFactorCount; ++i) |
233 |
|
(*context->globalUnitFactorMemory)[i] = VM_NO_FACTOR; |
234 |
context->globalStrMemory->resize(context->globalStrVarCount); |
context->globalStrMemory->resize(context->globalStrVarCount); |
235 |
|
|
236 |
context->destroyScanner(); |
context->destroyScanner(); |
271 |
dmsg(2,("Created VM exec context with %lld bytes VM stack size.\n", |
dmsg(2,("Created VM exec context with %lld bytes VM stack size.\n", |
272 |
parserCtx->requiredMaxStackSize * sizeof(ExecContext::StackFrame))); |
parserCtx->requiredMaxStackSize * sizeof(ExecContext::StackFrame))); |
273 |
//printf("execCtx=0x%lx\n", (uint64_t)execCtx); |
//printf("execCtx=0x%lx\n", (uint64_t)execCtx); |
274 |
const vmint polySize = parserCtx->polyphonicIntVarCount; |
const vmint polyIntSize = parserCtx->polyphonicIntVarCount; |
275 |
execCtx->polyphonicIntMemory.resize(polySize); |
execCtx->polyphonicIntMemory.resize(polyIntSize); |
276 |
memset(&execCtx->polyphonicIntMemory[0], 0, polySize * sizeof(vmint)); |
memset(&execCtx->polyphonicIntMemory[0], 0, polyIntSize * sizeof(vmint)); |
277 |
|
|
278 |
dmsg(2,("Allocated %lld bytes polyphonic memory.\n", polySize * sizeof(vmint))); |
const vmint polyRealSize = parserCtx->polyphonicRealVarCount; |
279 |
|
execCtx->polyphonicRealMemory.resize(polyRealSize); |
280 |
|
memset(&execCtx->polyphonicRealMemory[0], 0, polyRealSize * sizeof(vmfloat)); |
281 |
|
|
282 |
|
const vmint polyFactorSize = parserCtx->polyphonicUnitFactorCount; |
283 |
|
execCtx->polyphonicUnitFactorMemory.resize(polyFactorSize); |
284 |
|
for (vmint i = 0; i < polyFactorSize; ++i) |
285 |
|
execCtx->polyphonicUnitFactorMemory[i] = VM_NO_FACTOR; |
286 |
|
|
287 |
|
dmsg(2,("Allocated %lld bytes polyphonic int memory.\n", polyIntSize * sizeof(vmint))); |
288 |
|
dmsg(2,("Allocated %lld bytes polyphonic real memory.\n", polyRealSize * sizeof(vmfloat))); |
289 |
|
dmsg(2,("Allocated %lld bytes unit factor memory.\n", polyFactorSize * sizeof(vmfloat))); |
290 |
return execCtx; |
return execCtx; |
291 |
} |
} |
292 |
|
|