mirror of
https://gitlab.com/freepascal.org/fpc/source.git
synced 2025-08-12 20:09:19 +02:00
* use regular ref_incr/ref_decr for related interface assignments
instead of fpc_intf_assign. This allows optimization by reusing the left of the assignment for function return git-svn-id: trunk@8427 -
This commit is contained in:
parent
6b8a5e56b6
commit
b36a06e4d4
@ -570,29 +570,20 @@ implementation
|
|||||||
end
|
end
|
||||||
else
|
else
|
||||||
begin
|
begin
|
||||||
{ check if the assignment may cause a range check error }
|
{ check if the assignment may cause a range check error }
|
||||||
check_ranges(fileinfo,right,left.resultdef);
|
check_ranges(fileinfo,right,left.resultdef);
|
||||||
inserttypeconv(right,left.resultdef);
|
inserttypeconv(right,left.resultdef);
|
||||||
end;
|
end;
|
||||||
|
|
||||||
{ call helpers for interface }
|
{ call helpers for interface }
|
||||||
if is_interfacecom(left.resultdef) then
|
if is_interfacecom(left.resultdef) then
|
||||||
begin
|
begin
|
||||||
{ remove property flag to avoid errors, see comments for }
|
{ Normal interface assignments are handled by the generic refcount incr/decr }
|
||||||
{ tf_winlikewidestring assignments below }
|
if not right.resultdef.is_related(left.resultdef) then
|
||||||
exclude(left.flags,nf_isproperty);
|
|
||||||
if right.resultdef.is_related(left.resultdef) then
|
|
||||||
begin
|
|
||||||
hp:=
|
|
||||||
ccallparanode.create(
|
|
||||||
ctypeconvnode.create_internal(right,voidpointertype),
|
|
||||||
ccallparanode.create(
|
|
||||||
ctypeconvnode.create_internal(left,voidpointertype),
|
|
||||||
nil));
|
|
||||||
result:=ccallnode.createintern('fpc_intf_assign',hp)
|
|
||||||
end
|
|
||||||
else
|
|
||||||
begin
|
begin
|
||||||
|
{ remove property flag to avoid errors, see comments for }
|
||||||
|
{ tf_winlikewidestring assignments below }
|
||||||
|
exclude(left.flags,nf_isproperty);
|
||||||
hp:=
|
hp:=
|
||||||
ccallparanode.create(
|
ccallparanode.create(
|
||||||
cguidconstnode.create(tobjectdef(left.resultdef).iidguid^),
|
cguidconstnode.create(tobjectdef(left.resultdef).iidguid^),
|
||||||
@ -602,16 +593,14 @@ implementation
|
|||||||
ctypeconvnode.create_internal(left,voidpointertype),
|
ctypeconvnode.create_internal(left,voidpointertype),
|
||||||
nil)));
|
nil)));
|
||||||
result:=ccallnode.createintern('fpc_intf_assign_by_iid',hp);
|
result:=ccallnode.createintern('fpc_intf_assign_by_iid',hp);
|
||||||
|
left:=nil;
|
||||||
|
right:=nil;
|
||||||
|
exit;
|
||||||
end;
|
end;
|
||||||
|
end
|
||||||
left:=nil;
|
|
||||||
right:=nil;
|
|
||||||
exit;
|
|
||||||
end;
|
|
||||||
|
|
||||||
{ call helpers for variant, they can contain non ref. counted types like
|
{ call helpers for variant, they can contain non ref. counted types like
|
||||||
vararrays which must be really copied }
|
vararrays which must be really copied }
|
||||||
if left.resultdef.typ=variantdef then
|
else if left.resultdef.typ=variantdef then
|
||||||
begin
|
begin
|
||||||
hp:=ccallparanode.create(ctypeconvnode.create_internal(
|
hp:=ccallparanode.create(ctypeconvnode.create_internal(
|
||||||
caddrnode.create_internal(right),voidpointertype),
|
caddrnode.create_internal(right),voidpointertype),
|
||||||
@ -622,11 +611,10 @@ implementation
|
|||||||
left:=nil;
|
left:=nil;
|
||||||
right:=nil;
|
right:=nil;
|
||||||
exit;
|
exit;
|
||||||
end;
|
end
|
||||||
|
|
||||||
{ call helpers for composite types containing automated types }
|
{ call helpers for composite types containing automated types }
|
||||||
if (left.resultdef.needs_inittable) and
|
else if (left.resultdef.needs_inittable) and
|
||||||
(left.resultdef.typ in [arraydef,objectdef,recorddef]) then
|
(left.resultdef.typ in [arraydef,objectdef,recorddef]) then
|
||||||
begin
|
begin
|
||||||
hp:=ccallparanode.create(caddrnode.create_internal(
|
hp:=ccallparanode.create(caddrnode.create_internal(
|
||||||
crttinode.create(tstoreddef(left.resultdef),initrtti,rdt_normal)),
|
crttinode.create(tstoreddef(left.resultdef),initrtti,rdt_normal)),
|
||||||
@ -639,10 +627,9 @@ implementation
|
|||||||
left:=nil;
|
left:=nil;
|
||||||
right:=nil;
|
right:=nil;
|
||||||
exit;
|
exit;
|
||||||
end;
|
end
|
||||||
|
|
||||||
{ call helpers for windows widestrings, they aren't ref. counted }
|
{ call helpers for windows widestrings, they aren't ref. counted }
|
||||||
if (tf_winlikewidestring in target_info.flags) and is_widestring(left.resultdef) then
|
else if (tf_winlikewidestring in target_info.flags) and is_widestring(left.resultdef) then
|
||||||
begin
|
begin
|
||||||
{ The first argument of fpc_widestr_assign is a var parameter. Properties cannot }
|
{ The first argument of fpc_widestr_assign is a var parameter. Properties cannot }
|
||||||
{ be passed to var or out parameters, because in that case setters/getters are not }
|
{ be passed to var or out parameters, because in that case setters/getters are not }
|
||||||
|
Loading…
Reference in New Issue
Block a user