mirror of
https://gitlab.com/freepascal.org/fpc/source.git
synced 2025-08-09 02:26:06 +02:00
+ support for JVM string constants
git-svn-id: branches/jvmbackend@18416 -
This commit is contained in:
parent
7200245337
commit
f58de91f0c
@ -26,6 +26,7 @@ unit njvmcon;
|
|||||||
interface
|
interface
|
||||||
|
|
||||||
uses
|
uses
|
||||||
|
symtype,
|
||||||
node,ncon,ncgcon;
|
node,ncon,ncgcon;
|
||||||
|
|
||||||
type
|
type
|
||||||
@ -33,12 +34,18 @@ interface
|
|||||||
procedure pass_generate_code;override;
|
procedure pass_generate_code;override;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
|
tjvmstringconstnode = class(tstringconstnode)
|
||||||
|
procedure pass_generate_code;override;
|
||||||
|
end;
|
||||||
|
|
||||||
|
|
||||||
implementation
|
implementation
|
||||||
|
|
||||||
uses
|
uses
|
||||||
globtype,
|
globtype,widestr,
|
||||||
aasmdata,defutil,
|
symdef,symtable,symconst,
|
||||||
cgbase,hlcgobj,hlcgcpu,cgutils
|
aasmdata,aasmcpu,defutil,
|
||||||
|
cgbase,hlcgobj,hlcgcpu,cgutils,cpubase
|
||||||
;
|
;
|
||||||
|
|
||||||
|
|
||||||
@ -55,6 +62,28 @@ implementation
|
|||||||
end;
|
end;
|
||||||
|
|
||||||
|
|
||||||
|
{ tcgstringconstnode }
|
||||||
|
|
||||||
|
procedure tjvmstringconstnode.pass_generate_code;
|
||||||
|
begin
|
||||||
|
location_reset(location,LOC_REGISTER,def_cgsize(resultdef));
|
||||||
|
location.register:=hlcg.getaddressregister(current_asmdata.CurrAsmList,resultdef);
|
||||||
|
case cst_type of
|
||||||
|
cst_ansistring,
|
||||||
|
cst_shortstring,
|
||||||
|
cst_conststring:
|
||||||
|
current_asmdata.CurrAsmList.concat(taicpu.op_string(a_ldc,len,value_str));
|
||||||
|
cst_unicodestring,
|
||||||
|
cst_widestring:
|
||||||
|
current_asmdata.CurrAsmList.concat(taicpu.op_wstring(a_ldc,pcompilerwidestring(value_str)));
|
||||||
|
end;
|
||||||
|
thlcgjvm(hlcg).incstack(current_asmdata.CurrAsmList,1);
|
||||||
|
thlcgjvm(hlcg).a_load_stack_reg(current_asmdata.CurrAsmList,resultdef,location.register);
|
||||||
|
end;
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
begin
|
begin
|
||||||
crealconstnode:=tjvmrealconstnode;
|
crealconstnode:=tjvmrealconstnode;
|
||||||
|
cstringconstnode:=tjvmstringconstnode;
|
||||||
end.
|
end.
|
||||||
|
Loading…
Reference in New Issue
Block a user