Commit Graph

3662 Commits

Author SHA1 Message Date
florian
fc3b635013 * patch by Bart B to fix the value of Code for unsigned types if the input is negative, resolves #39523 2022-01-11 21:29:56 +01:00
florian
f39a6a7755 * fpc_Val_SInt_ShortStr: bug fixes and improvements by Bart B 2022-01-08 14:45:12 +01:00
florian
38c06e64c7 * optimze case
* few formatting changes
2022-01-07 23:43:59 +01:00
florian
05072d0d82 * updated version by Bart B 2022-01-07 23:21:12 +01:00
florian
4c296af05e * reordered condition so they can be evaluated quicker 2022-01-07 19:36:34 +01:00
florian
d29a482cd1 * fixes for fpc_Val_SInt_ShortStr by Bart B
+ new test for fpc_Val_SInt_ShortStr
  + benchmark
2022-01-07 19:19:55 +01:00
florian
2a93e65511 * seperator => separator 2022-01-02 13:12:33 +01:00
Karoly Balogh
c298c0e0da rtl/osheap: fixed a dumb reversed condition in osheap/SysAllocMem() 2021-12-26 15:56:34 +01:00
florian
781b2d0a80 * patch by Rika: second part of #39496, resolves #30496
+ extended test
2021-12-25 20:01:32 +01:00
florian
c0979bbc0c * TObject.InitInstance got very big so inlining has no advantage anymore, resolves #39494 2021-12-25 19:09:22 +01:00
marcoonthegit
4568c77f57 * implemented stringofchar unicodestring, bug #39483 2021-12-14 15:07:43 +01:00
Jonas Maebe
4426d0da7a Fixed variant discriminator types 2021-10-31 21:13:35 +01:00
florian
ee10850a57 * patch by Sergey Larin: Reducing and aligning the size of TAnsiRec, TUnicodeRec for CPU64, resolves #38018:
For CPU64, the size of record TAnsiRec and TUnicodeRec is 16 bytes instead of 24.
    Which is very good also because of the alignment. when allocating memory, the address
    of the first character of the string will be aligned on the 16-byte boundary.
    At the same time, the useless Dummy field, which is needed in CPU64 for exactly alignment, has been removed.
    For CPU32 (and CPU16), the record size has not changed, so procedures such as
    fpc_AnsiStr_Decr_Ref, implemented in assembler (see i386, arm), remained working correctly.
  * tests adapted
2021-10-17 11:13:29 +02:00
Nikolay Nikolov
f20de5d583 * fixed padding in the filerec to match textrec even on platforms where
sizeof(pointer)<>sizeof(codepointer), like in the medium and compact i8086
  memory models
2021-10-13 02:02:50 +03:00
florian
91cf1774dd * replace MT random generator by Xoshiro128**, resolves #38237 2021-10-05 22:20:22 +02:00
Nikolay Nikolov
7afb665c92 + insert exception flag check and branch after each function call, when
compiling in WebAssembly branchful exceptions mode
2021-10-05 02:26:13 +03:00
Nikolay Nikolov
5124ab2521 * cloned the WebAssembly native exceptions code generation and rtl support into
the branchful exceptions (which will be modified later, but we're using this
  as their starting point, because we can get a snapshot built, without compiler
  internal errors)
2021-10-05 00:37:20 +03:00
Nikolay Nikolov
0c3e179652 - get rid of fpc_PushExceptAddr and fpc_PopAddrStack entirely, when compiling in
wasm native exceptions mode - these helper routines aren't necessary in this
  mode
2021-09-28 03:59:38 +03:00
Nikolay Nikolov
91f0f1a86c * don't include except.inc if wasm32 native exception is turned on, instead
replace it with except_native.inc
2021-09-28 03:46:30 +03:00
florian
a5f6505edc * fix range checking for zero based strings, resolves #39323 2021-09-05 21:03:31 +02:00
florian
396a030fc2 + debugging statement 2021-09-04 19:12:04 +02:00
michael
e6a593c5fa * Patch from Zeljko Avramovic to extend ordinal/float helpers
git-svn-id: trunk@49622 -
2021-07-21 11:36:05 +00:00
michael
1e6952264b * BitSizeOf Documentation sub (issue #39110)
git-svn-id: trunk@49571 -
2021-06-30 10:10:38 +00:00
svenbarth
cb953f68c2 * as 3.2.0 is now the oldest compiler we support we can now use {$push} {$pop} to reset the $minenumsize in the RTTI header
git-svn-id: trunk@49403 -
2021-05-27 05:43:01 +00:00
florian
1e1848da92 * fix exception generation in ln(...), resolves #38832
git-svn-id: trunk@49328 -
2021-05-02 19:45:09 +00:00
Tomas Hajny
9f6651fdb7 + added Get/SetTextAutoFlush feature
git-svn-id: trunk@49324 -
2021-05-02 14:59:21 +00:00
florian
5442e9f9d8 * insert explicit type cast for the count parameter of move/fillchar wrapping C functions,
avoids a warning in combination with -O3 and negative count values

git-svn-id: trunk@49205 -
2021-04-14 19:02:54 +00:00
Károly Balogh
7b9ed5fe46 rtl: make STACK_MARGIN a variable instead of a const. this allows adjusting margin size on system unit init, based on the actual stack length of the executable. useful for small systems running with little stack. allow overwriting SysBackTraceStr with a platform-specific implementation
git-svn-id: trunk@49200 -
2021-04-14 02:35:01 +00:00
pierre
86c036d9ed Explicitly disable range and overflow checking to avoid troubles with pointer arithmetics
git-svn-id: trunk@49198 -
2021-04-13 20:57:18 +00:00
Károly Balogh
caa2735203 osheap: new very small heap manager which only acts as a thin layer above an OS provided heap API. mainly aimed for small and embedded systems
git-svn-id: trunk@49145 -
2021-04-09 02:20:22 +00:00
Jonas Maebe
f13b47289e * handle case where the first instruction with line information is looked up
o this should be handled better. The common way is looking up address - 1,
     but that doesn't seem to work here.

git-svn-id: trunk@49142 -
2021-04-08 19:50:40 +00:00
Jonas Maebe
0eb9dd3879 * Darwin support for printing line info for backtraces when using Dwarf,
based on patches by Colin Western, mantis #38483)
   o requires that the program/library is compiled with -Xg (or that
     dsymutil is run on it after compiling), and that the .dSYM bundle
     is in the same directory as the program/library
   o always use the "dl" unit in exeinfo for Darwin, as that's needed for
     dynamic library support, and this does not cause an extra dependency
     since on Darwin we always use libc
   o cleaned up the exeinfo unit for Darwin, and sped it up by using mmap
     instead of small reads
   o fixed unit dependencies for exeinfo, lineinfo and lnfodwarf in Darwin
     RTL Makefile
  * use the process address info from the original exe even when reading
    the debug information from an external file
  - removed outdated ifdef'd darwin code from dl.pp (no longer needed now
    that processaddress gets set correctly in exeinfo for that platform)

git-svn-id: trunk@49140 -
2021-04-08 19:50:34 +00:00
florian
45b3d8e0bf * check for cache entry before even trying to open the file containing the debug info
git-svn-id: trunk@49086 -
2021-03-30 14:06:19 +00:00
florian
4dfcdeaef8 + use a hash table to speed up line info retrieval
git-svn-id: trunk@49080 -
2021-03-29 12:20:39 +00:00
Károly Balogh
45b5e9215c rtl: remove defines for v2.x compiler from the common part of the RTL. It's no longer suppported to build with that
git-svn-id: trunk@49036 -
2021-03-23 09:32:49 +00:00
nickysn
800bb3adc2 * instead of using discardresult, wrap the uniquestring functions in procedures,
that are declared as inline

git-svn-id: trunk@49016 -
2021-03-19 21:13:20 +00:00
florian
3072df59ff * overflow checked mul helpers do not need to check all bits either
git-svn-id: trunk@48999 -
2021-03-17 21:30:41 +00:00
nickysn
a9f4c8a16b * compilation on Windows fixed
git-svn-id: trunk@48958 -
2021-03-14 02:53:41 +00:00
nickysn
df947d3ae8 * fixed rtl compilation with FPC 3.2.0 starting compiler
git-svn-id: branches/wasm@48305 -
2021-01-22 00:48:44 +00:00
nickysn
7e958e0a35 + introduced the discardresult directive and declared the UniqueString()
overloads, using this directive

git-svn-id: branches/wasm@48283 -
2021-01-21 21:42:07 +00:00
nickysn
05d66eddfc * synchronized with trunk
git-svn-id: branches/wasm@47982 -
2021-01-02 22:06:17 +00:00
florian
8b08079224 * fpc_AnsiStr_Concat: if one of the strings is empty and CP_NONE is passed, the code page
of the other string is taken, this is also like fpc_AnsiStr_Concat_multi works if length(sarr)=2

git-svn-id: trunk@47976 -
2021-01-02 16:39:39 +00:00
nickysn
a5fafea8d1 * more updates to attempt to get a larger part of the full RTL to compile for WASM32
git-svn-id: branches/wasm@47970 -
2021-01-02 13:01:39 +00:00
nickysn
4c85306f69 + added wasm32 type defines
git-svn-id: branches/wasm@47957 -
2021-01-02 07:58:33 +00:00
Jonas Maebe
b359080f42 * fixed round(currency) so it takes the rounding mode into account on
platforms where currency is "type int64"
  * inline trunc(currency), trunc(comp) and round(comp) on platforms where
    currency and comp are "type int64"

git-svn-id: trunk@47859 -
2020-12-27 13:19:02 +00:00
florian
1d92cc43bb * fpc_ln_real raises an exception for invalid operands if they exception is not masked
git-svn-id: trunk@47813 -
2020-12-18 22:36:17 +00:00
florian
2e2f2eb784 - remove could which prevented that rte is triggered even if we are inside
an exception block but *without* using sysutils. The remove code
    was once added to have primitive exception handling even if
    no sysutils is used. But if this is desired, an appropriate handler
    to ErrorProc should be assigned. Resolves #38201

git-svn-id: trunk@47775 -
2020-12-14 21:55:42 +00:00
florian
53a4e6c513 * patch by Zoran Vučenović: fixes TDoubleRec.SetFrac, resolves #38202
+ test

git-svn-id: trunk@47765 -
2020-12-12 21:39:17 +00:00
ondrej
1a0ba60de6 * revert r47598: implement TRandomGenerator
git-svn-id: trunk@47605 -
2020-11-27 04:53:06 +00:00
ondrej
c4dd3b661a * rtl: implement TRandomGenerator for thread-safe random
git-svn-id: trunk@47598 -
2020-11-26 05:59:00 +00:00
pierre
e4e1ea586c Revert wrong change, llvm supports extended constants
git-svn-id: trunk@47554 -
2020-11-24 13:55:27 +00:00
pierre
6d900039c4 Fix LLVM compilation by casting untyped real constants to double type, as LLVM does not support extended type constant apparently
git-svn-id: trunk@47551 -
2020-11-24 08:02:29 +00:00
michael
257ef24a1e * Fix bug ID #38008: allow UTF8 to unicode conversion to react on/ignore invalid input
git-svn-id: trunk@47391 -
2020-11-12 09:17:09 +00:00
Károly Balogh
05d680902e * make sure things still build with 3.0 after r47353
git-svn-id: trunk@47359 -
2020-11-09 00:24:29 +00:00
svenbarth
c496b609d1 * fix for Mantis #38051: make Chr() a real intrinsics so that it can be used in type declarations as well
+ added test

git-svn-id: trunk@47353 -
2020-11-08 22:23:02 +00:00
ondrej
a65158bfe8 * fix memory leak in RegisterLazyInitThreadingProc
git-svn-id: trunk@47311 -
2020-11-04 20:10:43 +00:00
ondrej
c64429cdd0 * lazy thread initialization support
git-svn-id: trunk@47308 -
2020-11-04 14:55:40 +00:00
svenbarth
ac36eec71a * protect GetFullName with FPC_HAS_FEATURE_UNICODESTRINGS instead of _WIDESTRINGS
git-svn-id: trunk@47294 -
2020-11-03 19:25:32 +00:00
pierre
e80b1d9e70 Put GetFullName functions inside $ifdef FPC_WIDESTRING_EQUAL_UNICODESTRING
git-svn-id: trunk@47287 -
2020-11-03 07:13:59 +00:00
svenbarth
c2454d5386 * fix for Mantis #38023: the code to convert LF to CRLF when converting to UTF-8 is disabled anyway, so disable unnecessary, duplicate if-branches as well
git-svn-id: trunk@47284 -
2020-11-02 16:42:32 +00:00
pierre
c2c4048e92 Fix compilation of RTL when USE_FILEREC_FULLNAME is not defined
git-svn-id: trunk@47267 -
2020-11-01 08:23:40 +00:00
Károly Balogh
3aa0d92c79 fix casting typo in r47263
git-svn-id: trunk@47265 -
2020-10-31 20:46:19 +00:00
florian
408fc819b3 + initial implementation of a FullName field in file records to overcome length limitions of the name field
git-svn-id: trunk@47263 -
2020-10-31 19:54:40 +00:00
svenbarth
16eb670e67 * use the sizes of the floatx80 and float128 structs for arrays having their size to avoid problems with padding on different platforms
git-svn-id: trunk@47198 -
2020-10-25 15:36:31 +00:00
svenbarth
52cf07d968 * the define to check for inclusion in the System unit is FPC_IS_SYSTEM, *not* FPC_IN_SYSTEM
git-svn-id: trunk@47197 -
2020-10-25 15:20:39 +00:00
svenbarth
b0f0ff1bc6 * fix for Mantis #37986: apply patch by Bart Broersma to fix a typo in a comment
git-svn-id: trunk@47196 -
2020-10-25 13:20:38 +00:00
svenbarth
d51213d26a * adjust softfpu unit so that it can be really used as a standalone unit instead of mainly as part of the System unit
git-svn-id: trunk@47193 -
2020-10-25 10:18:18 +00:00
florian
4afa4a73c6 + ISO mode: accept put/get without parameter, works on Input/Output respectively, resolves #37949
git-svn-id: trunk@47147 -
2020-10-20 21:03:51 +00:00
Jonas Maebe
d0d07dc3bf * naturally align threadvar lists/tables
o required for (future) Darwin arm64e target, and a good idea elsewhere too
     (on constrained targets, it won't make a difference because the alignment
     of pointers won't be > sizeof(longint))

git-svn-id: trunk@47115 -
2020-10-15 20:29:32 +00:00
florian
c9fcc68ec1 * enable the compiler to optimize away parts of System.PushExceptObject, if System.get_frame is not implemented, i.e. returning nil
git-svn-id: trunk@47058 -
2020-10-06 19:43:17 +00:00
florian
e718cb985e * replace some longint by ObjpasInt
git-svn-id: trunk@47047 -
2020-10-04 20:50:39 +00:00
florian
af20b064ed * make framecount and framebufsize dependent on the pointer size
git-svn-id: trunk@47030 -
2020-10-01 20:33:03 +00:00
florian
1bf58c2a55 + introduce TExitCode
git-svn-id: trunk@47029 -
2020-10-01 20:33:02 +00:00
florian
1e4dc56155 * inlinable frame handling dummies for avr
* inline frame handler if possible

git-svn-id: trunk@47025 -
2020-09-30 21:18:33 +00:00
florian
7f53d04ffd + xtensa: make use of nsau to implement Bsr*
git-svn-id: trunk@46963 -
2020-09-26 22:03:13 +00:00
florian
40d9b1108a * add VUString branch to tvardata, resolves #37651
git-svn-id: trunk@46957 -
2020-09-26 15:35:20 +00:00
Tomas Hajny
a71f87357d * simplified version of SeekEof for improved TP/BP/Delphi compatibility by Andrey 'Croco' Stolyarov as fix for #37716, plus a new test for testing the compatibility
git-svn-id: trunk@46946 -
2020-09-24 19:33:28 +00:00
pierre
d52aaf63eb msxdos target uses same __fpc_envp symbol as msdos
git-svn-id: trunk@46935 -
2020-09-24 09:48:49 +00:00
florian
e33f794eb6 * correctly handle eof in typed files in iso mode
git-svn-id: trunk@46918 -
2020-09-22 19:51:43 +00:00
florian
449cc8f152 * make use of AllocMem in fpc_dynarray_setlength
git-svn-id: trunk@46900 -
2020-09-19 21:06:11 +00:00
svenbarth
0c316deab5 * readd SmallInt typecasts to SmallInt overload of SwapEndian
git-svn-id: trunk@46898 -
2020-09-19 17:42:04 +00:00
svenbarth
9d86fed95b * avoid range check error when using SwapEndian with 16-bit constants
+ added test

git-svn-id: trunk@46897 -
2020-09-19 17:04:17 +00:00
svenbarth
15141124f4 * restore ability to cycle with 3.0.4 (at least until 3.2.2 is released) after r46890
git-svn-id: trunk@46895 -
2020-09-19 13:54:25 +00:00
svenbarth
d3e18ccb5e * fix for Mantis #37221: apply adjusted patch by Ondrej Pokorny to allow the use of Copy() on open array parameters (the result will be a dynamic array)
+ added test

git-svn-id: trunk@46890 -
2020-09-18 15:00:10 +00:00
florian
f8c1df0852 * ISO mode: handle typed files as text files regarding naming/program parameters, resolves #37415
git-svn-id: trunk@46865 -
2020-09-14 20:16:08 +00:00
Tomas Hajny
1eb11a2a29 * fix for problem with commit 46853
git-svn-id: trunk@46864 -
2020-09-14 05:30:59 +00:00
Tomas Hajny
3c9257300d * fix for bug #37716 by Andrey 'Croco' Stolyarov
git-svn-id: trunk@46853 -
2020-09-11 23:43:32 +00:00
pierre
1e8aa99f81 * Disable range and overflow checking inside softfpu implementation
git-svn-id: trunk@46682 -
2020-08-25 06:34:29 +00:00
florian
832c3d89c8 * Xtensa: disable simple random again, committed by accident
git-svn-id: trunk@46552 -
2020-08-22 20:36:26 +00:00
florian
04846345b2 * Xtensa: more fixes to tcg64fxtensa.a_op64_const_reg_reg and tcg64fxtensa.a_op64_reg_reg_reg
git-svn-id: trunk@46551 -
2020-08-22 20:33:30 +00:00
michael
213d2905df * Change some methods from using var to using out (bug ID 37376)
git-svn-id: trunk@46533 -
2020-08-21 10:44:48 +00:00
michael
82346563c1 * Add StoredAttribute class, bug ID #37602
git-svn-id: trunk@46506 -
2020-08-20 12:06:14 +00:00
michael
8bc2326b77 * Fix bug #37601: add some attribte definitions
git-svn-id: trunk@46505 -
2020-08-20 11:53:43 +00:00
yury
9d41a435c2 * tinyheap: Disable inline when FPC_TINYHEAP_HUGE is defined to prevent code bloat.
git-svn-id: trunk@46492 -
2020-08-19 10:48:00 +00:00
ondrej
cfff96f44c FExpand: always uppercase drive letter also in BasePath
git-svn-id: trunk@46353 -
2020-08-10 20:42:13 +00:00
yury
ec10ee8218 * Improved generic implementations of fpc_mul_dword, fpc_mul_word, fpc_mul_byte to use less iterations and registers.
git-svn-id: trunk@46269 -
2020-08-05 17:58:46 +00:00
yury
aa633544f1 * Added a simple implementation of random. It is TP/Delphi compatible. Enabled it for 8/16 bit CPUs by default.
git-svn-id: trunk@46266 -
2020-08-05 16:29:07 +00:00
florian
7281ea7a2c * floating point division by zero should throw run time error 208, fixed
git-svn-id: trunk@46210 -
2020-08-03 19:42:16 +00:00
yury
6edbc9ed7e * tinyheap: Early check for very big requested mem sizes in order to prevent overflows and properly report the out of memory error.
git-svn-id: trunk@45844 -
2020-07-24 16:02:13 +00:00
pierre
adf064cbb4 New: rtl/inc/genmathh.inc source file, to provide a unique position
for the interface definition of float64 and float32 records,
  available to all systems if FPUNONE is not defined.

  rtl/inc/genmath.inc: Remove float64/float32, as they are now in rtl/inc/genmathh.inc
  rtl/inc/softfpu.pp: Use provided definitions of float32 and float64
  if available (by checking presence of FPC_SYSTEM_HAS_floatXX macro)

  rtl/inc/systemh.inc: include genmathh.inc if FPUNONE is not defined.
  rtl/java/jsystemh_types.inc: Likewise.

git-svn-id: trunk@45821 -
2020-07-21 14:24:14 +00:00