Commit Graph

201 Commits

Author SHA1 Message Date
sergei
a1dfaa54dd * Fixed exception handling in constructors of TP-style objects to correctly handle cases of statically allocated objects (must call destructor but do not free memory) and objects without destructor (must free memory if it was allocated dynamically).
+ Test extended.

git-svn-id: trunk@26676 -
2014-02-05 18:19:13 +00:00
sergei
1626667374 * Object helper routines review/improvement for alignment-sensitive targets:
- Replaced duplicate local declarations of pvmt/tvmt with pobjectvmt/tobjectvmt
    (name change needed because tvmt is already used for class-style VMTs)
  - Removed 'packed' attribute from tobjectvmt, since it is always aligned.
  * Use appropriate typecasts to generate aligned memory accesses where possible.

git-svn-id: trunk@26659 -
2014-02-03 01:18:19 +00:00
nickysn
48edf78003 * make BSR/BSF return byte, instead of cardinal on 16/8-bit targets
git-svn-id: trunk@26591 -
2014-01-26 19:56:31 +00:00
nickysn
5c8aa6e5b0 * fpc_mul_integer and fpc_mul_longint: fallback directly to the unsigned
multiplication routine in case overflow checking is not used

git-svn-id: trunk@26524 -
2014-01-19 23:06:34 +00:00
nickysn
d4e01637e7 * use nativeint, instead of longint in fpc_div_dword and fpc_mod_dword, because
it produces more efficient code on 16-bit and 8-bit platforms.

git-svn-id: trunk@26351 -
2014-01-01 20:46:28 +00:00
florian
be3749301f * fix possible issues due to new behaviour of constant shifting
git-svn-id: trunk@26310 -
2013-12-29 12:21:25 +00:00
sergei
690995fa12 * RTL: fixed some warnings when compiling for x86_64:
* x86_64/x86_64.inc: IsMultithread is a LongBool, not Boolean -> fixed assembler instruction suffixes
  * inc/generic.inc: cast Sizeof() to unsigned, so that combining it with unsigned operands does not cause promotion to larger signed type.
  + win64/seh64.inc: explicit typecast and missing function result assignment.
  + inc/genmath.inc: explicit typecasts.

git-svn-id: trunk@25384 -
2013-08-29 07:52:38 +00:00
nickysn
7e18ac90e5 * the 'len' argument of fpc_shortstr_assign changed to smallint on 16-bit cpus, because getintparaloc allocates 16-bit ints on i8086
git-svn-id: branches/i8086@24258 -
2013-04-16 08:25:54 +00:00
paul
431ce7afc8 rtl: remove unused variables
git-svn-id: trunk@23275 -
2013-01-01 16:31:31 +00:00
florian
57ee96ef86 * compilation on non x86 fixed
git-svn-id: trunk@22330 -
2012-09-05 18:49:48 +00:00
florian
8818b58e5d * Bsf/Bsr on x86 handle now correctly 0 as argument, resolves #22783
* generic Bsf implementations handle now correctly 0 as argument
* test extended

git-svn-id: trunk@22327 -
2012-09-05 13:51:45 +00:00
florian
bc47125943 * use BsrDWord in software mod/div
* use a for loop instead of an until loop so code generation is potentially better

git-svn-id: trunk@22318 -
2012-09-04 18:58:20 +00:00
florian
9be3ca04ad * split FPC_HAS_INTERNAL_BSX_* defines into FPC_HAS_INTERNAL_BSF_* and FPC_HAS_INTERNAL_BSR_*
git-svn-id: trunk@22308 -
2012-09-04 12:56:18 +00:00
florian
2db4606eb0 * fix bootstrapping with 2.6.0
git-svn-id: trunk@22293 -
2012-09-03 09:16:46 +00:00
florian
ff12d63248 + generic popcnt support
git-svn-id: trunk@22290 -
2012-09-02 20:59:44 +00:00
florian
b782918434 * first draft to support the popcnt instruction, works so far for x86 with a real popcnt instruction
git-svn-id: trunk@22289 -
2012-09-02 20:59:39 +00:00
pierre
a311c53167 Replace HandleErrorFrame calls by HandleErrorAddrFrameInd where possible in common code (to allow correct backtrace for mips cpu)
git-svn-id: trunk@21900 -
2012-07-12 11:53:59 +00:00
Jonas Maebe
b42d204514 * fpc_shortstr_assign as compilerproc, forgot to commit
git-svn-id: trunk@21701 -
2012-06-25 05:06:41 +00:00
Jonas Maebe
aee5380ae0 * merged trunk up to r20882
o support for the new codepage-aware ansistrings in the jvm branch
   o empty ansistrings are now always represented by a nil pointer rather than
     by an empty string, because an empty string also has a code page which
     can confuse code (although this will make ansistrings harder to use
     in Java code)
   o more string helpers code shared between the general and jvm rtl
   o support for indexbyte/word in the jvm rtl (warning: first parameter
     is an open array rather than an untyped parameter there, so
     indexchar(pcharvar^,10,0) will be equivalent to
     indexchar[pcharvar^],10,0) there, which is different from what is
     intended; changing it to an untyped parameter wouldn't help though)
   o default() support is not yet complete
   o calling fpcres is currently broken due to limitations in
     sysutils.executeprocess() regarding handling unix quoting and
     the compiler using the same command lines for scripts and directly
     calling external programs
   o compiling the Java compiler currently requires adding ALLOW_WARNINGS=1
     to the make command line

git-svn-id: branches/jvmbackend@20887 -
2012-04-15 15:54:10 +00:00
sergei
f18767f6a8 * generic fpc_shortstr_assign: cleaned up
* align(): tweaked priority of calculation, yields better constant folding when these functions are inlined (alignment argument is a constant in most cases)

git-svn-id: trunk@20197 -
2012-01-30 09:20:43 +00:00
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