Commit Graph

231 Commits

Author SHA1 Message Date
florian
4765728fc4 * use SarInt64 to optimize 64 bit divs on 32 bit platforms, resolves #20998
git-svn-id: trunk@19968 -
2012-01-04 22:58:25 +00:00
sergei
009ee271ec - Cleaned out STR_CONCAT_PROCS define
- i386-specific fpc_shortstr_append_shortstr removed too, because a) it was anyway disabled with STR_CONCAT_PROCS, b) the generic implementation is smaller and probably faster due to optimized Move().

git-svn-id: trunk@19867 -
2011-12-17 17:22:18 +00:00
sergei
724f41a9af - Cleaned out FPC_STRTOSHORTSTRPROC and FPC_STRTOCHARARRAYPROC defines. Somebody had to do it one day.
git-svn-id: trunk@19851 -
2011-12-14 22:40:08 +00:00
Jonas Maebe
676ca4c891 * ifdef jvm -> ifdef cpujvm
git-svn-id: branches/jvmbackend@19829 -
2011-12-12 02:34:15 +00:00
sergei
8dc6ebb5ed rtl/generic.inc, minor optimizations:
* fpc_help_constructor: call platform-optimized version of FillChar directly instead of going through generic overloaded version.
* don't compile software multiplication routines if not necessary (the interface part already has similar $ifdef around)
* fpc_shortstr_append_shortstr: use sizeint instead of integer (the latter is 16-bit, produces less efficient code on most platforms)

git-svn-id: trunk@19727 -
2011-12-02 20:55:53 +00:00
florian
d7f7a9bb76 * patch by Alexander Shishkin to clean up $ifopt usage by $push/$pop, resolves #20346
git-svn-id: trunk@19256 -
2011-09-27 20:22:40 +00:00
Jonas Maebe
a4cf406189 * use generic string concatentation and comparison infrastructure for the
JVM target (and also the generic routines in case of shortstrings)

git-svn-id: branches/jvmbackend@18910 -
2011-08-29 22:59:25 +00:00
Jonas Maebe
10c586146a * moved fpc_shortstr_shortstr/chararray_intern_charmove() from sstrings.inc
to generic.inc
  * converted fpc_shortstr_concat(_multi) to use those routines so can also be
    activated for the JVM port

git-svn-id: branches/jvmbackend@18907 -
2011-08-29 22:59:10 +00:00
Jonas Maebe
8a95a04e16 * extracted dynarray helpers from system unit into jdynarr.inc (were
in the system unit for easier debugging)
  * disabled a bunch more feature flags by default for the JVM target
  * incorporate modified version of inc/systemh.inc (split into two parts:
    jsystemh_types.inc and jsystemh.inc, because some of the types are
    required for the declaration of the shortstring/ansistring/set/...
    classes, which in turn are required for the routine declarations) and
    inc/system.inc (as jsystem.inc)
   o moved some routines around from old to new locations based on where
     they appear in the common files
   o added a number of defines that allow skipping more common implementations
     in case a platform-specific one is already available
  * all base classes (AnsistringClass etc) are now descendants of
    JLObject rather than TObject, because their declaration is now parsed
    before TObject is known (and there's no need for them to inherit from
    TObject)
  * incorporate modified version of inc/system.inc
  * use the common version of generic.inc, currh.inc, gencurr.inc and
    genmath.inc (with small modification to those files)
  + addition of quite a bit of system unit functionality (halt, runerror,
    random, round, str() for integer types, abs, odd, endian swapping helpers,
    bit scanning, trigonometric functions, ln, exp, ...)
   o round()/trunc() for comp-types has been renamed trunc_comp() on the
     JVM target because their JVM signature conflicts with trunc(currency)
   o the unsigned versions of swapendian() and other endian helpers are not
     available on the JVM target because of JVM signature conflicts

git-svn-id: branches/jvmbackend@18746 -
2011-08-20 08:32:13 +00:00
Jonas Maebe
c5dfa9d354 * fixed fpc_shortstr_concat() in case the max length for the destination is
already smaller than the length of the first string (probably cannot
    happen currently, but may be in the future as a result of optimizations)

git-svn-id: trunk@17886 -
2011-06-30 15:48:52 +00:00
florian
efea42bcdf * rewrote Ror/Rol/Sar so that it can be completely folded into a const by the compiler
if possible, the copied (dist and xxx) expressions are folded by the CSE so they don't hurt

git-svn-id: trunk@17764 -
2011-06-16 20:27:11 +00:00
sergei
4ebc34c5e7 * Promoted result type of FPC_PCHAR_LENGTH and FPC_PWIDECHAR_LENGTH to SizeInt.
+ Check for nil pointer in FPC_PWIDECHAR_LENGTH

git-svn-id: trunk@17733 -
2011-06-13 04:59:17 +00:00
florian
0bc3ec2b8a * fix headers of fpc_mul helpers
git-svn-id: branches/avr@17029 -
2011-02-26 21:01:27 +00:00
florian
b4d4d4b208 * compilation fix
git-svn-id: branches/avr@17021 -
2011-02-26 20:56:36 +00:00
florian
d5455cf6ac + software multiplication support for OS_16,OS_S16,OS_32,OS_S32
git-svn-id: branches/avr@17020 -
2011-02-26 20:33:01 +00:00
florian
5dae691c96 * implementation of bit scan intrinsics by Richard Vida, resolves #17592
git-svn-id: trunk@16174 -
2010-10-16 15:03:30 +00:00
florian
dfc2652062 + support of compiler intrinsic sar* using a patch by Benjamin Rosseaux, resolves #15606
git-svn-id: trunk@14834 -
2010-01-31 16:47:01 +00:00
florian
6ff15f46e2 * made SwapEndian(<16 Bit>); inlined
git-svn-id: trunk@13453 -
2009-07-26 13:50:57 +00:00
ivost
02d177c885 * added FillQWord, IndexQWord, but CompareQWord is still missing
git-svn-id: trunk@13282 -
2009-06-15 21:35:52 +00:00
Jonas Maebe
b912e00440 * renamed rol/ror functions into rolbyte/rolword/roldword/rolqword
(and the same for ror), because their operation is very dependent on the
    operand size, and it's fairly easy to misjudge the bitwidth of the outcome
    of an expression in Pascal if you are not intimately familiar with the
    language (or if you don't know the exact types of all involved values in
    an expression)

git-svn-id: trunk@12621 -
2009-01-28 12:56:27 +00:00
Jonas Maebe
22aacd2a60 * return 0 for length(pchar(0)), like Kylix does (using corrected and
multi-platform version of patch in r12461, which caused the i386 version
    of fpc_pchar_length to return 0 in all cases, which used tabs, and did
    not include a test case)

git-svn-id: trunk@12464 -
2009-01-01 22:02:17 +00:00
Jonas Maebe
bc9e7c5580 * fixed syntax errors in r11708 (and it wasn't tested in the nightly
Sparc regressions tests because Solaris is an FPC_USE_LIBC platform,
    and these use memset rather than the generic fillchar)

git-svn-id: trunk@11711 -
2008-09-05 13:14:41 +00:00
Jonas Maebe
af05770a7c * fixed alignment code in generic fillchar (not sure why
tests/test/tfillchr didn't fail in the nightly sparc tests)

git-svn-id: trunk@11708 -
2008-09-04 21:42:51 +00:00
florian
20e632c8d8 * reorganized ror/rol defines
git-svn-id: trunk@11472 -
2008-07-28 13:03:18 +00:00
florian
1afb1aa9cc + ror/rol functions
+ internal compiler support for ror/rol on i386

git-svn-id: trunk@11466 -
2008-07-27 17:12:32 +00:00
florian
d672700a59 * some avr fixes
+ cpu16 type defines

git-svn-id: trunk@11380 -
2008-07-13 18:16:24 +00:00
yury
d1dd8bd928 * Fixed warning and notes.
git-svn-id: trunk@10899 -
2008-05-07 12:35:03 +00:00
Jonas Maebe
95637dea75 * fixed swapendian(smallint) (bug found by Joost van der Sluis)
* based swap(smallint) and swap(word) on swapendian(smallint/word),
    since the same bug was already fixed in swap(smallint) in r6752
    (so these routines now share the same code)
  * fixed potential range error in swapendian(word)
  + added basic test for the above four routines

git-svn-id: trunk@10840 -
2008-04-29 22:14:43 +00:00
micha
83b7f81f81 + add no-fpu support to compiler/rtl for powerpc-linux (-Cfnone)
git-svn-id: trunk@10422 -
2008-03-02 12:59:02 +00:00
peter
1561d97465 * optimize write loop in int_str
git-svn-id: trunk@9794 -
2008-01-19 16:48:12 +00:00
Jonas Maebe
bf9b021749 * optimized align() so it no longer contains any branches which
are undecidable at compile time
  + basic test for align() function

git-svn-id: trunk@9674 -
2008-01-07 21:41:12 +00:00
florian
c64ab62bdf * fixed CompareChar0, resolves #10151
git-svn-id: trunk@9219 -
2007-11-12 20:01:57 +00:00
florian
c794ec6de0 * fix Index*Word for CPUs requiring proper alignment
git-svn-id: trunk@9105 -
2007-11-03 15:51:11 +00:00
florian
b59fdbeb93 * CompareWord and CompareDWord fixed for building with <2.3.1
git-svn-id: trunk@9087 -
2007-11-02 23:33:57 +00:00
yury
3d1d9815ac * Fixed CompareDWord.
git-svn-id: trunk@9058 -
2007-11-02 11:19:10 +00:00
yury
5e9dd6cd4c * Fixed CompareDWord after r8827 (compiler warnings should not be ignored :).
git-svn-id: trunk@9038 -
2007-11-01 13:42:01 +00:00
yury
2770652beb * Fixed unreachable code warnings and removed not used variable.
git-svn-id: trunk@9036 -
2007-11-01 13:28:08 +00:00
florian
7da7364ee7 * refactored SysResetFPU into SysInitFPU and SysResetFPU
git-svn-id: trunk@8966 -
2007-10-28 12:06:49 +00:00
florian
7878f0feb3 * made all fpc_*_to_shortstr helpers a procedure, resolves #8580
git-svn-id: trunk@8898 -
2007-10-21 17:33:18 +00:00
florian
4b69743c92 * fixed compilation on non sigbusing cpus
git-svn-id: trunk@8829 -
2007-10-16 21:14:41 +00:00
florian
3f24d63176 * fixed Compare* for CPUs requiring natural alignment
git-svn-id: trunk@8827 -
2007-10-16 20:32:59 +00:00
peter
4f862a23a7 * fixed alignment leftover in compare
git-svn-id: trunk@8823 -
2007-10-16 17:53:00 +00:00
florian
96eaeeaf98 * fixed Index* for 64 Bit CPUs
* use forward move as much as possible

git-svn-id: trunk@8778 -
2007-10-13 19:06:41 +00:00
Jonas Maebe
775ee6f563 * len=0 should not be treated as overflow in comparebyte/word/dword
(further fix to r8754, fixes regresssion of twide4 on sparc/solaris)

git-svn-id: trunk@8765 -
2007-10-11 17:10:29 +00:00
Jonas Maebe
b5a1a6c6b4 * fixed generic index- and comparebyte/word/dword for limits which
overflow the pointer range (fixes tw3612 regression on sparc/solaris)

git-svn-id: trunk@8754 -
2007-10-09 11:00:15 +00:00
peter
e8322a83e4 * optimized generic implementations to use pointers instead of
array accesses. This also allows better register variable
    optimizations

git-svn-id: trunk@8742 -
2007-10-07 18:36:18 +00:00
Jonas Maebe
9bd4fe433b * fixed buffer overflows in int_str() + test
git-svn-id: trunk@8395 -
2007-09-07 14:06:08 +00:00
micha
d95b9082bb * add memory barrier prototypes + implementation for i386 and sparc + use lwsync for powerpc64
git-svn-id: trunk@8240 -
2007-08-07 20:37:08 +00:00
micha
7475f656f8 + add memory barrier routines for powerpc/64
git-svn-id: trunk@8179 -
2007-07-28 12:47:48 +00:00
daniel
bb5fea342f * RTL updates needed to successfully cycle with -CIcommon_type.
git-svn-id: trunk@8119 -
2007-07-21 19:22:28 +00:00
daniel
32216bcccd * ptrint -> ptruint
git-svn-id: trunk@7888 -
2007-07-01 09:41:07 +00:00
daniel
8ee5966a2e * Fix comparedword and change it to cardinal.
git-svn-id: trunk@7804 -
2007-06-24 21:17:43 +00:00
Jonas Maebe
9cec910eb9 * changed *string_to_*chararray helpers from functions into procedures
because on win64 the location of a function result can depend on its
    size (so some chararrays had to be returned in registers and others
    by reference, which means it's impossible to have a generic function
    declaration which works in all cases) (mantis #8533)
  * pad constant string assignments to chararrays with #0 up to the
    length of the chararray for 2.0.x compatibility (fixes
    tests/test/tarray3)

git-svn-id: trunk@6915 -
2007-03-18 12:20:01 +00:00
Jonas Maebe
a2c3826281 * changed fpc_big_chararray and fpc_big_widechararray from
array[0..1023] into array[0..0], because they're used as
    dummy return types for the Xstring_to_chararray helpers,
    and if a smaller array is actually passed as result then
    having a larger array declared will cause -gt to
    overwrite other data

git-svn-id: trunk@6855 -
2007-03-14 19:45:07 +00:00
peter
cd767cf5c8 * i386 uses generic fpc_compare_shortstr_equal
git-svn-id: trunk@6335 -
2007-02-04 16:24:02 +00:00
daniel
e8050233af + Patch by Thorsten Engler to optimize string comparisons for = and <> cases. (Mantis #8231)
git-svn-id: trunk@6241 -
2007-01-28 10:58:52 +00:00
florian
b3a1868ff0 * correct masking of exceptions in genmath code
git-svn-id: trunk@5965 -
2007-01-14 10:44:10 +00:00
yury
2244f1b9c6 * fixed warning.
git-svn-id: trunk@5853 -
2007-01-08 19:08:34 +00:00
florian
fd2032dab2 + start of embedded rtl
+ feature support in the compiler

git-svn-id: trunk@5628 -
2006-12-17 18:40:36 +00:00
peter
2f0ce31751 * string concat changed from function to procedure to
allow runtime optimization if the destination is the
    same as a source parameter
  * tassignmentnode now sets aktassignmentnode global that can be used
    to use the left node as a destination parameter and
    skip the assignment
  * disabled all cpu specific shortstr concat/append

git-svn-id: trunk@4770 -
2006-10-02 20:00:06 +00:00
yury
11576fd24b * fixed warnings and notes while compiling system unit for wince.
git-svn-id: trunk@4250 -
2006-07-18 15:00:09 +00:00
peter
fc3e5f68c8 * align needs to be unsigned, patch from Burkhard Carstens
git-svn-id: trunk@4090 -
2006-07-04 16:38:19 +00:00
florian
069ac7d163 * endian conversion functions
git-svn-id: trunk@3543 -
2006-05-15 19:42:13 +00:00
peter
2d3c01d83a * basic work to make Move() and FillChar() internal under ifdef INTERNALMOVEFILLCHAR
git-svn-id: trunk@3021 -
2006-03-24 17:32:39 +00:00
peter
340cf721b5 * faster int_str
* removed i386 int_str since the generic implementation is faster

git-svn-id: trunk@2646 -
2006-02-20 08:31:20 +00:00
daniel
3a60adb3a1 * var back to out
git-svn-id: trunk@2607 -
2006-02-16 08:03:13 +00:00
daniel
b2202654ca * It could be done even better.
git-svn-id: trunk@2606 -
2006-02-16 00:18:21 +00:00
daniel
3adcaaad36 * Faster and more compact integer str routines
git-svn-id: trunk@2605 -
2006-02-15 23:43:27 +00:00
Jonas Maebe
58381ff7b6 * made chararray handling 98% TP-compatible, fixes web bugs 3012
and 4080. The compatibility differences are:
      a) writing a chararray which is zero-based but not zero-
         terminated does not cause a buffer overflow
      b) non-zero-based chararrays can also be read

    The difference was that previously, all chararrays were treated
    as pchars. In TP/Delphi (and now also in FPC), this is only done
    for zero-based chararrays. For non-zero-based ones, the entire
    contents of the array should always be used (including #0's).

    The default parameters in the system unit for the chararray
    helpers are to avoid having to use a define for bootstrapping.

git-svn-id: trunk@2152 -
2006-01-04 10:05:10 +00:00
Jonas Maebe
5b9f58ef73 * reverted r2037 because of braindead "out" semantics for refcounted
types

git-svn-id: trunk@2045 -
2005-12-24 01:06:05 +00:00
Jonas Maebe
9a08cdccf0 * several changes of var parameters into out parameters to avoid
useless warnings: code parameter of val(), destination of str(),
    destinations of ansi2wide and wide2ansi

git-svn-id: trunk@2041 -
2005-12-23 22:25:26 +00:00
Jonas Maebe
84aab46550 * changed formal "var" paramters of move, movechar0 and fill* into
"out" parameters to avoid wrong "uninitialized" warnings

git-svn-id: trunk@2037 -
2005-12-23 20:59:08 +00:00
michael
5cafc069b5 + Removed NOSAVEREGISTERS define
git-svn-id: trunk@307 -
2005-06-09 17:58:20 +00:00
michael
033e38b8df + Removed NOCLASSHELPERS define
git-svn-id: trunk@299 -
2005-06-09 17:46:56 +00:00
michael
3a2eaa94b1 + Removed INTERNCONSTINTF define
git-svn-id: trunk@267 -
2005-06-07 22:04:18 +00:00
michael
93ba0409be + Removed HASCOMPILERPROC define
git-svn-id: trunk@265 -
2005-06-07 21:41:02 +00:00
michael
db5d9d75aa + Removed INTERNCOPY define
git-svn-id: trunk@259 -
2005-06-07 21:11:49 +00:00
michael
8a226bba52 + Removed HASWIDESTRING/HASWIDECHAR defines
git-svn-id: trunk@241 -
2005-06-07 20:42:22 +00:00
michael
23ad0ae1ec + Removed HASINTF and VER1_0 defines
git-svn-id: trunk@239 -
2005-06-07 20:30:03 +00:00
peter
4ace790492 * remove $Log
git-svn-id: trunk@231 -
2005-06-07 09:47:55 +00:00
fpc
790a4fe2d3 * log and id tags removed
git-svn-id: trunk@42 -
2005-05-21 09:42:41 +00:00
fpc
50778076c3 initial import
git-svn-id: trunk@1 -
2005-05-16 18:37:41 +00:00
peter
e417e34496 * truncate log 2005-02-14 17:13:06 +00:00
peter
f13ab0667c * missing typecast in indexchar0 2004-12-12 12:39:02 +00:00
michael
06668dda22 + Fixed IndexChar0 2004-12-05 12:41:00 +00:00
peter
14eb8f59b4 internconst, internproc and some external declarations moved to interface 2004-11-17 22:19:04 +00:00
florian
c9e17321d7 * fixed software longint mod operation 2004-11-06 13:36:42 +00:00
florian
5972f89919 * changed maxlongint to high(sizeint) 2004-11-02 08:50:40 +00:00
florian
ef25f06e1c * fixed array sizes 2004-11-02 08:46:50 +00:00
peter
fd759e521f * saveregisters calling convention is obsolete 2004-10-24 20:01:41 +00:00
florian
8c85454cf9 + added system.align
+ threadvars are now aligned
2004-10-14 17:39:33 +00:00
Jonas Maebe
0f26252376 + cgenmath with libc math functions. Faster than the routines in genmath
and also have full double support (exp() only has support for values in
    the single range in genmath, for example). Used in FPC_USE_LIBC is
    defined
  * several fixes to allow compilation with -dHASINLINE, but internalerrors
    because of missing support for inlining assembler code
2004-10-09 21:00:46 +00:00
florian
7a7c34e1b7 + several unicode (to/from utf-8 conversion) stuff added
* some longint -> SizeInt changes
2004-07-18 20:21:44 +00:00
peter
3094258825 * removed warnings 2004-05-31 20:25:04 +00:00
peter
62850815bd * fix arguments for shortstr_compare 2004-05-02 15:15:45 +00:00
peter
4917058b59 * fixed compile with 1.0.x 2004-05-02 00:31:03 +00:00
peter
81b6d9f16c * replace strlenint with sizeint 2004-05-01 23:55:18 +00:00
peter
b5df63e617 * ValSInt fixed for 64 bit 2004-05-01 20:52:50 +00:00
Jonas Maebe
dedf697f3a * use some more string routines from libc if FPC_USE_LIBC is used 2004-05-01 15:26:33 +00:00
peter
53ec165e68 * x86-64 fixes 2004-04-29 19:50:13 +00:00