Commit Graph

385 Commits

Author SHA1 Message Date
svenbarth
871f60ef61 * increase PPU version so that 3.2.0 correctly ignores 3.3.1 PPUs instead of fatally failing on the extended header entry
git-svn-id: trunk@45209 -
2020-05-01 13:55:01 +00:00
svenbarth
60345366f2 * fix for Mantis #35140: apply patch by Ryan Joseph together with some further changes by me to add support for constant parameters in generics
+ added tests

git-svn-id: trunk@45080 -
2020-04-25 22:12:35 +00:00
Jonas Maebe
2f914ee2d8 * packed tabstractvarsym.addr_taken/different_scope fields into a set
git-svn-id: trunk@43450 -
2019-11-11 09:26:51 +00:00
Jonas Maebe
ac1e0f96bd * replaced tentryfile.get/putsmall/normalset() with a common tget/putset
that expects an open array of byte, and use it for all sets
   o since all sets need to be typecasted to an array type of the appropriate
     size, we'll get a compilation error in case this needs to be done and
     that also tells us at the same time that the ppu version will need to
     be increased
  * enabled {$packset 1} for the compiler, as this is now safe with the above
    changes

git-svn-id: trunk@43407 -
2019-11-06 21:50:19 +00:00
pierre
dca8147958 Try to fix ppudump for generic/inline.
* entfile.pas: Differenciate ibsymtableoptions and ibrecsymtableoptions.
   * ppu.pas: Increase ppu unit CurrentPPULongVersion value.
   * utils/ppuutils/ppudump.pp: Add current_symtable_options variable.
     Change readsymtableoptions from procedure to function returning
     the new tsymtableoptions.

git-svn-id: trunk@42530 -
2019-07-29 16:40:58 +00:00
pierre
f2b200e4f0 Fix recordtoken writing into ppu files to allow correct
handling in cross-configuration with different endianess.

  The code has been modified to use the same scheme as the writing of
  the other parts of the ppu, i.e. change_endian filed has been
  added also to tscannerfile class of scanner unit.
  This field is then used to swap values that required endianess
  conversion.

  * scanner.pas: change_endian filed added to tscannerfile class.
    The value of this field is set as the same field in tentryfile class of entfile unit.
    Token read and write methods converted to use change_endian field.

  * ppu.pas: Increase CurrentPPILongVersion

  * utils/ppuutils/ppudump.pp: Remove unneeded FPC_BIG_ENDIAN code
    which was needed because tokens were previously written using a
    different rule.

git-svn-id: trunk@42527 -
2019-07-29 05:33:00 +00:00
svenbarth
900fd35f4a * increase PPU version now that all generic procdefs store their local symtables
git-svn-id: trunk@42460 -
2019-07-19 15:58:42 +00:00
svenbarth
b945e66e28 * store attribute information in PPU; this is less important for the compiler, but more for e.g. Lazarus when dealing with binary only units
* increase ppu version
+ added test
* adjust ppudump to handle attributes as well
ToDo: output parameter nodes as well

git-svn-id: trunk@42401 -
2019-07-12 22:07:46 +00:00
pierre
d8b89432a2 * Set ControllerSupport to false for sparc/sparc64 and x86_64 CPUs.
This boolean must only be set to true if TControllerType is not simply (ct_none)
  * ppu.pas: Increment CurrentPPULongVersion constant as the above modification
    changes the number of fields of the TSettings record that is saved to
    PPU in ST_LOADSETTINGS field.

git-svn-id: trunk@42323 -
2019-07-04 15:24:49 +00:00
Jonas Maebe
a0e35fd1bc * synchronised with trunk till r42118
git-svn-id: branches/debug_eh@42119 -
2019-05-25 13:19:06 +00:00
pierre
dd418f24b5 Add DEBUG_PPU conditional code to be able to debug ppu changes (only useful for debugging purposes)
git-svn-id: trunk@42110 -
2019-05-20 12:48:12 +00:00
Jonas Maebe
fc60ec2ea4 + support for LLVM LTO: compile units with -CLflto -> when compiling a main
program/library also with -Clflto, all units compiled with that option
    will be linked using their bitcode files and LTO
   o compiling with -CLflto will compile all units twice: once for normal
     (static or smart) linking, and once for LTO. So the result can be
     used both with and without LTO.

git-svn-id: branches/debug_eh@41910 -
2019-04-20 18:56:11 +00:00
Jonas Maebe
927fbc4387 * documented usage of ppuversion and ppulongversion
git-svn-id: trunk@41865 -
2019-04-13 14:58:15 +00:00
Jonas Maebe
0b61b5d4cf * added extra header to ppu inside a subsection, so we won't run into
trouble when the ppu version hits 255
  * also moved several ppu flags to a set inside that section

git-svn-id: trunk@41846 -
2019-04-06 21:28:43 +00:00
Jonas Maebe
170ec00348 - removed withnode (was no longer used since a very long time)
git-svn-id: trunk@40777 -
2019-01-05 22:28:37 +00:00
Jonas Maebe
95d79296bd * fixed alignment of tfiledef (same as corresponding file recorddef)
* cap set alignment to sizeof(aint)

git-svn-id: trunk@40442 -
2018-12-01 23:07:05 +00:00
pierre
0052e4da81 * Use getasizeint/putasizeint for tfieldvarsym.fieldoffset
* Change CurrentPPUVersion

git-svn-id: trunk@40347 -
2018-11-18 10:32:13 +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
svenbarth
ba08bdc9b1 * increase PPU version after the addition of the field to keep track of management operators (don't seperately to help merging)
git-svn-id: trunk@39710 -
2018-09-03 18:00:30 +00:00
florian
21d785e41b * do not unroll loops if the counter variable is accessed outside the current scope
git-svn-id: trunk@39163 -
2018-06-03 15:12:48 +00:00
nickysn
539d4cb68a + introduced taddrnodeflags (empty for now)
git-svn-id: trunk@38667 -
2018-04-03 14:33:41 +00:00
Károly Balogh
e9ca615924 r38636 changed the PPU format, but didn't bump the version. lets bump
git-svn-id: trunk@38639 -
2018-03-27 19:54:48 +00:00
nickysn
2cee948b72 + support segment overrides in inline asm references to local variables or parameters on x86
git-svn-id: trunk@38392 -
2018-03-01 17:59:57 +00:00
florian
b41cb26727 + write selected features in ppu of the system unit and load them further on
* ppu version update
* -Sf might be used only during system unit compilation
* loadsystemunit factored out so the system unit can be loaded earlier than other units to get features set

git-svn-id: trunk@37708 -
2017-12-10 16:32:56 +00:00
nickysn
2af5c9d508 * changed type used for section alignment from byte/shortint to longint, so the
internal object writer and the internal linker support object files with
  sections with alignment >=256

git-svn-id: trunk@37518 -
2017-10-25 15:47:29 +00:00
svenbarth
a6821c63e0 * store the type of the helper that had been encountered during parsing in the objectdef and by extension the PPU
git-svn-id: trunk@37202 -
2017-09-13 21:24:06 +00:00
Károly Balogh
addc3a2f94 m68k-palmos: fixed the syscall generation, and improved it to support the dispatch-selector-in-reg-D2 traps
git-svn-id: trunk@36892 -
2017-08-13 01:19:19 +00:00
florian
a37237ca11 * avoid range check errors with absolute symbols for cpus where addresses are bigger than the registers
git-svn-id: trunk@36361 -
2017-05-28 08:59:53 +00:00
nickysn
efc5e339d0 * use an enum instead of integer constants to represent inline numbers
* compinnr.inc include file converted to a unit
* inline number field size stored in ppu increased from byte to longint
* inlines in the parse tree (when written with the -vp option) now printed with
  their enum name, instead of number

git-svn-id: trunk@36174 -
2017-05-10 14:41:43 +00:00
florian
b1dff29cbf * removed unused units
git-svn-id: trunk@36165 -
2017-05-09 19:53:14 +00:00
maciej-izak
15ba9b54c6 Store informations about management operators in ppu files for records.
ppu.pas:
  * increase ppu version

symconst.pas:
  + new enum tmanagementoperator and set tmanagementoperators

symtable.pas, trecordsymtable:
  + new field managementoperators
  + new method includemanagementoperator

symdef.pas, trecorddef.ppuload and trecorddef.ppuwrite:
  * save/load for managementoperators

git-svn-id: trunk@35439 -
2017-02-18 18:43:25 +00:00
Jonas Maebe
7911cc8437 - removed some dataconstn remenants
git-svn-id: trunk@35314 -
2017-01-16 21:27:20 +00:00
Károly Balogh
8c4e5e0610 bump PPU version due to the latest syscall changes
git-svn-id: trunk@35048 -
2016-12-03 19:01:11 +00:00
Károly Balogh
657aa06360 arm: arm-aros syscall support
git-svn-id: trunk@34809 -
2016-11-06 14:31:42 +00:00
Károly Balogh
5db02f4202 atari: initial support for TOS syscalls
git-svn-id: trunk@34610 -
2016-10-03 23:37:30 +00:00
pierre
3360410c35 Fix cycling with -dTest_Double_checksum option
git-svn-id: trunk@34570 -
2016-09-28 08:56:30 +00:00
pierre
4d09dfca95 Remember usage of checkpointer (-gc) option:
Use new cs_checkpointer_called moduleswitches set element.
     Use new uf_checkpointer_called PPU flag (reusing obsolete uf_local_browser flag value)
     Emit warning if compiled library/program has any code using checkpointer.
  
 * ppu.pas: New constant: uf_checkpointer_called
 * globtype.pas: New constant: cs_checkpointer_called
 * fppu.pas: Set uf_checkpointer_called flag if cs_checkpointer_called is set in current_settings.module_switches
 * i8086/n8086mem.pas: Include cs_checkpointer_called in current_settings.moduleswitches
 *  ncgmem.pas: Likewise.
 * msg/errore.msg: Add new message saying that -gc and -Ur options are incompatible
   Add description to -gc option, saying it is experimental.
   Add warning at link time for program/library if checkpointer is used in any unit or main code.
 * options.pas: if -gc and -Ur options are used, never enable checkpointer code,
   instead output a warning that release is incompatible with -gc option.
 * pmodules.pas: proc_program: Check all modules for uf_checkpointer_called flag,
   emit a warning if checkpointer is used.
 * utils/ppuutils/ppudump.pp: Add code for uf_codepointer_called option.

git-svn-id: trunk@34567 -
2016-09-27 14:46:09 +00:00
Károly Balogh
464ecab542 huge syscall support refactor for Amiga-likes. removed large chunks of ancient duplicated code, and in general tried to make the entire thing more maintainable and cleaner. also added support for AROS EAXBase syscall convention
git-svn-id: trunk@34416 -
2016-09-03 07:57:23 +00:00
Károly Balogh
deda4c8247 simplified some code and removed a no longer used const
git-svn-id: trunk@34378 -
2016-08-26 10:07:30 +00:00
svenbarth
5bb121e91c Add a mechanism to keep track of assembler symbols that either publicly provided by a unit or used by a unit and that are not really baked by a Pascal symbol (e.g. public function aliases, RTTI & VMT symbol).
This basically revives the globalasmsym entry of the PPU though it feeds to different lists, one for the public (exported) symbols and one for the external (imported) symbols. Also the list of symbols is much smaller as it would be if all symbols would be dumped in there.

git-svn-id: trunk@34174 -
2016-07-22 13:08:32 +00:00
nickysn
a8ad82b99f + added new unit flag uf_i8086_ss_equals_ds, which indicates memory models with
SS=DS. This is currently redundant (whether SS=DS can be derived by the other
  i8086 memory model unit flags), but in the future will allow adding extra
  memory models, where the SS=DS assumption differs from the current ones.

git-svn-id: trunk@34139 -
2016-07-16 11:16:25 +00:00
Jonas Maebe
6558d7a521 * no longer store the tprocdef.synthetickind field in ppu files
git-svn-id: trunk@34130 -
2016-07-14 15:26:03 +00:00
Jonas Maebe
46166c89cb - removed no longer used and unsafe ttemprefnode.create_offset()
functionality

git-svn-id: trunk@33733 -
2016-05-21 10:28:28 +00:00
svenbarth
7d8d0340b9 Merged revision(s) 31988, 31991-31993, 32136, 32308-32309, 32312, 32318 from branches/svenbarth/packages:
Correctly parse the directives DenyPackageUnit and WeakPackageUnit

ppu.pas:
  + add flags uf_packagedeny and uf_packageweak
scandir.pas:
  + new procedure do_moduleflagswitch() which parses a ON/OFF/+/- argument and sets or clears a flag in the current module
  + new procedure dir_denypackageunit which handles DenyPackageUnit
  * implement dir_weakpackageunit (and move to the correct location ;) )
  * InitScannerDirectives: add dir_denypackageunit handler
........
Respect DenyPackageUnit flag.

pmodules.pas, proc_package:
  * check all contained units that are not already part of a package for their uf_package_deny flag and report an error for each that has it set
........
Do not check whether all units are used as by definition all units of a package are considered as used.

pmodules.pas, proc_package:
  - remove call to current_module.allunitsused
........
Check whether a unit has been implicitely imported in a package. A unit is considered as implicitely imported if it is not part of a required package nor part of the units listed in the contains section. This note is useful (Delphi even provides a dialog in that case) as a package with implicitely imported units /might/ become incompatible with other packages (e.g. if another package includes that unit uses that package and includes that unit explicitely; of course that is the same as if both package included it explicitely, but with the hint one knows where to look).

pmodules.pas, proc_package:
  * while walking the loaded units also check whether any of them not contained in a package was part of the contained units which are the same as the current module's used units
........
Generate CRC for package files

pcp.pas, tpcpfile:
  + new field do_crc which controls CRC generation
  + override putdata() method to generate CRC when data is written
  * resetfile: enable do_crc by default
........fppu.pas, tppumodule:
  * loadfrompackage: mention if a unit is loaded from a package
........
fpkg.pas, tcontainedunit:
  + new fields offset and size for the PPU data stored inside the PCP
fpcp.pas, tpcppackage:
  * readcontainedunits & addunit: correctly initialize offset and size to 0
........
Store the modified PPU files directly inside the PCP and thus get finally rid of the .ppl.ppu files.

entfile.pas:
  + new entry type ibpputable
pkgutil.pas:
  * adjust RewritePPU to work on a stream as output instead of a filename
fpcp.pas, tpcppackage:
  + new method writepputable() which writes the offsets and sizes of all contained units (not part of CRC!)
  + new method writeppudata() which rewrites all contained PPUs directly into the PCP after the ibend entry (Note: the data is written 16 Byte aligned to ease viewing of the PCP and its contained PPUs in a hex editor)
  + new method readpputable() which reads the offsets and sizes of all contained units
  + new method getmodulestream() which returns a substream for a contained module
  * loadpcp: also call readpputable()
  * writepcp: first write an empty pputable, then finish writing all data that requires the put*/write* methods of the pcpfile, then use writeppudata() to write all PPUs and finally write the correct pputable at the original location
fppu.pas, tppumodule:
  * loadfrompackage: don't read the PPU from a file if it is contained in a package, but using the new tpcppackage.getmodulestream() and tppumodule.openppustream() methods
pmodules.pas, proc_package:
  * don't rewrite the PPUs here
pcp.pas:
  * increase CurrentPCPVersion
........
Fix cycling

........

git-svn-id: trunk@33514 -
2016-04-15 13:39:41 +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
svenbarth
9d5f98eaa3 Merged revision(s) 28690 from branches/svenbarth/packages:
Extract reading of the PPU/PCP version into tentryfile.

entfile.pas:
  + add new getversion method which uses the pointer returned by getheaderaddr to read the PPU/PCP version
ppu.pas:
  - remove GetPPUVersion method
fppu.pas, pmodules.pas, utils/ppufiles.pp, utils/ppumove.pp, utils/ppuutils/ppudump.pp
  * replace call to GetPPUVersion by call to getversion
........

git-svn-id: trunk@32980 -
2016-01-22 15:47:29 +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
9258b5d76b + non-functional 128 bit integer types (inaccessible from Pascal), for use
in the LLVM high level code generator to implement overflow checking

git-svn-id: trunk@32735 -
2015-12-26 20:00:33 +00:00
Jonas Maebe
01d93b61c3 * save/restore the type (and hence code page) of ansistring constsyms in/from
the ppu (mantis #28964)
  * also save/restore the type of constnil, constresourcestring and constguid
    in/from the ppu

git-svn-id: trunk@32617 -
2015-12-08 14:27:23 +00:00
Jonas Maebe
f4a62c4c60 * fixed (harmless) range errors in getasizeint() after r32444
git-svn-id: trunk@32474 -
2015-11-22 11:49:47 +00:00