Check-in [3d3ad815fb]

Many hyperlinks are disabled.
Use anonymous login to enable hyperlinks.

Overview
Comment:Make the debug stuff more descriptive.
Downloads: Tarball | ZIP archive | SQL archive
Timelines: family | ancestors | descendants | both | trunk
Files: files | file ages | folders
SHA1:3d3ad815fba1f1f37ebf18974bc69ed578bf718a
User & Date: stephanie.gawroriski 2019-06-15 14:39:22
Context
2019-06-15
20:31
Minor work. check-in: b623c22b59 user: stephanie.gawroriski tags: trunk
14:39
Make the debug stuff more descriptive. check-in: 3d3ad815fb user: stephanie.gawroriski tags: trunk
14:16
Instead of returning illegal nonsense values when reading from an unmapped memory location, throw an exception. check-in: 846e1b33b2 user: stephanie.gawroriski tags: trunk
Changes
Hide Diffs Unified Diffs Ignore Whitespace Patch

Changes to runt/libs/summercoat-vm/cc/squirreljme/vm/summercoat/NativeCPU.java.

484
485
486
487
488
489
490
491







492











493
494
495
496
497
498
499
...
548
549
550
551
552
553
554





555
556
557
558
559
560


561
562
563
564
565
566
567
...
591
592
593
594
595
596
597
598


599
600
601
602
603
604
605
606
...
629
630
631
632
633
634
635
636


637
638
639
640
641
642
643
644
						// Entering some other frame
						reload = true;
					}
					break;
					
					// Load value from int array
				case NativeInstructionType.LOAD_FROM_INTARRAY:
					lr[args[0]] = memory.memReadInt(lr[args[1]] +







						Constants.ARRAY_BASE_SIZE + (lr[args[2]] * 4));











					break;
					
					// Load from constant pool
				case NativeInstructionType.LOAD_POOL:
					{
						lr[args[1]] = memory.memReadInt(
							lr[NativeCode.POOL_REGISTER] + (args[0] * 4));
................................................................................
				
					// Read off memory
				case NativeInstructionType.MEMORY_OFF_REG:
				case NativeInstructionType.MEMORY_OFF_REG_JAVA:
				case NativeInstructionType.MEMORY_OFF_ICONST:
				case NativeInstructionType.MEMORY_OFF_ICONST_JAVA:
					{





						// Is this a load operation?
						boolean load = ((op & 0b1000) != 0);
						
						// The address to load from/store to
						int addr = lr[args[1]] +
							(((op & 0x80) != 0) ? args[2] : lr[args[2]]);


						
						// Loads
						DataType dt = DataType.of(op & 0b0111);
						if (load)
						{
							// Load value
							int v;
................................................................................
							}
							
							// Set value
							lr[args[0]] = v;
							
							// Debug
							if (ENABLE_DEBUG)
								todo.DEBUG.note("%08x -> %d (%08x)",


									addr, v, v);
						}
						
						// Stores
						else
						{
							// Value to store
							int v = lr[args[0]];
................................................................................
									// Unknown
								default:
									throw new todo.OOPS(dt.name());
							}
							
							// Debug
							if (ENABLE_DEBUG)
								todo.DEBUG.note("%08x <- %d (%08x)",


									addr, v, v);
						}
					}
					break;
					
					// Return from method call
				case NativeInstructionType.RETURN:
					{







<
>
>
>
>
>
>
>
|
>
>
>
>
>
>
>
>
>
>
>







 







>
>
>
>
>




|
|
>
>







 







|
>
>
|







 







|
>
>
|







484
485
486
487
488
489
490

491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
...
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
...
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
...
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
						// Entering some other frame
						reload = true;
					}
					break;
					
					// Load value from int array
				case NativeInstructionType.LOAD_FROM_INTARRAY:

					{
						// Get arguments
						int addr = lr[args[1]],
							indx = lr[args[2]],
							rout = args[0];
						
						// Calculate array index offset
						int ioff = Constants.ARRAY_BASE_SIZE + (indx * 4);
						
						// Read value
						lr[rout] = memory.memReadInt(addr + ioff);
						
						// Debug
						if (ENABLE_DEBUG)
							todo.DEBUG.note(
								"(int)%08x[%d] (%08x) -> %d (%08x)",
								addr, indx, addr + ioff,
								lr[rout], lr[rout]);
					}
					break;
					
					// Load from constant pool
				case NativeInstructionType.LOAD_POOL:
					{
						lr[args[1]] = memory.memReadInt(
							lr[NativeCode.POOL_REGISTER] + (args[0] * 4));
................................................................................
				
					// Read off memory
				case NativeInstructionType.MEMORY_OFF_REG:
				case NativeInstructionType.MEMORY_OFF_REG_JAVA:
				case NativeInstructionType.MEMORY_OFF_ICONST:
				case NativeInstructionType.MEMORY_OFF_ICONST_JAVA:
					{
						// Is this Java?
						boolean isjava = (encoding == NativeInstructionType.
							MEMORY_OFF_REG_JAVA || encoding ==
							NativeInstructionType.MEMORY_OFF_ICONST_JAVA);
						
						// Is this a load operation?
						boolean load = ((op & 0b1000) != 0);
						
						// The address to load from/store to
						int base = lr[args[1]],
							offs = (((op & 0x80) != 0) ? args[2] :
								lr[args[2]]),
							addr = base + offs;
						
						// Loads
						DataType dt = DataType.of(op & 0b0111);
						if (load)
						{
							// Load value
							int v;
................................................................................
							}
							
							// Set value
							lr[args[0]] = v;
							
							// Debug
							if (ENABLE_DEBUG)
								todo.DEBUG.note(
									"%c %08x+%d (%08x) -> %d (%08x)",
									(isjava ? 'J' : 'N'),
									base, offs, addr, v, v);
						}
						
						// Stores
						else
						{
							// Value to store
							int v = lr[args[0]];
................................................................................
									// Unknown
								default:
									throw new todo.OOPS(dt.name());
							}
							
							// Debug
							if (ENABLE_DEBUG)
								todo.DEBUG.note(
									"%c %08x+%d (%08x) <- %d (%08x)",
									(isjava ? 'J' : 'N'),
									base, offs, addr, v, v);
						}
					}
					break;
					
					// Return from method call
				case NativeInstructionType.RETURN:
					{