mirror of
https://gitlab.com/freepascal.org/fpc/source.git
synced 2025-08-12 08:06:07 +02:00
+ JVM-specific versions of initialize_data_node()/finalize_data_node():
do nothing for finalization, assign nil pointer for dynamic arrays and refcounted strings (not required for JVM per se, but required because programmer's may use them without initialising them first and then they should be empty rather than invalid) git-svn-id: branches/jvmbackend@18368 -
This commit is contained in:
parent
09207563d5
commit
0ae4bbb0cf
1
.gitattributes
vendored
1
.gitattributes
vendored
@ -225,6 +225,7 @@ compiler/jvm/njvmcnv.pas svneol=native#text/plain
|
|||||||
compiler/jvm/njvmcon.pas svneol=native#text/plain
|
compiler/jvm/njvmcon.pas svneol=native#text/plain
|
||||||
compiler/jvm/njvminl.pas svneol=native#text/plain
|
compiler/jvm/njvminl.pas svneol=native#text/plain
|
||||||
compiler/jvm/njvmmat.pas svneol=native#text/plain
|
compiler/jvm/njvmmat.pas svneol=native#text/plain
|
||||||
|
compiler/jvm/njvmutil.pas svneol=native#text/plain
|
||||||
compiler/jvm/rgcpu.pas svneol=native#text/plain
|
compiler/jvm/rgcpu.pas svneol=native#text/plain
|
||||||
compiler/jvm/rjvmcon.inc svneol=native#text/plain
|
compiler/jvm/rjvmcon.inc svneol=native#text/plain
|
||||||
compiler/jvm/rjvmnor.inc svneol=native#text/plain
|
compiler/jvm/rjvmnor.inc svneol=native#text/plain
|
||||||
|
@ -35,6 +35,6 @@ implementation
|
|||||||
njvmadd,njvmcal,njvmmat,njvmcnv,njvmcon,njvminl
|
njvmadd,njvmcal,njvmmat,njvmcnv,njvmcon,njvminl
|
||||||
{ ncpuadd,ncpucall,ncpumat,ncpuinln,ncpucnv,ncpuset, }
|
{ ncpuadd,ncpucall,ncpumat,ncpuinln,ncpucnv,ncpuset, }
|
||||||
{ this not really a node }
|
{ this not really a node }
|
||||||
{ rgcpu},tgcpu;
|
{ rgcpu},tgcpu,njvmutil;
|
||||||
|
|
||||||
end.
|
end.
|
||||||
|
77
compiler/jvm/njvmutil.pas
Normal file
77
compiler/jvm/njvmutil.pas
Normal file
@ -0,0 +1,77 @@
|
|||||||
|
{
|
||||||
|
Copyright (c) 20011 by Jonas Maebe
|
||||||
|
|
||||||
|
JVM version of some node tree helper routines
|
||||||
|
|
||||||
|
This program is free software; you can redistribute it and/or modify
|
||||||
|
it under the terms of the GNU General Public License as published by
|
||||||
|
the Free Software Foundation; either version 2 of the License, or
|
||||||
|
(at your option) any later version.
|
||||||
|
|
||||||
|
This program is distributed in the hope that it will be useful,
|
||||||
|
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
|
GNU General Public License for more details.
|
||||||
|
|
||||||
|
You should have received a copy of the GNU General Public License
|
||||||
|
along with this program; if not, write to the Free Software
|
||||||
|
Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
|
||||||
|
|
||||||
|
****************************************************************************
|
||||||
|
}
|
||||||
|
unit njvmutil;
|
||||||
|
|
||||||
|
{$i fpcdefs.inc}
|
||||||
|
|
||||||
|
interface
|
||||||
|
|
||||||
|
uses
|
||||||
|
node,
|
||||||
|
ngenutil;
|
||||||
|
|
||||||
|
|
||||||
|
type
|
||||||
|
tjvmnodeutils = class(tnodeutils)
|
||||||
|
class function initialize_data_node(p:tnode):tnode; override;
|
||||||
|
class function finalize_data_node(p:tnode):tnode; override;
|
||||||
|
end;
|
||||||
|
|
||||||
|
|
||||||
|
implementation
|
||||||
|
|
||||||
|
uses
|
||||||
|
verbose,constexp,
|
||||||
|
symconst,symtype,symdef,symsym,symbase,symtable,defutil,
|
||||||
|
nbas,ncnv,ncon,nld,
|
||||||
|
pass_1;
|
||||||
|
|
||||||
|
class function tjvmnodeutils.initialize_data_node(p:tnode):tnode;
|
||||||
|
begin
|
||||||
|
if not assigned(p.resultdef) then
|
||||||
|
typecheckpass(p);
|
||||||
|
if ((p.resultdef.typ=stringdef) and
|
||||||
|
not is_shortstring(p.resultdef) and
|
||||||
|
not is_longstring(p.resultdef)) or
|
||||||
|
is_dynamic_array(p.resultdef) then
|
||||||
|
begin
|
||||||
|
result:=cassignmentnode.create(
|
||||||
|
ctypeconvnode.create_internal(p,voidpointertype),
|
||||||
|
cnilnode.create
|
||||||
|
);
|
||||||
|
end
|
||||||
|
else
|
||||||
|
{ records/arrays/... are automatically initialised }
|
||||||
|
result:=cnothingnode.create;
|
||||||
|
end;
|
||||||
|
|
||||||
|
|
||||||
|
class function tjvmnodeutils.finalize_data_node(p:tnode):tnode;
|
||||||
|
begin
|
||||||
|
// do nothing
|
||||||
|
result:=cnothingnode.create;
|
||||||
|
end;
|
||||||
|
|
||||||
|
begin
|
||||||
|
cnodeutils:=tjvmnodeutils;
|
||||||
|
end.
|
||||||
|
|
Loading…
Reference in New Issue
Block a user