Commit Graph

762 Commits

Author SHA1 Message Date
florian
aca9727418 + OptimizeForLoop: convert for-loops into zero-based backward for-loops if possible, for most architectures, this results in simpler code
git-svn-id: trunk@44287 -
2020-03-08 14:30:59 +00:00
svenbarth
147559349b * fix for Mantis #36652: gracefully handle the error if one tries to implement a method of a type from another unit
+ added test

git-svn-id: trunk@44170 -
2020-02-14 16:48:58 +00:00
Jonas Maebe
254b85c352 + new pio_inline_forbidden flag to indicate that while parsing the
implementation the compiler determined the routine must never be
    inlined
   o difference with po_noinline: can also be set in the implementation
   o difference with pio_inline_not_possible: it indicates that e.g.
     LLVM must not inline the routine either

git-svn-id: trunk@44065 -
2020-01-29 22:21:17 +00:00
Jonas Maebe
b625afe800 * never inline routines that call get_frame (otherwise get_frame would return
the frame of the caller rather than of the current routine, which could
    cause e.g. stackframes to be missed in RTL helpers that are known to be
    only called from run time error routines)

git-svn-id: trunk@44064 -
2020-01-29 22:21:14 +00:00
florian
931d4dcfee * ensure the rtl and the packages for embedded compile with features exceptions and classes disabled
git-svn-id: trunk@43931 -
2020-01-13 21:20:03 +00:00
florian
2f2b378c03 * moved conversion of for into while loops in a separate pass, so node optimizations on the node tree can be
carried out without losing information from for loops

git-svn-id: trunk@43910 -
2020-01-11 16:08:45 +00:00
florian
6f87a572af * factored out tcgprocinfo.OptimizeNodeTree
git-svn-id: trunk@43907 -
2020-01-10 21:47:20 +00:00
svenbarth
0a915e883e * keep track of static symbols that a global function references, as those must now be exported from a dynamic package as well if the function can potentially be inlined
git-svn-id: trunk@43544 -
2019-11-21 21:44:53 +00:00
svenbarth
f13200d68b * restore localswitch settings after the initialization and finalization code was generated
git-svn-id: trunk@43535 -
2019-11-21 21:44:19 +00:00
florian
af8783e8d2 * i386: with a fixed stack, exception handling does not need a frame pointer
git-svn-id: trunk@43218 -
2019-10-17 20:55:39 +00:00
florian
7ee889d4ec * it must be decided in allocate_tls_register if a tls register is allocated
git-svn-id: trunk@43131 -
2019-10-05 20:48:28 +00:00
florian
c3f4ad39a3 * it must be decided in g_maybe_tls_init if a tls is loaded
git-svn-id: trunk@43126 -
2019-10-05 20:48:24 +00:00
florian
11319353fd * loading a got depends only on the fact if a got is needed and not if pic shall be generated
git-svn-id: trunk@43075 -
2019-09-25 21:19:06 +00:00
Jonas Maebe
9678542ba6 + add "thunk" attribute for stubs/thunks and emit it for LLVM
- also removed wrong "noreturn" attribute for interface thunks generated
     for high level code generator targets

git-svn-id: trunk@43018 -
2019-09-15 20:43:12 +00:00
Jonas Maebe
a051b8d225 - remmoved doregister parameter from t*sym constructors, as the registration
is handled automatically nowadays

git-svn-id: trunk@42998 -
2019-09-14 17:30:45 +00:00
Károly Balogh
4d6b8a6c45 fixed the messy state of messages after recent custom attributes merge. fixed a typo, fixed double definition of message 3350, restored a message that was removed but still used, so the build passes at least.
git-svn-id: trunk@42412 -
2019-07-13 07:34:07 +00:00
svenbarth
3a02393584 - remove functionality to get the code block when parsing again (let's open this pandora's box only when really needed...)
git-svn-id: trunk@42397 -
2019-07-12 22:07:31 +00:00
svenbarth
b2932393df Reintegration of Custom Attributes branch by Joost van der Sluis with patches reworked by Svetozar Belic [patch 1/3]
Implemented attributes for class types and properties (based on work by Joost van der Sluis). Added TCustomAttribute - a base class for attributes. Added TUnitInfo record to RTTI. It contains the unit name and unit options (for now only a flag which specifies if the unit contains attributes). Added several tests for attributes.

git-svn-id: trunk@42356 -
2019-07-12 22:04:48 +00:00
Jonas Maebe
e56b58c2b0 * factored out checks whether a procdef's symbol needs to be global, and
the generation of the procdef's asmsymbols
   o also removed unnecessary definition of procdef alias symbols for Darwin
     (they are already defined in ncgutil.alloc_proc_symbol)

git-svn-id: trunk@42341 -
2019-07-07 21:33:47 +00:00
Jonas Maebe
3fee990218 * on Mach-O, PECOFF and ELF platforms, write local symbols as hidden/
private_extern (or plain global in case of PECOFF, as the effect is
    the same there): visible across object files, but they become local
    when linked into a binary/library. This enables cross-unit inlining
    of functions accessig implementation-only symbols.

git-svn-id: trunk@42340 -
2019-07-07 21:33:43 +00:00
pierre
67cf63049d Commit patch submitted in bug report #35787 by Gareth Moreton
git-svn-id: trunk@42318 -
2019-07-01 19:42:48 +00:00
pierre
243c967967 Commit of new debug feature implemented by J. Gareth Moreton
Allows compilation of compiler using -dDEBUG_NODE_XML
  which will generate a NAME-node-dump.xml file for each 
  unit, program or library compiled,
  containing a XML description of the nodes handled during
  compilation of the unit, program or library.

git-svn-id: trunk@42271 -
2019-06-22 14:08:47 +00:00
Jonas Maebe
1b6425176b * synchronised with trunk till r42049
git-svn-id: branches/debug_eh@42050 -
2019-05-12 18:44:05 +00:00
Jonas Maebe
281b3ad276 * fix case completeness and unreachable code warnings in compiler that would
be introduced by the next commit

git-svn-id: trunk@42046 -
2019-05-12 14:29:03 +00:00
Jonas Maebe
50c82b6468 * synchronised with trunk till r41537
git-svn-id: branches/debug_eh@41538 -
2019-03-01 16:20:22 +00:00
yury
e5c2d13671 * Do not set pi_needs_got in current_procinfo.flags at the node level, since the GOT usage can only be estimated there. Instead set the pi_needs_got flag at places where the GOT register is accessed during the code generation. This eliminates generation of the unneeded initialization of the GOT register and fixes linker errors when the _GLOBAL_OFFSET_TABLE_ symbol is referenced but no actual GOT references are present.
git-svn-id: trunk@41460 -
2019-02-25 13:35:40 +00:00
Jonas Maebe
a079e5fa80 * synchronised with trunk till r41449
git-svn-id: branches/debug_eh@41450 -
2019-02-24 20:01:53 +00:00
Jonas Maebe
bc77aad3d9 * give an error when trying to call through to a C varargs routine with a
high level code generator
   o we cannot create a high-level stub in that case

git-svn-id: trunk@41443 -
2019-02-24 19:58:44 +00:00
florian
9514bd9162 * refactored psabieh handling, most code is now in psabiehpi
git-svn-id: branches/debug_eh@41367 -
2019-02-17 21:20:40 +00:00
florian
dcf9744f12 * reverts accidentally changed identifier spelling
git-svn-id: branches/debug_eh@41305 -
2019-02-11 20:27:29 +00:00
florian
65aebd22b0 + initial implementation of dwarf/eh_frame based exception handling for i386-linux, basic stuff works, open todos
* nested exception handling statments in one procedure need to be fixed
  * clean up, finally factor out tcgprocinfo from psub at least
  * extensive testing

git-svn-id: branches/debug_eh@41289 -
2019-02-10 18:07:33 +00:00
Jonas Maebe
d93c05a90c * synchronised with trunk till r41207
git-svn-id: branches/debug_eh@41208 -
2019-02-03 21:05:37 +00:00
Jonas Maebe
503ea604f3 + nolinline modifier to specify that a routine must never be inlined
git-svn-id: trunk@41198 -
2019-02-03 21:00:17 +00:00
Jonas Maebe
b3a8543a56 * synchronised with trunk till r40942
git-svn-id: branches/debug_eh@40943 -
2019-01-20 17:37:07 +00:00
Jonas Maebe
51e68eb302 * fixed several places where the interface crc could change:
o unsetting po_inline while parsing the implementation for various reasons
     (interprocedural goto/label, accessing a local in a parent frame,
      having nested procedures)
   o instead handle this via the pio_inline_not_possible flag
   o noreturn can no longer be specified only in the implementation

git-svn-id: trunk@40789 -
2019-01-06 20:35:56 +00:00
Jonas Maebe
51b58f342f * synchronised with trunk till r40775
git-svn-id: branches/debug_eh@40776 -
2019-01-05 22:12:28 +00:00
Jonas Maebe
91d5457b38 * moved around/replaced the following procedures to stop nflw from depending
on pdecsub (node units should not depend on parser units):
   o maybe_add_public_default_java_constructor()
   o handle_calling_convention()
   o create_finalizer_procdef() (replaced with create_outline_procdef())
   o insert_record_hidden_paras()
   o handle_calling_convention()
   o proc_add_definition()
   o build_parentfpstruct()
   o maybe_guarantee_record_typesym()
   o get_first_proc_str()
  * factored out the creation of a procinfo for a nested procdef based on a
    subnodetree of the current procdef into tprocinfo.create_for_outlining()

git-svn-id: trunk@40773 -
2019-01-05 16:26:33 +00:00
Jonas Maebe
2f8fcf7819 + new tf_use_psabieh target flag to indicate a target uses PSABI/Dwarf EH
o use this flag to set the personality routine of a function if it uses
     exception handlinga
   o also define FPC_USE_PSABIEH if this target flag is set
   o set this target flag for darwin/x86-64 if the compiler is compiled with
     -dllvm

git-svn-id: branches/debug_eh@40415 -
2018-11-29 21:31:30 +00:00
Jonas Maebe
4cd6f59bc3 * changed create_hlcodegen into a procvar, so that we don't have to insert
hlcgllvm in the uses clause of every unit that calls create_hlcodegen
   o prevents dependency cycles that can cause llvm codegen units to init
     before the cpu variants, which is bad since the llvm versions have to
     override the cpu variants in their init code (+ added checks in the
     init code that they are in fact initialised later)

git-svn-id: branches/debug_eh@40410 -
2018-11-29 21:31:15 +00:00
Jonas Maebe
3a5a69619e * moved initialisation of parentfpstruct to just behind where the local vars
get initialised, so that parameters in this struct are already available
    in any wrappers generated for the parent routine (e.g. in case self is
    moved to the parentfpstruct in a destructor, which calls beforestruction
    in its wrapper)

git-svn-id: trunk@40384 -
2018-11-28 19:23:28 +00:00
Jonas Maebe
b96a8aee61 * don't generate tempsfinalize nodes in except filter procdefs, as that would
finalize the parent's temps twice (fix for r40345, mantis #34574)

git-svn-id: trunk@40357 -
2018-11-20 19:25:06 +00:00
Jonas Maebe
3b9f5a5e96 * moved finalization of code generator temps to a node, so it can be getcopy'd
(needed for LLVM, where we need two copies of the finally code: one in case
     an exception occurs, and one in case none is raised)
   o also first finalize parameters and only then code generator temps, since
     in theory the former could create more of the latter

git-svn-id: trunk@40345 -
2018-11-17 22:38:36 +00:00
florian
a40335de34 * non-linux arm targets fixed
git-svn-id: trunk@40276 -
2018-11-08 19:57:30 +00:00
florian
c37c485eb7 + check if initialization/finalization code uses implicitly thread vars
git-svn-id: trunk@40269 -
2018-11-07 22:03:00 +00:00
florian
9f16c34329 + initial work for tls-based threadvar support on arm-linux
git-svn-id: trunk@40267 -
2018-11-07 22:02:58 +00:00
yury
5c5dc2ed50 * Changed verbosity of ""???" not yet supported inside inline procedure/function" to note to be consistent with note "Call to subroutine "?" marked as inline is not inlined".
git-svn-id: trunk@40255 -
2018-11-07 12:57:23 +00:00
yury
dd60397165 + Added the pio_inline_not_possible flag to timplprocoption. It is set if a function can't be inline (contains an assembler block, etc). When calling such functions, no note "Call to subroutine "?" marked as inline is not inlined" is emitted.
git-svn-id: trunk@40254 -
2018-11-07 12:20:30 +00:00
yury
b115886930 * po_inline can't be removed from procoptions when the interface part is already parsed. It changes the interface's CRC and causes other units to recompile.
git-svn-id: trunk@40238 -
2018-11-06 10:21:06 +00:00
yury
95d18cd052 * If a function can't be inline (contains an assembler block, etc) remove the po_inline flag from its procoptions.
git-svn-id: trunk@40223 -
2018-11-05 14:18:27 +00:00
yury
4357caaad8 * Removed unused local vars.
git-svn-id: trunk@40183 -
2018-11-02 18:44:29 +00:00
Jonas Maebe
0cd85d73e4 * ttryfinallynode now inherits from tbinarynode instead of tloopnode, as its
t1 field was always set to tnothingnode

git-svn-id: trunk@40142 -
2018-11-01 13:19:33 +00:00
florian
a34d4e715c Merged riscv_new branch
git-svn-id: trunk@39813 -
2018-09-26 19:49:08 +00:00
svenbarth
10886d8cef * fix for Mantis #34206: when specializing nested routines of a generic routine we don't need access to their genericdef (which isn't available anyway in other units when loading from PPU) as their definition is completely contained in the token stream
+ added simplified test for the problem

git-svn-id: trunk@39692 -
2018-08-31 16:11:05 +00:00
Jeppe Johansen
76dda5813e Updated dynlinker filename.
Fix passing of vararg register pairs.
Fix passing of big record, and return of records.
Disabled framepointer elimination for the time being.

git-svn-id: branches/laksen/riscv_new@39519 -
2018-07-28 20:06:06 +00:00
Jeppe Johansen
ceb38833f2 Added RiscV32/64 target, from a cleaned up version of branches/laksen/riscv/trunk.
git-svn-id: branches/laksen/riscv_new@39474 -
2018-07-20 08:21:15 +00:00
nickysn
966564aade - removed 'if assigned(code)' before calling code.free in tcgprocinfo.destroy,
since .free already checks for <>nil

git-svn-id: trunk@39312 -
2018-06-27 12:38:58 +00:00
svenbarth
5510b13975 * ensure that sto_has_generic is set when a generic routine has been parsed
git-svn-id: trunk@39230 -
2018-06-15 13:49:03 +00:00
florian
f08d3fdf8f * moved execution weight calculation into a separate pass, so the info is available already available before the code generation pass if needed
git-svn-id: trunk@38717 -
2018-04-08 20:51:27 +00:00
florian
1497b64804 * the temp. locations created by cse were not properly cleanup up, this patch fixes this
git-svn-id: trunk@38624 -
2018-03-25 15:55:34 +00:00
svenbarth
dffe423b10 * fix for Mantis #31945: two fixes for nested routines inside generic methods
a) correctly determine whether token recording is required or not (nested routines of generic routines don't need it)
  b) correctly determine whether the trailing ";" needs to be parsed (nested routines of generic routines need to)

git-svn-id: trunk@36469 -
2017-06-09 15:46:10 +00:00
florian
b1dff29cbf * removed unused units
git-svn-id: trunk@36165 -
2017-05-09 19:53:14 +00:00
nickysn
012153201a * moved the conversion of "x:=x op k" to inline nodes to a separate optimization
pass, so that it can be done after other optimizations, such as constant
  propagation

git-svn-id: trunk@35961 -
2017-04-26 22:44:01 +00:00
maciej-izak
48b149acd4 New tokens for new management operators: Initialize, Finalize, AddRef and Copy. Small code adjustment for parser (pdecobj.pas, pstatmnt.pas, psub.pas, ptype.pas) was required because few of old token has from now value which is outside range of set: _CONSTRUCTOR, _FINALIZATION.
New tokens for operators:
  * _OP_INITIALIZE, _OP_FINALIZE, _OP_ADDREF, _OP_COPY

New tokens:
  * _INITIALIZE, _FINALIZE, _ADDREF, _COPY

git-svn-id: trunk@35438 -
2017-02-18 18:12:45 +00:00
Jonas Maebe
7013a879c3 - disabled check for existence for texceptaddr/tguid/tjmpbuf in the system
unit for the JVM platform (they do not exist/are not needed there)
    (mantis #31240)

git-svn-id: trunk@35348 -
2017-01-28 14:33:36 +00:00
florian
668b198d7c * fix for issue #29936: check if the internal needed types are available
git-svn-id: trunk@35310 -
2017-01-15 20:54:07 +00:00
svenbarth
109dff8b56 * allow nested procedures and functions in generic routines (and get rid of an untranslated error message :P )
git-svn-id: trunk@35148 -
2016-12-17 21:23:07 +00:00
svenbarth
779799c406 * only record tokens for real generic routines or those that belong to a generic class/record
* don't parse a semicolon at the end for real specializations or specializations of methods that belong to a specialized class/record 

git-svn-id: trunk@35146 -
2016-12-17 21:13:30 +00:00
svenbarth
a76fd967b2 * inherit df_generic and df_specialization from the parent routine and correctly set the genericdef for a specialization
git-svn-id: trunk@35145 -
2016-12-17 21:10:58 +00:00
florian
b527bab087 * better check if we are in the main program which never returns
git-svn-id: trunk@34938 -
2016-11-20 18:01:13 +00:00
pierre
89c1b68b14 * Delete regvars unit.
This unit was empty unless OLDREGVARS macro was set,
    but this does not compile and no change has been made since 2011.

  * Remove regvars from all _USES clauses.

git-svn-id: trunk@34808 -
2016-11-06 14:01:39 +00:00
nickysn
e1792e712a * changed the 'size' parameter of fpc_zeromem and fpc_fillmem from ptruint to sizeuint
git-svn-id: trunk@34741 -
2016-10-18 15:42:29 +00:00
nickysn
cc234e7de9 + when the -vp option is specified, also print the node tree in tree.log right
before pass 2, since there are now quite a lot of changes to the tree
  happening after pass 1.

git-svn-id: trunk@34606 -
2016-10-03 14:15:59 +00:00
Jonas Maebe
1e506ce1d5 * call beforedestruction if an exception happens in afterconstruction
(mantis #30570)

git-svn-id: trunk@34453 -
2016-09-08 14:18:59 +00:00
Jonas Maebe
90f09a599e * simplified flow while adding afterconstruction code
git-svn-id: trunk@34451 -
2016-09-08 14:18:53 +00:00
Jonas Maebe
adcf07aabb * fixed line information for constructor code added to new block while
generating the afterconstruction code

git-svn-id: trunk@34450 -
2016-09-08 14:18:50 +00:00
Jonas Maebe
d22b83ee73 * renamed afterconstructionblock to constructionblock
git-svn-id: trunk@34449 -
2016-09-08 14:18:47 +00:00
Jonas Maebe
eb2ce85269 * correctly set the line info for the implicitly generated entry code nodes,
and update the code to also set it for some implicitly generated exit code

git-svn-id: trunk@34393 -
2016-08-29 16:05:25 +00:00
svenbarth
f69b365b77 * declare various symbols as external assembler symbols: RTTI references, parent VMT, FPC_EMPTYMETHOD (all three only if it's used from a different unit), threadvar lists and symbols declared as "external"
git-svn-id: trunk@34176 -
2016-07-22 13:34:38 +00:00
Jonas Maebe
1cb8c0d00c * specify the def of assembler level symbols defined via
tasmdata.DefineAsmSymbol() and all routines that call it
   o will be used to automatically generate AB_INDIRECT sybols when
     necessary

git-svn-id: trunk@34164 -
2016-07-20 20:52:59 +00:00
Jonas Maebe
cd5817a689 * also emit a tai_varloc() when regvars are initially assigned
o removed separate writing of the local variable/parameter location from
     psub, as that is now triggered by thise tai_varloc

git-svn-id: trunk@34084 -
2016-07-08 07:46:45 +00:00
Jonas Maebe
98ac6c4797 * converted gen_stack_check_call() to the high level code generator
git-svn-id: trunk@33990 -
2016-06-15 18:31:52 +00:00
svenbarth
e527b6fe4f psub.pas, read_proc:
* always register implementation-only, public routines as they might only be called from other units using an external declaration

git-svn-id: trunk@33967 -
2016-06-12 13:47:08 +00:00
svenbarth
af26a31251 psub.pas, read_proc_body:
* reset _FAIL directly after parsing the routine

git-svn-id: trunk@33881 -
2016-06-02 19:31:47 +00:00
svenbarth
ac95dcd7fa Improve inlining of generic routines (no matter whether they belong to a generic type or a generics themselves).
psub.pas, read_proc_body: 
  * also try to generate pending specializations before generating a routine's code so that these might be inlined as well

git-svn-id: trunk@33827 -
2016-05-26 18:57:55 +00:00
svenbarth
f27ce0b159 Rework the way the method bodies for specializations are generated: instead of walking the global and local symboltable all pending specializations are kept in a list of the current module which is (for now) walked at the end of a unit/program to generate the method bodies as before.
fmodule.pas, tmodule:
  + new list pendingspecializations which keeps track of all pending specializations of the current module
psub.pas:
  * move generate_specialization_procs and related routines to pgenutil
  + new procedure read_proc_body to read a routine's body, cause generate_specialization_procs needs it (unlike the already existing overload in the implementation section, this one can only handle bodies of non-nested routines) 
pgenutil.pas:
  * generate_specialization_phase2: add the newly specialized generic to the current module's pending specializations
  * generate_specialization_procs: reworked so that it uses the new pendingspecializations field instead of walking the global and local symboltable of the current unit
pmodules.pas:
  + add pgenutil to uses due to the moved generate_specialization_procs

+ added test

git-svn-id: trunk@33826 -
2016-05-26 18:56:16 +00:00
Jonas Maebe
0e9d232d2a * fixed indentation in previous commit
git-svn-id: trunk@33738 -
2016-05-21 14:51:24 +00:00
Jonas Maebe
fe5cf94e10 * moved generation of initialisation/finalisation nodes from the code
generator to psub and ngenutil
   o removed dependence of hlcgobj on pass_1

git-svn-id: trunk@33737 -
2016-05-21 14:48:34 +00:00
florian
3c2dab9878 * i386 peephole assembler uses largely the common peephole optimizer infrastructure, the resulting code is besides a few improvements the same
git-svn-id: trunk@33542 -
2016-04-21 20:14:01 +00:00
svenbarth
0a8d531b8d Merged revision(s) 32582-32583, 32635, 32637, 32639 from branches/svenbarth/packages:
pkgutil.pas, createimportlibfromexternals:
  * findpackagewithsym: ignore other (weak) external symbols
........
pkgutil.pas, createimportlibfromexternals:
  * import_proc_symbol: at least import the mangled name if there is no alias available
........
pkgutil.pas:
  * exportabstractrecordsymproc & insert_export: don't try to export a typedef if it doesn't belong to the current symtable, happens for cross unit type aliases
........
psub.pas:
  * read_proc: extract the code that creates an import library entry into its own function import_external_proc so that the same code can be used from other locations as well
........
Correctly handle external functions that are used from other units.

pkgutil.pas, createimportlibfromexternals:
  * processasmsyms: also check the import name when checking for duplicates (just for safety, the cache check should have caught these already)
  * processimportedsyms: if we have a routine imported from a library of whihc the symbol resides in a unit loaded from a package we need to import the routine ourselves instead of trying to import it from the package; also add an entry in the cache to speed up finding it again in processasmsyms()
........

git-svn-id: trunk@33519 -
2016-04-15 15:09:37 +00:00
svenbarth
35f8d5427f Revert r31262. Not doing type checking on generics leads to strange warnings (e.g. because variables are not considered as written). I better deal with the compile time errors one at a time than the warnings.
The added test shows such a bogus warning (sadly the test suite can handle the occurence or absense of certain messages yet :/ )

git-svn-id: trunk@33324 -
2016-03-24 20:58:04 +00:00
svenbarth
e9fab1bfee Fix for Mantis #29080.
psub.pas, tcgprocinfo.parse_body:
  * ensure that parse_generic and current_genericdef are set correctly when parsing a generic routine
pgenutil.pas, generate_specialization_phase2:
  * when we're specializing inside a generic we don't want to have the routine definitions, so let the compiler assume that the routine is no longer a forward definition

+ added test

git-svn-id: trunk@33275 -
2016-03-18 16:31:23 +00:00
svenbarth
557f74cdbd (Note to self: always include the root of the working copy in the commit when dealing with merges -.-)
Merged revision(s) 28793, 28903, 31951 from branches/svenbarth/packages:
psub.pas, read_proc:
  * don't generate assembler symbols for compiler internal code
........
Ensure that unneeded initialization/finalization procedures don't leave assembler symbols.

ncgutil.pas:
  + new function release_proc_symbol which removes all assembler symbols of a procdef
pmodules.pas, proc_unit:
  * if the initialization or finalization procedure is empty also remove their assembler symbols so they are exported
........
Ensure that readonly sections that need relocations are indeed declared as such.
Thanks to Jonas for this.

ncgvmt.pas, TVMTWriter:
  * writeinterfaceids: use sec_rodata instead of sec_rodata_norel

........

git-svn-id: trunk@32982 -
2016-01-22 16:58:33 +00:00
Jonas Maebe
8164d5aaf4 * don't make all procdef symbols global if we are using section-based
smartlinkin

git-svn-id: trunk@32803 -
2015-12-30 21:55:32 +00:00
Jonas Maebe
31bd38c45b * only add the procdef's parentfpinitblock if there are any statements in it
* internalerror if we try to add a non-empty parentfpinitblock to a
    pure assembler routine

git-svn-id: trunk@32740 -
2015-12-26 20:01:25 +00:00
Jonas Maebe
7a8079cfb4 * removed DLLsource global variable and replaced its uses with
current_module.islibrary

git-svn-id: trunk@32676 -
2015-12-17 15:23:05 +00:00
svenbarth
8bd79f95be Fix a few typos discovered by Blaise
git-svn-id: trunk@32640 -
2015-12-11 16:31:00 +00:00
yury
17358aa3ed * Removed unused local vars.
git-svn-id: trunk@32537 -
2015-11-26 17:15:04 +00:00
svenbarth
3c41e50f2f Implement generation of method bodies for generic functions.
psub.pas, specialize_objectdefs:
  + new nested procedure process_procdef() to handle the generation of method bodies for procdefs both in generic types as well as of generic functions
  + new nested procedure process_procsym() to handle the generation of method bodies for each specialization procdef of a procsym
  * allow all procsyms and recursively walk all non-generic types to find all method bodies that need to be generated

git-svn-id: trunk@32383 -
2015-11-20 18:01:18 +00:00
svenbarth
d3660fec31 Implement support for parsing "generic [class] procedure" and "generic [class] function" in non-Delphi modes. Since "generic" is a prefix it is quite ugly to implement, but from a Pascal language point of view it fits better than "procedure generic xyz".
Supporting such a prefix of course means that all section handling code ("var", "type", etc.) needs to respect the case of a "generic" token followed by "function", "procedure" or "class" and thus abort doing its own business.
Maybe I'll find the time somewhen in the future to rework the parser (plus scanner?) a bit so that code like this gets more easy to add and more importantly less ugly.

pdecsub.pas:
  * extend parse_proc_dec() and parse_record_method_dec() so that they can be told that they are supposed to handle the to be parsed function/procedure/method header as a generic
pdecvar.pas:
  + new entry for tvar_dec_option named "vd_check_generic" to tell read_var_decls() and read_record_fields() to look out for "generic"
  * extend read_var_decls() and read_record_fields() to check for "generic" if needed and to clean up correctly if it is encountered
pdecl.pas:
  * the section handling procedures types_dec(), resourcestring_dec(), var_dec(), threadvar_dec() and consts_dec() all return whether they had encountered a "generic" token that was followed by one of $
pdecobj.pas:
  * extend method_dec() to take a parameter that says whether the method is supposed to be a generic one
  * parse_object_members: while read_record_fields() can handle "generic" we also need to handle the case of "generic" if no fields are allowed anymore
psub.pas:
  * extend read_proc() by the possibility to tell it that the procedure/function to be parsed is supposed to be generic
  * adjust read_declarations() and read_interface_declarations() to keep track of parsed "generic" tokens and to pass them on accordingly
ptype.pas:
  * parse_record_members: same remark as for pdecobj.parse_object_members

git-svn-id: trunk@32380 -
2015-11-20 16:50:58 +00:00
Jonas Maebe
1e1e4b96e0 * don't store node trees for inline generic routines, as they contain
references to defs that are not stored in the ppu files (causing
    errors) and are never used for inlining (only the specialisations
    may be inlined) (fixes webtbs/tw27658.pp after r32031)

git-svn-id: trunk@32050 -
2015-10-13 15:59:18 +00:00