VirtualMachine.cpp 21 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479
  1. // zlib open source license
  2. //
  3. // Copyright (c) 2019 David Forsgren Piuva
  4. //
  5. // This software is provided 'as-is', without any express or implied
  6. // warranty. In no event will the authors be held liable for any damages
  7. // arising from the use of this software.
  8. //
  9. // Permission is granted to anyone to use this software for any purpose,
  10. // including commercial applications, and to alter it and redistribute it
  11. // freely, subject to the following restrictions:
  12. //
  13. // 1. The origin of this software must not be misrepresented; you must not
  14. // claim that you wrote the original software. If you use this software
  15. // in a product, an acknowledgment in the product documentation would be
  16. // appreciated but is not required.
  17. //
  18. // 2. Altered source versions must be plainly marked as such, and must not be
  19. // misrepresented as being the original software.
  20. //
  21. // 3. This notice may not be removed or altered from any source
  22. // distribution.
  23. #include "VirtualMachine.h"
  24. #include "../api/timeAPI.h"
  25. using namespace dsr;
  26. VirtualMachine::VirtualMachine(const ReadableString& code, const std::shared_ptr<PlanarMemory>& memory,
  27. const InsSig* machineInstructions, int32_t machineInstructionCount,
  28. const VMTypeDef* machineTypes, int32_t machineTypeCount)
  29. : memory(memory), machineInstructions(machineInstructions), machineInstructionCount(machineInstructionCount),
  30. machineTypes(machineTypes), machineTypeCount(machineTypeCount) {
  31. #ifdef VIRTUAL_MACHINE_DEBUG_PRINT
  32. printText("Starting media machine.\n");
  33. #endif
  34. this->methods.pushConstruct(U"<init>", 0, this->machineTypeCount);
  35. #ifdef VIRTUAL_MACHINE_DEBUG_PRINT
  36. printText("Reading assembly.\n");
  37. #endif
  38. string_split_callback([this](ReadableString currentLine) {
  39. // If the line has a comment, then skip everything from #
  40. int commentIndex = string_findFirst(currentLine, U'#');
  41. if (commentIndex > -1) {
  42. currentLine = string_before(currentLine, commentIndex);
  43. }
  44. currentLine = string_removeOuterWhiteSpace(currentLine);
  45. int colonIndex = string_findFirst(currentLine, U':');
  46. if (colonIndex > -1) {
  47. ReadableString command = string_removeOuterWhiteSpace(string_before(currentLine, colonIndex));
  48. ReadableString argumentLine = string_after(currentLine, colonIndex);
  49. List<String> arguments = string_split(argumentLine, U',', true);
  50. this->interpretMachineWord(command, arguments);
  51. } else if (string_length(currentLine) > 0) {
  52. throwError("Unexpected line \"", currentLine, "\".\n");
  53. }
  54. }, code, U'\n');
  55. // Calling "<init>" to execute global commands
  56. #ifdef VIRTUAL_MACHINE_DEBUG_PRINT
  57. printText("Initializing global machine state.\n");
  58. #endif
  59. this->executeMethod(0);
  60. }
  61. int VirtualMachine::findMethod(const ReadableString& name) {
  62. for (int i = 0; i < this->methods.length(); i++) {
  63. if (string_caseInsensitiveMatch(this->methods[i].name, name)) {
  64. return i;
  65. }
  66. }
  67. return -1;
  68. }
  69. Variable* VirtualMachine::getResource(const ReadableString& name, int methodIndex) {
  70. Variable* result = this->methods[methodIndex].getLocal(name);
  71. if (result) {
  72. // If found, take the local variable
  73. return result;
  74. } else if (methodIndex > 0) {
  75. // If not found but having another scope, look for global variables in the global initiation method
  76. return getResource(name, 0);
  77. } else {
  78. return nullptr;
  79. }
  80. }
  81. void VirtualMachine::addMachineWord(MachineOperation operation, const List<VMA>& args) {
  82. this->machineWords.pushConstruct(operation, args);
  83. this->methods[this->methods.length() - 1].instructionCount++;
  84. }
  85. void VirtualMachine::addMachineWord(MachineOperation operation) {
  86. this->machineWords.pushConstruct(operation);
  87. this->methods[this->methods.length() - 1].instructionCount++;
  88. }
  89. void VirtualMachine::interpretCommand(const ReadableString& operation, const List<VMA>& resolvedArguments) {
  90. // Compare the input with overloads
  91. for (int s = 0; s < machineInstructionCount; s++) {
  92. if (machineInstructions[s].matches(operation, resolvedArguments)) {
  93. this->addMachineWord(machineInstructions[s].operation, resolvedArguments);
  94. return;
  95. }
  96. }
  97. // TODO: Allow asking the specific machine type what the given types are called.
  98. String message = string_combine(U"\nError! ", operation, U" does not match any overload for the given arguments:\n");
  99. for (int s = 0; s < machineInstructionCount; s++) {
  100. const InsSig* signature = &machineInstructions[s];
  101. if (string_caseInsensitiveMatch(signature->name, operation)) {
  102. string_append(message, " * ", signature->name, "(");
  103. for (int a = 0; a < signature->arguments.length(); a++) {
  104. if (a > 0) {
  105. string_append(message, ", ");
  106. }
  107. const ArgSig* argument = &signature->arguments[a];
  108. string_append(message, argument->name);
  109. }
  110. string_append(message, ")\n");
  111. }
  112. }
  113. throwError(message);
  114. }
  115. // TODO: Inline into declareVariable
  116. Variable* VirtualMachine::declareVariable_aux(const VMTypeDef& typeDef, int methodIndex, AccessType access, const ReadableString& name, bool initialize, const ReadableString& defaultValueText) {
  117. // Make commonly used data more readable
  118. bool global = methodIndex == 0;
  119. Method* currentMethod = &this->methods[methodIndex];
  120. // Assert correctness
  121. if (global && (access == AccessType::Input || access == AccessType::Output)) {
  122. throwError("Cannot declare inputs or outputs globally!\n");
  123. }
  124. // Count how many variables the method has of each type
  125. currentMethod->count[typeDef.dataType]++;
  126. this->methods[methodIndex].unifiedLocalIndices[typeDef.dataType].push(this->methods[methodIndex].locals.length());
  127. // Count inputs for calling the method
  128. if (access == AccessType::Input) {
  129. if (this->methods[methodIndex].declaredNonInput) {
  130. throwError("Cannot declare input \"", name, "\" after a non-input has been declared. Declare inputs, outputs and locals in order.\n");
  131. }
  132. this->methods[methodIndex].inputCount++;
  133. } else if (access == AccessType::Output) {
  134. if (this->methods[methodIndex].declaredLocals) {
  135. throwError("Cannot declare output \"", name, "\" after a local has been declared. Declare inputs, outputs and locals in order.\n");
  136. }
  137. this->methods[methodIndex].outputCount++;
  138. this->methods[methodIndex].declaredNonInput = true;
  139. } else if (access == AccessType::Hidden) {
  140. this->methods[methodIndex].declaredLocals = true;
  141. this->methods[methodIndex].declaredNonInput = true;
  142. }
  143. // Declare the variable so that code may find the type and index by name
  144. int typeLocalIndex = currentMethod->count[typeDef.dataType] - 1;
  145. int globalIndex = typeLocalToGlobalIndex(global, typeLocalIndex);
  146. this->methods[methodIndex].locals.pushConstruct(name, access, &typeDef, typeLocalIndex, global);
  147. if (initialize && access != AccessType::Input) {
  148. // Generate instructions for assigning the variable's initial value
  149. typeDef.initializer(*this, globalIndex, defaultValueText);
  150. }
  151. return &this->methods[methodIndex].locals.last();
  152. }
  153. Variable* VirtualMachine::declareVariable(int methodIndex, AccessType access, const ReadableString& typeName, const ReadableString& name, bool initialize, const ReadableString& defaultValueText) {
  154. if (this->getResource(name, methodIndex)) {
  155. throwError("A resource named \"", name, "\" already exists! Be aware that resource names are case insensitive.\n");
  156. return nullptr;
  157. } else {
  158. // Loop over type definitions to find a match
  159. const VMTypeDef* typeDef = getMachineType(typeName);
  160. if (typeDef) {
  161. if (string_length(defaultValueText) > 0 && !typeDef->allowDefaultValue) {
  162. throwError("The variable \"", name, "\" doesn't have an immediate constructor for \"", typeName, "\".\n");
  163. }
  164. return this->declareVariable_aux(*typeDef, methodIndex, access, name, initialize, defaultValueText);
  165. } else {
  166. throwError("Cannot declare variable of unknown type \"", typeName, "\"!\n");
  167. return nullptr;
  168. }
  169. }
  170. }
  171. VMA VirtualMachine::VMAfromText(int methodIndex, const ReadableString& content) {
  172. DsrChar first = content[0];
  173. DsrChar second = content[1];
  174. if (first == U'-' && second >= U'0' && second <= U'9') {
  175. return VMA(FixedPoint::fromText(content));
  176. } else if (first >= U'0' && first <= U'9') {
  177. return VMA(FixedPoint::fromText(content));
  178. } else {
  179. int leftIndex = string_findFirst(content, U'<');
  180. int rightIndex = string_findLast(content, U'>');
  181. if (leftIndex > -1 && rightIndex > -1) {
  182. ReadableString name = string_removeOuterWhiteSpace(string_before(content, leftIndex));
  183. ReadableString typeName = string_removeOuterWhiteSpace(string_inclusiveRange(content, leftIndex + 1, rightIndex - 1));
  184. ReadableString remainder = string_removeOuterWhiteSpace(string_after(content, rightIndex));
  185. if (string_length(remainder) > 0) {
  186. throwError("No code allowed after > for in-place temp declarations!\n");
  187. }
  188. Variable* resource = this->declareVariable(methodIndex, AccessType::Hidden, typeName, name, false, U"");
  189. if (resource) {
  190. return VMA(resource->typeDescription->dataType, resource->getGlobalIndex());
  191. } else {
  192. throwError("The resource \"", name, "\" could not be declared as \"", typeName, "\"!\n");
  193. return VMA(FixedPoint());
  194. }
  195. } else if (leftIndex > -1) {
  196. throwError("Using < without > for in-place temp allocation.\n");
  197. return VMA(FixedPoint());
  198. } else if (rightIndex > -1) {
  199. throwError("Using > without < for in-place temp allocation.\n");
  200. return VMA(FixedPoint());
  201. } else {
  202. Variable* resource = getResource(content, methodIndex);
  203. if (resource) {
  204. return VMA(resource->typeDescription->dataType, resource->getGlobalIndex());
  205. } else {
  206. throwError("The resource \"", content, "\" could not be found! Make sure that it's declared before being used.\n");
  207. return VMA(FixedPoint());
  208. }
  209. }
  210. }
  211. }
  212. static ReadableString getArg(const List<String>& arguments, int32_t index) {
  213. if (index < 0 || index >= arguments.length()) {
  214. return U"";
  215. } else {
  216. return string_removeOuterWhiteSpace(arguments[index]);
  217. }
  218. }
  219. void VirtualMachine::addReturnInstruction() {
  220. addMachineWord([](VirtualMachine& machine, PlanarMemory& memory, const List<VMA>& args) {
  221. if (memory.callStack.length() > 0) {
  222. // Return to caller
  223. #ifdef VIRTUAL_MACHINE_DEBUG_PRINT
  224. printText("Returning from \"", machine.methods[memory.current.methodIndex].name, "\" to caller \"", machine.methods[memory.callStack.last().methodIndex].name, "\"\n");
  225. machine.debugPrintMemory();
  226. #endif
  227. memory.current = memory.callStack.last();
  228. memory.callStack.pop();
  229. memory.current.programCounter++;
  230. } else {
  231. #ifdef VIRTUAL_MACHINE_DEBUG_PRINT
  232. printText("Returning from \"", machine.methods[memory.current.methodIndex].name, "\"\n");
  233. #endif
  234. // Leave the virtual machine
  235. memory.current.programCounter = -1;
  236. }
  237. });
  238. }
  239. void VirtualMachine::addCallInstructions(const List<String>& arguments) {
  240. if (arguments.length() < 1) {
  241. throwError("Cannot make a call without the name of a method!\n");
  242. }
  243. // TODO: Allow calling methods that aren't defined yet.
  244. int currentMethodIndex = this->methods.length() - 1;
  245. int calledMethodIndex = findMethod(string_removeOuterWhiteSpace(arguments[0]));
  246. // Check the total number of arguments
  247. Method* calledMethod = &this->methods[calledMethodIndex];
  248. if (arguments.length() - 1 != calledMethod->outputCount + calledMethod->inputCount) {
  249. throwError("Wrong argument count to \"", calledMethod->name, "\"! Call arguments should start with the method to call, continue with output references and end with inputs.\n");
  250. }
  251. // Split assembler arguments into separate input and output arguments for machine instructions
  252. List<VMA> inputArguments;
  253. List<VMA> outputArguments;
  254. inputArguments.push(VMA(FixedPoint::fromMantissa(calledMethodIndex)));
  255. outputArguments.push(VMA(FixedPoint::fromMantissa(calledMethodIndex)));
  256. int outputCount = 0;
  257. for (int a = 1; a < arguments.length(); a++) {
  258. ReadableString content = string_removeOuterWhiteSpace(arguments[a]);
  259. if (string_length(content) > 0) {
  260. if (outputCount < calledMethod->outputCount) {
  261. outputArguments.push(this->VMAfromText(currentMethodIndex, getArg(arguments, a)));
  262. outputCount++;
  263. } else {
  264. inputArguments.push(this->VMAfromText(currentMethodIndex, getArg(arguments, a)));
  265. }
  266. }
  267. }
  268. // Check types
  269. for (int a = 1; a < outputArguments.length(); a++) {
  270. // Output
  271. Variable* variable = &calledMethod->locals[a - 1 + calledMethod->inputCount];
  272. if (outputArguments[a].argType != ArgumentType::Reference) {
  273. throwError("Output argument for \"", variable->name, "\" in \"", calledMethod->name, "\" must be a reference to allow writing its result!\n");
  274. } else if (outputArguments[a].dataType != variable->typeDescription->dataType) {
  275. throwError("Output argument for \"", variable->name, "\" in \"", calledMethod->name, "\" must have the type \"", variable->typeDescription->name, "\"!\n");
  276. }
  277. }
  278. for (int a = 1; a < inputArguments.length(); a++) {
  279. // Input
  280. Variable* variable = &calledMethod->locals[a - 1];
  281. if (inputArguments[a].dataType != variable->typeDescription->dataType) {
  282. throwError("Input argument for \"", variable->name, "\" in \"", calledMethod->name, "\" must have the type \"", variable->typeDescription->name, "\"!\n");
  283. }
  284. }
  285. addMachineWord([](VirtualMachine& machine, PlanarMemory& memory, const List<VMA>& args) {
  286. // Get the method to call
  287. int calledMethodIndex = args[0].value.getMantissa();
  288. int oldMethodIndex = memory.current.methodIndex;
  289. Method* calledMethod = &machine.methods[calledMethodIndex];
  290. #ifdef VIRTUAL_MACHINE_DEBUG_PRINT
  291. printText("Calling \"", calledMethod->name, "\".\n");
  292. #endif
  293. // Calculate new frame pointers
  294. int32_t newFramePointer[MAX_TYPE_COUNT] = {};
  295. int32_t newStackPointer[MAX_TYPE_COUNT] = {};
  296. for (int t = 0; t < MAX_TYPE_COUNT; t++) {
  297. newFramePointer[t] = memory.current.stackPointer[t];
  298. newStackPointer[t] = memory.current.stackPointer[t] + machine.methods[oldMethodIndex].count[t];
  299. }
  300. // Assign inputs
  301. for (int a = 1; a < args.length(); a++) {
  302. Variable* target = &calledMethod->locals[a - 1];
  303. DataType typeIndex = target->typeDescription->dataType;
  304. int targetStackIndex = target->getStackIndex(newFramePointer[typeIndex]);
  305. memory.store(targetStackIndex, args[a], memory.current.framePointer[typeIndex], typeIndex);
  306. }
  307. // Jump into the method
  308. memory.callStack.push(memory.current);
  309. memory.current.methodIndex = calledMethodIndex;
  310. memory.current.programCounter = machine.methods[calledMethodIndex].startAddress;
  311. for (int t = 0; t < MAX_TYPE_COUNT; t++) {
  312. memory.current.framePointer[t] = newFramePointer[t];
  313. memory.current.stackPointer[t] = newStackPointer[t];
  314. }
  315. }, inputArguments);
  316. // Get results from the method
  317. addMachineWord([](VirtualMachine& machine, PlanarMemory& memory, const List<VMA>& args) {
  318. int calledMethodIndex = args[0].value.getMantissa();
  319. Method* calledMethod = &machine.methods[calledMethodIndex];
  320. #ifdef VIRTUAL_MACHINE_DEBUG_PRINT
  321. printText("Writing results after call to \"", calledMethod->name, "\":\n");
  322. #endif
  323. // Assign outputs
  324. for (int a = 1; a < args.length(); a++) {
  325. Variable* source = &calledMethod->locals[a - 1 + calledMethod->inputCount];
  326. DataType typeIndex = source->typeDescription->dataType;
  327. int sourceStackIndex = source->getStackIndex(memory.current.stackPointer[typeIndex]);
  328. memory.load(sourceStackIndex, args[a], memory.current.framePointer[typeIndex], typeIndex);
  329. #ifdef VIRTUAL_MACHINE_DEBUG_PRINT
  330. printText(" ");
  331. machine.debugArgument(VMA(typeIndex, source->getGlobalIndex()), calledMethodIndex, memory.current.stackPointer, false);
  332. printText(" -> ");
  333. machine.debugArgument(args[a], memory.current.methodIndex, memory.current.framePointer, false);
  334. printText("\n");
  335. #endif
  336. }
  337. // TODO: Decrease reference counts for images by zeroing memory above the new stack-pointer
  338. // Avoiding temporary memory leaks and making sure that no cloning is needed for operations that clone if needed
  339. // Planar memory will receive a new memset operation for a range of stack indices for a given type
  340. memory.current.programCounter++;
  341. #ifdef VIRTUAL_MACHINE_DEBUG_PRINT
  342. machine.debugPrintMemory();
  343. #endif
  344. }, outputArguments);
  345. }
  346. void VirtualMachine::interpretMachineWord(const ReadableString& command, const List<String>& arguments) {
  347. #ifdef VIRTUAL_MACHINE_DEBUG_PRINT
  348. printText("interpretMachineWord @", this->machineWords.length(), " ", command, "(");
  349. for (int a = 0; a < arguments.length(); a++) {
  350. if (a > 0) { printText(", "); }
  351. printText(getArg(arguments, a));
  352. }
  353. printText(")\n");
  354. #endif
  355. if (string_caseInsensitiveMatch(command, U"Begin")) {
  356. if (this->methods.length() == 1) {
  357. // When more than one function exists, the init method must end with a return instruction
  358. // Otherwise it would start executing instructions in another method and crash
  359. this->addReturnInstruction();
  360. }
  361. this->methods.pushConstruct(getArg(arguments, 0), this->machineWords.length(), this->machineTypeCount);
  362. } else if (string_caseInsensitiveMatch(command, U"Temp")) {
  363. for (int a = 1; a < arguments.length(); a++) {
  364. this->declareVariable(methods.length() - 1, AccessType::Hidden, getArg(arguments, 0), getArg(arguments, a), false, U"");
  365. }
  366. } else if (string_caseInsensitiveMatch(command, U"Hidden")) {
  367. this->declareVariable(methods.length() - 1, AccessType::Hidden, getArg(arguments, 0), getArg(arguments, 1), true, getArg(arguments, 2));
  368. } else if (string_caseInsensitiveMatch(command, U"Input")) {
  369. this->declareVariable(methods.length() - 1, AccessType::Input, getArg(arguments, 0), getArg(arguments, 1), true, getArg(arguments, 2));
  370. } else if (string_caseInsensitiveMatch(command, U"Output")) {
  371. this->declareVariable(methods.length() - 1, AccessType::Output, getArg(arguments, 0), getArg(arguments, 1), true, getArg(arguments, 2));
  372. } else if (string_caseInsensitiveMatch(command, U"End")) {
  373. this->addReturnInstruction();
  374. } else if (string_caseInsensitiveMatch(command, U"Call")) {
  375. this->addCallInstructions(arguments);
  376. } else {
  377. int methodIndex = this->methods.length() - 1;
  378. List<VMA> resolvedArguments;
  379. for (int a = 0; a < arguments.length(); a++) {
  380. ReadableString content = string_removeOuterWhiteSpace(arguments[a]);
  381. if (string_length(content) > 0) {
  382. resolvedArguments.push(this->VMAfromText(methodIndex, getArg(arguments, a)));
  383. }
  384. }
  385. this->interpretCommand(command, resolvedArguments);
  386. }
  387. }
  388. void VirtualMachine::executeMethod(int methodIndex) {
  389. Method* rootMethod = &this->methods[methodIndex];
  390. #ifdef VIRTUAL_MACHINE_PROFILE
  391. if (rootMethod->instructionCount < 1) {
  392. // TODO: Assert that each method ends with a return or jump instruction after compiling
  393. printText("Cannot call \"", rootMethod->name, "\", because it doesn't have any instructions.\n");
  394. return;
  395. }
  396. #endif
  397. // Create a new current state
  398. this->memory->current.methodIndex = methodIndex;
  399. this->memory->current.programCounter = rootMethod->startAddress;
  400. for (int t = 0; t < this->machineTypeCount; t++) {
  401. int framePointer = this->methods[0].count[t];
  402. this->memory->current.framePointer[t] = framePointer;
  403. this->memory->current.stackPointer[t] = framePointer + this->methods[methodIndex].count[t];
  404. }
  405. #ifdef VIRTUAL_MACHINE_DEBUG_PRINT
  406. this->debugPrintMemory();
  407. #endif
  408. #ifdef VIRTUAL_MACHINE_PROFILE
  409. printText("Calling \"", rootMethod->name, "\":\n");
  410. double startTime = time_getSeconds();
  411. #endif
  412. // Execute until the program counter is out of bound (-1)
  413. while (true) {
  414. int32_t pc = this->memory->current.programCounter;
  415. if (pc < 0 || pc >= this->machineWords.length()) {
  416. // Return statements will set the program counter to -1 if there are no more callers saved in the stack
  417. if (pc != -1) {
  418. throwError("Unexpected program counter! @", pc, " outside of 0..", (this->machineWords.length() - 1), "\n");
  419. }
  420. break;
  421. }
  422. MachineWord* word = &this->machineWords[pc];
  423. #ifdef VIRTUAL_MACHINE_DEBUG_PRINT
  424. const InsSig* signature = getMachineInstructionFromFunction(word->operation);
  425. if (signature) {
  426. printText("Executing @", pc, " ", signature->name, "(");
  427. for (int a = signature->targetCount; a < word->args.length(); a++) {
  428. if (a > signature->targetCount) {
  429. printText(", ");
  430. }
  431. debugArgument(word->args[a], this->memory->current.methodIndex, this->memory->current.framePointer, false);
  432. }
  433. printText(")");
  434. }
  435. word->operation(*this, *(this->memory.get()), word->args);
  436. if (signature) {
  437. if (signature->targetCount > 0) {
  438. printText(" -> ");
  439. for (int a = 0; a < signature->targetCount; a++) {
  440. if (a > 0) {
  441. printText(", ");
  442. }
  443. debugArgument(word->args[a], this->memory->current.methodIndex, this->memory->current.framePointer, true);
  444. }
  445. }
  446. }
  447. printText("\n");
  448. #else
  449. word->operation(*this, *(this->memory.get()), word->args);
  450. #endif
  451. }
  452. #ifdef VIRTUAL_MACHINE_PROFILE
  453. double endTime = time_getSeconds();
  454. printText("Done calling \"", rootMethod->name, "\" after ", (endTime - startTime) * 1000000.0, " microseconds.\n");
  455. #ifdef VIRTUAL_MACHINE_DEBUG_PRINT
  456. printText(" (debug prints are active)\n");
  457. #endif
  458. #endif
  459. }