Commit Graph

556 Commits

Author SHA1 Message Date
svenbarth
cb27889dea * fix cycling by correctly handling the case that the global symtable of a program file is Nil
* also check the local symtable in that case (a program does not result in a PPU, but we need the imported symbols nevertheless when linking to a package)

git-svn-id: trunk@34414 -
2016-09-02 17:22:59 +00:00
svenbarth
36e5d02e8e * addsymref: do not directly check the top level symtable against the current module's global symtable as that would be false for a specialize symtable; check the module id instead
git-svn-id: trunk@34413 -
2016-09-02 16:03:25 +00:00
Jonas Maebe
c752050728 * don't print "parameter not used" hints for abstract methods (mantis #30431)
git-svn-id: trunk@34281 -
2016-08-12 13:35:34 +00:00
pierre
ef1369fef2 Reset static recorddef variables to nil in InitSymtable, avoid crashes in TextMode IDE
git-svn-id: trunk@34203 -
2016-07-26 12:52:40 +00:00
svenbarth
54b6cacf36 Fix for Mantis #30357.
Reset tstoredsymtable.init_final_check_done when a symbol is added or removed as otherwise property getters in a record *before* any managed field would trigger it, thus leading to the record being considered as "non-managed".

git-svn-id: trunk@34088 -
2016-07-08 18:20:47 +00:00
Jonas Maebe
0ce68d223f - removed unused tllvmshadowsymtable.recordalignmin field
git-svn-id: trunk@34026 -
2016-06-30 15:33:21 +00:00
Jonas Maebe
4121facc7a * only free the llvm shadow symtable when the original symtable will
also be freed

git-svn-id: trunk@33989 -
2016-06-15 18:31:47 +00:00
Jonas Maebe
68d9eb89a2 * skip static fields while constructing the LLVM shadow symtable for structs
git-svn-id: trunk@33960 -
2016-06-12 09:21:03 +00:00
svenbarth
046614948c + new utility routine to print all parameter declarations for a specified system routine
git-svn-id: trunk@33893 -
2016-06-03 21:11:13 +00:00
svenbarth
9fd8c8718a Partial merge of r28846 (without the global assembler symbols)
To correctly generate the import library for a package we need to resolve the dangling external symbols of all units. For this each unit now stores which symbols it exported from another unit and it also stores all global and external assembler symbols it has (maybe this can be streamlined later on, but for now this works).

entfile.pas:
  + new entry for the imported unit symbols
fmodule.pas, tmodule:
  + new field unitimportsyms which holds all symbols imported by a unit from another unit
  + new method to add an imported symbol
  * create, destroy & reset: correctly instantiate/free the two new lists
fppu.pas, tppumodule:
  + new field unitimportsymsderefs to hold the derefs during loading from/storing to PPU
  + new method buildderefunitimportsyms to generate the derefs for each imported symbol
  + new method derefunitimportsyms to resolve each imported symbol deref
  + new method readunitimportsyms to read the imported symbols from the PPU
  + new method writeunitimportsyms to write all imported symbols to the PPU
  * load_implementation: read the imported symbols if their entry is encountered
  * writeppu: generate the derefs for the imported symbols and write them to the PPU
  * load_usedunits: resolve the imported symbols once all derefs are known
symtable.pas:
  * addsymref: if the symbol is not from the current unit than mark it as imported
ppu.pas:
  * increase PPU version
-- Diese und die folgenden Zeilen werden ignoriert --

M    entfile.pas
M    fmodule.pas
M    fppu.pas
M    ppu.pas
M    symtable.pas

git-svn-id: trunk@33492 -
2016-04-12 20:59:35 +00:00
Jonas Maebe
0da80d1a15 * use is_objccategory() instead of just checking for oo_is_classhelper when
looking for a category, as oo_is_classhelper is also set for Pascal
    class helpers (fixes crash caused by the fact that Object Pascal class
    helpers don't have childof set, while categories do -- mantis #29666)

git-svn-id: trunk@33193 -
2016-03-06 14:44:21 +00:00
svenbarth
02e56f410d Merged revision(s) 28689 from branches/svenbarth/packages:
Extract functionality that is shared between the metadata files for units (PPU) and for packages (PCP) into a parent class called tentryfile

+ add new unit entfile which contains the new tentryfile class and related types and constants
* ppu.pas:
    - remove methods, fields, types and constants which were moved to entfile.pas
    * replace the parts of tppuheader shared with tentryheader by a field of type tentryheader
fppu.pas, pmodules.pas, utils/ppumove.pp, utils/ppuutils/ppudump.pp:
    + add entfile to uses
    * adjust access to common header fields
node.pas, symdef.pas, symsym.pas, symtable.pas, wpoinfo.pas, utils/ppufiles.pp:
    + add entfile to uses
........

git-svn-id: trunk@32976 -
2016-01-22 15:26:30 +00:00
Jonas Maebe
99aaec5431 * handle typed constant definitions of variant records using different fields
than the one we use to construct the LLVM equivalent (which doesn't support
    variants), or in case the complete record is not defined in the source and
    has to be padded with zeroes
   o we do this by creating a new recorddef in this case with as elements the
     defs of the actually emitted constant data, and replacing the original
     def with this new def; note that this can also replace arrays in case of,
     e.g., an array of a variant record type
   o the pass in llvmtype takes care of inserting type conversions (bitcasts)
     when these constants are accessed using the original def

git-svn-id: trunk@32719 -
2015-12-25 21:05:45 +00:00
Jonas Maebe
00c777e51a * add padding byte fields all as unsigned, as that is also how we
generate them in aasmcnst

git-svn-id: trunk@32717 -
2015-12-25 21:05:36 +00:00
Jonas Maebe
abcf441c00 * moved tllvmshadowsymtable items default property from private to public
section (although the compiler doesn't seem to care about it)

git-svn-id: trunk@32716 -
2015-12-25 21:05:31 +00:00
Jonas Maebe
787caf4dda * treat records with {$packrecords c} the same as other records for LLVM
o while in principle LLVM can layout those the same as we do, this would
     require special treatment in case some fields are not initialised in
     a typed record declaration (because then we have to emit padding only
     for the skipped fields, and not for any padding between them)
   o exception: records we create to represent parameters, as those have to
     match the ABI definitions exactly for them to be treated as expected

git-svn-id: trunk@32714 -
2015-12-25 21:05:22 +00:00
Jonas Maebe
0b4f3f01b3 * fixed another case of endless recursion in
tabstractrecordsymtable.has_single_field(), due to always looking in the
    symlist of the original record rather than properly recursing into those
    of nested ones (mantis #28641)

git-svn-id: trunk@32618 -
2015-12-08 15:35:19 +00:00
Jonas Maebe
86b02cf76e * handle bitpacked ordinal fields whose size is a multiple of 8 bits the same
other bitpacked ordinal fields, since they can also start on a non-byte-
    aligned boundary

git-svn-id: trunk@32570 -
2015-12-02 22:24:04 +00:00
Jonas Maebe
00d97d54ca * don't overwrite the curroffset field while adding bytes for bitpacked fields
git-svn-id: trunk@32569 -
2015-12-02 22:24:00 +00:00
Jonas Maebe
bbbceb08d9 * fixed the number of bytes added for packed record ordinal fields in the
llvm shadow table

git-svn-id: trunk@32564 -
2015-12-01 21:52:20 +00:00
yury
17358aa3ed * Removed unused local vars.
git-svn-id: trunk@32537 -
2015-11-26 17:15:04 +00:00
svenbarth
86f1ca2037 symtable.pas, is_visible_for_object:
* correctly handle the case that a generic method specialized in another unit needs to have access to private/protected members as well

git-svn-id: trunk@32437 -
2015-11-21 15:52:56 +00:00
florian
70b8789262 o basic extended pascal support:
+ automatically loaded helper unit
  * Makefiles adapted
  * mode switch
  * mode switches reorganized
+ TimeStamp support

git-svn-id: trunk@32330 -
2015-11-15 15:13:36 +00:00
Jonas Maebe
ed211b9888 * don't use symid anymore as fallback when sorting fields, as it's no longer
guaranteed to be set. Instead, temporarily assign fieldoffsets to determine
    their order in the sort function (fixes webtbs/tw15415 with -O4 after
    r32153)

git-svn-id: trunk@32159 -
2015-10-26 17:31:11 +00:00
Jonas Maebe
2cea723a0d * only write the parts of the unit localsymtables that are actually needed:
the defs and syms (recursively) referred by inline routines and by the WPO
    info
   o defs and syms are no longer added immediately to the module's deflist/
     symlist, even if they are created as "registered". Instead,
     "doregister=true" simply means "add it to the symbol table at the
     top of the symtable stack"
   o normally only when a sym/def is deref'ed, it gets added to the module
     symlist/deflist and defid/symid gets a (unique) value
   o in cases where we use(d) the defid to construct unique names within the
     current module, you now have to call call the tdef.new unique_id_str()
     method. If the def was not yet registered, we will reserve room for it
     in the deflist (to get a unique id), but the defid gets set to a
     negative value computed from its position in the deflist. Should it
     have to be written to the ppu file later on, the defid will be
     modified to the actual position in the deflist. For both values,
     new unique_id_str() will return the same result so that references
     to this def before and after actual registrations are the same (needed
     for the JVM backend, but also a good principle in general)

   Overall: don't directly use symid/defid anymore to get unique identifiers,
     but use tdef.new unique_id_str() instead (if necessary, a similar routine
     for tsym can be added)

   The result is the ppu file size gets reduced significantly after its big
   increase as a result of the high level typed constant builder (which creates
   a lot of defs). The result is even more efficient than before, as other
   unneeded defs/syms from the localsymtables don't get saved/restored anymore
   either.

git-svn-id: trunk@32153 -
2015-10-25 19:22:00 +00:00
florian
0ffe6157a8 * cast hsym with the correct type, should resolve issue #28862
git-svn-id: trunk@32125 -
2015-10-22 19:07:31 +00:00
pierre
6435968a3b Introduce tabstractsubsymtable class that uses subentryid to use it also for tenumsymtable and tarraysymtable, to fix errors for ppudump util with -VH option
git-svn-id: trunk@31798 -
2015-09-23 16:37:40 +00:00
Jonas Maebe
5a50d05e50 * fixed skipping if intermediate fields in llvm shadow symtable
git-svn-id: trunk@31640 -
2015-09-12 23:32:56 +00:00
svenbarth
6fb71e55fd symtable.pas, tparasymtable:
* checkduplicate: also ensure that the owner of the procdef is assigned before using it

git-svn-id: trunk@31589 -
2015-09-11 13:09:17 +00:00
Jonas Maebe
413680f593 * factored out getting a previously created internal type by name
git-svn-id: trunk@31247 -
2015-07-30 16:57:52 +00:00
Jonas Maebe
89c4bd8522 * index the llvm shadow symtable with a fieldvarsym rather than with the
index of the corresponding llvm fieldvar, as this index is a member
    of the fieldvarsym that only gets initialised once the llvm shadow
    symtable gets built, which in turn is triggered by trying to access
    it for the first time -> if fieldvarsym.llvmfieldnr got loaded by
    the compiler before evaluating the llvmst expression and if the
    llvmst hadn't been built yet, this llvmfieldnr was not yet initialized

git-svn-id: trunk@31060 -
2015-06-13 22:48:37 +00:00
florian
7dd1d6aa77 o fixes handling of iso i/o parameters/program parameters:
* explicit reset is needed
  * variable must be declared again

git-svn-id: trunk@30757 -
2015-05-01 20:58:31 +00:00
Jonas Maebe
3be51e1455 * fixed endless recursion in tabstractrecorddef.contains_float_field() in
case a record contains an internal typed constant of its own type
    (which happened becuase such a typed constant is also fieldvarsym, solved
     by checking for sp_static) (mantis #27880)
  * fixed several other similar cases in the compiler where we are only
    interested in instance fields, but processed all fieldvarsyms

git-svn-id: trunk@30614 -
2015-04-16 21:25:22 +00:00
Jonas Maebe
25e6eaf07f * store the to be used recordalignmin and maxcrecordalign settings inside
(abstract)recordsymtables, so that these settings don't depend on the
    current user settings when internally creating record definitions

git-svn-id: branches/hlcgllvm@30343 -
2015-03-27 21:25:56 +00:00
Jonas Maebe
bd203a5b57 * synchronised with trunk till r30240
git-svn-id: branches/hlcgllvm@30241 -
2015-03-15 19:44:58 +00:00
Jonas Maebe
3d9713b9c8 * has_single_field() now looks recursively into fields that are aggregate
types until it finds a non-aggregate type, and then returns "true" if
    that aggregate (record or array) contains one element
  * it now also returns the type of that element directly rather than a
    tfieldvarsym, since we only care about the type and in case of an array
    there is no field

git-svn-id: trunk@30205 -
2015-03-14 18:35:53 +00:00
Jonas Maebe
67b8aceaee * synchronized with privatetrunk till r30095
git-svn-id: branches/hlcgllvm@30101 -
2015-03-05 20:32:15 +00:00
pierre
af883cdcb7 Avoid warning for function not set if noreturn modifier is used
git-svn-id: trunk@29710 -
2015-02-15 18:01:22 +00:00
Jonas Maebe
146e3bcb9e * synchronised with trunk till r29513
git-svn-id: branches/blocks@29516 -
2015-01-21 23:28:34 +00:00
Jonas Maebe
e97f31541e - reverted partial commit of merge
git-svn-id: branches/blocks@29515 -
2015-01-21 23:24:37 +00:00
Jonas Maebe
a76bbf363d * synchronised with trunk r29513
git-svn-id: branches/blocks@29514 -
2015-01-21 23:18:29 +00:00
Jonas Maebe
8fe981cccb * also give a warning when a field masks an identifier from a category
* also give a warning when a field/parameter/local variable masks an
    identifier from a class helper that's in scope

git-svn-id: trunk@29498 -
2015-01-17 15:38:29 +00:00
Jonas Maebe
990e47f2d3 * give a warning instead of an error if a parameter or local variable in a
an Objective-C method masks an identifier from a category, because due
    to the fact that all standard categories are imported at the same time via
    the CocoaAll unit, this can often happen with categories you don't know/
    care about. These errors also didn't happen in 2.6.x

git-svn-id: trunk@29497 -
2015-01-17 15:27:42 +00:00
svenbarth
5fd47d5e00 Fix for Mantis #26483. This regression was introduced by famous revision 27861 which introduced partial specializations (and thus that specializations can be part of local- and parasymtables as well).
symtable.pas, is_visible_for_object:
  * if the symtable belongs to a specialization we need to ignore any owning local- or parasymtable as well to determine which unit it belongs to

+ added test

git-svn-id: trunk@29482 -
2015-01-16 14:23:49 +00:00
florian
9a9bf4be91 * write better hint message about the first occurence of an identifuer in case of a duplicate identifier error
git-svn-id: trunk@29400 -
2015-01-04 21:23:26 +00:00
Jonas Maebe
f6f304e0ca * check for duplicate identifiers when inserting union symtables into the
parent record symtable (mantis #26704)

git-svn-id: trunk@28820 -
2014-10-14 20:30:14 +00:00
Jonas Maebe
9d9e0a578b * return the next field from tabstractrecordsymtable.findfieldbyoffset() if
there is no field at that exact offset, so we can also use it to find the
    next field in case there is alignment padding

git-svn-id: branches/hlcgllvm@28754 -
2014-10-06 20:53:22 +00:00
Jonas Maebe
5c75b6dd6b * synchronised with trunk up till r28402
git-svn-id: branches/hlcgllvm@28403 -
2014-08-13 16:04:30 +00:00
Jonas Maebe
142d5d6d06 - removed get_jumpbuf_size/align, use rec_jmp_buf instead
git-svn-id: branches/hlcgllvm@28371 -
2014-08-10 19:40:16 +00:00
Jonas Maebe
dedf7e9384 + tabstractrecordsymtable.findfieldbyoffset() method to get the (first, in
case of variant records) fieldvarsym corresponding to the given offset

git-svn-id: branches/hlcgllvm@28321 -
2014-08-06 18:04:21 +00:00