* removed ifdef jvm from ncgvmt

git-svn-id: trunk@27154 -
This commit is contained in:
Jonas Maebe 2014-03-16 11:24:44 +00:00
parent 73a3f5ced4
commit 8d4c372d50
4 changed files with 88 additions and 24 deletions

1
.gitattributes vendored
View File

@ -303,6 +303,7 @@ compiler/jvm/njvmmem.pas svneol=native#text/plain
compiler/jvm/njvmset.pas svneol=native#text/plain
compiler/jvm/njvmtcon.pas svneol=native#text/plain
compiler/jvm/njvmutil.pas svneol=native#text/plain
compiler/jvm/njvmvmt.pas svneol=native#text/plain
compiler/jvm/pjvm.pas svneol=native#text/plain
compiler/jvm/rgcpu.pas svneol=native#text/plain
compiler/jvm/rjvmcon.inc svneol=native#text/plain

View File

@ -33,7 +33,7 @@ implementation
ncgbas,ncgflw,ncgcnv,ncgld,ncgmem,ncgcon,ncgset,
ncgadd, ncgcal,ncgmat,ncginl,
njvmadd,njvmcal,njvmmat,njvmcnv,njvmcon,njvminl,njvmmem,njvmflw,njvmld,
njvmset
njvmset,njvmvmt
{ these are not really nodes }
,rgcpu,tgcpu,njvmutil,njvmtcon;

52
compiler/jvm/njvmvmt.pas Normal file
View File

@ -0,0 +1,52 @@
{
Copyright (c) 2014 by Jonas Maebe
Generate JVM bytecode for in set/case nodes
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 njvmvmt;
{$i fpcdefs.inc}
interface
uses
ncgvmt;
type
tjvmvmtwriter = class(TVMTWriter)
class function use_vmt_writer: boolean; override;
end;
implementation
{*****************************************************************************
TJVMVMTWRITER
*****************************************************************************}
class function tjvmvmtwriter.use_vmt_writer: boolean;
begin
result:=false;
end;
begin
CVMTWriter:=tjvmvmtwriter;
end.

View File

@ -26,23 +26,8 @@ unit ncgvmt;
interface
uses
symbase;
{ generate persistent type information like VMT, RTTI and inittables }
procedure write_persistent_type_info(st:tsymtable;is_global:boolean);
implementation
uses
cutils,cclasses,
globtype,globals,verbose,constexp,
systems,
symconst,symtype,symdef,symsym,symtable,defutil,
aasmbase,aasmtai,aasmdata,
wpobase,
nobj,
cgbase,parabase,paramgr,cgobj,cgcpu,hlcgobj,hlcgcpu,
ncgrtti;
aasmdata,aasmbase,
symbase,symdef;
type
pprocdeftree = ^tprocdeftree;
@ -93,11 +78,33 @@ implementation
function gendmt : tasmlabel;
{$endif WITHDMT}
public
constructor create(c:tobjectdef);
constructor create(c:tobjectdef); virtual;
{ write the VMT to al_globals }
procedure writevmt;
procedure writeinterfaceids(list: TAsmList);
{ should the VMT writer be used at all (e.g., not for the JVM target) }
class function use_vmt_writer: boolean; virtual;
end;
TVMTWriterClass = class of TVMTWriter;
{ generate persistent type information like VMT, RTTI and inittables }
procedure write_persistent_type_info(st:tsymtable;is_global:boolean);
var
CVMTWriter: TVMTWriterClass = TVMTWriter;
implementation
uses
cutils,cclasses,
globtype,globals,verbose,constexp,
systems,
symconst,symtype,symsym,symtable,defutil,
aasmtai,
wpobase,
nobj,
cgbase,parabase,paramgr,cgobj,cgcpu,hlcgobj,hlcgcpu,
ncgrtti;
{*****************************************************************************
@ -686,6 +693,12 @@ implementation
end;
class function TVMTWriter.use_vmt_writer: boolean;
begin
result:=true;
end;
function TVMTWriter.RedirectToEmpty(procdef : tprocdef) : boolean;
var
i : longint;
@ -964,10 +977,8 @@ implementation
def : tdef;
vmtwriter : TVMTWriter;
begin
{$ifdef jvm}
{ no Delphi-style RTTI }
exit;
{$endif jvm}
if not CVMTWriter.use_vmt_writer then
exit;
for i:=0 to st.DefList.Count-1 do
begin
def:=tdef(st.DefList[i]);
@ -984,7 +995,7 @@ implementation
{ Write also VMT if not done yet }
if not(ds_vmt_written in def.defstates) then
begin
vmtwriter:=TVMTWriter.create(tobjectdef(def));
vmtwriter:=CVMTWriter.create(tobjectdef(def));
if is_interface(tobjectdef(def)) then
vmtwriter.writeinterfaceids(current_asmdata.AsmLists[al_globals]);
if (oo_has_vmt in tobjectdef(def).objectoptions) then