|
@@ -36,7 +36,6 @@ interface
|
|
|
tjvmaddnode = class(tcgaddnode)
|
|
|
function pass_1: tnode;override;
|
|
|
protected
|
|
|
- function first_addstring: tnode; override;
|
|
|
function jvm_first_addset: tnode;
|
|
|
|
|
|
function cmpnode2topcmp(unsigned: boolean): TOpCmp;
|
|
@@ -99,72 +98,6 @@ interface
|
|
|
end;
|
|
|
|
|
|
|
|
|
- function tjvmaddnode.first_addstring: tnode;
|
|
|
- var
|
|
|
- cmpfuncname: string;
|
|
|
- begin
|
|
|
- { when we get here, we are sure that both the left and the right }
|
|
|
- { node are both strings of the same stringtype (JM) }
|
|
|
- case nodetype of
|
|
|
- addn:
|
|
|
- begin
|
|
|
- if is_shortstring(resultdef) then
|
|
|
- begin
|
|
|
- result:=inherited;
|
|
|
- exit;
|
|
|
- end;
|
|
|
- { unicode/ansistring operations use functions rather than
|
|
|
- procedures for efficiency reasons (were also implemented before
|
|
|
- var-parameters were supported; may go to procedures for
|
|
|
- maintenance reasons though }
|
|
|
- if (left.nodetype=stringconstn) and (tstringconstnode(left).len=0) then
|
|
|
- begin
|
|
|
- result:=right;
|
|
|
- left.free;
|
|
|
- left:=nil;
|
|
|
- right:=nil;
|
|
|
- exit;
|
|
|
- end;
|
|
|
- if (right.nodetype=stringconstn) and (tstringconstnode(right).len=0) then
|
|
|
- begin
|
|
|
- result:=left;
|
|
|
- left:=nil;
|
|
|
- right.free;
|
|
|
- right:=nil;
|
|
|
- exit;
|
|
|
- end;
|
|
|
-
|
|
|
- { create the call to the concat routine both strings as arguments }
|
|
|
- result:=ccallnode.createintern('fpc_'+
|
|
|
- tstringdef(resultdef).stringtypname+'_concat',
|
|
|
- ccallparanode.create(right,
|
|
|
- ccallparanode.create(left,nil)));
|
|
|
- { we reused the arguments }
|
|
|
- left := nil;
|
|
|
- right := nil;
|
|
|
- end;
|
|
|
- ltn,lten,gtn,gten,equaln,unequaln :
|
|
|
- begin
|
|
|
- { call compare routine }
|
|
|
- cmpfuncname := 'fpc_'+tstringdef(left.resultdef).stringtypname+'_compare';
|
|
|
- { for equality checks use optimized version }
|
|
|
- if nodetype in [equaln,unequaln] then
|
|
|
- cmpfuncname := cmpfuncname + '_equal';
|
|
|
-
|
|
|
- result := ccallnode.createintern(cmpfuncname,
|
|
|
- ccallparanode.create(right,ccallparanode.create(left,nil)));
|
|
|
- { and compare its result with 0 according to the original operator }
|
|
|
- result := caddnode.create(nodetype,result,
|
|
|
- cordconstnode.create(0,s32inttype,false));
|
|
|
- left := nil;
|
|
|
- right := nil;
|
|
|
- end;
|
|
|
- else
|
|
|
- internalerror(2011031401);
|
|
|
- end;
|
|
|
- end;
|
|
|
-
|
|
|
-
|
|
|
function tjvmaddnode.jvm_first_addset: tnode;
|
|
|
|
|
|
procedure call_set_helper_paras(const n : string; isenum: boolean; paras: tcallparanode);
|