Commit Graph

168 Commits

Author SHA1 Message Date
Michael VAN CANNEYT
b69c78ccce * String -> ShortString/RTLString 2023-07-14 17:26:11 +02:00
Michaël Van Canneyt
517d1b017c * Interface thunk class must query owner object interface list 2023-07-11 17:47:03 +02:00
Michaël Van Canneyt
70282826ad * Parent class for hidden TVirtualInterface thunking class 2023-07-11 08:36:57 +00:00
Michaël Van Canneyt
96921aaba3 * Fix NilValue 2023-07-09 16:48:07 +02:00
Michaël Van Canneyt
b121045d4a * TPtrWrapper for Delphi compatibility 2023-07-09 15:05:53 +02:00
Michaël Van Canneyt
b8738944ed * Add TNoRefCountObject (delphi compatibility) 2023-06-05 11:43:07 +02:00
florian
c0979bbc0c * TObject.InitInstance got very big so inlining has no advantage anymore, resolves #39494 2021-12-25 19:09:22 +01:00
Nikolay Nikolov
5124ab2521 * cloned the WebAssembly native exceptions code generation and rtl support into
the branchful exceptions (which will be modified later, but we're using this
  as their starting point, because we can get a snapshot built, without compiler
  internal errors)
2021-10-05 00:37:20 +03:00
Nikolay Nikolov
91f0f1a86c * don't include except.inc if wasm32 native exception is turned on, instead
replace it with except_native.inc
2021-09-28 03:46:30 +03:00
michael
e6a593c5fa * Patch from Zeljko Avramovic to extend ordinal/float helpers
git-svn-id: trunk@49622 -
2021-07-21 11:36:05 +00:00
michael
82346563c1 * Add StoredAttribute class, bug ID #37602
git-svn-id: trunk@46506 -
2020-08-20 12:06:14 +00:00
pierre
3aa253c11d Allow system unit to be compiled without RTTI feature
git-svn-id: trunk@45351 -
2020-05-13 09:10:23 +00:00
ondrej
9a9cd15ec4 TInterfacedObject.Destroy: fix case for correct auto-completion
git-svn-id: trunk@43418 -
2019-11-08 21:29:26 +00:00
svenbarth
10af6fe2fb * fix for Mantis #35965: correct alignment also for the class info used to retrieve the unit name
+ added test

git-svn-id: trunk@42697 -
2019-08-15 13:29:19 +00:00
svenbarth
e97a2cb03e * tests with Delphi showed that an attribute class must explicitely declare a parameterless constructor if it should be used, cause TCustomAttribute.Create is private
Note: this also means that TCustomAttribute itself can not be used as an attribute
* adjusted existing tests
+ added test

git-svn-id: trunk@42471 -
2019-07-20 20:03:38 +00:00
svenbarth
3ad24c9db8 * as attributes can be part of any type they are best suited in a common part of TTypeData
git-svn-id: trunk@42375 -
2019-07-12 22:06:09 +00:00
svenbarth
e296b26e9e - remove unit info and related code again as that will be handled similar, but differently with dynamic packages
git-svn-id: trunk@42369 -
2019-07-12 22:05:47 +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
svenbarth
a076677336 * instead of a flags field generate a table with all Initialize operators of all fields (nested or not, parent class or not) for class types; objects and records don't use this (yet)
git-svn-id: trunk@39690 -
2018-08-29 19:21:35 +00:00
svenbarth
8536abce8a * as the management operator feature is not platform specific using a specific define for it aside from a
version check is unnecessary, thus remove the FPC_HAS_MANAGEMENT_OPERATOR define and instead check for VER3_0

git-svn-id: trunk@39257 -
2018-06-20 19:00:24 +00:00
svenbarth
4d0ab82ef7 * optimize class initialization by calling RTTIRecord() only when required for a non-trivial initialization
git-svn-id: trunk@39256 -
2018-06-20 19:00:21 +00:00
michael
3787d52dee * Fix bug ID #32353, reset ref count fields in destructor
git-svn-id: trunk@37112 -
2017-09-02 15:07:23 +00:00
michael
9878dc280b * Fix bug ID #32168
git-svn-id: trunk@36757 -
2017-07-21 16:08:01 +00:00
maciej-izak
5a7d4eb25f * Call management initialize operator for records inside classes (record with management operators as field) (rtl/inc/objpas.inc, TObject.InitInstance)
git-svn-id: trunk@35449 -
2017-02-19 12:17:20 +00:00
florian
0b82f71e8d * take care of the fact that there are 32 bit abis (e.g. ARMHF) which align qword on 8 byte boundaries, resolves issue #31132
git-svn-id: trunk@35218 -
2016-12-30 15:32:56 +00:00
florian
091b31fc76 * fix avr compilation after r34975 by more tests against feature defines, resolves #31036
git-svn-id: trunk@35015 -
2016-11-29 20:37:58 +00:00
florian
bcb7061314 * made TObject usable, even if no ansistring support is available
git-svn-id: trunk@34974 -
2016-11-26 19:33:31 +00:00
michael
784da563ef * Patch from Silvio Clecio to implement QualifiedClassName (bug ID 30985)
git-svn-id: trunk@34966 -
2016-11-26 13:53:27 +00:00
nickysn
7d15b688e8 * TInterfaceEntry changed to a variant record, that overlays a CodePointer on
top of the IOffset: SizeUInt field, because it is sometimes used as a
  CodePointer (for etStaticMethodResult and etStaticMethodClass) and sometimes
  as a SizeInt and these two types can be of different size in certain i8086
  memory models

git-svn-id: trunk@34645 -
2016-10-07 20:18:02 +00:00
nickysn
5e7ba4a893 * the type of FieldOffset in the TFieldInfo rtti structure changed to SizeUInt,
because it represents an offset _within_ a structure

git-svn-id: trunk@34627 -
2016-10-04 21:57:29 +00:00
svenbarth
fb6546972b * IID and IIDStr references of the VMT's interface table need to be indirect
git-svn-id: trunk@34338 -
2016-08-19 13:06:26 +00:00
svenbarth
685f820622 * switch class'/object's parent reference in the VMT to an indirect reference
(this also requires the adjustment of a test)

git-svn-id: trunk@34172 -
2016-07-22 12:53:51 +00:00
svenbarth
7a5bac9cd3 Rework the interface table of VMTs to get rid of FPC_EMPTYINTF.
Previously we had the following approach:
- classes that implemented interfaces had an interface table
- classes that didn't implement an interface, but inherited from a class that did had a Nil entry
- classes that didn't implement any interface (including their parents) had a reference to FPC_EMPTYINTF (this was to optimize lookups)

Now the approach is as follows:
- classes that implement an interface or have a parent that implements an interface have an interface table; if the class itself doesn't implement an interface then the count will be 0
- classes that don't implement an interface at all (neither them nor their parents) have a Nil interface table

This way FPC_EMPTYINTF can be removed without sacrificing at least the optimization for classes without any interface. For classes that have parents with interfaces there will be a small speed penalty due to an additional lookup for the counter.

git-svn-id: trunk@34087 -
2016-07-08 15:34:55 +00:00
nickysn
c1b0fb81f1 * updated all the RTL helper functions related to exceptions and stack traces to use codepointer instead of pointer
git-svn-id: trunk@25513 -
2013-09-17 21:25:26 +00:00
nickysn
ef2423128f * use CodePointer instead of Pointer in TObject.MethodName() and .MethodAddress() for i8086 medium memory model compatibility
git-svn-id: trunk@25152 -
2013-07-20 22:08:38 +00:00
nickysn
54c4c8155b + also added PCodePointer and PPCodePointer
git-svn-id: trunk@24841 -
2013-06-09 17:30:03 +00:00
sergei
27c626245b * Reuse RecordRTTI to finalize class instances. This is possible because RTTI for classes is the same as for records (except different value of tkKind field), and RecordRTTI ignores tkKind (assuming that required checks are done by its caller).
git-svn-id: trunk@23213 -
2012-12-23 12:10:11 +00:00
Jonas Maebe
93c345a099 * always decrease the refcount of the function result of helpers that return
interfaces (since that may not have been done yet in case of an optimized
    assignment before r21955, and will never be done as of r21955)

git-svn-id: trunk@21962 -
2012-07-23 23:54:44 +00:00
pierre
a311c53167 Replace HandleErrorFrame calls by HandleErrorAddrFrameInd where possible in common code (to allow correct backtrace for mips cpu)
git-svn-id: trunk@21900 -
2012-07-12 11:53:59 +00:00
sergei
568ef396fb * Added fpc_dynarray_assign (a helper for dynamic array assignments), added local access to fpc_intf_assign, and switched fpc_copy to use assignment helpers instead of incr_ref/decr_ref combinations.
git-svn-id: trunk@20114 -
2012-01-19 17:43:37 +00:00
tom_at_work
0cb36ee173 * fix integer message dispatch on ppc64-darwin by temporarily setting the correct record alignment
git-svn-id: trunk@16271 -
2010-10-31 12:24:38 +00:00
tom_at_work
8a2696eb24 * limit the number of string message methods per class to 2^31 independent of architecture width: this avoids lots of compiler changes when allowing 2^63 (for 64 bit targets)
* fix string message method handling data structures to reflect this change, and also use the correct types for accessing them (longint vs. dword)
* output proper alignment code for string message method data structures to avoid issues on big-endian 64 bit architectures or architectures requiring proper alignment
* same for integer message methods; also, like string message method data structures, do not use packed records for them when accessing
* extend the test case (tw14145) do do multiple message dispatches, both integer and string ones, to complete successfully

git-svn-id: trunk@16254 -
2010-10-29 13:26:50 +00:00
joost
07bf44517c * Merged XPCom branch into trunk, added support for constref and changed
the IInterface implementation to be XPCom-compatible
--- Merging r15997 through r16179 into '.':
U    rtl/inc/variants.pp
U    rtl/inc/objpash.inc
U    rtl/inc/objpas.inc
U    rtl/objpas/classes/persist.inc
U    rtl/objpas/classes/compon.inc
U    rtl/objpas/classes/classesh.inc
A    tests/test/tconstref1.pp
A    tests/test/tconstref2.pp
A    tests/test/tconstref3.pp
U    tests/test/tinterface4.pp
A    tests/test/tconstref4.pp
U    tests/webtbs/tw10897.pp
U    tests/webtbs/tw4086.pp
U    tests/webtbs/tw15363.pp
U    tests/webtbs/tw2177.pp
U    tests/webtbs/tw16592.pp
U    tests/tbs/tb0546.pp
U    compiler/sparc/cpupara.pas
U    compiler/i386/cpupara.pas
U    compiler/pdecsub.pas
U    compiler/symdef.pas
U    compiler/powerpc/cpupara.pas
U    compiler/avr/cpupara.pas
U    compiler/browcol.pas
U    compiler/defcmp.pas
U    compiler/powerpc64/cpupara.pas
U    compiler/ncgrtti.pas
U    compiler/x86_64/cpupara.pas
U    compiler/opttail.pas
U    compiler/htypechk.pas
U    compiler/tokens.pas
U    compiler/objcutil.pas
U    compiler/ncal.pas
U    compiler/symtable.pas
U    compiler/symsym.pas
U    compiler/m68k/cpupara.pas
U    compiler/regvars.pas
U    compiler/arm/cpupara.pas
U    compiler/symconst.pas
U    compiler/mips/cpupara.pas
U    compiler/paramgr.pas
U    compiler/psub.pas
U    compiler/pdecvar.pas
U    compiler/dbgstabs.pas
U    compiler/options.pas
U    packages/fcl-fpcunit/src/testutils.pp

git-svn-id: trunk@16180 -
2010-10-17 20:58:22 +00:00
ivost
a6022f5df2 * removed IImplementorGetter interface and replaced it by the guid IObjectReference.
* GetInterface and GetInterfaceWeak is modified so that when querying for IObjectReference not an interface is returned but the object pointer

git-svn-id: trunk@15087 -
2010-03-28 12:35:50 +00:00
ivost
561997e8ef * added fpc_class_is_corbaintf and fpc_class_cast_corbaintf compiler helper functions
git-svn-id: trunk@15085 -
2010-03-28 11:31:50 +00:00
ivost
d9a6e63ef0 * prepeared compiler functions for IS and cast operators
* IS: fpc_intf_is, fpc_intf_is_class, fpc_class_is_intf
* AS: fpc_intf_cast, fpc_intf_cast_class, fpc_class_cast_intf

git-svn-id: trunk@15084 -
2010-03-28 11:19:56 +00:00
ivost
dc785f6f68 * implemented intf as object. When doing IInterface as TObject the compiler calls fpc_intf_as_class to query for the IImplementorGetter interface and then invokes GetObject to get the
objects reference.
* by default the TInterfacedObject is supporting now IImplementorGetter

git-svn-id: trunk@15080 -
2010-03-28 00:17:20 +00:00
ivost
6560ed87e9 * removed a debug writeln, unfortunately commited by r15077
git-svn-id: trunk@15079 -
2010-03-27 17:06:02 +00:00
ivost
3b5826059d * Added GetInterfaceWeak to TObject. It's equal to GetInterface but the returned interface is not referenced. This way it's possible to query interfaces of unreferenced objects.
* Changed fpc_class_as_intf so that it uses GetInterfaceWeak instead of GetInterface. This way it's prevented that the AS operator is increasing the refcounter of an unreferenced object from 0 to 1 temporarily and then by decreasing from 1 to 0 the object is freed.

git-svn-id: trunk@15077 -
2010-03-27 17:00:52 +00:00
ivost
3f2d66b188 * when calling GetInterfaceByStr on COM Objects, the refcounter was not increased
* this bugfix fixes bugreport #0012778

git-svn-id: trunk@15073 -
2010-03-27 11:12:46 +00:00