TempleOSTS_131005.ISO
This commit is contained in:
1 parent
1343005a29
commit
2d2a65d572
547 files changed
+33608
-12549
No files matched your search
@@ -15,26 +15,26 @@ U0 TimeIns()
|
||||
CPURep;
|
||||
|
||||
//Measure Loop Overhead
|
||||
start1=GetTimeStamp;
|
||||
start1=GetTSC;
|
||||
for (i=0;i<SAMPLE_SIZE;i++) {
|
||||
}
|
||||
end1=GetTimeStamp;
|
||||
end1=GetTSC;
|
||||
overhead_time=end1-start1;
|
||||
|
||||
//Measure remainder...
|
||||
start2=GetTimeStamp;
|
||||
start2=GetTSC;
|
||||
for (i=0;i<SAMPLE_SIZE;i++)
|
||||
temp=i%0x400;
|
||||
end2=GetTimeStamp;
|
||||
end2=GetTSC;
|
||||
test_time=end2-start2;
|
||||
"Remainder Version #1 Cycles\t: %10.5f\n",
|
||||
ToF64(test_time-overhead_time)/SAMPLE_SIZE;
|
||||
|
||||
//Measure remainder...
|
||||
start2=GetTimeStamp;
|
||||
start2=GetTSC;
|
||||
for (i=0;i<SAMPLE_SIZE;i++)
|
||||
temp=i&0x3FF;
|
||||
end2=GetTimeStamp;
|
||||
end2=GetTSC;
|
||||
test_time=end2-start2;
|
||||
"Remainder Version #2 Cycles\t: %10.5f\n",
|
||||
ToF64(test_time-overhead_time)/SAMPLE_SIZE;
|
||||
|
||||
@@ -88,10 +88,10 @@ U0 Main()
|
||||
coordinates[i]=RandU32;
|
||||
|
||||
//Measure Loop Overhead
|
||||
start=GetTimeStamp;
|
||||
start=GetTSC;
|
||||
for (i=SAMPLE_SIZE-1;i>=0;i--) {
|
||||
}
|
||||
end=GetTimeStamp;
|
||||
end=GetTSC;
|
||||
overhead_time=end-start;
|
||||
"$$FG,RED$$Overhead Cycles :%10.5f$$FG$$\n",
|
||||
ToF64(overhead_time)/SAMPLE_SIZE;
|
||||
@@ -101,10 +101,10 @@ U0 Main()
|
||||
// compiler code.)
|
||||
d1=Sin(1.0);
|
||||
fsum=0;
|
||||
start=GetTimeStamp;
|
||||
start=GetTSC;
|
||||
for (i=SAMPLE_SIZE-1;i>=0;i--)
|
||||
fsum+=d1*coordinates[i&65535];
|
||||
end=GetTimeStamp;
|
||||
end=GetTSC;
|
||||
test_time=end-start;
|
||||
"Float Sum :%X\n",ToI64(fsum);
|
||||
"$$FG,RED$$Float Cycles :%10.5f$$FG$$\n",
|
||||
@@ -114,30 +114,30 @@ U0 Main()
|
||||
//Measure fixed point arithmetic
|
||||
d2=Sin(1.0)*0x100000000;
|
||||
sum=0;
|
||||
start=GetTimeStamp;
|
||||
start=GetTSC;
|
||||
for (i=SAMPLE_SIZE-1;i>=0;i--) {
|
||||
temp=d2*coordinates[i&65535];
|
||||
sum+=temp.i32[1];
|
||||
}
|
||||
end=GetTimeStamp;
|
||||
end=GetTSC;
|
||||
test_time=end-start;
|
||||
"Fixed-Point Sum :%X\n",sum;
|
||||
"$$FG,RED$$Fixed-Point Cycles :%10.5f$$FG$$\n",
|
||||
ToF64(test_time)/SAMPLE_SIZE;
|
||||
|
||||
//Measure fixed point arithmetic
|
||||
start=GetTimeStamp;
|
||||
start=GetTSC;
|
||||
sum=AsmFixedPt;
|
||||
end=GetTimeStamp;
|
||||
end=GetTSC;
|
||||
test_time=end-start;
|
||||
"Asm Fixed-Point Sum :%X\n",sum;
|
||||
"$$FG,RED$$Asm Fixed-Point Cycles:%10.5f$$FG$$\n",
|
||||
ToF64(test_time)/SAMPLE_SIZE;
|
||||
|
||||
//Measure float arithmetic
|
||||
start=GetTimeStamp;
|
||||
start=GetTSC;
|
||||
sum=AsmFloat;
|
||||
end=GetTimeStamp;
|
||||
end=GetTSC;
|
||||
test_time=end-start;
|
||||
"Asm Float Sum :%X\n",sum;
|
||||
"$$FG,RED$$Asm Float Cycles :%10.5f$$FG$$\n",
|
||||
|
||||
@@ -37,7 +37,7 @@ U0 GrDemo()
|
||||
|
||||
GrDemo;
|
||||
|
||||
/* Program Output$HL,0$$WW+H,1$$FD,1$
|
||||
/* Program Output (Not VMware)$HL,0$$WW+H,1$$FD,1$
|
||||
|
||||
8 Cores 2.660GHz
|
||||
$FG,2$Rate:$FG,4$369.7 FPS$FG$ $FG,2$Load@60Hz:$FG,4$ 16.2%$FG$
|
||||
|
||||
@@ -62,17 +62,17 @@ U0 TimeIns()
|
||||
old_irq=IntEntrySet(I_F_UNARY_MINUS,F_UNARY_MINUS_INT,IDTET_TRAP);
|
||||
|
||||
//Measure interrupt time
|
||||
start=GetTimeStamp;
|
||||
start=GetTSC;
|
||||
for (i=0;i<SAMPLE_SIZE;i++)
|
||||
UnaryMinusInt(ã);
|
||||
end=GetTimeStamp;
|
||||
end=GetTSC;
|
||||
"Interrupt Cycles: %10.5f\n",ToF64(end-start)/SAMPLE_SIZE;
|
||||
|
||||
//Measure call time
|
||||
start=GetTimeStamp;
|
||||
start=GetTSC;
|
||||
for (i=0;i<SAMPLE_SIZE;i++)
|
||||
UnaryMinusCall(ã);
|
||||
end=GetTimeStamp;
|
||||
end=GetTSC;
|
||||
"Call Cycles: %10.5f\n",ToF64(end-start)/SAMPLE_SIZE;
|
||||
|
||||
Preempt(old_preempt);
|
||||
|
||||
@@ -4,9 +4,9 @@ $ID,2$The mini compiler is like the main compiler, except the main compiler's le
|
||||
|
||||
The main compiler generates $LK,"Intermediate Code","FF:::/TempleOS/Compiler/CmpDefs.HPP,IC_END"$ at the parser stage. See $LK,"PrsExpression","MN:PrsExpression"$(), $LK,"PrsStatement","MN:PrsStatement"$(). Set $LK,"PTrace","MN:PTrace"$(ON) to see the output of the parser.
|
||||
|
||||
The main compiler optimizes See $LK,"Intermediate Code Attributes","FF:D:/TempleOS/Compiler/CmpInit.CPP,ST_INTERMEDIATE_CODE"$, $LK,"Combining Constants","FF:::/TempleOS/Compiler/OptPass012.CPP,IC_MUL"$, $LK,"Choosing Reg Vars","FF:::/TempleOS/Compiler/OptPass3.CPP,num_reg_vars"$. Set $LK,"OTrace","MN:OTrace"$(ON) to see the optimization stages.
|
||||
The main compiler optimizes See $LK,"Intermediate Code Attributes","FF:D:/TempleOS/Compiler/CmpInit.CPP,ST_INTERMEDIATE_CODE"$, $LK,"Combining Consts","FF:::/TempleOS/Compiler/OptPass012.CPP,case IC_MUL"$, $LK,"Choosing Reg Vars","FF:::/TempleOS/Compiler/OptPass3.CPP,num_reg_vars"$. Set $LK,"OTrace","MN:OTrace"$(ON) to see the optimization stages.
|
||||
|
||||
The main compiler makes machine code in the back end. See $LK,"IC Struct","MN:CIntermediateCode"$, $LK,"CBCompile","MN:CBCompile"$ and $LK,"OptPass789A","FF:::/TempleOS/Compiler/OptPass789A.CPP,IC_MUL"$(), $LK,"BackEnd","FF:::/TempleOS/Compiler/BackEnd.CPP,ICMul"$. Set $LK,"CTrace","MN:CTrace"$(ON) to see the output of the backend.
|
||||
The main compiler makes machine code in the back end. See $LK,"IC Struct","MN:CIntermediateCode"$, $LK,"LCCCompile","MN:LCCCompile"$ and $LK,"OptPass789","FF:::/TempleOS/Compiler/OptPass789.CPP,IC_MUL"$(), $LK,"BackEnd","FF:::/TempleOS/Compiler/BackEnd.CPP,ICMul"$. Set $LK,"CTrace","MN:CTrace"$(ON) to see the output of the backend.
|
||||
$ID,-2$
|
||||
$TR,"Mini Compiler"$
|
||||
$ID,2$For this mini compiler, some things you should know about 64-bit asm:
|
||||
|
||||
@@ -14,20 +14,14 @@ I64 *addr=VGA_GRAPHIC_MEM_BASE,
|
||||
48[RBP]=STK_SELECTOR
|
||||
*/
|
||||
|
||||
interrupt U0 PageFault()
|
||||
interrupt haserrcode U0 PageFault()
|
||||
{
|
||||
I64 reg *rbp=GetBasePtr,reg *rsp=GetStkPtr,reg *src=rbp,reg *dst=rbp+1;
|
||||
I64 reg *rbp=GetRBP;
|
||||
*pte_addr|=1;
|
||||
InvlPg(addr);
|
||||
err_code=rbp[1];
|
||||
asm { MOV_RAX_CR2}
|
||||
reported_fault_addr=GetRAX;
|
||||
//Remove err_code from stk
|
||||
//so IRET works right.
|
||||
while (src>=rsp)
|
||||
*dst--=*src--;
|
||||
SetBasePtr(rbp+1);
|
||||
SetStkPtr(rsp+1);
|
||||
}
|
||||
|
||||
|
||||
|
||||
@@ -30,10 +30,10 @@ TO_RING0:: //Set to handle general protection 0xD fault temporarily.
|
||||
|
||||
U0 Ring3Demo()
|
||||
{
|
||||
U8 *old_pf;
|
||||
U8 *old_vect;
|
||||
"Progress1 Before:%X\n",progress1;
|
||||
Cli;
|
||||
old_pf=IntEntrySet(0x0D,TO_RING0,IDTET_TRAP,0);
|
||||
old_vect=IntEntrySet(0x0D,TO_RING0,IDTET_TRAP,0);
|
||||
|
||||
TSSBusy(Gs->tss->tr_ring3,OFF);
|
||||
SetRAX(Gs->tss->tr_ring3+3);
|
||||
@@ -74,7 +74,7 @@ R3_CALLBACK:
|
||||
SetRAX(Gs->tss->tr);
|
||||
asm { LTR AX}
|
||||
|
||||
IntEntrySet(0x0D,old_pf,IDTET_IRQ,0);
|
||||
IntEntrySet(0x0D,old_vect,IDTET_IRQ,0);
|
||||
Sti;
|
||||
"Progress1 After :%X\n",progress1;
|
||||
}
|
||||
|
||||
@@ -21,18 +21,18 @@ U0 TimeIns()
|
||||
old_preempt=Preempt(OFF);
|
||||
|
||||
//Measure cached time
|
||||
start=GetTimeStamp;
|
||||
start=GetTSC;
|
||||
for (i=0;i<SAMPLE_SIZE;i++)
|
||||
*cached_I64=i;
|
||||
|
||||
end=GetTimeStamp;
|
||||
end=GetTSC;
|
||||
" Cached Cycles: %10,d\n",end-start;
|
||||
|
||||
//Measure uncached time
|
||||
start=GetTimeStamp;
|
||||
start=GetTSC;
|
||||
for (i=0;i<SAMPLE_SIZE;i++)
|
||||
*uncached_I64=i;
|
||||
end=GetTimeStamp;
|
||||
end=GetTSC;
|
||||
"Uncached Cycles: %10,d\n",end-start;
|
||||
|
||||
"$$FG,GREEN$$The difference is even greater\n"
|
||||
|
||||
Reference in new issue
Block a user