mirror of
				https://gitlab.com/freepascal.org/fpc/source.git
				synced 2025-11-04 13:39:39 +01:00 
			
		
		
		
	+ support for [recordfield.field] in assembler blocks in methods in
intel assembler (mantis 8171) git-svn-id: trunk@6150 -
This commit is contained in:
		
							parent
							
								
									fcb128c66c
								
							
						
					
					
						commit
						ed13c7f60e
					
				
							
								
								
									
										1
									
								
								.gitattributes
									
									
									
									
										vendored
									
									
								
							
							
						
						
									
										1
									
								
								.gitattributes
									
									
									
									
										vendored
									
									
								
							@ -7991,6 +7991,7 @@ tests/webtbs/tw8150a.pp svneol=native#text/plain
 | 
			
		||||
tests/webtbs/tw8150d.pp svneol=native#text/plain
 | 
			
		||||
tests/webtbs/tw8155.pp svneol=native#text/plain
 | 
			
		||||
tests/webtbs/tw8156.pp svneol=native#text/plain
 | 
			
		||||
tests/webtbs/tw8171.pp svneol=native#text/plain
 | 
			
		||||
tests/webtbs/tw8183.pp svneol=native#text/plain
 | 
			
		||||
tests/webtbs/ub1873.pp svneol=native#text/plain
 | 
			
		||||
tests/webtbs/ub1883.pp svneol=native#text/plain
 | 
			
		||||
 | 
			
		||||
@ -1202,6 +1202,14 @@ Begin
 | 
			
		||||
              exit;
 | 
			
		||||
            end;
 | 
			
		||||
         end;
 | 
			
		||||
       fieldvarsym :
 | 
			
		||||
         begin
 | 
			
		||||
           if (tfieldvarsym(srsym).vardef.typ in [recorddef,objectdef]) then
 | 
			
		||||
             begin
 | 
			
		||||
               SearchRecordType:=true;
 | 
			
		||||
               exit;
 | 
			
		||||
             end;
 | 
			
		||||
         end;
 | 
			
		||||
     end;
 | 
			
		||||
   end;
 | 
			
		||||
end;
 | 
			
		||||
 | 
			
		||||
@ -982,6 +982,10 @@ Unit Rax86int;
 | 
			
		||||
                               if not(ttypesym(sym).typedef.typ in [recorddef,objectdef]) then
 | 
			
		||||
                                Message(asmr_e_wrong_sym_type);
 | 
			
		||||
                             end;
 | 
			
		||||
                           fieldvarsym :
 | 
			
		||||
                             begin
 | 
			
		||||
                               tempstr:='SELF.'+tempstr;
 | 
			
		||||
                             end;
 | 
			
		||||
                           else
 | 
			
		||||
                             Message(asmr_e_wrong_sym_type);
 | 
			
		||||
                         end;
 | 
			
		||||
@ -1014,8 +1018,10 @@ Unit Rax86int;
 | 
			
		||||
                       else
 | 
			
		||||
                         Message(asmr_e_only_add_relocatable_symbol);
 | 
			
		||||
                    end;
 | 
			
		||||
                   if actasmtoken=AS_DOT then
 | 
			
		||||
                    begin
 | 
			
		||||
                   if (actasmtoken=AS_DOT) or
 | 
			
		||||
                      (assigned(sym) and
 | 
			
		||||
                       (sym.typ = fieldvarsym)) then
 | 
			
		||||
                     begin
 | 
			
		||||
                      BuildRecordOffsetSize(tempstr,l,k,hs);
 | 
			
		||||
                      if hs <> '' then
 | 
			
		||||
                        hssymtyp:=AT_FUNCTION
 | 
			
		||||
 | 
			
		||||
							
								
								
									
										37
									
								
								tests/webtbs/tw8171.pp
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										37
									
								
								tests/webtbs/tw8171.pp
									
									
									
									
									
										Normal file
									
								
							@ -0,0 +1,37 @@
 | 
			
		||||
{ %cpu=i386 }
 | 
			
		||||
 | 
			
		||||
program FieldDoesntResolve;
 | 
			
		||||
 | 
			
		||||
{$IFDEF FPC}
 | 
			
		||||
  {$mode delphi}
 | 
			
		||||
{$ENDIF}
 | 
			
		||||
 | 
			
		||||
type
 | 
			
		||||
  TMyRecord = record
 | 
			
		||||
    rField: Integer;
 | 
			
		||||
  end;
 | 
			
		||||
 | 
			
		||||
  TMyObject = class
 | 
			
		||||
  private
 | 
			
		||||
    oField: TMyRecord;
 | 
			
		||||
  public
 | 
			
		||||
    procedure Test;
 | 
			
		||||
  end;
 | 
			
		||||
 | 
			
		||||
{ TMyObject }
 | 
			
		||||
 | 
			
		||||
procedure TMyObject.Test;
 | 
			
		||||
asm
 | 
			
		||||
//  mov [eax + TMyObject.oField.rField], 0 // works in Delphi and FPC
 | 
			
		||||
  mov [eax + oField.rField], 5 // works only in Delphi
 | 
			
		||||
end;
 | 
			
		||||
 | 
			
		||||
begin
 | 
			
		||||
  with TMyObject.Create do try
 | 
			
		||||
    Test;
 | 
			
		||||
  finally
 | 
			
		||||
    if (ofield.rfield <> 5) then
 | 
			
		||||
      halt(1);
 | 
			
		||||
    Free;
 | 
			
		||||
  end;
 | 
			
		||||
end.
 | 
			
		||||
		Loading…
	
		Reference in New Issue
	
	Block a user