Check-in [ca8f827836]

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

Overview
Comment:Always exit all profiler frames with the launcher exits; Add extra profiling to SummerCoat (breakpoint and syscalls).
Downloads: Tarball | ZIP archive | SQL archive
Timelines: family | ancestors | descendants | both | trunk
Files: files | file ages | folders
SHA1:ca8f82783650af95e798c993d3a1157ce07f292f
User & Date: stephanie.gawroriski 2019-06-30 19:53:22
Context
2019-06-30
21:38
Do not read the table of contents offset and entry count in BootLibrary() because it triggers builds in plain SummerCoat. check-in: 84e6aa7adb user: stephanie.gawroriski tags: trunk
19:53
Always exit all profiler frames with the launcher exits; Add extra profiling to SummerCoat (breakpoint and syscalls). check-in: ca8f827836 user: stephanie.gawroriski tags: trunk
19:41
Add exitAll() to ProfilerSnapshot without a time. check-in: f90a142aa8 user: stephanie.gawroriski tags: trunk
Changes
Hide Diffs Unified Diffs Ignore Whitespace Patch

Changes to bldt/libs/builder-support/cc/squirreljme/builder/support/vm/VMMain.java.

171
172
173
174
175
176
177





178
179
180
181
182
183
184
		{
			exitcode = machine.runVm();
		}
		
		// Dump the profiler snapshot somewhere
		finally
		{





			// Dump to file
			try
			{
				// Create temporary file
				Calendar now = Calendar.getInstance();
				Path temp = Files.createTempFile(String.format(
					"squirreljme-vm-%TF_%TH-%TM-%TS-", now, now, now, now),







>
>
>
>
>







171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
		{
			exitcode = machine.runVm();
		}
		
		// Dump the profiler snapshot somewhere
		finally
		{
			// Exit all frames in the profiler so that it is maybe valid
			// otherwise if the VM crashes mid-frame without a clean exit
			// the exact times will be hard to tell
			profiler.exitAll();
			
			// Dump to file
			try
			{
				// Create temporary file
				Calendar now = Calendar.getInstance();
				Path temp = Files.createTempFile(String.format(
					"squirreljme-vm-%TF_%TH-%TM-%TS-", now, now, now, now),

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

217
218
219
220
221
222
223

224
225
226
227
228
229
230
...
417
418
419
420
421
422
423

424









425
426
427
428
429
430
431
...
810
811
812
813
814
815
816









817
818


819
820








821
822
823
824
825
826
827
	 * @since 2019/04/21
	 */
	public final void runWithoutCatch(int __fl)
	{
		// Read the CPU stuff
		final WritableMemory memory = this.memory;
		boolean reload = true;

		
		// Frame specific info
		Frame nowframe = null;
		int[] lr = null;
		int pc = -1;
		
		// Per operation handling
................................................................................
			int nextpc = lasticache + rargp;
			
			// Handle the operation
			switch (encoding)
			{
					// CPU Breakpoint
				case NativeInstructionType.BREAKPOINT:

					this.__cpuDebugPrint(nowframe, op, af, args, reglist);









					
					// {@squirreljme.error AE04 CPU breakpoint hit.}
					throw new VMException("AE04");
				
					// Debug entry point of method
				case NativeInstructionType.DEBUG_ENTRY:
					this.__debugEntry(nowframe, args[0], args[1], args[2]);
................................................................................
						// so they must be extracted first before they can be
						// known
						int nrl = reglist.length;
						int[] sargs = new int[nrl];
						for (int i = 0; i < nrl; i++)
							sargs[i] = lr[reglist[i]];
						









						// Set the return register to whatever system call
						// was used


						lr[NativeCode.RETURN_REGISTER] = this.__sysCall(
							(short)lr[args[0]], sargs);








					}
					break;
					
					// {@squirreljme.error AE0n Invalid instruction.}
				default:
					throw new VMException("AE0n " +
						NativeInstruction.mnemonic(op));







>







 







>

>
>
>
>
>
>
>
>
>







 







>
>
>
>
>
>
>
>
>


>
>
|
|
>
>
>
>
>
>
>
>







217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
...
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
...
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
	 * @since 2019/04/21
	 */
	public final void runWithoutCatch(int __fl)
	{
		// Read the CPU stuff
		final WritableMemory memory = this.memory;
		boolean reload = true;
		ProfiledThread profiler = this.profiler;
		
		// Frame specific info
		Frame nowframe = null;
		int[] lr = null;
		int pc = -1;
		
		// Per operation handling
................................................................................
			int nextpc = lasticache + rargp;
			
			// Handle the operation
			switch (encoding)
			{
					// CPU Breakpoint
				case NativeInstructionType.BREAKPOINT:
					// Debug print the frame
					this.__cpuDebugPrint(nowframe, op, af, args, reglist);
					
					// If profiling, immediately enter the frame to signal
					// a break point then exit it
					if (profiler != null)
					{
						profiler.enterFrame("<breakpoint>", "<breakpoint>",
							"<breakpoint>");
						profiler.exitFrame();
					}
					
					// {@squirreljme.error AE04 CPU breakpoint hit.}
					throw new VMException("AE04");
				
					// Debug entry point of method
				case NativeInstructionType.DEBUG_ENTRY:
					this.__debugEntry(nowframe, args[0], args[1], args[2]);
................................................................................
						// so they must be extracted first before they can be
						// known
						int nrl = reglist.length;
						int[] sargs = new int[nrl];
						for (int i = 0; i < nrl; i++)
							sargs[i] = lr[reglist[i]];
						
						// Get the system call ID
						short syscallid = (short)lr[args[0]];
							
						// If profiling, profile the handling of the
						// system call in a sub-frame
						if (profiler != null)
							profiler.enterFrame("<syscall>",
								Integer.toString(syscallid), "(IIIIIIII)I");
						
						// Set the return register to whatever system call
						// was used
						try
						{
							lr[NativeCode.RETURN_REGISTER] = this.__sysCall(
								syscallid, sargs);
						}
						
						// If profiling, that frame needs to exit always!
						finally
						{
							if (profiler != null)
								profiler.exitFrame();
						}
					}
					break;
					
					// {@squirreljme.error AE0n Invalid instruction.}
				default:
					throw new VMException("AE0n " +
						NativeInstruction.mnemonic(op));