mirror of
https://gitlab.com/freepascal.org/fpc/source.git
synced 2025-04-07 18:47:52 +02:00
* moved tabstractvarsym.jvmmangledbasename to the jvmdef unit as a separate
function, so it can be easily also used for constsym without adding JVM-specific routines to symtype or duplicating the routine without inheritance + added tconstsym support to jvmdef.jvmmangledbasename() git-svn-id: branches/jvmbackend@18390 -
This commit is contained in:
parent
59ccdd1de8
commit
737f9f5e90
@ -603,7 +603,7 @@ implementation
|
||||
if (vissym.owner.symtabletype in [staticsymtable,globalsymtable]) or
|
||||
(sp_static in vissym.symoptions) then
|
||||
result:=result+'static ';
|
||||
result:=result+sym.jvmmangledbasename;
|
||||
result:=result+jvmmangledbasename(sym);
|
||||
end;
|
||||
|
||||
|
||||
|
@ -58,7 +58,7 @@ implementation
|
||||
version,globals,verbose,systems,
|
||||
cpubase,cpuinfo,cgbase,paramgr,
|
||||
fmodule,
|
||||
defutil,symtable,ppu
|
||||
defutil,symtable,jvmdef,ppu
|
||||
;
|
||||
|
||||
{****************************************************************************
|
||||
@ -75,7 +75,7 @@ implementation
|
||||
if not(sym.localloc.loc in [LOC_REFERENCE,LOC_CREFERENCE]) then
|
||||
exit;
|
||||
proc:=tprocdef(sym.owner.defowner);
|
||||
jvar:=tai_jvar.create(sym.localloc.reference.offset,sym.jvmmangledbasename,fcurrprocstart,fcurrprocend);
|
||||
jvar:=tai_jvar.create(sym.localloc.reference.offset,jvmmangledbasename(sym),fcurrprocstart,fcurrprocend);
|
||||
proc.exprasmlist.InsertAfter(jvar,proc.procstarttai);
|
||||
end;
|
||||
|
||||
|
@ -61,6 +61,10 @@ interface
|
||||
JVM target (e.g., records, regular arrays, ...) }
|
||||
function jvmimplicitpointertype(def: tdef): boolean;
|
||||
|
||||
{ returns the mangled base name for a tsym (type + symbol name, no
|
||||
visibility etc) }
|
||||
function jvmmangledbasename(sym: tsym): string;
|
||||
|
||||
implementation
|
||||
|
||||
uses
|
||||
@ -331,6 +335,41 @@ implementation
|
||||
end;
|
||||
|
||||
|
||||
function jvmmangledbasename(sym: tsym): string;
|
||||
var
|
||||
vsym: tabstractvarsym;
|
||||
csym: tconstsym;
|
||||
founderror: tdef;
|
||||
begin
|
||||
case sym.typ of
|
||||
staticvarsym,
|
||||
paravarsym,
|
||||
localvarsym,
|
||||
fieldvarsym:
|
||||
begin
|
||||
vsym:=tabstractvarsym(sym);
|
||||
result:=jvmencodetype(vsym.vardef);
|
||||
if (vsym.typ=paravarsym) and
|
||||
(vo_is_self in tparavarsym(vsym).varoptions) then
|
||||
result:='this ' +result
|
||||
else if (vsym.typ in [paravarsym,localvarsym]) and
|
||||
([vo_is_funcret,vo_is_result] * tabstractnormalvarsym(vsym).varoptions <> []) then
|
||||
result:='result '+result
|
||||
else
|
||||
result:=vsym.realname+' '+result;
|
||||
end;
|
||||
constsym:
|
||||
begin
|
||||
csym:=tconstsym(sym);
|
||||
result:=jvmencodetype(csym.constdef);
|
||||
result:=csym.realname+' '+result;
|
||||
end;
|
||||
else
|
||||
internalerror(2011021703);
|
||||
end;
|
||||
end;
|
||||
|
||||
|
||||
{******************************************************************
|
||||
jvm type validity checking
|
||||
*******************************************************************}
|
||||
|
@ -145,7 +145,6 @@ interface
|
||||
function register_notification(flags:Tnotification_flags;
|
||||
callback:Tnotification_callback):cardinal;
|
||||
procedure unregister_notification(id:cardinal);
|
||||
function jvmmangledbasename:string;
|
||||
private
|
||||
_vardef : tdef;
|
||||
vardefderef : tderef;
|
||||
@ -1148,23 +1147,6 @@ implementation
|
||||
end;
|
||||
|
||||
|
||||
function tabstractvarsym.jvmmangledbasename: string;
|
||||
var
|
||||
founderror: tdef;
|
||||
begin
|
||||
if not jvmtryencodetype(vardef,result,founderror) then
|
||||
internalerror(2011011203);
|
||||
if (typ=paravarsym) and
|
||||
(vo_is_self in tparavarsym(self).varoptions) then
|
||||
result:='this ' +result
|
||||
else if (typ in [paravarsym,localvarsym]) and
|
||||
([vo_is_funcret,vo_is_result] * tabstractnormalvarsym(self).varoptions <> []) then
|
||||
result:='result '+result
|
||||
else
|
||||
result:=realname+' '+result;
|
||||
end;
|
||||
|
||||
|
||||
procedure tabstractvarsym.setvardef(def:tdef);
|
||||
begin
|
||||
_vardef := def;
|
||||
@ -1233,7 +1215,7 @@ implementation
|
||||
result:=cachedmangledname^
|
||||
else
|
||||
begin
|
||||
result:=jvmmangledbasename;
|
||||
result:=jvmmangledbasename(self);
|
||||
jvmaddtypeownerprefix(owner,result);
|
||||
cachedmangledname:=stringdup(result);
|
||||
end;
|
||||
@ -1391,7 +1373,7 @@ implementation
|
||||
if not assigned(_mangledname) then
|
||||
begin
|
||||
{$ifdef jvm}
|
||||
tmpname:=jvmmangledbasename;
|
||||
tmpname:=jvmmangledbasename(self);
|
||||
jvmaddtypeownerprefix(owner,tmpname);
|
||||
_mangledname:=stringdup(tmpname);
|
||||
{$else jvm}
|
||||
|
Loading…
Reference in New Issue
Block a user