mirror of
https://gitlab.com/freepascal.org/fpc/source.git
synced 2025-08-14 14:49:17 +02:00
* made setfirsttemp() virtual and override it in jvm/tgcpu so it no
longer aligns the temp offset in case it's odd (not required for jvm) * ignore the "def" argument in alloctemp() for the jvm since all stack slots can be reused for anything there, and reformatted its alloctemp() git-svn-id: branches/jvmbackend@18297 -
This commit is contained in:
parent
dc8df7fe79
commit
c84ec623dd
@ -29,7 +29,9 @@ unit tgcpu;
|
|||||||
interface
|
interface
|
||||||
|
|
||||||
uses
|
uses
|
||||||
tgobj;
|
globtype,
|
||||||
|
aasmdata,
|
||||||
|
symtype,tgobj;
|
||||||
|
|
||||||
type
|
type
|
||||||
|
|
||||||
@ -38,25 +40,39 @@ unit tgcpu;
|
|||||||
ttgjvm = class(ttgobj)
|
ttgjvm = class(ttgobj)
|
||||||
protected
|
protected
|
||||||
function alloctemp(list: TAsmList; size, alignment: longint; temptype: ttemptype; def: tdef): longint; override;
|
function alloctemp(list: TAsmList; size, alignment: longint; temptype: ttemptype; def: tdef): longint; override;
|
||||||
|
public
|
||||||
|
procedure setfirsttemp(l : longint); override;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
implementation
|
implementation
|
||||||
|
|
||||||
{ ttgjvm }
|
uses
|
||||||
|
verbose;
|
||||||
|
|
||||||
function ttgjvm.alloctemp(list: TAsmList; size, alignment: longint; temptype: ttemptype; def: tdef): longint;
|
|
||||||
begin
|
{ ttgjvm }
|
||||||
{ the JVM only support s1 slot (= 4 bytes in FPC) and 2 slot (= 8 bytes in
|
|
||||||
FPC) temps on the stack. double and int64 are 2 slots, the rest is one slot.
|
function ttgjvm.alloctemp(list: TAsmList; size, alignment: longint; temptype: ttemptype; def: tdef): longint;
|
||||||
There are no problems with reusing the same slot for a vakue of a different
|
begin
|
||||||
type. There are no alignment requirements either. }
|
{ the JVM only supports 1 slot (= 4 bytes in FPC) and 2 slot (= 8 bytes in
|
||||||
if size<4 then
|
FPC) temps on the stack. double and int64 are 2 slots, the rest is one slot.
|
||||||
size:=4;
|
There are no problems with reusing the same slot for a value of a different
|
||||||
if not(size in [4,8]) then
|
type. There are no alignment requirements either. }
|
||||||
internalerror(2010121401);
|
if size<4 then
|
||||||
Result:=inherited alloctemp(list, size div 4, 1, temptype, def);
|
size:=4;
|
||||||
end;
|
if not(size in [4,8]) then
|
||||||
|
internalerror(2010121401);
|
||||||
|
{ don't pass on "def", since we don't care if a slot is used again for a
|
||||||
|
different type }
|
||||||
|
result:=inherited alloctemp(list, size shr 2, 1, temptype, nil);
|
||||||
|
end;
|
||||||
|
|
||||||
|
procedure ttgjvm.setfirsttemp(l: longint);
|
||||||
|
begin
|
||||||
|
firsttemp:=l;
|
||||||
|
lasttemp:=l;
|
||||||
|
end;
|
||||||
|
|
||||||
begin
|
begin
|
||||||
tgclass:=ttgjvm;
|
tgobjclass:=ttgjvm;
|
||||||
end.
|
end.
|
||||||
|
@ -78,7 +78,7 @@ unit tgobj;
|
|||||||
|
|
||||||
@param(l start offset where temps will start in stack)
|
@param(l start offset where temps will start in stack)
|
||||||
}
|
}
|
||||||
procedure setfirsttemp(l : longint);
|
procedure setfirsttemp(l : longint); virtual;
|
||||||
|
|
||||||
procedure gettemp(list: TAsmList; size, alignment : longint;temptype:ttemptype;out ref : treference);
|
procedure gettemp(list: TAsmList; size, alignment : longint;temptype:ttemptype;out ref : treference);
|
||||||
procedure gettemptyped(list: TAsmList; def:tdef;temptype:ttemptype;out ref : treference);
|
procedure gettemptyped(list: TAsmList; def:tdef;temptype:ttemptype;out ref : treference);
|
||||||
|
Loading…
Reference in New Issue
Block a user