Commit Graph

330 Commits

Author SHA1 Message Date
Jonas Maebe
f29598384b * Objective-Pascal inferred result type and improved category method searching
--- Merging r42815 through r42817 into '.':
U    tests/test/tobjc34.pp
U    tests/test/tobjc36.pp
U    tests/test/tobjcl2.pp
A    tests/test/units/cocoaall
A    tests/test/units/cocoaall/tw35994.pp
U    compiler/defcmp.pas
U    compiler/ncal.pas
C    compiler/pdecl.pas
C    compiler/symconst.pas
C    compiler/utils/ppuutils/ppudump.pp
U    compiler/symtable.pas
--- Recording mergeinfo for merge of r42815 through r42817 into '.':
 U   .
--- Merging r42857 into '.':
G    compiler/symtable.pas
--- Recording mergeinfo for merge of r42857 into '.':
 G   .
  

git-svn-id: branches/fixes_3_2@42883 -
2019-08-31 11:43:41 +00:00
Jonas Maebe
3ac703506c * rest of the previous accidental partial commit
git-svn-id: branches/fixes_3_2@41250 -
2019-02-07 19:56:21 +00:00
yury
0dd9e4d6a5 Fixes for aarch64.
Merged revision(s) 39948, 39951, 39953 from trunk:
* Fixed interface delegation for aarch64 (tdel1 and tdel2 tests).
  It was broken by r31676 which did not take in account r29953. As a consequence $self was passed in register x1 instead of x0 when the method result is of a managed type.
  This fix enables changing order of the $self and $result parameters only for aarch64 AND llvm combination where it is actually needed.
  The issue with interface delegation still exists for aarch64-llvm and need to be fixed separately. Probably by applying llvm-specific workarounds as it was made in r29953 for regular aarch64 targets.
........
* Fixed bug #17413 (and the tw17413 test) for aarch64 by adding additional check.
........
* aarch64: Fixed loading of a function result which is returned in 4 32-bit MM registers to 2 64-bit int registers. Bug #30329.
........

git-svn-id: branches/fixes_3_2@40543 -
2018-12-13 18:27:26 +00:00
marco
edf32cd5dc The Important Ones:
- 39683, 39684, 39685, 39686 (rework of Interface Method RTTI)
- 39687, 39688, 39689, 39690, 39709, 39710 (change of PPU version)

git-svn-id: branches/fixes_3_2@39809 -
2018-09-26 12:50:46 +00:00
florian
0eea2141f6 * patch by J. Gareth Moreton: clarity in directive conflict error messages, resolves #33754
git-svn-id: trunk@39407 -
2018-07-07 14:46:01 +00:00
svenbarth
ac0322c323 + add a flags field to the record init RTTI which declares whether
a) the current record contains a field with non-trivial initialization
    b) and of the parents contains such a field (only relevant for objects and classes)

git-svn-id: trunk@39255 -
2018-06-20 19:00:17 +00:00
svenbarth
cc153176f3 + add a new symtable option sto_has_non_trivial_init that is true if the symtable contains a symbol with an
Initialize() operator (like sto_needs_init_final this flag is calculated on demand)
* increase PPU version

git-svn-id: trunk@39252 -
2018-06-20 19:00:08 +00:00
nickysn
02fb59d3e5 * unified the definition of pushleftright_pocalls on i8086 and i386
git-svn-id: trunk@38952 -
2018-05-08 14:27:36 +00:00
nickysn
42ebdbe277 + introduce po_hasnearfarcallmodel (specifies that the near/far call model was
specified explicitly). This will be useful, when we implement an automatic
  call model selection optimization.

git-svn-id: trunk@38732 -
2018-04-11 12:31:09 +00:00
nickysn
303309b28f + added support for 'external far' variables for i8086
git-svn-id: trunk@37532 -
2017-10-30 18:03:44 +00:00
svenbarth
50788e8b3b * correctly encapsulate the RTTI data for sets to avoid alignment problems with the new SetSize field (fixes compilation on Sparc and basically every other target that requires proper alignment with 64-bit values dictating an 8-Byte alignment)
git-svn-id: trunk@37201 -
2017-09-13 21:05:04 +00:00
svenbarth
5c97248f85 + also write the set's size to the RTTI as that simplifies handling in Invoke()
git-svn-id: trunk@37090 -
2017-08-31 19:23:12 +00:00
svenbarth
1950e57899 * fix order in tinternaltypeprefix so that it fits internaltypeprefixName
git-svn-id: trunk@37089 -
2017-08-31 18:53:20 +00:00
svenbarth
239d0704ca + add support for type helpers to also extend interface types
git-svn-id: trunk@37023 -
2017-08-21 20:49:20 +00:00
svenbarth
236a9b0aa5 * rework the checks for a helper's extended def to be a class so that it can be more easily extended by other objecttypes
git-svn-id: trunk@37022 -
2017-08-21 20:48:02 +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
126b834976 * ncgrtti has to use target pointer sizes, so changed SizeOf(PtrInt) into SizeOf(PInt), should fix #31964
* try to avoid to use anonymous records in ncgrtti

git-svn-id: trunk@36416 -
2017-06-04 19:57:46 +00:00
maciej-izak
af8e0efe57 * Rtti info about Management Operators (MO) in init table for records. Note: commit contains minimal changes for RTL (for proper "make") no functional changes. More RTL changes for fully functionally MO in next commits.
compiler/ncgrtti.pas
  + write_record_operators procedure which fills simple VMT like table for MO.
  * recorddef_rtti save MO (if exists)
  * objectdef_rtti_fields save nil pointer/entry for objects rtti (have same RTL parts like for records)

compiler/options.pas
  + new define FPC_HAS_MANAGEMENT_OPERATORS

compiler/symconst.pas
  + new item itp_init_record_operators for tinternaltypeprefix enum
  + new entry '$init_record_operators$' in internaltypeprefixName

rtl/inc/rtti.inc
  + new field RecordOp (pointer to MO VMT table) in TRecordInfoInit
  + new types to handle MO VMT: TRTTIRecordOpVMT, PRTTIRecordOpVMT, TRTTIRecCopyOp, TRTTIRecVarOp

rtl/objpas/typinfo.pp
  + RecordOp field for TRecInitData record

git-svn-id: trunk@35445 -
2017-02-19 00:22:59 +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
svenbarth
1a6a8b7c9f + introduce a new potype for the main stub of a package library (which on Windows is simply a DLLMain returning True)
git-svn-id: trunk@35371 -
2017-01-29 22:37:40 +00:00
svenbarth
fdad2ebb9b + new set type tvisibilities for tvisibility
git-svn-id: trunk@35289 -
2017-01-13 16:23:35 +00:00
svenbarth
f905303c4a + new TParamFlag pfResult if the result is passed as a parameter and thus needs to be set up as well
git-svn-id: trunk@35286 -
2017-01-13 16:17:03 +00:00
svenbarth
5275c36393 + extend TParamFlags by values for hidden parameters in general and especially the hidden high, self and vmt parameters (this is necessary so a manager approach for Invoke() can be used with as few knowledge about the involved calling conventions as possible)
Note: with this TParamFlags exceeds the size of a Byte

git-svn-id: trunk@35267 -
2017-01-08 16:08:35 +00:00
svenbarth
a9d14fe30b * extend TOrdType by entries for 64-bit values
* have tkInt64 and tkQWord entries also contain the OrdType field (basically the compiler can now use the same function to generate them only with different type kinds)

+ added test

git-svn-id: trunk@35135 -
2016-12-16 14:22:04 +00:00
Károly Balogh
c7c37f66ed * refactored syscall types for unified naming,first bits of ARM AROS syscall support
git-svn-id: trunk@34806 -
2016-11-06 12:41:56 +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
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
94eb087aa2 * fixed typo (obcj -> objc)
git-svn-id: trunk@34452 -
2016-09-08 14:18:56 +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
Jonas Maebe
ae51adac18 * give names to the types of the fields of the enumdef rtti, so that we can
refer to these type names when writing the s2o and o2s arrays in the LLVM
    assembler writer (otherwise we have to write out the entire definition
    of those fields and their subtypes for every access, resulting in a 139MB
    cpubase.ll instead of a more reasonable 1.5MB one now)

git-svn-id: trunk@34386 -
2016-08-28 22:07:47 +00:00
svenbarth
c2662bd96a * mark defs created with create_global_internal() with df_internal so that they can be easily identified
git-svn-id: trunk@34316 -
2016-08-15 14:30:46 +00:00
Jonas Maebe
adef9340e6 * converted metadata generation for variant dispatch to high level typed
constant builder

git-svn-id: trunk@34154 -
2016-07-19 14:30:39 +00:00
Jonas Maebe
2bd2e03309 * no longer use the synthetickind field of a procdef to determine whether
it's an automatically generated getter/setter, but a procoption. This
    way we no longer have to save/restore the synthetickind procdef field
    to/from ppu's. This way we can modify the field also after the interface
    has been parsed without affecting the crc (e.g. when creating wrappers
    for high level targets for routines that are only declared as "external"
    in the implementation)

git-svn-id: trunk@34129 -
2016-07-14 15:25:30 +00:00
Jonas Maebe
c0ff55e95a * changed the abstract method wrapper generation from thlcgobj to synthetic
methods. Implementing a fully functional g_external_wrapper() for llvm is
    quite hard, and the regular wrapper method that calls FPC_ABSTRACTERROR can
    in principle be optimized to a plain jump by tail call optimisation on other
    targets (to the extent that this matters, because most of them will be
    smartlinked away, and the ones that are executed will trigger an exception)
   o this means that the synthetic method generation needs to be run for all
     objectdefs on all platforms now, rather than only for Java classes

git-svn-id: trunk@34127 -
2016-07-14 15:24:13 +00:00
svenbarth
3971ba7898 Provide basic facilities to handle indirect symbols that are needed for proper dynamic packages support.
symconst.pas:
  + new constant suffix_indirect which will be used to denote indirect symbols
aasmbase.pas:
  * TAsmsymbind: extend by AB_INDIRECT (which is used to define an indirect symbol) and AB_EXTERNAL_INDIRECT (which is used when an unknown indirect symbol is requested)
  * asmsymbindname: adjust for TAsmsymbind changes
  + new constant asmsymbindindirect which is a set of both indirect asm symbol binds
aasmdata.pas, TAsmData:
  * DefineAsmSymbolByClass: adjust to correctly declare an indirect symbol (with suffix_indirect) if one of the indirect asm symbol binds is used
  * RefAsmSymbol: extend by a boolean parameter which is used to request an indirect symbol (usually AB_EXTERNAL_INDIRECT instead of AB_EXTERNAL)

git-svn-id: trunk@33278 -
2016-03-18 21:34:17 +00:00
Jonas Maebe
b9231aa6f1 * converted objcgutl (Objective-C metadata generation) to the high level
typed const builder

git-svn-id: trunk@32917 -
2016-01-10 17:22:20 +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
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
96b529072a * factored out generating the start and end of a vectorized dead strippable
section to the high level typed const builder, and use this functionality
    for the resource strings (generating items: todo)
  * fixed dead stripping unused resource strings (all string data was put in the
    same section since r30342)

git-svn-id: trunk@32394 -
2015-11-21 12:36:06 +00:00
Jonas Maebe
fa3b0ca312 * support marking defs created via the getreusable*() class methods as
"don't free even if not registered"; use for defs that may not be written
    to a ppu file, but that must nevertheless survive the compilation of the
    current module
  * mark all defs created for para locations as "don't free even if not
    registered", because we don't discard and recalculate all para locations
    after a module has been compiled (since that's not needed)
   o solves issues if the paralocations for a routine in the interface of
     unit A are calculated while the implementation of unit B gets
     compiled, and a new reusable type is allocated at that point which
     is not used anywhere else (after r32160)

git-svn-id: trunk@32235 -
2015-11-04 20:46:18 +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
Jonas Maebe
2d2b8c635d * detect whether or not a def/sym is registered based on its defid, so we
don't need a separate field for this
   o changed the order in which symid and realname are stored to/loaded from
     the ppufile (because tsym.create now initialised tsym.symid, and it's
     called from ppuload) -> increased ppu version

git-svn-id: trunk@32031 -
2015-10-12 21:03:09 +00:00
Jonas Maebe
bf10ae45de * only add the llvm "sret" attribute to "struct return" parameters if they
are the first parameter (as required by llvm)
   o ensure that for AArch64, "struct return" the parameter always is the first
     parameter, as it needs to be returned in a special register there

git-svn-id: trunk@31676 -
2015-09-14 16:10:48 +00:00
Jonas Maebe
faf4a9cb38 * moved the generation of the "main" stub for libc-based platforms from
hlcgobj to pmodules/symcreat/ngenutil, so that it also works for llvm

git-svn-id: trunk@31658 -
2015-09-12 23:34:01 +00:00
Jonas Maebe
83ae160057 + get_threadvar_record() to get a recorddef representing a threadvar (index
and data in case of single threaded)

git-svn-id: trunk@31643 -
2015-09-12 23:33:07 +00:00
Jonas Maebe
c7a418829b * support for implementing interface method wrappers at the node tree
level, used by LLVM

git-svn-id: trunk@31636 -
2015-09-12 23:32:42 +00:00
Jonas Maebe
d7f6744f7b * converted ncgrtti to the high level typed constant builder
o the result is still not very clean due to the fact that this data
     is almost completely unstructured due to variable-length strings
     everywhere, which means that
    a) we cannot just load recorddefs from the system or typeinfo unit
       and use those as templates
    b) we cannot easily reuse the recorddefs we create ourselves (except
       if the strings have the same length -- this is the reason for all
       of the names specified to begin_anonymous_record: to reuse defs
       as much as possible rather than creating new ones all the time)
    c) we have to add explicitly aligned subrecords everywhere to insert
       explicit alignment on platforms that need it

git-svn-id: trunk@31255 -
2015-07-30 16:58:17 +00:00
Jonas Maebe
b55c7df996 * factored out internal type prefixes
git-svn-id: trunk@31248 -
2015-07-30 16:57:55 +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
florian
01cbf00455 * unified code to remove unnecessary type casts to support also removals of type conversions between smaller ints
* get rid of unnecessary 8->16 Bit type conversions on 8 Bit CPUs, resolves issue #27839

git-svn-id: trunk@30726 -
2015-04-25 21:18:34 +00:00