* synchronized with trunk

git-svn-id: branches/wasm@46418 -
This commit is contained in:
nickysn 2020-08-14 02:04:01 +00:00
commit f0aca344dc
8 changed files with 80 additions and 16 deletions

1
.gitattributes vendored
View File

@ -18445,6 +18445,7 @@ tests/webtbs/tw37228.pp svneol=native#text/plain
tests/webtbs/tw37254.pp svneol=native#text/pascal
tests/webtbs/tw37261.pp svneol=native#text/pascal
tests/webtbs/tw37272a.pp svneol=native#text/pascal
tests/webtbs/tw37286.pp svneol=native#text/pascal
tests/webtbs/tw37301.pp svneol=native#text/pascal
tests/webtbs/tw37322.pp svneol=native#text/pascal
tests/webtbs/tw37323.pp svneol=native#text/pascal

View File

@ -1315,12 +1315,15 @@ implementation
{arm_attribute} [oso_data]
);
begin
if (aType in [sec_rodata,sec_rodata_norel]) then
if target_asm.id in asms_int_coff then
begin
if (target_info.system in systems_all_windows) then
aType:=sec_rodata_norel
else
aType:=sec_data;
if (aType in [sec_rodata,sec_rodata_norel]) then
begin
if (target_info.system in systems_all_windows) then
aType:=sec_rodata_norel
else
aType:=sec_data;
end;
end;
result:=secoptions[atype];
{$ifdef OMFOBJSUPPORT}

View File

@ -443,6 +443,10 @@ interface
+ [system_i386_beos,system_i386_haiku]
+ [system_powerpc_morphos];
{ all internal COFF writers }
asms_int_coff = [as_arm_pecoffwince,as_x86_64_pecoff,as_i386_pecoffwince,
as_i386_pecoffwdosx,as_i386_pecoff,as_i386_coff];
cpu2str : array[TSystemCpu] of string[10] =
('','i386','m68k','alpha','powerpc','sparc','vm','ia64','x86_64',
'mips','arm', 'powerpc64', 'avr', 'mipsel','jvm', 'i8086',

View File

@ -742,7 +742,9 @@ implementation
else
Internalerror(2020031401);
end;
end;
end
else if target_info.abi=abi_xtensa_windowed then
list.concat(taicpu.op_reg_const(A_ENTRY,NR_STACK_POINTER_REG,16));
end;

View File

@ -939,10 +939,35 @@ begin
Raise EConvertError.Create('Invalid JSON String:'+S);
end;
{$ELSE}
function BufferHexToInt(P : PAnsiChar): integer;
var
N, i: integer;
ch: char;
begin
Result:= 0;
for i:= 1 to 4 do
begin
ch:= p^;
case ch of
'0'..'9':
N:= Ord(ch)-Ord('0');
'a'..'f':
N:= Ord(ch)-(Ord('a')-10);
'A'..'F':
N:= Ord(ch)-(Ord('A')-10);
else
exit(-1);
end;
Inc(P);
Result:= Result*16+N;
end;
end;
Var
I,J,L,U1,U2 : Integer;
App,W : String;
App : String;
Procedure MaybeAppendUnicode;
@ -982,20 +1007,17 @@ begin
'f' : App:=#12;
'r' : App:=#13;
'u' : begin
W:=Copy(S,I+1,4);
U2:=BufferHexToInt(PAnsiChar(@S[I+1]));
if U2=-1 then
Raise EJSON.Create('Invalid unicode hex code: '+Copy(S,I+1,4));
Inc(I,4);
u2:=StrToInt('$'+W);
if (U1<>0) then
begin
App:={$IFDEF FPC_HAS_CPSTRING}UTF8Encode({$ENDIF}WideChar(U1)+WideChar(U2){$IFDEF FPC_HAS_CPSTRING}){$ENDIF};
writeln('app a: ',L,': ',App);
U2:=0;
end
else
begin
writeln('app b: ',L,': ',WideChar(U2));
U1:=U2;
end;
end;
end;
if App<>'' then

View File

@ -129,8 +129,17 @@ begin
// Add to existing structural type
if (FStruct is TJSONObject) then
begin
if (Not (joIgnoreDuplicates in options)) or (TJSONObject(FStruct).IndexOfName(FKey)=-1) then
TJSONObject(FStruct).Add(FKey,AValue);
if (Not (joIgnoreDuplicates in options)) then
try
TJSONObject(FStruct).Add(FKey,AValue);
except
AValue.Free;
Raise;
end
else if (TJSONObject(FStruct).IndexOfName(FKey)=-1) then
TJSONObject(FStruct).Add(FKey,AValue)
else
AValue.Free;
FKey:='';
end
else if (FStruct is TJSONArray) then

View File

@ -198,11 +198,14 @@ procedure TPasWriter.AddLn(const s: string);
Var
L : String;
len : Integer;
begin
Add(s);
L:=PostProcessLine(FCurrentLine);
Stream.Write(L[1],Length(L));
Len:=Length(L);
if Len>0 then
Stream.Write(L[1],Len);
Stream.Write(FLineEnding[1],Length(FLineEnding));
IsStartOfLine:=True;
FCurrentLine:='';

20
tests/webtbs/tw37286.pp Normal file
View File

@ -0,0 +1,20 @@
{ %NORUN }
program tw37286;
{$mode objfpc}
var preShiftWorldDx: LongInt;
WorldDx: LongInt;
playWidth: LongInt;
procedure ShiftWorld(Dir: LongInt); inline;
begin
preShiftWorldDx:= WorldDx;
WorldDx:= WorldDx + LongInt(Dir * LongInt(playWidth));
end;
begin
ShiftWorld(-1);
end.