+ tcallnode.createinternmethodres() that allows specifying a forced

resultdef for internally generated method calls
  * force the resulttype of methods used to build non-unicode string
    constants on the JVM platform to the stringconstn's resultdef

git-svn-id: branches/jvmbackend@18832 -
This commit is contained in:
Jonas Maebe 2011-08-24 22:11:16 +00:00
parent bb593346a9
commit eb268fb2c4
5 changed files with 15 additions and 9 deletions

4
.gitattributes vendored
View File

@ -7370,6 +7370,8 @@ rtl/java/jrec.inc svneol=native#text/plain
rtl/java/jrech.inc svneol=native#text/plain
rtl/java/jset.inc svneol=native#text/plain
rtl/java/jseth.inc svneol=native#text/plain
rtl/java/jsstringh.inc svneol=native#text/plain
rtl/java/jsstrings.inc svneol=native#text/plain
rtl/java/jsystem.inc svneol=native#text/plain
rtl/java/jsystemh.inc svneol=native#text/plain
rtl/java/jsystemh_types.inc svneol=native#text/plain
@ -7380,8 +7382,6 @@ rtl/java/objpas.pp svneol=native#text/plain
rtl/java/objpash.inc svneol=native#text/plain
rtl/java/rtl.cfg svneol=native#text/plain
rtl/java/rtti.inc svneol=native#text/plain
rtl/java/sstringh.inc svneol=native#text/plain
rtl/java/sstrings.inc svneol=native#text/plain
rtl/java/sysos.inc svneol=native#text/plain
rtl/java/sysosh.inc svneol=native#text/plain
rtl/java/sysres.inc svneol=native#text/plain

View File

@ -163,7 +163,6 @@ implementation
function tjvmstringconstnode.pass_1: tnode;
var
strclass: tobjectdef;
psym: tsym;
pw: pcompilerwidestring;
begin
{ all Java strings are utf-16. However, there is no way to
@ -197,13 +196,11 @@ implementation
internalerror(2011052401);
end;
cst_type:=cst_unicodestring;
psym:=search_struct_member(strclass,'CREATEFROMLITERALSTRINGBYTES');
if not assigned(psym) or
(psym.typ<>procsym) then
internalerror(2011052001);
{ since self will be freed, have to make a copy }
result:=ccallnode.create(ccallparanode.create(self.getcopy,nil),
tprocsym(psym),psym.owner,nil,[]);
result:=ccallnode.createinternmethodres(
cloadvmtaddrnode.create(ctypenode.create(strclass)),
'CREATEFROMLITERALSTRINGBYTES',ccallparanode.create(self.getcopy,nil),
resultdef);
end;

View File

@ -133,6 +133,7 @@ interface
constructor createinternresfromunit(const fromunit, procname: string; params: tnode; res:tdef);
constructor createinternreturn(const name: string; params: tnode; returnnode : tnode);
constructor createinternmethod(mp: tnode; const name: string; params: tnode);
constructor createinternmethodres(mp: tnode; const name: string; params: tnode; res:tdef);
destructor destroy;override;
constructor ppuload(t:tnodetype;ppufile:tcompilerppufile);override;
procedure ppuwrite(ppufile:tcompilerppufile);override;
@ -1193,6 +1194,14 @@ implementation
end;
constructor tcallnode.createinternmethodres(mp: tnode; const name: string; params: tnode; res: tdef);
begin
createinternmethod(mp,name,params);
typedef:=res;
include(callnodeflags,cnf_typedefset)
end;
destructor tcallnode.destroy;
begin
methodpointer.free;