Commit Graph

187 Commits

Author SHA1 Message Date
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
ivost
c47c125ec0 * changed 0 to S_OK as return value of QueryInterface (niceness)
* bugfix: initialized temp variables that are going to keep an interface by nil (segfaults)
* bugfix: AS operator has to call QueryInterface before GetInterface (related to revision r15066)

git-svn-id: trunk@15068 -
2010-03-26 00:48:28 +00:00
paul
cf0a1b1af9 compiler: safecall exception handling:
- move safecall exception handling from codegenerator to generate_except_block method (which generates nodes)
  - call SafeCallException for safecall methods which raises an exception

git-svn-id: trunk@14940 -
2010-02-26 10:17:24 +00:00
paul
ea8bf4f2fd rtl: TObject.SafeCallException and TComponent.SafeCallException has HResult return value. Fix default return value to catastrophic failure error code.
git-svn-id: trunk@14936 -
2010-02-25 04:13:52 +00:00
Jonas Maebe
b1d2ab5450 * tobject.inheritsfrom(nil) has to return false (mantis #15690)
git-svn-id: trunk@14870 -
2010-02-06 18:14:26 +00:00
Jonas Maebe
870edaf916 * tobject.unitname and tobject.tostring have to return an ansistring instead
of a shortstring (mantis #15693)
  * changed tobject5 so it checks whether the return values are correct

git-svn-id: trunk@14869 -
2010-02-06 17:53:49 +00:00
florian
dab642986e * patch by Sergei Gorelkin, fixes several issues with implements, resolves #15209
git-svn-id: trunk@14466 -
2009-12-23 16:23:19 +00:00
marco
4104d9f481 * More pluggability of the RTL. Mantis 15124
git-svn-id: trunk@14212 -
2009-11-18 21:16:12 +00:00
paul
dfef902c53 rtl: introduce new TObject methods: UnitName, GetHashCode, Equals, ToString added for compatibility with delphi 2009.
+ changes in compiler, utils, packages to resolve identifier conflicts with the new TObject methods (like changing of UnitName arguments to AUnitName, adding Classes. before the toString, etc). (issue #0014931)

git-svn-id: trunk@14005 -
2009-11-01 16:22:47 +00:00
florian
e8dff46f8e * several small bugs in the handling of implements fixed, resolves #14418
git-svn-id: trunk@13615 -
2009-08-30 08:01:10 +00:00
ivost
0438667eed * fixed bug #5800
* const s: string = icorbainterface; is possible now
* as operator is working now with corba interfaces
* supports helper function is working now with corba interfaces

git-svn-id: trunk@12729 -
2009-02-09 00:35:09 +00:00
ivost
0f519439b5 * reverted r12690 and r12691
* but extended ptconst so that a com interface maybe assigned to a TGuid const

git-svn-id: trunk@12692 -
2009-02-06 02:56:13 +00:00
ivost
7f2c77a407 * temporarly disabled GetInterface(iidstr: .... to keep fpc compiling
git-svn-id: trunk@12691 -
2009-02-06 01:37:52 +00:00
yury
15d0521f39 * Inlining is not supported for formal parameters. Disable inlining to prevent warning.
git-svn-id: trunk@11579 -
2008-08-14 14:56:28 +00:00
florian
1fa70f7a0a * proper support for tobject.getinterface with raw/corba interfaces, resolves #6798 and #6036
git-svn-id: trunk@11497 -
2008-08-01 15:27:58 +00:00
florian
d672700a59 * some avr fixes
+ cpu16 type defines

git-svn-id: trunk@11380 -
2008-07-13 18:16:24 +00:00
florian
d79851dc1b * patch by Sergei Gorelkin to improve class creation speed and make objpas.inc more readable
git-svn-id: trunk@11036 -
2008-05-22 11:49:40 +00:00
marco
eb2a80d272 * TContainedObject 10496. First implementation copied from TInterfacedObject
git-svn-id: trunk@9569 -
2007-12-29 15:30:57 +00:00
peter
6ed3d91989 * CompareText for shortstrings added
* optimize CompareText
  * use CompareText for case-insenstive compares in the RTL
  patches from Sergei Gorelkin

git-svn-id: trunk@9384 -
2007-12-02 18:36:20 +00:00
peter
e8322a83e4 * optimized generic implementations to use pointers instead of
array accesses. This also allows better register variable
    optimizations

git-svn-id: trunk@8742 -
2007-10-07 18:36:18 +00:00
Jonas Maebe
5cffd5d22b * marked TObject.InitInstance as inline
git-svn-id: trunk@8400 -
2007-09-08 09:19:13 +00:00
daniel
ea47fcfc97 * ptrint -> ptruint
git-svn-id: trunk@7892 -
2007-07-01 10:14:19 +00:00
ivost
1a7f06aa7d * added the new CLONE_* constants from syscall clone
git-svn-id: trunk@6686 -
2007-02-28 22:26:42 +00:00
ivost
c0e9be49b8 * fixed bug related to IMPLEMENTS keyword. The interface type was stored inside the interface defintion what was wrong! now it's set per TImplementedInterface$
* merged IOffset and EntryOffset of TInterfaceEntry. The meaning of IOffset depends now on IType
    * to optimize: IOffset and FieldOffset of TImplementedInterface can be merged also! fpc still generate an interfacetable entry even for interfaces that aren't implemented in the current class (redirected by IMPLEMENTS keyword)

git-svn-id: trunk@6206 -
2007-01-26 20:58:46 +00:00
Jonas Maebe
3eb4823209 * made return value of TInterfacedObject._AddRef and
TInterfacedObject._Release thread safe

git-svn-id: trunk@6130 -
2007-01-22 15:39:55 +00:00
florian
49796e5151 + TAggregatedObject, fixes #8149
git-svn-id: trunk@6089 -
2007-01-20 20:28:29 +00:00
florian
8e8c0832c6 * fixed previous commit
git-svn-id: trunk@5843 -
2007-01-07 18:20:58 +00:00
florian
4c7c5e5adf * hopefully fpc_intf_assign_by_iid improved
git-svn-id: trunk@5842 -
2007-01-07 17:59:46 +00:00
florian
a2ec2e72b6 * better hint about abstract methods (fixes 5098)
+ code generation for invoking dispinterface methods
* small dispinterface problems fixed

git-svn-id: trunk@5798 -
2007-01-03 19:14:31 +00:00
florian
21955282d0 + infrastructure for DispInterface call dispatching
git-svn-id: trunk@5793 -
2007-01-02 23:06:17 +00:00
florian
fd2032dab2 + start of embedded rtl
+ feature support in the compiler

git-svn-id: trunk@5628 -
2006-12-17 18:40:36 +00:00
ivost
7e2f18ea7e * removed debug output (sorry, forgot the remove it, my bad)
git-svn-id: trunk@5560 -
2006-12-08 18:14:29 +00:00
ivost
73713d14e3 * improved getinterfaceentry and getinterfaceentrybystr
* fixed InitInterfacePointers (just etStandard interface pointers need to be initialized!)
    * to fix: EntryOffset and IOffset should be merged (compiler thing)
    * to fix: Interface pointer allocation in TClass for not etStandard interfaces is not necessary! (also compiler thing)

git-svn-id: trunk@5559 -
2006-12-08 17:59:31 +00:00
chrivers
4bb1d117d6 Use symbolic const E_NOINTERFACE instead of raw value $80004002
git-svn-id: trunk@4934 -
2006-10-15 19:51:40 +00:00
florian
557afed6f3 * missing space added
git-svn-id: trunk@4923 -
2006-10-15 14:06:53 +00:00
micha
d704af7216 fix compilation for {$T+} linux/win
git-svn-id: trunk@4794 -
2006-10-04 20:43:55 +00:00
peter
367958e154 * fpc_intf_assign_by_iid does not call Addref anymore, the QueryInterface call will increase the refcount
git-svn-id: trunk@4744 -
2006-09-28 06:32:20 +00:00
chrivers
dceda55abf Implemented _IMPLEMENTS. Changed GetInterfaceByStr() and GetInterface() accordingly. Also introduced new compilerproc: fpc_intf_assign_by_iid to allow := with _IMPLEMENTS-support
git-svn-id: trunk@4362 -
2006-08-06 01:09:20 +00:00
florian
849878b472 * fixed memory leak with the as operator, fixes #7174
git-svn-id: trunk@4355 -
2006-08-05 21:53:38 +00:00
tom_at_work
f86ee115d8 * more fixes for 64 bit compilation after Peter's changes
* updated and added a warning notice about changing structures in this file to objpash.inc

git-svn-id: trunk@2547 -
2006-02-12 20:33:33 +00:00
florian
e9b718a0a2 * cleanup
git-svn-id: trunk@2282 -
2006-01-14 12:55:26 +00:00
Jonas Maebe
640ddd2e26 - removed unused local conflicting type definition
git-svn-id: trunk@2056 -
2005-12-26 16:01:13 +00:00
tom_at_work
0b34b01a6d * fixed class messages for PowerPC64, due to a wrong typecast
git-svn-id: trunk@1363 -
2005-10-12 22:28:51 +00:00
florian
0b3094fdde * from Thomas Schatzl: changed result type of InstanceSize to PtrInt
* simplified some code
* small methods of tobject are now inlined

git-svn-id: trunk@1170 -
2005-09-24 08:35:43 +00:00
michael
5cafc069b5 + Removed NOSAVEREGISTERS define
git-svn-id: trunk@307 -
2005-06-09 17:58:20 +00:00
michael
93ba0409be + Removed HASCOMPILERPROC define
git-svn-id: trunk@265 -
2005-06-07 21:41:02 +00:00
michael
7712d4e2d1 + Removed FPC_ALIGNSRTTI define
git-svn-id: trunk@251 -
2005-06-07 20:59:11 +00:00
michael
23ad0ae1ec + Removed HASINTF and VER1_0 defines
git-svn-id: trunk@239 -
2005-06-07 20:30:03 +00:00
peter
4ace790492 * remove $Log
git-svn-id: trunk@231 -
2005-06-07 09:47:55 +00:00
fpc
790a4fe2d3 * log and id tags removed
git-svn-id: trunk@42 -
2005-05-21 09:42:41 +00:00
fpc
50778076c3 initial import
git-svn-id: trunk@1 -
2005-05-16 18:37:41 +00:00
michael
81fd0bb72c + Removed S_OK declarations, they are in objpash.inc 2005-05-04 08:56:03 +00:00
florian
3a6006367f * getinterface fixed 2005-04-28 17:58:18 +00:00
peter
36d97e9310 * call initspecialchars if one of the specialchars is configured
for the first time
2005-04-05 21:05:31 +00:00
florian
7b56e65a4b * fixed FieldAddress for 64 bit and CPUs requiring proper alignment 2005-03-13 08:34:58 +00:00
peter
e417e34496 * truncate log 2005-02-14 17:13:06 +00:00
florian
36bcc2defa * fixed memory release in TInterfacedObject._Release 2004-12-05 21:09:54 +00:00
florian
b6d34b6bd1 * fixed dyn. array handling for 32 bit architectures requiering proper alignment 2004-11-03 11:33:50 +00:00
florian
ac7f9351f0 * info record about class fields must be packed else it will be aligned wrongly on 64 bit platforms 2004-11-03 10:22:19 +00:00
peter
fd759e521f * saveregisters calling convention is obsolete 2004-10-24 20:01:41 +00:00
florian
2f291713e1 * fixed aligntoptr 2004-10-10 19:18:31 +00:00
florian
feeba0ede6 * bootstrapping with rtti alignment fixed 2004-10-05 20:21:02 +00:00
florian
b39c0af01b * rtti alignment fixed 2004-10-04 21:23:15 +00:00
florian
f3e9309eef * fixed tobject.dispatch for 64 bit cpus 2004-04-29 21:33:22 +00:00
peter
8c60c6f93e * ordinal-pointer conversions fixed 2004-04-28 20:48:20 +00:00
florian
7367801810 * more alignment fixes 2004-03-22 22:19:36 +00:00
florian
5e82863f3f * CleanupInstance takes now care of FPC_REQUIRES_PROPER_ALIGNMENT 2004-03-21 22:41:29 +00:00
peter
72324a4283 * tkclass removed from finalize()
* cleanupinstance now parses the tkclass rtti entry itself and
    calls finalize() for the rtti members
2004-02-26 16:19:01 +00:00
michael
bea2706914 + fix from Ivan Shikhalev for QueryInterface to return ancestor methods 2003-07-19 11:19:07 +00:00
florian
eab5d1f7c5 * started to make the rtl 64 bit save by introducing SizeInt and SizeUInt (similar to size_t of C) 2003-05-01 08:05:23 +00:00
peter
c7786e73aa * ClassType changed to class method 2003-03-17 20:55:58 +00:00
peter
4deb6a9b4e * 'inlined' some more calls 2002-10-19 15:53:20 +00:00
peter
2e3c4a27eb * manual inline classparent calls in the loops 2002-10-15 19:29:49 +00:00
florian
b5f091d0cb * initinterfacepointers improved 2002-10-11 14:05:21 +00:00
peter
01dfac4a4e * old logs removed and tabs fixed 2002-09-07 15:06:34 +00:00
carl
1b53eca49d - remove logs 2002-09-07 11:08:58 +00:00
florian
44ad4027b7 * several fixes for Linux/PPC compilation 2002-08-31 13:11:11 +00:00
Jonas Maebe
58fc64dc09 * interface "as" helpers converted from procedures to functions 2002-08-20 18:24:05 +00:00
florian
272865d6af * interface helpers for 1.1 compilers without interface support fixed 2002-07-30 17:29:19 +00:00
peter
71a1ae2136 * sLineBreak changed to normal constant like Kylix 2002-07-01 16:29:05 +00:00
peter
268e4bb7e7 * use saveregisters for incr routines, saves also problems with
the optimizer
2002-04-26 15:19:04 +00:00
peter
0cdf327866 * updated compilerprocs
* incr ref count has now a value argument instead of var
2002-04-25 20:14:56 +00:00