Browse Source

Merge branch source:main into main

Curtis Hamilton 1 month ago
parent
commit
b0cf24d901
2 changed files with 15 additions and 9 deletions
  1. 14 8
      rtl/objpas/classes/classes.inc
  2. 1 1
      tests/webtbs/tw41503.pp

+ 14 - 8
rtl/objpas/classes/classes.inc

@@ -909,15 +909,21 @@ begin
     as volatile, so the access won't be optimized away by the compiler. (KB) }
     as volatile, so the access won't be optimized away by the compiler. (KB) }
   for i:=1 to aIterations do
   for i:=1 to aIterations do
     begin
     begin
+    {$if FPC_FULLVERSION<30300}
+    Inc(SpinWaitDummy); // SpinWaitDummy *MUST* be global
+    {$else}
     {$IF defined(CPUX86_64) or Defined(CPUI386)}
     {$IF defined(CPUX86_64) or Defined(CPUI386)}
     fpc_x86_pause;
     fpc_x86_pause;
     {$ELSEIF defined(CPUARM)}
     {$ELSEIF defined(CPUARM)}
     fpc_arm_yield;
     fpc_arm_yield;
-    {$ELSEIF defined(CPUAARCH64}
+    {$ELSEIF defined(CPUAARCH64)}
     fpc_aarch64_yield;
     fpc_aarch64_yield;
+    {$ELSEIF defined(RISCV) and defined(CPURV_HAS_ZIHINTPAUSE)}
+    fpc_riscv_pause;
     {$ELSE}
     {$ELSE}
     Inc(SpinWaitDummy); // SpinWaitDummy *MUST* be global
     Inc(SpinWaitDummy); // SpinWaitDummy *MUST* be global
     {$ENDIF}
     {$ENDIF}
+    {$ifend}
     end;
     end;
 end;
 end;
 
 
@@ -936,10 +942,10 @@ class function TThread.GetCPUUsage(var Previous: TSystemTimes): Integer;
 var
 var
   Act : TSystemTimes;
   Act : TSystemTimes;
   Load,Idle: QWord;
   Load,Idle: QWord;
-  
+
 begin
 begin
   Result:=0;
   Result:=0;
-  if not GetSystemTimes(Act) then 
+  if not GetSystemTimes(Act) then
     exit;
     exit;
   Load:=(Act.UserTime-Previous.UserTime) +
   Load:=(Act.UserTime-Previous.UserTime) +
         (Act.KernelTime-Previous.KernelTime) +
         (Act.KernelTime-Previous.KernelTime) +
@@ -1492,7 +1498,7 @@ function IsUniqueGlobalComponentName(const aName: string): Boolean;
 begin
 begin
   if Assigned(IsUniqueGlobalComponentNameProc) then
   if Assigned(IsUniqueGlobalComponentNameProc) then
     Result:=IsUniqueGlobalComponentNameProc(aName)
     Result:=IsUniqueGlobalComponentNameProc(aName)
-  else 
+  else
     Result:=Not Assigned(FindGlobalComponent(aName));
     Result:=Not Assigned(FindGlobalComponent(aName));
 end;
 end;
 
 
@@ -1534,7 +1540,7 @@ function CreateComponentfromRes(const res : string;Inst : THandle;var Component
   var
   var
     ResStream : TResourceStream;
     ResStream : TResourceStream;
     ResID : TFPResourceHandle;
     ResID : TFPResourceHandle;
-    
+
   begin
   begin
 
 
     if Inst=0 then
     if Inst=0 then
@@ -1575,7 +1581,7 @@ function DefaultInitHandler(Instance: TComponent; RootAncestor: TClass): Boolean
     try
     try
 {$endif}
 {$endif}
       result:=doinit(Instance.ClassType);
       result:=doinit(Instance.ClassType);
-      if Result then 
+      if Result then
         Instance.ReadDeltaState;
         Instance.ReadDeltaState;
 {$ifdef FPC_HAS_FEATURE_THREADING}
 {$ifdef FPC_HAS_FEATURE_THREADING}
     finally
     finally
@@ -1679,7 +1685,7 @@ var
   HInst: THandle;
   HInst: THandle;
   RootName, Delta, ResName: string;
   RootName, Delta, ResName: string;
   S: TStream;
   S: TStream;
-  
+
 begin
 begin
   S:=nil;
   S:=nil;
   if (Instance=Nil) or (Proc=Nil) then
   if (Instance=Nil) or (Proc=Nil) then
@@ -2810,7 +2816,7 @@ var
   aPos: Int64;
   aPos: Int64;
   Sig: Packed Array[0..3] of byte;
   Sig: Packed Array[0..3] of byte;
   IntSig : Longint absolute sig;
   IntSig : Longint absolute sig;
-  
+
 begin
 begin
   Result:=sofUnknown;
   Result:=sofUnknown;
   aPos:=Stream.Position;
   aPos:=Stream.Position;

+ 1 - 1
tests/webtbs/tw41503.pp

@@ -1,4 +1,4 @@
-{ %NORUN }
+{ %NORUN }
 
 
 program tw41503;
 program tw41503;
 {$mode objFPC}
 {$mode objFPC}