View Issue Details

IDProjectCategoryView StatusLast Update
0006574JEDI Code LibraryJclGraphUtilspublic2023-11-11 23:45
ReportermksjgjAssigned ToAHUser 
PrioritynormalSeveritycrashReproducibilityalways
Status resolvedResolutionfixed 
Product VersionVersion 2.5 (Subversion repository/Daily zips) 
Target VersionFixed in VersionVersion 2.5 (Subversion repository/Daily zips) 
Summary0006574: assembler version of M_CombineReg corrupt the memory
Descriptionthe following code will get an error:

Project BlendColor.exe raised exception class $C0000092 with message 'floating point stack check at 0x00407015'.

procedure TForm25.BitBtn1Click(Sender: TObject);
var
  c32:TColor32;
begin
  c32 := CombineReg( Color32(clRed),Color32(clBlue), 100);
  Caption := ColorToString( WinColor(c32) );
end;

but if you comment the source and force using the pascal version,it will work very well:

procedure SetupFunctions;
var
  CpuInfo: TCpuInfo;
begin
  //WIMDC
  CpuInfo := CPUID;
  MMX_ACTIVE := (CpuInfo.Features and MMX_FLAG) = MMX_FLAG;
// if MMX_ACTIVE then
// begin
// // link MMX functions
// CombineReg := M_CombineReg;
// CombineMem := M_CombineMem;
// BlendReg := M_BlendReg;
// BlendMem := M_BlendMem;
// BlendRegEx := M_BlendRegEx;
// BlendMemEx := M_BlendMemEx;
// BlendLine := M_BlendLine;
// BlendLineEx := M_BlendLineEx;
// end
// else
  begin
    // link non-MMX functions
    CombineReg := _CombineReg;
    CombineMem := _CombineMem;
    BlendReg := _BlendReg;
    BlendMem := _BlendMem;
    BlendRegEx := _BlendRegEx;
    BlendMemEx := _BlendMemEx;
    BlendLine := _BlendLine;
    BlendLineEx := _BlendLineEx;
  end;
end;
Additional InformationIDE: Delphi Berlin
TagsNo tags attached.
Fixed in GIT commit2a4c7ff1da4fc53b74cda8cef27cda6f52b208ae
Fixed in SVN revision
IDE versionAll

Activities

AHUser

2023-11-11 23:45

developer   ~0022060

You must call "EMMS;" after using the MMX instruction set, because MMX "trashes" the FPU registers.

Fixed in git main branch.

The fix removes all MMX instructions and replaces them with the SSE2 instruction set (if available). This removes the need the explicit call "EMMS;". Nowadays you shouldn't run int a CPU that doesn't have SSE2 support.

Issue History

Date Modified Username Field Change
2017-06-10 05:14 mksjgj New Issue
2017-06-10 05:14 mksjgj IDE version => All
2023-11-11 23:45 AHUser Assigned To => AHUser
2023-11-11 23:45 AHUser Status new => resolved
2023-11-11 23:45 AHUser Resolution open => fixed
2023-11-11 23:45 AHUser Fixed in Version => Version 2.5 (Subversion repository/Daily zips)
2023-11-11 23:45 AHUser Fixed in GIT commit => 2a4c7ff1da4fc53b74cda8cef27cda6f52b208ae
2023-11-11 23:45 AHUser Note Added: 0022060