mirror of
https://gitlab.com/freepascal.org/fpc/source.git
synced 2025-08-12 03:46:10 +02:00
* synchronized with trunk
git-svn-id: branches/wasm@48158 -
This commit is contained in:
commit
e0a1ce86fd
1
.gitattributes
vendored
1
.gitattributes
vendored
@ -18684,6 +18684,7 @@ tests/webtbs/tw3827.pp svneol=native#text/plain
|
|||||||
tests/webtbs/tw3829.pp svneol=native#text/plain
|
tests/webtbs/tw3829.pp svneol=native#text/plain
|
||||||
tests/webtbs/tw38295.pp svneol=native#text/pascal
|
tests/webtbs/tw38295.pp svneol=native#text/pascal
|
||||||
tests/webtbs/tw38299.pp svneol=native#text/pascal
|
tests/webtbs/tw38299.pp svneol=native#text/pascal
|
||||||
|
tests/webtbs/tw38306.pp -text svneol=native#text/pascal
|
||||||
tests/webtbs/tw38309.pp svneol=native#text/pascal
|
tests/webtbs/tw38309.pp svneol=native#text/pascal
|
||||||
tests/webtbs/tw38310a.pp svneol=native#text/pascal
|
tests/webtbs/tw38310a.pp svneol=native#text/pascal
|
||||||
tests/webtbs/tw38310b.pp svneol=native#text/pascal
|
tests/webtbs/tw38310b.pp svneol=native#text/pascal
|
||||||
|
@ -59,6 +59,8 @@ interface
|
|||||||
RELOC_RELATIVE_5,
|
RELOC_RELATIVE_5,
|
||||||
{ PIC }
|
{ PIC }
|
||||||
RELOC_GOTPCREL,
|
RELOC_GOTPCREL,
|
||||||
|
RELOC_GOTPCRELX,
|
||||||
|
RELOC_REX_GOTPCRELX,
|
||||||
RELOC_PLT32,
|
RELOC_PLT32,
|
||||||
RELOC_TLSGD,
|
RELOC_TLSGD,
|
||||||
RELOC_TPOFF,
|
RELOC_TPOFF,
|
||||||
|
@ -88,6 +88,8 @@ implementation
|
|||||||
R_X86_64_TLSDESC_CALL = 35;
|
R_X86_64_TLSDESC_CALL = 35;
|
||||||
R_X86_64_TLSDESC = 36;
|
R_X86_64_TLSDESC = 36;
|
||||||
R_X86_64_IRELATIVE = 37;
|
R_X86_64_IRELATIVE = 37;
|
||||||
|
R_X86_64_GOTPCRELX =41;
|
||||||
|
R_X86_64_REX_GOTPCRELX =42;
|
||||||
R_X86_64_GNU_VTINHERIT = 250; { GNU extension to record C++ vtable hierarchy }
|
R_X86_64_GNU_VTINHERIT = 250; { GNU extension to record C++ vtable hierarchy }
|
||||||
R_X86_64_GNU_VTENTRY = 251; { GNU extension to record C++ vtable member usage }
|
R_X86_64_GNU_VTENTRY = 251; { GNU extension to record C++ vtable member usage }
|
||||||
|
|
||||||
@ -169,6 +171,10 @@ implementation
|
|||||||
result:=R_X86_64_32S;
|
result:=R_X86_64_32S;
|
||||||
RELOC_GOTPCREL :
|
RELOC_GOTPCREL :
|
||||||
result:=R_X86_64_GOTPCREL;
|
result:=R_X86_64_GOTPCREL;
|
||||||
|
RELOC_GOTPCRELX :
|
||||||
|
result:=R_X86_64_GOTPCRELX;
|
||||||
|
RELOC_REX_GOTPCRELX :
|
||||||
|
result:=R_X86_64_REX_GOTPCRELX;
|
||||||
RELOC_PLT32 :
|
RELOC_PLT32 :
|
||||||
result:=R_X86_64_PLT32;
|
result:=R_X86_64_PLT32;
|
||||||
RELOC_TPOFF:
|
RELOC_TPOFF:
|
||||||
|
@ -30,7 +30,7 @@ type
|
|||||||
procedure SetValue(position:SizeUInt; value:T);inline;
|
procedure SetValue(position:SizeUInt; value:T);inline;
|
||||||
function GetValue(position:SizeUInt):T;inline;
|
function GetValue(position:SizeUInt):T;inline;
|
||||||
function GetMutable(position:SizeUInt):PT;inline;
|
function GetMutable(position:SizeUInt):PT;inline;
|
||||||
procedure IncreaseCapacity();inline;
|
procedure IncreaseCapacity();
|
||||||
public
|
public
|
||||||
function Size():SizeUInt;inline;
|
function Size():SizeUInt;inline;
|
||||||
constructor Create();
|
constructor Create();
|
||||||
@ -142,7 +142,14 @@ begin
|
|||||||
GetMutable:=@FData[(FStart+position) mod FCapacity];
|
GetMutable:=@FData[(FStart+position) mod FCapacity];
|
||||||
end;
|
end;
|
||||||
|
|
||||||
procedure TDeque.IncreaseCapacity;inline;
|
procedure TDeque.IncreaseCapacity;
|
||||||
|
function Min(const A,B: SizeUInt): SizeUInt; inline; //no need to drag in the entire Math unit ;-)
|
||||||
|
begin
|
||||||
|
if (A<B) then
|
||||||
|
Result:=A
|
||||||
|
else
|
||||||
|
Result:=B;
|
||||||
|
end;
|
||||||
const
|
const
|
||||||
// if size is small, multiply by 2;
|
// if size is small, multiply by 2;
|
||||||
// if size bigger but <256M, inc by 1/8*size;
|
// if size bigger but <256M, inc by 1/8*size;
|
||||||
@ -151,7 +158,7 @@ const
|
|||||||
cSizeBig = 256*1024*1024;
|
cSizeBig = 256*1024*1024;
|
||||||
var
|
var
|
||||||
i,OldEnd,
|
i,OldEnd,
|
||||||
DataSize:SizeUInt;
|
DataSize,CurLast,EmptyElems,Elems:SizeUInt;
|
||||||
begin
|
begin
|
||||||
OldEnd:=FCapacity;
|
OldEnd:=FCapacity;
|
||||||
DataSize:=FCapacity*SizeOf(T);
|
DataSize:=FCapacity*SizeOf(T);
|
||||||
@ -165,11 +172,32 @@ begin
|
|||||||
FCapacity:=FCapacity+FCapacity div 8
|
FCapacity:=FCapacity+FCapacity div 8
|
||||||
else
|
else
|
||||||
FCapacity:=FCapacity+FCapacity div 16;
|
FCapacity:=FCapacity+FCapacity div 16;
|
||||||
|
|
||||||
SetLength(FData, FCapacity);
|
SetLength(FData, FCapacity);
|
||||||
if (FStart>0) then
|
if (FStart>0) then
|
||||||
for i:=0 to FStart-1 do
|
begin
|
||||||
FData[OldEnd+i]:=FData[i];
|
if (FCapacity-OldEnd>=FStart) then //we have room to move all items in one go
|
||||||
|
begin
|
||||||
|
if IsManagedType(T) then
|
||||||
|
for i:=0 to FStart-1 do
|
||||||
|
FData[OldEnd+i]:=FData[i]
|
||||||
|
else
|
||||||
|
Move(FData[0], FData[OldEnd], FStart*SizeOf(T));
|
||||||
|
end
|
||||||
|
else
|
||||||
|
begin //we have to move things around in chunks: we have more data in front of FStart than we have newly created unused elements
|
||||||
|
CurLast := OldEnd-1;
|
||||||
|
EmptyElems:=FCapacity-1-CurLast;
|
||||||
|
while (FStart>0) do
|
||||||
|
begin
|
||||||
|
Elems:=Min(EmptyElems, FStart);
|
||||||
|
for i:=0 to Elems-1 do
|
||||||
|
FData[CurLast+1+i]:=FData[i];
|
||||||
|
for i := 0 to FCapacity-Elems-1 do
|
||||||
|
FData[i]:=FData[Elems+i];
|
||||||
|
Dec(FStart, Elems);
|
||||||
|
end;
|
||||||
|
end;
|
||||||
|
end;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
procedure TDeque.Reserve(cap:SizeUInt);inline;
|
procedure TDeque.Reserve(cap:SizeUInt);inline;
|
||||||
|
@ -2850,6 +2850,8 @@ function GetDefaultLibGCCDir(CPU : TCPU;OS: TOS; var ErrorMessage: string): stri
|
|||||||
var
|
var
|
||||||
CrossPrefix: string;
|
CrossPrefix: string;
|
||||||
UseBinutilsPrefix: boolean;
|
UseBinutilsPrefix: boolean;
|
||||||
|
SourceOS : TOS;
|
||||||
|
SourceCPU : TCPU;
|
||||||
|
|
||||||
function Get4thWord(const AString: string): string;
|
function Get4thWord(const AString: string): string;
|
||||||
var p: pchar;
|
var p: pchar;
|
||||||
@ -2916,24 +2918,35 @@ var
|
|||||||
begin
|
begin
|
||||||
result := '';
|
result := '';
|
||||||
ErrorMessage:='';
|
ErrorMessage:='';
|
||||||
if (Defaults.SourceOS<>OS) then
|
if assigned(Defaults) then
|
||||||
|
begin
|
||||||
|
SourceOS:=Defaults.SourceOS;
|
||||||
|
SourceCPU:=Defaults.SourceCPU;
|
||||||
|
end
|
||||||
|
else
|
||||||
|
begin
|
||||||
|
SourceOS:=StringToOS({$I %FPCTARGETOS%});
|
||||||
|
SourceCPU:=StringToCPU({$I %FPCTARGETCPU%});
|
||||||
|
end;
|
||||||
|
|
||||||
|
if (SourceOS<>OS) then
|
||||||
UseBinutilsPrefix:=true;
|
UseBinutilsPrefix:=true;
|
||||||
if (Defaults.SourceCPU<>CPU) then
|
if (SourceCPU<>CPU) then
|
||||||
begin
|
begin
|
||||||
{ we need to accept 32<->64 conversion }
|
{ we need to accept 32<->64 conversion }
|
||||||
{ expect for OpenBSD which does not allow this }
|
{ expect for OpenBSD which does not allow this }
|
||||||
if not(
|
if not(
|
||||||
((Defaults.SourceCPU=aarch64) and (CPU=arm)) or
|
((SourceCPU=aarch64) and (CPU=arm)) or
|
||||||
((Defaults.SourceCPU=powerpc64) and (CPU=powerpc)) or
|
((SourceCPU=powerpc64) and (CPU=powerpc)) or
|
||||||
((Defaults.SourceCPU=x86_64) and (CPU=i386)) or
|
((SourceCPU=x86_64) and (CPU=i386)) or
|
||||||
((Defaults.SourceCPU=riscv64) and (CPU=riscv32)) or
|
((SourceCPU=riscv64) and (CPU=riscv32)) or
|
||||||
((Defaults.SourceCPU=sparc64) and (CPU=sparc)) or
|
((SourceCPU=sparc64) and (CPU=sparc)) or
|
||||||
((CPU=aarch64) and (Defaults.SourceCPU=arm)) or
|
((CPU=aarch64) and (SourceCPU=arm)) or
|
||||||
((CPU=powerpc64) and (Defaults.SourceCPU=powerpc)) or
|
((CPU=powerpc64) and (SourceCPU=powerpc)) or
|
||||||
((CPU=x86_64) and (Defaults.SourceCPU=i386)) or
|
((CPU=x86_64) and (SourceCPU=i386)) or
|
||||||
((CPU=riscv64) and (Defaults.SourceCPU=riscv32)) or
|
((CPU=riscv64) and (SourceCPU=riscv32)) or
|
||||||
((CPU=sparc64) and (Defaults.SourceCPU=sparc))
|
((CPU=sparc64) and (SourceCPU=sparc))
|
||||||
) or (Defaults.SourceOS=openbsd) then
|
) or (SourceOS=openbsd) then
|
||||||
UseBinutilsPrefix:=true;
|
UseBinutilsPrefix:=true;
|
||||||
end;
|
end;
|
||||||
if not UseBinutilsPrefix then
|
if not UseBinutilsPrefix then
|
||||||
|
39
tests/webtbs/tw38306.pp
Normal file
39
tests/webtbs/tw38306.pp
Normal file
@ -0,0 +1,39 @@
|
|||||||
|
{ %OPT=-gh }
|
||||||
|
{$mode objfpc}
|
||||||
|
program gqueue_test;
|
||||||
|
|
||||||
|
uses
|
||||||
|
gqueue;
|
||||||
|
|
||||||
|
type
|
||||||
|
TIntQueue = specialize TQueue<Integer>;
|
||||||
|
|
||||||
|
var
|
||||||
|
IntQueue: TIntQueue;
|
||||||
|
PushCnt: Integer;
|
||||||
|
|
||||||
|
procedure Push2Pop1;
|
||||||
|
var
|
||||||
|
i: Integer;
|
||||||
|
begin
|
||||||
|
for i:= 0 to 1000000 do begin
|
||||||
|
IntQueue.Push(PushCnt);
|
||||||
|
inc(PushCnt);
|
||||||
|
IntQueue.Push(PushCnt);
|
||||||
|
inc(PushCnt);
|
||||||
|
IntQueue.Pop();
|
||||||
|
end;
|
||||||
|
end;
|
||||||
|
|
||||||
|
var
|
||||||
|
i: Integer;
|
||||||
|
begin
|
||||||
|
try
|
||||||
|
IntQueue:= TIntQueue.Create;
|
||||||
|
Push2Pop1;
|
||||||
|
WriteLn('Ready');
|
||||||
|
finally
|
||||||
|
IntQueue.Free;
|
||||||
|
end;
|
||||||
|
end.
|
||||||
|
|
11
utils/pas2js/dist/rtl.js
vendored
11
utils/pas2js/dist/rtl.js
vendored
@ -739,15 +739,20 @@ var rtl = {
|
|||||||
delete this[id];
|
delete this[id];
|
||||||
old._Release(); // may fail
|
old._Release(); // may fail
|
||||||
}
|
}
|
||||||
this[id]=intf;
|
if(intf) {
|
||||||
|
this[id]=intf;
|
||||||
|
}
|
||||||
return intf;
|
return intf;
|
||||||
},
|
},
|
||||||
free: function(){
|
free: function(){
|
||||||
//console.log('rtl.intfRefs.free...');
|
//console.log('rtl.intfRefs.free...');
|
||||||
for (var id in this){
|
for (var id in this){
|
||||||
if (this.hasOwnProperty(id)){
|
if (this.hasOwnProperty(id)){
|
||||||
//console.log('rtl.intfRefs.free: id='+id+' '+this[id].$name+' $o='+this[id].$o.$classname);
|
var intf = this[id];
|
||||||
this[id]._Release();
|
if (intf){
|
||||||
|
//console.log('rtl.intfRefs.free: id='+id+' '+intf.$name+' $o='+intf.$o.$classname);
|
||||||
|
intf._Release();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user