@@ -97,12 +97,12 @@ class MediaMemory : public PlanarMemory<MEDIA_MACHINE_TYPE_COUNT> {
9797// Type definitions
9898static const VMTypeDef<MEDIA_MACHINE_TYPE_COUNT> mediaMachineTypes[] = {
9999 VMTypeDef<MEDIA_MACHINE_TYPE_COUNT>(U" FixedPoint" , DataType_FixedPoint, true ,
100- [](PlanarMemory<MEDIA_MACHINE_TYPE_COUNT>& memory, Variable<MEDIA_MACHINE_TYPE_COUNT>& variable, int32_t globalIndex, int32_t * framePointer, bool fullContent) {
100+ [](PlanarMemory<MEDIA_MACHINE_TYPE_COUNT>& memory, Variable<MEDIA_MACHINE_TYPE_COUNT>& variable, int32_t globalIndex, const FixedArray< int32_t , MEDIA_MACHINE_TYPE_COUNT>& framePointer, bool fullContent) {
101101 FixedPoint value = MEDIA_MEMORY.fixedPointMemory .accessByGlobalIndex (globalIndex, framePointer[DataType_FixedPoint]);
102102 printText (variable.name , U" (" , value, U" )" );
103103 }),
104104 VMTypeDef<MEDIA_MACHINE_TYPE_COUNT>(U" ImageU8" , DataType_ImageU8, false ,
105- [](PlanarMemory<MEDIA_MACHINE_TYPE_COUNT>& memory, Variable<MEDIA_MACHINE_TYPE_COUNT>& variable, int32_t globalIndex, int32_t * framePointer, bool fullContent) {
105+ [](PlanarMemory<MEDIA_MACHINE_TYPE_COUNT>& memory, Variable<MEDIA_MACHINE_TYPE_COUNT>& variable, int32_t globalIndex, const FixedArray< int32_t , MEDIA_MACHINE_TYPE_COUNT>& framePointer, bool fullContent) {
106106 AlignedImageU8 value = MEDIA_MEMORY.alignedImageU8Memory .accessByGlobalIndex (globalIndex, framePointer[DataType_ImageU8]);
107107 printText (variable.name , U" ImageU8" );
108108 if (image_exists (value)) {
@@ -116,7 +116,7 @@ static const VMTypeDef<MEDIA_MACHINE_TYPE_COUNT> mediaMachineTypes[] = {
116116 }
117117 }),
118118 VMTypeDef<MEDIA_MACHINE_TYPE_COUNT>(U" ImageRgbaU8" , DataType_ImageRgbaU8, false ,
119- [](PlanarMemory<MEDIA_MACHINE_TYPE_COUNT>& memory, Variable<MEDIA_MACHINE_TYPE_COUNT>& variable, int32_t globalIndex, int32_t * framePointer, bool fullContent) {
119+ [](PlanarMemory<MEDIA_MACHINE_TYPE_COUNT>& memory, Variable<MEDIA_MACHINE_TYPE_COUNT>& variable, int32_t globalIndex, const FixedArray< int32_t , MEDIA_MACHINE_TYPE_COUNT>& framePointer, bool fullContent) {
120120 OrderedImageRgbaU8 value = MEDIA_MEMORY.orderedImageRgbaU8Memory .accessByGlobalIndex (globalIndex, framePointer[DataType_ImageRgbaU8]);
121121 printText (variable.name , U" ImageRgbaU8" );
122122 if (image_exists (value)) {
@@ -168,9 +168,15 @@ static const InsSig<MEDIA_MACHINE_TYPE_COUNT> mediaMachineInstructions[] = {
168168 [](VirtualMachine<MEDIA_MACHINE_TYPE_COUNT>& machine, PlanarMemory<MEDIA_MACHINE_TYPE_COUNT>& memory, const List<VMA>& args) {
169169 int32_t targetAddress = args[0 ].index ;
170170 // TODO: Assert that the target address is within the same method when running in debug mode.
171+ // VirtualMachine.h only asserts that we are within the whole program's instructions.
172+ #ifdef VIRTUAL_MACHINE_DEBUG_PRINT
173+ printText (U" Jumping from instruction " , memory.current .programCounter , U" to " , targetAddress, U" .\n " );
174+ #endif
171175 memory.current .programCounter = targetAddress;
172176 },
173- ArgSig (U" InstructionAddress" , true , DataType_InstructionAddress)
177+ // The argument for labels is matched with the Label type before we know the label's final instruction address,
178+ // but label indices it will be converted into DataType_InstructionAddress once all machine instructions are generated.
179+ ArgSig (U" Address" , true , DataType_Label)
174180 ),
175181 InsSig<MEDIA_MACHINE_TYPE_COUNT>::create (U" ROUND" , 1 ,
176182 [](VirtualMachine<MEDIA_MACHINE_TYPE_COUNT>& machine, PlanarMemory<MEDIA_MACHINE_TYPE_COUNT>& memory, const List<VMA>& args) {
0 commit comments