Commit Graph

9849 Commits

Author SHA1 Message Date
svenbarth
764f36a179 Extend TThread with (class) methods and (class) properties from Delphi 2007 and newer.
Especially for the introduction of the Queue method the internal Synchronize handling was modified. Instead of handling only one event there is now a queue of events which is walked completely when CheckSynchronize is called. Each entry in the queue can carry a PRTLEvent which will be signaled when the contained method has been executed and thus Synchronize methods can still be blocking.
Exceptions inside the queued methods are either handed back to the calling method for Synchronize events or raised directly (after leaving the queue in a valid state) to the caller of CheckSynchronize.

The way platform specific adjustments can be made to TThread was changed. Instead of implementing the Constructor and Destructor directly one now implements the methods SysCreate and SysDestroy which are called from the Constructor and Destructor respectively. All RTLs were adjusted for this and should be controlled by the platform maintainers for correct compilation (Unix works).

The new method NameThreadForDebugging has two overloaded variants: one with the thread name as AnsiString and one with the thread name as UnicodeString.
By default the AnsiString variant calls the UnicodeString variant and the latter needs to be implemented. This can be changed by defining THREADNAME_IS_ANSISTRING for a platform. Then the UnicodeString variant calls the AnsiString one and the AnsiString one needs to be implemented.

Also added was a global property CPUCount for the System unit. This property returns the number of virtual cores of the system.

New methods and functions that should be implemented per platform are:
System.GetCPUCount (default returns 1)
Classes.TThread.GetSystemTimes (default zeros the struct)
Classes.TThread.NameThreadForDebugging (default does nothing)

More detailed information about the added methods will be available in the feature announcement mail.

git-svn-id: trunk@23227 -
2012-12-27 16:16:17 +00:00
pierre
7457a0f321 Use new getdirentriesi49 syscall, contributed by Pascal Stumpf
git-svn-id: trunk@23223 -
2012-12-26 14:33:30 +00:00
pierre
bba4932ef9 * Fix commit 23220, by moving declaration from syscallh.inc to syscall.inc
git-svn-id: trunk@23221 -
2012-12-25 22:54:49 +00:00
pierre
70a29668a4 Try to fix simply the fpc_threadvar_relocate_proc problem
git-svn-id: trunk@23220 -
2012-12-24 16:23:30 +00:00
svenbarth
e914ec7f00 Add platform independant support for "GetTickCount" and "GetTickCount64" to unit "SysUtils". "GetTickCount" is declared as deprecated from the beginning and thus "GetTickCount64" should be used instead.
The default implementation of "GetTickCount" just uses the lower 32-Bit from the result of "GetTickCount64". 
The default implementation of "GetTickCount64" is based upon "Now" for systems that support a floating point unit (and thus "Now"). 
Other systems can define a "SysTimerTick" function which is used instead if "HAS_SYSTIMERTICK" is defined.

The Windows implementation of "GetTickCount" uses Windows' "GetTickCount" function. 
The implemenation of "GetTickCount64" checks whether the system is a Windows Vista or newer and then uses Windows' "GetTickCount64" function. Otherwise Windows' "GetTickCount" is used also.

The Unix implementation of "GetTickCount" is the default one. 
The "GetTickCount64" implementation uses "fpgettimeofday".

git-svn-id: trunk@23215 -
2012-12-23 16:12:57 +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
yury
2012220aec * Fixed HKEY_xxx defines for win64. For example HKEY_CLASSES_ROOT should be $FFFFFFFF80000000 on win64 instead of $80000000. Most registry API functions accept invalid HKEY_xxx values. But some registry functions like RegOverridePredefKey() require proper values. I had spent several hours fighting with RegOverridePredefKey() on win64 until I have found what had been wrong.
git-svn-id: trunk@23205 -
2012-12-22 16:15:32 +00:00
sergei
f9dbcbd0c3 - Removed duplicate file header
git-svn-id: trunk@23199 -
2012-12-21 09:16:23 +00:00
sergei
278fbb742e * mips-linux: call SetErrno in order to remove dependence on threadvar implementation details.
git-svn-id: trunk@23197 -
2012-12-21 04:42:41 +00:00
pierre
c979ded1f9 Use FPUSOFT instead of CPUCOLDFIRE for settings some m68k software macors
git-svn-id: trunk@23186 -
2012-12-18 15:20:33 +00:00
pierre
14c5fceb45 Add fpc_longword_to_double
git-svn-id: trunk@23185 -
2012-12-18 15:17:48 +00:00
pierre
6d5f2e0cf2 Regenerated after: Add lineinfo
git-svn-id: trunk@23184 -
2012-12-18 15:16:37 +00:00
pierre
bb6355e716 Add lineinfo
git-svn-id: trunk@23183 -
2012-12-18 15:15:26 +00:00
pierre
daccd0d283 Add aliases fro mkdir/rmdir/chdir
git-svn-id: trunk@23182 -
2012-12-18 15:14:13 +00:00
pierre
76ba2ea6c7 Save complete register set for setjmp/longjmp
git-svn-id: trunk@23174 -
2012-12-18 14:05:52 +00:00
pierre
0e14a3c5bd add fpc_longword_to_double if needed
git-svn-id: trunk@23173 -
2012-12-18 14:04:14 +00:00
Károly Balogh
e2f02faca0 do not refer reg a6 directly, base pointer might differ among platforms (a5 on m68k-amiga)
git-svn-id: trunk@23167 -
2012-12-18 02:13:43 +00:00
Károly Balogh
39755ba888 use operatingsystem_result on m68k-amiga to pass returncode to OS
git-svn-id: trunk@23166 -
2012-12-18 01:41:52 +00:00
Károly Balogh
e2ce0e54c2 made Amiga/68k RTL to build with new m68k compiler at least (result probably not functional yet)
git-svn-id: trunk@23159 -
2012-12-16 23:46:27 +00:00
florian
d4c17ec4e0 + patch by Vojtech Cihak to add csqr function, resolves #23492
+ init function for complex numbers
+ csamevalue function
+ test
+ run tests in units/ucomplex directory

git-svn-id: trunk@23156 -
2012-12-16 10:15:13 +00:00
sergei
1415569ecb - Removed UnixToWinAge, since revision 444 it does not change its argument, but wastes a lot of CPU cycles converting it from local time and back.
git-svn-id: trunk@23145 -
2012-12-15 08:38:41 +00:00
michael
11a531ab62 * Fixed bug #23477
git-svn-id: trunk@23135 -
2012-12-12 15:21:28 +00:00
Jonas Maebe
14b1c8a99c * moved fpc_threadvar_relocate_proc from systemh.inc to thread.inc
and gave it the correct type (TRelocateThreadVarHandler)
  * changed parameter type of InitThread also to TRelocateThreadVarHandler

git-svn-id: trunk@23130 -
2012-12-09 22:42:46 +00:00
florian
1ea8a397e5 * use membar only for sparcv9(+)
git-svn-id: trunk@23109 -
2012-12-03 21:55:51 +00:00
Jonas Maebe
9804fd527b * don't add a thousands separator in FormatFloat if there are no digits
before it because the value is too small, regardless of what the format
   pattern sepcifies (patch by Bart Broersma, mantis #13076)

git-svn-id: trunk@23095 -
2012-12-02 16:57:41 +00:00
michael
66553a253e * Applied and expanded patch from Luiz Americo to implement faster notifyobservers (bug ID 23419)
git-svn-id: trunk@23089 -
2012-12-02 11:14:49 +00:00
michael
e3b48d6eb2 * Simplified observer/observed GUIDs, patch from Luiz Americo (Bug ID 23420)
git-svn-id: trunk@23088 -
2012-12-02 11:09:51 +00:00
michael
217679843e * IFPObserver methods made public
git-svn-id: trunk@23080 -
2012-11-29 13:28:11 +00:00
michael
b774bbb681 * Use sender when notifying observers
git-svn-id: trunk@23079 -
2012-11-29 13:22:51 +00:00
florian
fcc6d3dcd9 + VarIsBool function by Alexander Strokach, resolves #23358
git-svn-id: trunk@23038 -
2012-11-20 20:30:08 +00:00
svenbarth
bb5dc545f8 rtl/objpas/fgl.pp:
Fix typo in comment; fixes Mantis #23352

git-svn-id: trunk@23036 -
2012-11-19 19:23:58 +00:00
Jonas Maebe
dfe59e6838 - removed unimplemented/unsupported rtleventsync (mantis #23332)
git-svn-id: trunk@23012 -
2012-11-18 10:23:48 +00:00
Jonas Maebe
d3d0df6e4d * terminate with an error when initializing a critical section and recursive
mutexes are not available, since one of the expected properties of
    (Delphi/Windows-compatible) critical sections is that they ar
    re-entrant (mantis #23334)

git-svn-id: trunk@23011 -
2012-11-18 10:23:44 +00:00
Jonas Maebe
676db6d377 * removed stray try/finally statement (mantis #23333)
git-svn-id: trunk@23010 -
2012-11-18 10:23:38 +00:00
sergei
186cbaaf18 * Ansistring versions of MkDir,ChDir,RmDir: make a full copy of argument string. This is necessary because underlying implementations can modify directory separators in argument, causing crash if argument resides in read-only memory. This is also consistent with shortstring variants of same procedures.
git-svn-id: trunk@23000 -
2012-11-16 18:27:55 +00:00
masta
e370303fda Add unsigned versions of ntohl and htonl
All systems i know of define ntohl and htonl to use unsigned 32bit
types. To keep backward compatibility for now I've added overloaded
versions so the impact on existing code is a small as possible. But I've
marked the signed versions as deprecated.

The code will now also use SwapEndian which is available as optimized
versions on some platforms.

git-svn-id: trunk@22994 -
2012-11-16 12:37:07 +00:00
michael
4ecfde31e1 * Prevent Move from freeing an associated object if OwnsObjects=True (reported on sourceforge)
git-svn-id: trunk@22992 -
2012-11-16 11:04:44 +00:00
Jonas Maebe
8bf71af3b1 * fixed compatilation on Haiku Alpha4 (patch by Olivier Coursière,
mantis #23300)

git-svn-id: trunk@22969 -
2012-11-10 20:26:46 +00:00
michael
cbbf87a58f * Need FILE_WRITE_ATTRIBUTES for setfiledate (mantis #23290)
git-svn-id: trunk@22952 -
2012-11-08 14:25:15 +00:00
michael
a3f7a7fdb4 * Avoid overflow when reading from streams > 2gb
git-svn-id: trunk@22945 -
2012-11-06 23:41:49 +00:00
svenbarth
fdf6b17421 rtl/linux/m68k/prt0.as:
correctly calculate and pass on the addresses for the parameters and the environment; this way parameters can now be used, but reading environment variables still does not seem to work...

Note: the other assembler files (especially cprt0.as) were not adjusted and might not work at all

git-svn-id: trunk@22936 -
2012-11-05 21:12:09 +00:00
florian
39aef35bdc * pass not only exception address but also frame to raise:
if an address is passed the compiler cannot know a good 
  value for the frame so it passed nil and no stack trace is printed, resolves #12528

git-svn-id: trunk@22932 -
2012-11-04 20:40:21 +00:00
florian
b58273fdeb * fix memory leak of video unit as proposed by Michael Karst, resolves #22876
git-svn-id: trunk@22927 -
2012-11-04 18:42:47 +00:00
florian
a523d81b87 * fix sincos also for x86-64-linux
git-svn-id: trunk@22926 -
2012-11-04 18:02:20 +00:00
florian
a9fed57090 * fix sincos for x86-64 windows resolves #23268
* changed to intel assembler to be more readble
* test for sincos extended

git-svn-id: trunk@22925 -
2012-11-04 16:27:29 +00:00
florian
ddc054be79 * patch by Cyrax for easy redirection of heaptrc output, resolves #22168
git-svn-id: trunk@22922 -
2012-11-04 14:07:57 +00:00
svenbarth
4d1e42e891 rtl/m68k/setjump.inc:
* implement "fpc_setjmp" and "fpc_longjmp"
rtl/m68k/m68k.inc:
  * add "nostackframe" to "get_frame" and "sptr"
  + add "get_pc_addr"
=> allows stack traces to be displayed correctly

git-svn-id: trunk@22899 -
2012-11-01 16:00:14 +00:00
svenbarth
fb873d6f02 rtl/m68k/m68k.inc:
dummyplement Interlocked* functions; they are not locking in any way, but at least they do what they should

git-svn-id: trunk@22884 -
2012-10-31 06:24:08 +00:00
svenbarth
f204f84f6a rtl/m68k/m68k.inc, move:
completely disable the "fast loop" code for Coldfire instead of "hackfixing" it; with this StdIO starts to work (though one byte is missing at the end...)

git-svn-id: trunk@22883 -
2012-10-31 06:10:03 +00:00
sergei
47cd83ae14 * Fetch PECOFF section sizes correctly (not including zero padding), resolves #22788.
git-svn-id: trunk@22879 -
2012-10-30 09:00:13 +00:00