Commit Graph

131 Commits

Author SHA1 Message Date
florian
466561f09f * patch by Rika: Use Index* for pointer lists, resolves #40218 2023-03-25 21:32:29 +01:00
Rika Ichinose
986a6feb95 Allocate THashSet item and its key together when FOwnKeys=true. 2022-01-21 22:13:39 +01:00
florian
89f9ebc7b7 * throw an error if raise is called in a noreturn subroutine outside of any exception frame, resolves #39514 2022-01-06 21:13:19 +01:00
florian
d5867793f6 * partially applied patch by J. Gareth "Kit" Moreton to inline parts of cclasses, resolves #39344 2021-10-06 21:24:18 +02:00
florian
177b38dfe9 * modified (cosmetics) patch by Rika: replace DJB2 with MurmurHash3, resolves #39377 2021-10-01 23:06:31 +02:00
nickysn
d5a0dd3d25 * prevent a range check error in TFPList.IndexOfItem when searching backwards in
an empty list and the compiler is compiled with range checking turned on

git-svn-id: trunk@49406 -
2021-05-28 21:59:57 +00:00
florian
0188a558d1 - obsolete defines removed
git-svn-id: trunk@49184 -
2021-04-11 18:18:30 +00:00
nickysn
f7dd8755cc + introduced TFPList.IndexOfItem and TFPObjectList.IndexOfItem, which are like
IndexOf, but can also search backwards. The same method already exists in
  FPC's classes unit.

git-svn-id: trunk@48984 -
2021-03-15 18:06:44 +00:00
nickysn
77f3acdf76 * the TFPList.List property made protected in order to discourage using it
directly, as this circumvents range checking

git-svn-id: trunk@48976 -
2021-03-14 23:17:44 +00:00
florian
872c22842e * do prefetching correctly
* more prefetching inserted
  * unnecessary/wrong UpdateUsedRegs removed

git-svn-id: trunk@43878 -
2020-01-06 20:59:24 +00:00
svenbarth
79bdee3278 * finally implement tdynamicarray.equal so that exact match comdat sections work as well
git-svn-id: trunk@43119 -
2019-10-05 09:42:49 +00:00
Jonas Maebe
33d57ac646 * replaced TCmdStrListItem getter function with a property
git-svn-id: trunk@41906 -
2019-04-20 18:18:07 +00:00
yury
9f88cae771 * Removed inline, since inherited is not supported.
git-svn-id: trunk@41458 -
2019-02-25 11:27:54 +00:00
yury
c9a7503bbb * Rearranged the code to place implementation of inline methods before their usage within this unit.
git-svn-id: trunk@40220 -
2018-11-05 13:59:59 +00:00
yury
2dc64e5fae * Reverted r40181 because the "not inlined" notes are issued not due to access to private fields, but due to string conversion. It need to be fixed by overloaded versions of some methods.
git-svn-id: trunk@40182 -
2018-11-02 18:21:26 +00:00
yury
fa2d82f879 * Removed 'inline' from public methods of TFPObjectList and TFPHashObjectList since they use private fields and can not be inlined when called from other units.
git-svn-id: trunk@40181 -
2018-11-02 16:55:33 +00:00
florian
800ce23499 * fixed some issues to get correct values of section_count, works better than before but it is still not perfect for unknown reasons
git-svn-id: trunk@39750 -
2018-09-12 20:33:18 +00:00
florian
68eb921d46 * broken compilation after r39347 fixed
git-svn-id: trunk@39349 -
2018-06-30 12:30:25 +00:00
florian
5e07957594 + TLinkedList.RemoveAll
git-svn-id: trunk@36323 -
2017-05-25 12:44:32 +00:00
svenbarth
b74b3b0047 + placeholder function to check whether two tdynamicarray instances have the same contents (needs to be implemented for COMDAT selection with same content to work)
git-svn-id: trunk@36196 -
2017-05-12 15:52:07 +00:00
pierre
b3063b7db2 Reset class fields FList and FHashList to nil after Destroy call
git-svn-id: trunk@34078 -
2016-07-06 06:14:37 +00:00
svenbarth
3e70ac05c2 Merged revision(s) 32450-32451, 32455, 32457-32458, 32460-32462, 32477, 32480 from branches/svenbarth/packages:
cclasses.pas, TCmdStrList:
  * if doubles are not allowed then do case sensitive checks instead of insensitive ones

........
Correctly handle export/import generation depending on whether we're compiling for a system that needs indirect imports or not.

systems.pas:
  * replace systems_package_need_exports with systems_indirect_var_imports
pmodules.pas, proc_package:
  - remove check for systems_package_need_exports
pkgutil.pas:
  * insert_export, export_unit: export the direct or the indirect variable symbol depending on systems_indirect_var_imports

........
ncgrtti.pas, TRTTIWriter.write_extra_rttisyms:
  * enumdef_rtti_string2ordindex & enumdef_rtti_ord2stringindex: put the indirect suffix at the end of the symbol

........
pkgutil.pas, add_package_libs:
  * check for systems_indirect_var_imports instead of systems_package_needs_exports

........
expunix.pas, texportlibunix:
  * generatelib: check all procdefs whether they have the alias and not only the first one

........
pkgutil.pas:
  * insert_export: directly report the symbol type instead of its ordinal to ease finding of problems

........
pkgutil.pas, export_procsym:
  * restructure if for better readability
  + also check the procdef for po_has_public_name

........
Ensure that all implicitely imported units are indeed part of the package.

pmodules.pas, proc_package:
  * instead of checking the units loaded by the current module we need to check *all* units that are loaded for the package

........
Fix inclusion of PPUs that don't have a corresponding object file.

pkgutil.pas, RewritePPU:
  * don't abort if a unit does have the flag uf_no_link set
  * only abort if both uf_static_link and uf_no_link are not set

........
Generate an error if a unit listed as in "contains" is part of a directly or indirectly required package.

pmodules.pas, proc_package:
  * walk all units and check whether it had been loaded from a package, but is also part of the units of the current module; if so then generate an error

........

git-svn-id: trunk@33516 -
2016-04-15 14:23:55 +00:00
Jonas Maebe
231039b224 * since T(Tag)HashSet always forces the size to a power of 2, use "and"
rather than "mod" to select the hash bucket

git-svn-id: trunk@32055 -
2015-10-14 16:44:02 +00:00
Jonas Maebe
67b958bb32 * take SizeOfItem() properly into account in T(Tag)HashSet
git-svn-id: trunk@32044 -
2015-10-13 15:59:00 +00:00
Jonas Maebe
dff35e7d03 * fixed overallocation of buckets in T(Tag)HashSet after resize
git-svn-id: trunk@32043 -
2015-10-13 15:58:57 +00:00
nickysn
94bcb9878a * reimplemented r28329 in a different way, as suggested by Jonas
git-svn-id: trunk@28332 -
2014-08-07 19:36:52 +00:00
marco
70088d12a8 * eliminate classes unit from the compiler by copying an array of string based
extractstrings to cclasses.

git-svn-id: trunk@27372 -
2014-03-30 12:03:10 +00:00
florian
4d5119bf1c * fixes several issues which cause warnings by the dfa code when using it to detect uninitialized variables
git-svn-id: trunk@26161 -
2013-12-01 17:02:08 +00:00
svenbarth
68a3827539 Fix for Mantis #21051. Correctly handle specializations that occur during the specialization of methods.
cclasses.pas:
  + TFPHashList & TFPHashObjectList: add WhileEachCall methods that walk the list like ForEachCall does, but uses a while-loop instead of a for-loop
psub.pas, generate_specialization_procs:
  * use WhileEachCall instead of ForEachCall as new defs can be added during the specialization that need to be specialized as well

+ added test

git-svn-id: trunk@25577 -
2013-09-26 08:15:58 +00:00
sergei
1f8a67f552 + Property TObjSymbol.ObjData, allows to access owning TObjData for external/common symbols, i.e. ones with ObjSection=nil.
* For common symbols, report objdata of the original ObjSymbol, not of the resolving one, so the map file shows where it comes from.
+ TElfExeOutput.OrderOrphanSections method, handles object sections not mentioned in script similar to ld.
- t_linux.pas: removed sections that are not part of ld scripts, they are now handled by OrderOrphanSections.

git-svn-id: trunk@25184 -
2013-07-30 09:23:48 +00:00
florian
99f2e57e42 * better error reporting
git-svn-id: trunk@24242 -
2013-04-14 15:51:25 +00:00
masta
d60049a1fd Removing duplicated hash functions in compiler/cclasses.pas
FPHash was duplicated 4 times for different input types. I've
consolidated it to a single function with 3 proxy-functions which can be
inlined.

I've also modified the hash function itself slightly, it now resembled
the original DJB hash and seems to perform a tiny bit better.

git-svn-id: trunk@23850 -
2013-03-16 00:50:45 +00:00
sergei
12ad6704f6 - Removed a number of unused variables, reduces noise at compilation.
git-svn-id: trunk@22880 -
2012-10-30 11:55:59 +00:00
Jonas Maebe
3798b79fd7 + optimization that (re)orders instance fields of Delphi-style classes in
order to minimise memory losses due to alignment padding. Not yet enabled
    by default at any optimization level, but can be (de)activated separately
    via -Oo(no)orderfields
   o added separate tdef.structalignment method that returns the alignment
     of a type when it appears in a record/object/class (factors out
     AIX-specific double alignment in structs)
   o changed the handling of the offset of a delegate interface
     implemented via a field, by taking the field offset on demand
     rather than at declaration time (because the ordering optimization
     causes the offsets of fields to be unknown until the entire
     declaration has been parsed)

git-svn-id: trunk@21947 -
2012-07-22 16:47:19 +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
aea30f9bb2 * Added a lower limit on tdynamicarray block size. Certain values less than dynamicblockbasesize+alignment, e.g. 8 on x86_64, cause grow() to enter an infinite loop. Such values come e.g. from cloning tdataconstnode, which abuses blocksize argument as data size. Mantis #20929.
git-svn-id: trunk@19873 -
2011-12-18 22:34:56 +00:00
florian
111d05c68f o patch by Alexander Shishkin, resolves #20409
* eliminate warnings in compiler (i386 & i368->x86_64) and minor refactorings
    - comment out unused vars and types
    - comment out unneeded comparisons (Longword <=> 0)
    - suppress some "comparison always true|false" warnings
    - tweak visiblity sections

git-svn-id: trunk@19385 -
2011-10-05 20:11:09 +00:00
paul
4cf5e36ce7 compiler:
- add TTagHashSet class descendant of THashSet with an ability to has also a LongWord value together with key
  - change TAsmData.ConstPools[] to be an indexed property to properly initialize ConstPool class, remove pool initialization from all other units
  - add ansistring constants to pool together with their encoding to distinct the same text constants with different codepage
  + test

git-svn-id: trunk@19261 -
2011-09-28 01:18:43 +00:00
florian
2f4fcf7dee * avoid range check error
git-svn-id: trunk@18786 -
2011-08-20 12:25:58 +00:00
Jonas Maebe
ce88df680b + symansistr conditional define that, when activated, makes the symbol/
mangled name handling ansistring rather than pshortstring based (required
    for JVM target; little effect on speed, some extra memory usage)

git-svn-id: branches/jvmbackend@18597 -
2011-08-20 08:13:50 +00:00
Jonas Maebe
7173b9dfed * fixed (harmless) range check errors
git-svn-id: trunk@17643 -
2011-06-02 20:07:06 +00:00
paul
d21bbc4548 compiler: reduce amount of hints and warnings
git-svn-id: trunk@17350 -
2011-04-20 02:58:52 +00:00
Jonas Maebe
66258fb0b8 * fixed TCmdStrListItem.GetCopy() (the reference count of the ansistring
field was messed up due to the use of "move()" to copy all field data)

git-svn-id: trunk@17270 -
2011-04-08 08:10:07 +00:00
Jonas Maebe
c072eb5a34 * fixed growing a tbitset when adding an element whose index equals the
datasize (and grow with 16 bytes at a time instead of with only
    exactly as many bytes as required to accomodate the new element)

git-svn-id: trunk@15603 -
2010-07-18 21:58:47 +00:00
Jonas Maebe
434a6f6ee8 * ensure that the power-of-2 size of the hash table is always larger than
the parameter initially passed to TFPHashList.SetCapacity after r15516
    (mantis #16834)

git-svn-id: trunk@15521 -
2010-07-03 18:25:31 +00:00
Jonas Maebe
d432023cf6 * force the size of TFPHashList always to a power of two, and use an "and"
instead of a "div" to truncate the hash to the table size
  * prefetch the string we are looking for
  - removed the optimization whereby the length and the last character are
    checked before the entire string is compared during the hashtable
    searching, because this does not help anymore (our hash funcion is
    better than when this was added, and we also have a special "equals"
    string comparison function nowadays that also first checks the length)

git-svn-id: trunk@15516 -
2010-07-03 13:05:32 +00:00
Jonas Maebe
35bacb55b5 * re-enabled CCLASSESINLINE since it no longer internalerrors the compiler
while compiling the IDE
  - removed "inline" from a lot of methods because they are too large

git-svn-id: trunk@15497 -
2010-06-30 17:41:12 +00:00
paul
c6c15f6533 compiler: revert r14244
git-svn-id: trunk@14257 -
2009-11-23 01:43:42 +00:00
paul
5684e3acc7 compiler: speedup tdynamicarray.read, tdynamicarray.write
git-svn-id: trunk@14244 -
2009-11-21 18:27:37 +00:00
Jonas Maebe
dac2903107 * prefetch next items in TLinkedList.clear, removes most l2 cache misses
git-svn-id: trunk@13706 -
2009-09-13 15:30:53 +00:00