| OLD | NEW |
| 1 // Copyright (c) 2015, the Dartino project authors. Please see the AUTHORS file | 1 // Copyright (c) 2015, the Dartino project authors. Please see the AUTHORS file |
| 2 // for details. All rights reserved. Use of this source code is governed by a | 2 // for details. All rights reserved. Use of this source code is governed by a |
| 3 // BSD-style license that can be found in the LICENSE.md file. | 3 // BSD-style license that can be found in the LICENSE.md file. |
| 4 | 4 |
| 5 library dartino_compiler.vm_commands; | 5 library dartino_compiler.vm_commands; |
| 6 | 6 |
| 7 import 'dart:convert' show | 7 import 'dart:convert' show |
| 8 UTF8; | 8 UTF8; |
| 9 | 9 |
| 10 import 'dart:typed_data' show | 10 import 'dart:typed_data' show |
| (...skipping 100 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 111 int value = CommandBuffer.readInt32FromBuffer(buffer, 0); | 111 int value = CommandBuffer.readInt32FromBuffer(buffer, 0); |
| 112 return new ProcessNumberOfStacks(value); | 112 return new ProcessNumberOfStacks(value); |
| 113 case VmCommandCode.ProcessGetProcessIdsResult: | 113 case VmCommandCode.ProcessGetProcessIdsResult: |
| 114 int count = CommandBuffer.readInt32FromBuffer(buffer, 0); | 114 int count = CommandBuffer.readInt32FromBuffer(buffer, 0); |
| 115 List<int> ids = new List(count); | 115 List<int> ids = new List(count); |
| 116 for (int i = 0; i < count; ++i) { | 116 for (int i = 0; i < count; ++i) { |
| 117 ids[i] = CommandBuffer.readInt32FromBuffer(buffer, (i + 1) * 4); | 117 ids[i] = CommandBuffer.readInt32FromBuffer(buffer, (i + 1) * 4); |
| 118 } | 118 } |
| 119 return new ProcessGetProcessIdsResult(ids); | 119 return new ProcessGetProcessIdsResult(ids); |
| 120 case VmCommandCode.UncaughtException: | 120 case VmCommandCode.UncaughtException: |
| 121 return const UncaughtException(); | 121 int offset = 0; |
| 122 int processId = CommandBuffer.readInt32FromBuffer(buffer, offset); |
| 123 offset += 4; |
| 124 int functionId = translateFunction( |
| 125 CommandBuffer.readInt64FromBuffer(buffer, offset)); |
| 126 offset += 8; |
| 127 int bytecodeIndex = CommandBuffer.readInt64FromBuffer(buffer, offset); |
| 128 return new UncaughtException(processId, functionId, bytecodeIndex); |
| 122 case VmCommandCode.CommitChangesResult: | 129 case VmCommandCode.CommitChangesResult: |
| 123 bool success = CommandBuffer.readBoolFromBuffer(buffer, 0); | 130 bool success = CommandBuffer.readBoolFromBuffer(buffer, 0); |
| 124 String message = CommandBuffer.readAsciiStringFromBuffer( | 131 String message = CommandBuffer.readAsciiStringFromBuffer( |
| 125 buffer, 1, buffer.length - 1); | 132 buffer, 1, buffer.length - 1); |
| 126 return new CommitChangesResult(success, message); | 133 return new CommitChangesResult(success, message); |
| 127 case VmCommandCode.ProgramInfo: | 134 case VmCommandCode.ProgramInfo: |
| 128 if ((buffer.offsetInBytes % 4) != 0) { | 135 if ((buffer.offsetInBytes % 4) != 0) { |
| 129 buffer = new Uint8List.fromList(buffer); | 136 buffer = new Uint8List.fromList(buffer); |
| 130 } | 137 } |
| 131 | 138 |
| (...skipping 659 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 791 ..addAsciiString(message) | 798 ..addAsciiString(message) |
| 792 ..sendOn(sink, code); | 799 ..sendOn(sink, code); |
| 793 } | 800 } |
| 794 | 801 |
| 795 int get numberOfResponsesExpected => 0; | 802 int get numberOfResponsesExpected => 0; |
| 796 | 803 |
| 797 String valuesToString() => 'success: $successful, message: $message'; | 804 String valuesToString() => 'success: $successful, message: $message'; |
| 798 } | 805 } |
| 799 | 806 |
| 800 class UncaughtException extends VmCommand { | 807 class UncaughtException extends VmCommand { |
| 801 const UncaughtException() | 808 final int processId; |
| 809 final int functionId; |
| 810 final int bytecodeIndex; |
| 811 |
| 812 const UncaughtException( |
| 813 this.processId, this.functionId, this.bytecodeIndex) |
| 802 : super(VmCommandCode.UncaughtException); | 814 : super(VmCommandCode.UncaughtException); |
| 803 | 815 |
| 804 int get numberOfResponsesExpected => 0; | 816 int get numberOfResponsesExpected => 0; |
| 805 | 817 |
| 806 String valuesToString() => ""; | 818 String valuesToString() => ""; |
| 807 } | 819 } |
| 808 | 820 |
| 809 class MapLookup extends VmCommand { | 821 class MapLookup extends VmCommand { |
| 810 final MapId mapId; | 822 final MapId mapId; |
| 811 | 823 |
| (...skipping 977 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1789 Class, | 1801 Class, |
| 1790 InstanceStructure | 1802 InstanceStructure |
| 1791 } | 1803 } |
| 1792 | 1804 |
| 1793 enum MapId { | 1805 enum MapId { |
| 1794 methods, | 1806 methods, |
| 1795 classes, | 1807 classes, |
| 1796 constants, | 1808 constants, |
| 1797 fibers, | 1809 fibers, |
| 1798 } | 1810 } |
| OLD | NEW |