summaryrefslogtreecommitdiff
path: root/compiler/jvm
diff options
context:
space:
mode:
authorjonas <jonas@3ad0048d-3df7-0310-abae-a5850022a9f2>2015-01-21 23:28:34 +0000
committerjonas <jonas@3ad0048d-3df7-0310-abae-a5850022a9f2>2015-01-21 23:28:34 +0000
commit1903b037de2fb3e75826406b46f055acb70963fa (patch)
tree604cd8b790fe14e5fbe441d4cd647c80d2a36a9a /compiler/jvm
parentad1141d52f8353457053b925cd674fe1d5c4eafc (diff)
parent953d907e4d6c3a5c2f8aaee6e5e4f73c55ce5985 (diff)
downloadfpc-blocks.tar.gz
* synchronised with trunk till r29513blocks
git-svn-id: http://svn.freepascal.org/svn/fpc/branches/blocks@29516 3ad0048d-3df7-0310-abae-a5850022a9f2
Diffstat (limited to 'compiler/jvm')
-rw-r--r--compiler/jvm/cpuinfo.pas20
-rw-r--r--compiler/jvm/dbgjasm.pas44
-rw-r--r--compiler/jvm/njvmflw.pas6
-rw-r--r--compiler/jvm/njvminl.pas6
-rw-r--r--compiler/jvm/njvmmem.pas2
-rw-r--r--compiler/jvm/njvmutil.pas3
-rw-r--r--compiler/jvm/tgcpu.pas8
7 files changed, 77 insertions, 12 deletions
diff --git a/compiler/jvm/cpuinfo.pas b/compiler/jvm/cpuinfo.pas
index e4918dc954..62b89fcd1f 100644
--- a/compiler/jvm/cpuinfo.pas
+++ b/compiler/jvm/cpuinfo.pas
@@ -21,6 +21,9 @@ Interface
Type
bestreal = double;
+{$if FPC_FULLVERSION>20700}
+ bestrealrec = TDoubleRec;
+{$endif FPC_FULLVERSION>20700}
ts32real = single;
ts64real = double;
ts80real = extended;
@@ -44,8 +47,25 @@ Type
fpu_standard
);
+ tcontrollertype =
+ (ct_none
+ );
+
Const
+ { Is there support for dealing with multiple microcontrollers available }
+ { for this platform? }
+ ControllerSupport = false;
+
+ { We know that there are fields after sramsize
+ but we don't care about this warning }
+ {$PUSH}
+ {$WARN 3177 OFF}
+ embedded_controllers : array [tcontrollertype] of tcontrollerdatatype =
+ (
+ (controllertypestr:''; controllerunitstr:''; flashbase:0; flashsize:0; srambase:0; sramsize:0));
+ {$POP}
+
{ calling conventions supported by the code generator }
supported_calling_conventions : tproccalloptions = [
pocall_internproc
diff --git a/compiler/jvm/dbgjasm.pas b/compiler/jvm/dbgjasm.pas
index 2b76bbc1ca..40c971ad74 100644
--- a/compiler/jvm/dbgjasm.pas
+++ b/compiler/jvm/dbgjasm.pas
@@ -38,9 +38,10 @@ interface
TDebugInfoJasmin=class(TDebugInfo)
protected
fcurrprocstart,
+ fcurrprocafterstart,
fcurrprocend: tasmsymbol;
- procedure appendsym_localsym(list: TAsmList; sym: tabstractnormalvarsym);
+ procedure appendsym_localsym(list: TAsmList; sym: tabstractnormalvarsym; startlab: tasmsymbol);
procedure appendsym_paravar(list:TAsmList;sym:tparavarsym);override;
procedure appendsym_localvar(list:TAsmList;sym:tlocalvarsym);override;
@@ -65,7 +66,7 @@ implementation
TDebugInfoJasmin
****************************************************************************}
- procedure TDebugInfoJasmin.appendsym_localsym(list: TAsmList; sym: tabstractnormalvarsym);
+ procedure TDebugInfoJasmin.appendsym_localsym(list: TAsmList; sym: tabstractnormalvarsym; startlab: tasmsymbol);
var
jvar: tai_jvar;
proc: tprocdef;
@@ -75,20 +76,20 @@ 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,jvmmangledbasename(sym,true),fcurrprocstart,fcurrprocend);
+ jvar:=tai_jvar.create(sym.localloc.reference.offset,jvmmangledbasename(sym,true),startlab,fcurrprocend);
tcpuprocdef(proc).exprasmlist.InsertAfter(jvar,proc.procstarttai);
end;
procedure TDebugInfoJasmin.appendsym_paravar(list: TAsmList; sym: tparavarsym);
begin
- appendsym_localsym(list,sym);
+ appendsym_localsym(list,sym,fcurrprocstart);
end;
procedure TDebugInfoJasmin.appendsym_localvar(list: TAsmList; sym: tlocalvarsym);
begin
- appendsym_localsym(list,sym);
+ appendsym_localsym(list,sym,fcurrprocafterstart);
end;
@@ -100,7 +101,11 @@ implementation
procedure TDebugInfoJasmin.appendprocdef(list: TAsmList; def: tprocdef);
var
procstartlabel,
- procendlabel : tasmlabel;
+ procendlabel,
+ afterprocstartlabel : tasmlabel;
+ hp,
+ afterproccodestart : tai;
+ instrcount : longint;
begin
{ insert debug information for local variables and parameters, but only
for routines implemented in the Pascal code }
@@ -113,6 +118,33 @@ implementation
tcpuprocdef(def).exprasmlist.insertbefore(tai_label.create(procendlabel),def.procendtai);
fcurrprocstart:=procstartlabel;
+ { set the start label for local variables after the first instruction,
+ because javac's code completion support assumes that all info at
+ bytecode position 0 is for parameters }
+ instrcount:=0;
+ afterproccodestart:=def.procstarttai;
+ while assigned(afterproccodestart.next) do
+ begin
+ afterproccodestart:=tai(afterproccodestart.next);
+ if (afterproccodestart.typ=ait_instruction) then
+ break;
+ end;
+ { must be followed by at least one more instruction }
+ hp:=tai(afterproccodestart.next);
+ while assigned(hp) do
+ begin
+ if hp.typ=ait_instruction then
+ break;
+ hp:=tai(hp.next);
+ end;
+ if assigned(hp) then
+ begin
+ current_asmdata.getlabel(afterprocstartlabel,alt_dbgtype);
+ tcpuprocdef(def).exprasmlist.insertafter(tai_label.create(afterprocstartlabel),afterproccodestart);
+ fcurrprocafterstart:=afterprocstartlabel;
+ end
+ else
+ fcurrprocafterstart:=procstartlabel;
fcurrprocend:=procendlabel;
write_symtable_parasyms(list,def.paras);
diff --git a/compiler/jvm/njvmflw.pas b/compiler/jvm/njvmflw.pas
index 966a57a23d..25f9d11fb0 100644
--- a/compiler/jvm/njvmflw.pas
+++ b/compiler/jvm/njvmflw.pas
@@ -340,6 +340,12 @@ implementation
reasonbuf,
exceptreg: tregister;
begin
+ oldBreakLabel:=nil;
+ oldContinueLabel:=nil;
+ finallycodecopy:=nil;
+ continuefinallylabel:=nil;
+ breakfinallylabel:=nil;
+
{ not necessary on a garbage-collected platform }
if implicitframe then
internalerror(2011031803);
diff --git a/compiler/jvm/njvminl.pas b/compiler/jvm/njvminl.pas
index e4176fc838..3141b48016 100644
--- a/compiler/jvm/njvminl.pas
+++ b/compiler/jvm/njvminl.pas
@@ -87,13 +87,13 @@ implementation
function tjvminlinenode.typecheck_length(var handled: boolean): tnode;
begin
+ result:=nil;
typecheckpass(left);
if is_open_array(left.resultdef) or
is_dynamic_array(left.resultdef) or
is_array_of_const(left.resultdef) then
begin
resultdef:=s32inttype;
- result:=nil;
handled:=true;
end;
end;
@@ -101,6 +101,7 @@ implementation
function tjvminlinenode.typecheck_high(var handled: boolean): tnode;
begin
+ result:=nil;
typecheckpass(left);
if is_dynamic_array(left.resultdef) or
is_open_array(left.resultdef) or
@@ -120,6 +121,7 @@ implementation
para: tcallparanode;
elemdef: tdef;
begin
+ result:=nil;
{ normally never exists; used by the JVM backend to create new
arrays because it requires special opcodes }
tcallparanode(left).get_paratype;
@@ -150,7 +152,6 @@ implementation
para:=tcallparanode(para.right);
elemdef:=tarraydef(elemdef).elementdef;
end;
- result:=nil;
resultdef:=left.resultdef;
handled:=true;
end;
@@ -289,6 +290,7 @@ implementation
var
handled: boolean;
begin
+ result:=nil;
handled:=false;
case inlinenumber of
in_length_x:
diff --git a/compiler/jvm/njvmmem.pas b/compiler/jvm/njvmmem.pas
index a93902a3f5..a65a070077 100644
--- a/compiler/jvm/njvmmem.pas
+++ b/compiler/jvm/njvmmem.pas
@@ -361,6 +361,8 @@ implementation
newsize: tcgsize;
isjump: boolean;
begin
+ otl:=nil;
+ ofl:=nil;
if left.resultdef.typ=stringdef then
internalerror(2011052702);
diff --git a/compiler/jvm/njvmutil.pas b/compiler/jvm/njvmutil.pas
index 72df2627b2..ad61b5099c 100644
--- a/compiler/jvm/njvmutil.pas
+++ b/compiler/jvm/njvmutil.pas
@@ -75,6 +75,9 @@ implementation
paras: tcallparanode;
proc: string;
begin
+ result:=nil;
+ proc:='';
+ temp:=nil;
if not assigned(p.resultdef) then
typecheckpass(p);
if ((p.resultdef.typ=stringdef) and
diff --git a/compiler/jvm/tgcpu.pas b/compiler/jvm/tgcpu.pas
index 012f90d80d..12f163226b 100644
--- a/compiler/jvm/tgcpu.pas
+++ b/compiler/jvm/tgcpu.pas
@@ -46,7 +46,7 @@ unit tgcpu;
public
procedure setfirsttemp(l : longint); override;
procedure getlocal(list: TAsmList; size: longint; alignment: shortint; def: tdef; var ref: treference); override;
- procedure gethltemp(list: TAsmList; def: tdef; forcesize: aint; temptype: ttemptype; out ref: treference); override;
+ procedure gethltemp(list: TAsmList; def: tdef; forcesize: asizeint; temptype: ttemptype; out ref: treference); override;
procedure gethltemptyped(list: TAsmList; def: tdef; temptype: ttemptype; out ref: treference); override;
end;
@@ -145,8 +145,8 @@ unit tgcpu;
if tprocsym(sym).procdeflist.Count<>1 then
internalerror(2011062801);
pd:=tprocdef(tprocsym(sym).procdeflist[0]);
+ hlcg.a_call_name(list,pd,pd.mangledname,nil,false);
end;
- hlcg.a_call_name(list,pd,pd.mangledname,nil,false);
{ static calls method replaces parameter with set instance
-> no change in stack height }
end
@@ -202,8 +202,8 @@ unit tgcpu;
if tprocsym(sym).procdeflist.Count<>1 then
internalerror(2011052404);
pd:=tprocdef(tprocsym(sym).procdeflist[0]);
+ hlcg.a_call_name(list,pd,pd.mangledname,nil,false);
end;
- hlcg.a_call_name(list,pd,pd.mangledname,nil,false);
{ static calls method replaces parameter with string instance
-> no change in stack height }
{ store reference to instance }
@@ -245,7 +245,7 @@ unit tgcpu;
end;
- procedure ttgjvm.gethltemp(list: TAsmList; def: tdef; forcesize: aint; temptype: ttemptype; out ref: treference);
+ procedure ttgjvm.gethltemp(list: TAsmList; def: tdef; forcesize: asizeint; temptype: ttemptype; out ref: treference);
begin
if not getifspecialtemp(list,def,forcesize,temptype,ref) then
inherited;