Commit Graph

1117 Commits

Author SHA1 Message Date
Nikolay Nikolov
adf843196a Merge remote-tracking branch 'origin/main' into wasm_js_promise_integration 2023-06-24 15:08:18 +03:00
Sven/Sarah Barth
62cc594ca4 * for unique type aliases keep track of the original def
* increase PPU version
2023-06-23 16:15:27 +02:00
Nikolay Nikolov
3e21d24098 + magically insert a void externref type in the System unit, called WasmExternRef 2023-06-05 04:26:57 +03:00
florian
8f3cce556d * some error messages use nicer symbol names 2023-04-01 22:34:37 +02:00
Dmytro Bogatskyy
327aac7f24 Add aarch64-iphonesim target 2023-03-27 18:45:00 +00:00
Jonas Maebe
12bde4e903 WPO: fix dead code detection, and handle procvars
Extend dead code detection to not only look for the main mangled name, but also
for any aliases before deciding that a routine has been dead-stripped.

Assume objects/classes can also be constructed if the address of one of their
constructors or of the TObject.NewInstance class method has been taken.

Resolves #40204
2023-03-24 21:22:18 +01:00
Sven/Sarah Barth
b6b2785b66 * also skip high parameters when pc_normal_no_hidden is given to tprocdef.getcopyas 2022-12-30 23:32:00 +01:00
Sven/Sarah Barth
d7d65fe0d7 * fix typo in comment 2022-12-30 23:32:00 +01:00
florian
0eee70ac81 * fix FindUnitSymtable for exception symtables, resolves #24801 and #39974
* more consistent naming of exceptsymtable enumeration symbol
2022-10-31 20:19:10 +01:00
Jonas Maebe
efbf5eaa01 Fix loading of ObjC protocol type after c8fee69345
That type lives in the objcbase unit, not in the system unit

Resolves #39914
2022-09-21 21:27:04 +02:00
Pierre Muller
2187bfaddd Add name of unit for return type if not from current module in tprocdef.customprocname 2022-09-20 22:53:37 +02:00
Sven/Sarah Barth
c8fee69345 * fix #39907: only load system class types from units that are marked as a System unit
+ added test
2022-09-18 15:41:33 +02:00
Ondrej Pokorny
55629aeb19 do not publish enums with jumps 2022-08-16 20:47:44 +02:00
Sven/Sarah Barth
27c1bb3bea * an objectdef also requires an init for its members if a member (or a member of one of the parents) has a complex initialization
+ added test
2022-08-14 15:42:32 +02:00
Jonas Maebe
9e7895575e tarraydef.elecount: fix overflow detection
It did not trigger in case of an array[0..high(asizeint)]. Fixes compilation
of webtbs/tw9039[ab] with a compiler built with range checking enabled.
2022-05-29 13:33:27 +02:00
florian
45bf47ee05 * compilation with -O3 fixed 2022-05-26 22:34:34 +02:00
Sven/Sarah Barth
9aac622dc9 + add necessary core functions and functionality to implement capturing of variables
Based on code by Blaise.ru
2022-05-26 21:44:22 +02:00
Sven/Sarah Barth
90ebeb275a + add utility function to retrieve a file position of a usage of a type symbol from a type's definition 2022-05-26 21:43:40 +02:00
Sven/Sarah Barth
5cf15be434 + add a constructor for trecorddef to declare an internal record type as part of a specific other type
Based on code by Blaise.ru
2022-05-26 21:43:37 +02:00
Sven/Sarah Barth
7de854ef1e + add method register_implemented_interface to tobjectdef which registers an implemented interface and - if desired - also initializes the GUID related fields of the objectdef
* use that method in all locations outside symdef that add add an implemented interface

Based on work by Blaise.ru
2022-05-26 21:43:37 +02:00
Sven/Sarah Barth
76d3a9c4b5 * generate a better name if the procdef is an anonymous one 2022-05-26 21:43:36 +02:00
Sven/Sarah Barth
2be8f01efe * implement assignment of anonymous functions to procedure or method variables if they either capture nothing or (in case of method variables) at most the Self variable 2022-05-26 21:43:01 +02:00
Sven/Sarah Barth
d56a90e5ed * keep track of symbols that are accessed from a nested/anonymous function that belong to a surrounding scope 2022-05-26 21:43:01 +02:00
Sven/Sarah Barth
7f3a5eb9ab * extend tabstractprocdef.getcopyas by a parameter to control whether the copy should be registered or not 2022-05-26 21:42:59 +02:00
Sven/Sarah Barth
5e148c1dca + add a new tproccopytyp pc_normal_no_paras to copy an abstractprocdef without its parameters (useful if the parameters themselves will be reused and the original def otherwise deleted) 2022-05-26 21:42:56 +02:00
Sven/Sarah Barth
3aebcccdf2 * allow procvars to not be registered right away 2022-05-26 21:42:52 +02:00
Sven/Sarah Barth
a764c035b2 * if the symbol belongs to the current def also consider it a specialization if it's a nameless type symbol from an implicit function specialization as their owner gets changed to the function itself 2022-05-26 21:42:52 +02:00
Sven/Sarah Barth
8bef91d1de * declare the type symbol of an internal def as sp_internal 2022-05-26 21:42:52 +02:00
Sven/Sarah Barth
30a7199165 * make the VMT symbol and type def of the corresponding class or object instead of having them be global
* bump PPU version to avoid potential compilation errors due to this

Based on code by Blaise.ru
2022-05-26 21:42:51 +02:00
Jonas Maebe
3d3c904ac5 TSymStr: more consistent usage 2022-05-08 15:03:44 +02:00
Jonas Maebe
fcaea21075 SymAnsiStr: fix "make all" and webtbs/tw39661*
Fixes compilation with LLVM backend
2022-05-08 14:59:36 +02:00
Pierre Muller
5acd7a7b83 Rename tsymtable.insert and delete methods to insertsym ands deletesym 2022-05-03 23:00:28 +02:00
Sven/Sarah Barth
90844c2027 * fix #35261: apply slightly adjusted changes by Ryan Joseph to implement support for implicit generic function specializations
The main adjustments were as follows:
  - fixing coding style and identation
  - fixing some typos
  - using a better name for the property in tcallcandidates which holds the symbols created for anonymous parameter values
2022-04-20 18:59:31 +02:00
ccrause
665c1b3966 Move member variable "section" to tprocdef. Type of "section" to agree with symansistr define. 2022-02-22 20:51:32 +00:00
ccrause
738a0a35de Add section directive for subroutines for embedded and freertos systems. 2022-02-22 20:51:32 +00:00
Yuriy Sydorov
b78761efd3 * Removed obsolete OLDREGVARS ifdefs. 2021-11-02 17:08:08 +02:00
florian
a4672fbd1c o based on a patch by Rika, resolves #39401:
* use Base64 (62=_, 63=$) encoded FNV hash (instead of CR-32) to shorted identifiers
    * renamed fpccrc to fpchash
    + test
2021-10-10 10:09:22 +02:00
Jonas Maebe
3fb0fab410 Fix bitpacking 62/63 bit fields on 64 bit targets
As reported on the lazarus forum:
* https://forum.lazarus.freepascal.org/index.php?topic=56341.new
* https://forum.lazarus.freepascal.org/index.php/topic,56339.msg418608/topicseen.html

Also optimized nextpowerof2 in the compiler
2021-10-03 14:00:50 +02:00
Jonas Maebe
fcb646bc3b obcpas: fix categories implementing protocols
Allocate the ImplementedInterfaces array for them and save to/load from ppu

Solves #39375
2021-09-25 16:15:45 +02:00
nickysn
3ecb41cd2d * improvements to the prevention of dangling pointers in tmodule.deflist,
introduced in r49417. Now it no longer depends on current_module, so it
  handles the case when current_module changes between the time the tdef was
  registered and the time it was freed. It also supports freeing the tmodule
  before the defs, so the freeing order of the object is once again flexible.

git-svn-id: trunk@49426 -
2021-06-01 15:02:26 +00:00
nickysn
ea5ffd597f * set self to nil in current_module.deflist for registered defs in the
tstoreddef.destroy destructor, instead of doing it after each call to
  x.owner.deletedef(x)

git-svn-id: trunk@49417 -
2021-05-30 21:27:57 +00:00
florian
fe57cd3536 * fix LLVM after r48828
* global gotos really use the return type of fpc_setjmp to test where we come from

git-svn-id: trunk@48835 -
2021-02-27 22:07:58 +00:00
florian
4c2e0b9ff0 * for setjmp based exception handling, get the type of the exception reason from the setjmp result
git-svn-id: trunk@48828 -
2021-02-27 16:47:36 +00:00
florian
857cbddf04 * applied patch by Pierre to fix make cycle -Cr
git-svn-id: trunk@48806 -
2021-02-24 21:10:05 +00:00
florian
34f7c3e6d4 + array defs. of open arrays are now marked by ado_OpenArray, so (internally!) zero sized array can be declared with 0..-1
git-svn-id: trunk@48758 -
2021-02-21 18:45:58 +00:00
yury
64c586b86d * Removed/ifdefed lots of unused variables.
git-svn-id: trunk@48384 -
2021-01-24 12:24:01 +00:00
svenbarth
cc92af8423 * apply patch by Blaise.ru to enable the correct generation of names for classes/interfaces inside local symtables; these will be required for reference function types which are in fact interfaces and classes, this does not mean that ordinary classes can be declared inside functions
Note: no test as the functionality is not yet used

git-svn-id: trunk@47834 -
2020-12-22 22:22:35 +00:00
svenbarth
cbe352808a * fix for Mantis #38238: when creating a copy of a procdef for a procvar set the methodpointer flag also for methods of records
+ added test

git-svn-id: trunk@47826 -
2020-12-20 22:41:27 +00:00
svenbarth
32938dde1c * apply patch by Blaise.ru to allow record methods to be assigned to method variables as well (this is Delphi compatible)
+ added test

git-svn-id: trunk@47794 -
2020-12-16 21:43:25 +00:00
pierre
6230de31bb * Second patch xml-node-dump-defs.patch from J. Gareth Moreton from bug report 36882.
With same changes to ensure that xmllint find no errors in generated xml files.

git-svn-id: trunk@47667 -
2020-12-02 21:01:40 +00:00