Commit Graph

3359 Commits

Author SHA1 Message Date
pierre
856b3d86ce Add ufloatx80 unit, to add operator overload for 80-bit extended type on CPUs that do not support this type natively
git-svn-id: trunk@37256 -
2017-09-19 20:57:20 +00:00
pierre
9daa2279f6 Use sfpu128 unit instead of softfpu, as softfpu does not always has 128-bit support enabled
git-svn-id: trunk@37255 -
2017-09-19 17:23:03 +00:00
Károly Balogh
e1501c86bf m68k: fix no FPU support
git-svn-id: trunk@37227 -
2017-09-16 18:13:57 +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
svenbarth
c45f738081 * fix DynArrayIndex(): as the last typeinfo entry is no longer a dynamic array the elSize needs to be remembered
git-svn-id: trunk@36942 -
2017-08-20 15:15:25 +00:00
michael
2ac3610048 * Better presentation of arguments (bug ID 32275)
git-svn-id: trunk@36923 -
2017-08-16 07:20:48 +00:00
svenbarth
187ebc6821 * adjust/update guard against older compiler versions
git-svn-id: trunk@36876 -
2017-08-12 08:17:07 +00:00
svenbarth
8b5461367b * move TTypeKind from TypInfo unit to System unit as it's necessary for the future GetTypeKind() intrinsic
* also adjust (P)Byte usages to (P/T)TypeKind where necessary/approbiate

git-svn-id: trunk@36873 -
2017-08-11 20:37:36 +00:00
Károly Balogh
4002833001 morphos: also enable the elf32 loader in exeinfo for morphos
git-svn-id: trunk@36805 -
2017-07-28 12:20:40 +00:00
Károly Balogh
ac19b0eae6 morphos: enabling lineinfo unit
git-svn-id: trunk@36804 -
2017-07-27 22:31:19 +00:00
michael
aaf0647f58 * Fix bug ID #31462: sysreallocmem uses sys* routines instead of installed memmanager routines
git-svn-id: trunk@36769 -
2017-07-23 09:23:02 +00:00
michael
9878dc280b * Fix bug ID #32168
git-svn-id: trunk@36757 -
2017-07-21 16:08:01 +00:00
svenbarth
00e9289f58 * envp is part of sysunixh, so no need to manually import it using an external
git-svn-id: trunk@36685 -
2017-07-08 19:15:54 +00:00
florian
16c9a2260d * check alignment properly in CompareDWord for 64 bit targets
git-svn-id: trunk@36656 -
2017-07-06 18:02:22 +00:00
Károly Balogh
2d8313165d m68k: support FFU exception settings, also reworked FPU initalization
git-svn-id: trunk@36618 -
2017-06-30 02:38:14 +00:00
florian
8bbe7d7268 * define STACK_BIAS constant for sparc64, it is fundamental
git-svn-id: trunk@36540 -
2017-06-19 21:17:54 +00:00
florian
cd70098b84 + SPARC64 support for the system unit
git-svn-id: trunk@36431 -
2017-06-05 21:33:59 +00:00
Károly Balogh
a57d0d51b4 softfpu: make it possible to optionally inline some of the simple functions. also made it possible to replace the MUL32TO64 function with compiler generated code. If the new defines are enabled, they results in 15-30% speedup on m68k (68020+) softfpu code
git-svn-id: trunk@36352 -
2017-05-27 22:12:27 +00:00
nickysn
34113b930b * removed the checkoverflow: boolean parameter of the software mul helpers;
replaced it with a separate "_checkoverflow" version of each helper

git-svn-id: trunk@36344 -
2017-05-26 15:34:26 +00:00
nickysn
ba665e103c + added sqr(shortint) and sqr(smallint) for CPUs with 8/16-bit alu
git-svn-id: trunk@36342 -
2017-05-26 13:16:36 +00:00
pierre
a16326fa95 Avoid MSDOS Memory Control Block (MCB) chain corruption in RegisterTinyHeapBlock
git-svn-id: trunk@36340 -
2017-05-26 06:44:07 +00:00
nickysn
78a7445751 + added Odd(byte) and Odd(shortint) for cpus with 8-bit alu and Odd(word)/
Odd(smallint) for cpus with 8 or 16-bit alu

git-svn-id: trunk@36328 -
2017-05-25 14:42:56 +00:00
nickysn
fa645dcaf7 + added abs(smallint) and abs(shortint) for cpus with 8-bit or 16-bit alu
git-svn-id: trunk@36327 -
2017-05-25 14:14:18 +00:00
svenbarth
72c595eefe + implement support for Insert() for dynamic arrays; the parameter that is inserted can be a dynamic or static array of the same type, an array constructor or a single element of the arrays type; all that is determined based on the second type
+ added test

git-svn-id: trunk@36307 -
2017-05-23 19:11:49 +00:00
Károly Balogh
346f040a54 also try to inline 32bit SwapEndian variants, as they're still reasonably simple
git-svn-id: trunk@36304 -
2017-05-23 07:32:54 +00:00
pierre
0f80603dae + SysGetMem: Add DEBUG_TINY_HEAP message after SysAlloc call.
* Change InternalTinyAlign procedure:
  Change variable ASize to be VAR parameter type
  so that possible size reduction required by alignment
  is propagated correctly to calling function.

git-svn-id: trunk@36297 -
2017-05-22 20:27:08 +00:00
pierre
ade39069e5 Change ASize type for RegisterTinyHeapBlockXXX functions
git-svn-id: trunk@36249 -
2017-05-18 22:36:24 +00:00
pierre
570f159e65 Get SysGetMem to return immediately with Result=Nil if SysOSAlloc fails and RetrunNilIfGrowHeapFails is true
git-svn-id: trunk@36239 -
2017-05-18 08:19:17 +00:00
nickysn
504662826a * fixed the rtl cpu ifdefs for the rol/ror/sar cpu support check
git-svn-id: trunk@36153 -
2017-05-08 10:16:15 +00:00
pierre
ded1fb23a2 Improve stack trace output with -Cr option, contributed by Colin Western
git-svn-id: trunk@36134 -
2017-05-06 13:54:50 +00:00
pierre
d2d1794b40 Use HandleError instead of RunError in fpc_help_destructor, fpc_check_object and fpc_check_object_ext
git-svn-id: trunk@36113 -
2017-05-05 11:49:16 +00:00
pierre
651f8b17c1 Add minimum type/const for RTL compilation with threading support disabled
git-svn-id: trunk@36106 -
2017-05-04 22:12:17 +00:00
pierre
6c43882cf5 Allow compilation with -Sfnothreading
git-svn-id: trunk@36092 -
2017-05-04 21:18:22 +00:00
nickysn
056e742684 + enable the internal 8-bit and 16-bit sar on i8086
git-svn-id: trunk@36032 -
2017-05-01 12:36:36 +00:00
michael
011a88b1fe * Remove mode objfpc (bug ID 31629)
git-svn-id: trunk@35886 -
2017-04-22 08:53:13 +00:00
nickysn
b14f277e8f + use rtl helpers for 64-bit shl/shr/sar/rol/ror modify in place operations, on
platforms that don't have native 64-bit implementation of the corresponding
  64-bit shift/rotate operation

git-svn-id: trunk@35787 -
2017-04-13 15:24:32 +00:00
nickysn
f514657e45 + implemented the sar/shl/shr/rol/ror inline modify-in-place nodes; the actual
optimization of "i:=i shl/shr k", etc statements is not performed yet

git-svn-id: trunk@35780 -
2017-04-12 00:41:15 +00:00
nickysn
256dc546ac + implemented the in_neg_assign_x and in_not_assign_x inline nodes, which will
be used (TBD in a future commit) for optimizing x:=-x and x:=not x on CPUs
  that support performing these operations directly in memory (such as x86)

git-svn-id: trunk@35749 -
2017-04-07 16:02:40 +00:00
nickysn
321876252b + enabled the rol/ror intrinsic on i8086
git-svn-id: trunk@35734 -
2017-04-04 22:37:58 +00:00
maciej-izak
322720236c + added missing dwarf constants: DW_FORM_sec_offset, DW_FORM_exprloc and DW_FORM_flag_present
git-svn-id: trunk@35717 -
2017-04-03 10:42:27 +00:00
nickysn
fc59649a98 + added inline nodes for handling and/or/xor in place (i.e. x:=x op y, where
op=and/or/xor). They generate more optimal code on certain architectures
  (including x86). The new inline nodes aren't generated by the compiler yet,
  but will be used in the future, at certain optimization levels, whenever the
  pattern x:=x op y is detected by the compiler.

git-svn-id: trunk@35666 -
2017-03-26 23:16:53 +00:00
marco
a2d397c064 * pmethod declaration, patch from mantis #31576 by Silvio
git-svn-id: trunk@35632 -
2017-03-20 21:19:20 +00:00
michael
cd03ec93fe * Patch from Karl-Michael Schindler (Bug ID 30402)
git-svn-id: trunk@35622 -
2017-03-18 18:11:18 +00:00
michael
68bb9bef2c * Optimize fpc_AnsiStr_Compare to not use exception frame unless codepages differ
git-svn-id: trunk@35620 -
2017-03-18 14:38:50 +00:00
michael
2714a06e77 * Small optimization for comparing nil strings.
git-svn-id: trunk@35619 -
2017-03-18 14:22:57 +00:00
michael
ae6b9652fc * Avoid exception frame in ansistring compare for cases where codepage is equal
git-svn-id: trunk@35603 -
2017-03-15 22:02:29 +00:00
florian
bb8b8f2eae * do not set IsMultithread on windows, if no second thread is started, resolves #30535
git-svn-id: trunk@35567 -
2017-03-11 21:35:48 +00:00
nickysn
2fbe5d2a8b * use ObjpasInt instead of longint in fpc_shortstr_currency (generates shorter
and more efficient code on 16 and 8-bit targets)

git-svn-id: trunk@35484 -
2017-02-27 01:29:52 +00:00
florian
7213a13081 * split fpc_mul_<64 bit> into separate procedures with and without overflow checking
git-svn-id: trunk@35454 -
2017-02-19 19:15:14 +00:00
maciej-izak
4154b4ca8a * Call management operators also for records with zero-size. For that purpose was changed function RTTISize. New name for RTTISize is RTTISizeAndOp. RTTISizeAndOp can return size of required type and information about existing management operators for that type in current context (to determine context is used enum TRTTIRecOpType which is passed also as parameter in RTTISizeAndOp). RTTISizeAndOp is used in fpc_initialize_array, fpc_finalize_array, fpc_addref_array and CopyArray.
git-svn-id: trunk@35451 -
2017-02-19 13:20:43 +00:00
maciej-izak
0cff9fe83c * Call management operator (Initialize) for records when SetLength for dynamic arrays is used.
git-svn-id: trunk@35450 -
2017-02-19 12:47:31 +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
maciej-izak
9a9eb1b840 * Use RTTIRecordRttiInfoToInitInfo (when FPC_HAS_MANAGEMENT_OPERATORS is not defined) for records/objects in fpc_Copy as well as for fpc_Initialize, fpc_finalize, fpc_Addref
git-svn-id: trunk@35448 -
2017-02-19 11:53:52 +00:00
maciej-izak
8a68a7aea8 * Declare field RecordOp for TRecordInfoInit only when FPC_HAS_MANAGEMENT_OPERATORS is defined, same for additional types for management operators.
git-svn-id: trunk@35447 -
2017-02-19 01:26:08 +00:00
maciej-izak
d42428bc3c * Initial support for management operators in RTL (rtl/inc/rtti.inc):
* fpc_Initialize: Initialize operator is called after recordrtti(data,typeinfo,@int_initialize);
  * fpc_Finalize: Finalize operator is called before recordrtti(data,typeinfo,@int_finalize);
  * fpc_Addref: AddRef operator is called after recordrtti(data,typeinfo,@int_addref);
  * fpc_Copy: Copy operator (if exists) is called instead of default copy behavior
  * replace RTTIRecordRttiInfoToInitInfo function (which was introduced only to speed-up InitializeArray/FinalizeArray) with a more advanced RTTIRecordOp function. Result of RTTIRecordRttiInfoToInitInfo is now returned in initrtti parameter. Additionally as new result is returned PRecordInfoInit which is usefully in basic RTL functions: fpc_Initialize, fpc_Finalize, fpc_Addref, fpc_Copy

git-svn-id: trunk@35446 -
2017-02-19 01:18:35 +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
pierre
d5f2c58d32 Fix bug report 34320, about random returning two same values at start
git-svn-id: trunk@35259 -
2017-01-08 09:19:50 +00:00
florian
29a2c433f7 * -Sr option for iso mode: in case no command line parameter is passed, the file name for program parameters is derived from their variable name
git-svn-id: trunk@35257 -
2017-01-07 14:50:58 +00:00
Károly Balogh
233185a4e5 rtti: make aligntoqword to always align to the same size as typinfo/AlignTypeData. this fixes m68k crashes in RTTI after r35218
git-svn-id: trunk@35228 -
2017-01-04 05:01:53 +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
nickysn
ca46040728 + added 16-bit versions of the InterLocked* functions for i8086
git-svn-id: trunk@35149 -
2016-12-18 00:17:10 +00:00
svenbarth
121a857af8 * fix for Mantis #31118: applied patch by Maciej Izak to fix usage of wrong variable
+ added test

git-svn-id: trunk@35133 -
2016-12-15 13:47:26 +00:00
marco
7ef8f00100 * more occured -> occurred spelling fixes.
git-svn-id: trunk@35130 -
2016-12-14 20:05:21 +00:00
svenbarth
7089677a22 * change RecInitTable into a direct reference to avoid an unnecessary indirection as both the full and init RTTI of a record always reside inside the same unit
git-svn-id: trunk@35128 -
2016-12-14 18:40:16 +00:00
svenbarth
12dba952f0 * integration of Part 2 patch of Mantis #30687 with a few adjustments:
- indentation in ncgrtti.pas
  - fewer ifdefs in rtti.inc
  - InitTable/Terminator field as first field to avoid padding on targets that require proper alignment and have SizeOf(Pointer) > 4

Original message by Maciej Izak:

Breaking change for rtti layout for record rtti. Init table
is always accessible from regular rtti. Rtti table contains indirect
reference to init table, additionally init table contains nil-terminator (for
rtl purposes - the only way to determine kind of info : init or rtti). Pros:

* will be possible to create more Delphi compatible code for RTTI, finally end-user can access to *real* managed fields of records (some work on TypInfo.pp is still required but is not necessary).
* important step forward for management operators (anyway this commit is not directly related to management operators)
* much more optimal memory allocation/initialization/finalization for records created/destroyed by InitializeArray/FinalizeArray, for example:

type
  TBar = record
    f1,f2,f3,f4,f5,f6,f7,f8,f9: byte;
    s: string;
  end;

previously:

  GetMem(PB, SizeOf(TBar));
  InitializeArray(PB, TypeInfo(TBar), 1); // FPC_INITIALIZE was executed 10 times

now:

  GetMem(PB, SizeOf(TBar));
  InitializeArray(PB, TypeInfo(TBar), 1); // FPC_INITIALIZE is executed just once

+ test attached

git-svn-id: trunk@35125 -
2016-12-13 23:03:11 +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
c32e41b551 + add missing semicolon in fpc_initialize_array declaration, patch by Maciej Izak
git-svn-id: trunk@35000 -
2016-11-27 20:01:42 +00:00
florian
3faff7946d * fix typo for endif VER3_0_0, patch by Maciej Izak
git-svn-id: trunk@34999 -
2016-11-27 20:01:41 +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
florian
0c238b72e5 + set/longjmp implementation for avr
git-svn-id: trunk@34971 -
2016-11-26 18:33:15 +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
florian
86f0b59095 * avoid conversion to larger type in Align
git-svn-id: trunk@34940 -
2016-11-20 19:02:53 +00:00
michael
8b2d858ba5 * Fix bug ID #30672, patch by Silvio Clecio
git-svn-id: trunk@34884 -
2016-11-13 11:02:09 +00:00
nickysn
e1792e712a * changed the 'size' parameter of fpc_zeromem and fpc_fillmem from ptruint to sizeuint
git-svn-id: trunk@34741 -
2016-10-18 15:42:29 +00:00
florian
9c81e90e08 + extension to iso mode: reset/rewrite can take a file name as a second parameter
git-svn-id: trunk@34726 -
2016-10-16 07:55:08 +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
019f904be8 - removed the FPC 2.6.x compatibility ifdefs from tinterfaceentry
git-svn-id: trunk@34637 -
2016-10-06 21:10:40 +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
Jonas Maebe
868370d727 + InterlockedCompareExchangePointer() alias for InterlockedCompareExchange(pointer)
(mantis #29964)

git-svn-id: trunk@34599 -
2016-10-02 12:57:07 +00:00
Jonas Maebe
e5a1231931 * updated FSF address (mantis #30198, patch by Paul Gevers)
git-svn-id: trunk@34598 -
2016-10-02 12:56:59 +00:00
pierre
749dc00401 Fix CheckPointer code for pointer in stack area for linux
git-svn-id: trunk@34551 -
2016-09-21 13:19:27 +00:00
Jonas Maebe
eb9d4b71b3 * equivalent of r34246 for targets using the non-fragile Objective-C ABI
(fixes webtbs/tw30443 for iOS and 64 bit targets)

git-svn-id: trunk@34549 -
2016-09-20 21:43:59 +00:00
sergei
67bd4775fd - Cleaned out thread manager semaphore support which was ever implemented only for Unix, and not used since r28965. This also reverts changes to System unit interface introduced in r27665.
git-svn-id: trunk@34542 -
2016-09-20 20:14:36 +00:00
pierre
dcd349abd9 Use DEBUG_LINEINFO instead of DEBUG in exeinfo unit source
git-svn-id: trunk@34521 -
2016-09-13 08:37:52 +00:00
michael
be17071b46 * Fix windows compilation
git-svn-id: trunk@34517 -
2016-09-11 18:20:40 +00:00
michael
d94b9bd4ab * Check for Nil in strend
git-svn-id: trunk@34493 -
2016-09-10 18:43:22 +00:00
michael
1f188c3685 * Patch from Karl-Michael Schindler to prepend TMP to temp filename
git-svn-id: trunk@34480 -
2016-09-10 12:13:10 +00:00
michael
3b3d5ab8be * Undid last commit
git-svn-id: trunk@34479 -
2016-09-10 12:12:39 +00:00
michael
4fa2ec7740 * Patch from Karl-Michael Schindler to prepend TMP to temp filename../inc/iso7185.pp
git-svn-id: trunk@34478 -
2016-09-10 12:04:24 +00:00
svenbarth
f889891466 * fix Delete() for dynamic arrays
git-svn-id: trunk@34457 -
2016-09-08 17:42:50 +00:00
svenbarth
26a2ddd3d6 + extend Delete() intrinsics with Delphi compatible support for dynamic arrays. Also fixes Mantis #30306
git-svn-id: trunk@34455 -
2016-09-08 17:15:10 +00:00
pierre
97c2067832 Fix compiler cycling starting from 3.0.0 powerpc64 release compiler
git-svn-id: trunk@34431 -
2016-09-05 09:36:43 +00:00
pierre
cb5f540eb9 Fix typo in last commit: to disable TraceManager, call SetMemoryManager with saved PrevMemoryManager variable
git-svn-id: trunk@34399 -
2016-08-30 15:51:56 +00:00
pierre
b6b27f2fb7 + Add tail_size varaible to be able to adjust size of tail memory area.
* Correct computation of CRC for if add_tail is true:
    tail is before extra_info, not after.
    Use tail_size variable to cacluate CRC use the whole tail memory area.
  + New function released_modified. Checks if released memory
    was modified after it release (used if keep_released is true).
  * TraceGetMem,TraceFreeMem TraceReallocMem: adapt to new tail_size variable.
  * TraceInit: Store previous memory manager in local variable,
    to be able to restore it in TracExit call.
  * LoadEnvironment: Add parsing of tail_size=XXX, where XXX is a decimal value,
    rounded up to next multiple of sizeof(ptruint).

git-svn-id: trunk@34385 -
2016-08-28 21:42:07 +00:00
pierre
1612138071 Use $checkpointer off to avoid calls to CheckPointer function if -gc option is used
git-svn-id: trunk@34384 -
2016-08-28 15:59:36 +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
pierre
b9e336dcbe Fix for trwsync.pp sporadic failure that appeared in trunk.
The problem was in the source of random related functions,
  which are used in this test by several thread in parallel,
  while this code is known and advertised as non-thread safe.

  The access by multiple threads led to multiple increments of the
  mt_index static variable, which was then never reset to zero and
  led to all successive calls to random function to return zero.

  This fix simply insures that the mt_state array is never
  accessed past its end, and that mt_index is reset correctly even
  if multiple increments do happen.

  It does not make the random function thread-safe.

  * Use local variable l_index to avoid accessing mt_state array past last element.
  * Change mt_index=MTWIST_N+1 into l_index>=MTWIST_N+1
    to insure that mt_init will be called again if index is past end.

git-svn-id: trunk@34320 -
2016-08-16 11:59:33 +00:00
pierre
5884fbc8b0 Move {$checkpointer off} before interface and relax windows data bss check to also accept sections in between like .rdata
git-svn-id: trunk@34262 -
2016-08-10 09:46:37 +00:00
pierre
0cb0bc3371 Use symbols instead of constants in code:
+ AllocateSig and ReleaseSig for theap_mem_info.sig field.
  + CheckSig for theap_extra_info.check field.
  + CRC32Seed and CRC32Pattern in CRC related functions.

  * if sig is equal ReleaseSig, always assume already released (even if usecrc ius true).

git-svn-id: trunk@34260 -
2016-08-10 08:36:38 +00:00
Jonas Maebe
de97285393 * fixed conformsToProtocol() declaration (the protocol is not a changeable
parameter, and it's already declared as a pointer type)

git-svn-id: trunk@34246 -
2016-08-03 14:35:32 +00:00
svenbarth
61551cbb0f * move properties and functions of TVMT to the end of the record, so that one only needs to adjust the total entry count TVMTBuilder.generate_vmt_def()
git-svn-id: trunk@34223 -
2016-07-29 13:54:36 +00:00
yury
980c4741ac * Fixed conversion from PWideChar to ansistring.
+ test. 

git-svn-id: trunk@34219 -
2016-07-29 09:43:05 +00:00
pierre
b9e6938519 Correct behavior: if VMT becomes NIL, RTE 219 must be generated as this happens if EXPVMT is not an ancestor of starting VMT
git-svn-id: trunk@34197 -
2016-07-24 06:13:46 +00:00
svenbarth
59303c5113 Fix -CR after the recent VMT changes.
* tobjectvmt: parent needs to be ppointer for 3.1.1
* fpc_check_object_ext: correctly determine parent VMT

git-svn-id: trunk@34194 -
2016-07-23 16:42:15 +00:00
svenbarth
d9d2789375 * fix DynArrayDim() and DynArrayIndex() after the RTTI changes in r33944
git-svn-id: trunk@34180 -
2016-07-22 13:48:12 +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
pierre
47f01eaa52 Fix CRC calculation for i8086 compact memory model
git-svn-id: trunk@34070 -
2016-07-05 22:06:18 +00:00
svenbarth
72be688a8c A unit's threadvar list needs to be indirectly referenced by the THREADVARLIST as well.
compiler/ngenutil.pas, tnodeutils:
  * InsertThreadvarTablesTable: reference a unit's (and the program's) threadvar table using a indirect symbol
  * InsertThreadvars: generate an indirect symbol for the threadvar table
rtl/inc/threadvr.inc:
  * TltvInitTablesTable: add an additional indirection for the tables field

git-svn-id: trunk@34043 -
2016-07-01 14:18:28 +00:00
svenbarth
248490bbf1 * declare fpc_zeromem and fpc_fillmem as inline to avoid one call
git-svn-id: trunk@33994 -
2016-06-15 20:16:16 +00:00
svenbarth
25c4a5c986 Fix usage of external resources on systems besides Darwin by moving the variable referencing FPC_RESLOCATION fon non-indirect entry information systems from system.inc back into intres.inc
git-svn-id: trunk@33984 -
2016-06-14 12:18:36 +00:00
pierre
a72434e93a Trial to clarify heap for i8086 issues:
- MSDOS heap in tinyheap.inc modified to use usual
  SysGetMem and similar names.
  - Use HAS_MEMORYMANAGER (used previously in wince source code,
  to specify that a memory manager is defined elsewhere than inside
  heap.inc include file.
  - Use
  - Remove TinyHeapMemoryManager Structure variable completely

  heaptrc.pp: remove unneeded macro code after name changes of tinyheap.inc

  msdos/system.pp now only defines HAS_MEMORYMANAGER macro
  win16/system.pp defines HAS_MEMORYMANAGER and FPC_NO_DEFAULT_HEAP
  as it still uses a different memory manager.
  __stkbottom variable added for win16 system.pp as it is required
  by i8086 specific stack check code.

git-svn-id: trunk@33983 -
2016-06-13 22:26:03 +00:00
svenbarth
7f079ff58a Fix compilation of Win64 and WinCE as those don't have indirect entry information yet and thus they'd require FPC_RESLOCATION which is not available for those platforms... Fixes Mantis #30264.
git-svn-id: trunk@33982 -
2016-06-13 07:55:45 +00:00
svenbarth
f8ff8eca4d Fix non-Windows resources since me and merging without TortoiseSVN don't go along that well :/
rtl/inc/system.inc:
  + ResHeader variable that provides the public _FPC_ResLocation symbol used by intres.inc; this variable will always be available and without indirect entry information it will simply hook up to FPC_RESLOCATION itself
  * SetupEntryInformation: setup FPCResLocation
rtl/inc/intres.inc:
  * no need to cater for indirect entry or not anymore

git-svn-id: trunk@33964 -
2016-06-12 10:57:15 +00:00
svenbarth
ca07a4f86f Merged revision(s) 32491-32492 from branches/svenbarth/packages:
Adjust non-Windows resources to work with indirect main information as well.

rtl/inc/systemh.inc, TEntryInformation:
  + new cross platform field ResLocation which stores the pointer to the resources
rtl/inc/intres.inc:
  * change the type of ResHeader from PResHdr to PPResHdr (and adjust code that uses it accordingly; Note: the first dereferencing is assumed to be always valid!)
  * adjust declaration of ResHeader depending on whether indirect main information is used or not
rtl/darwin/sysinit.pas & rtl/linux/si_impl.inc:
  * pass the location of the resources through SysInitEntryInformation
rtl/bsd/system.pp & rtl/linux/system.pp:
  + new public variable FPCResLocation which is setup by SysEntry
rtl/win32/sysinit.inc:
  * initialize ResLocation of SysInitEntryInformation as Nil
rtl/win32/system.pp:
  * initialize ResLocation of EntryInformation as Nil
........
For systems that support both internal and external resources (in this case only Darwin ones) we need to generate the FPC_RESLOCATION symbol always, because the SysInit unit is resource type agnostic.

ngenutil.pas, tnodeutils:
  * InsertResourceInfo: generate FPC_RESLOCATION symbol pointing to 0 in case the program is compiled on Darwin with resources set to external ones (-We)

git-svn-id: trunk@33952 -
2016-06-12 09:08:17 +00:00
svenbarth
3f45860cf9 Use constref instead of const when passing TEntryInformation along
git-svn-id: trunk@33951 -
2016-06-11 20:45:47 +00:00
svenbarth
535621faaa Rename FPC_HAS_INDIRECT_MAIN_INFORMATION to FPC_HAS_INDIRECT_ENTRY_INFORMATION which is more logical considering the record's name
git-svn-id: trunk@33950 -
2016-06-11 20:38:22 +00:00
svenbarth
f406867100 Merged revision(s) 31929-31931,32547 from branches/svenbarth/packages:
Switch Mac OS X to indirect entry information.

compiler/systems/t_bsd.pas, TLinkerBSD:
  + implement InitSysInitUnitName
compiler/system.pas:
  * systems_internal_sysinit: add Darwin systems
compiler/hlcgobj.pas, thlcgobj:
  * gen_proc_symbol_end: for Darwin systems don't directly call PascalMain for libraries, but FPC_LIBMAIN instead
rtl/darwin:
  + add sysinit.pas unit which contains the executable and library entry points for Darwin
rtl/darwin/Makefile.fpc:
  * add sysinit unit
rtl/bsd/sysosh.inc:
  + add a Darwin specific TPlatformEntryInformation (could probably be used for all Unix systems...)
rtl/bsd/system.pp:
  * define FPC_HAS_INDIRECT_MAIN_INFORMATION for Darwin systems once we're no longer bootstrapping with 2.6.x
  + add EntryInformation variable (this could maybe moved to system.inc...)
  + add new procedure SysEntry that is called from the entrypoint and which sets up necessary information required by other parts of the RTL
  * the old FPC_SYSTEMMAIN is still in place for bootstrapping
rtl/inc/systemh.inc, TEntryInformation:
  * PascalMain is cdecl on non-Windows systems (ToDo: really?)
rtl/inc/system.inc:
  * initialstklen is provided by the indirect entry information, so no external here
........
Fix bootstrapping.

rtl/darwin/sysinit.pas:
  * enable the code only when no longer bootstrapping with 2.6.x
........
Fix bootstrapping.

rtl/objpas/objpas.pp:
  * define FPC_HAS_INDIRECT_MAIN_INFORMATION for Darwin only while not bootstrapping with 2.6.x
........
rtl/darwin/sysinit.pas:
  * reference PASCALMAIN correctly (I wonder how this even worked previously :/ )

git-svn-id: trunk@33949 -
2016-06-11 20:29:51 +00:00
svenbarth
345d83c3e3 Merge RTTI changes from packages branch (including adjustments that were required due to changes in trunk since then). These changes favor source backwards compatibility in contrast to Delphi compatibility. Binary compatiblity is however drastically broken due to the indirect references that are platform independant!
Merged revision(s) 28239-28289 from branches/svenbarth/packages:
Provide the possiblity to switch between the direct and indirect RTTI symbols.

ncgrtti.pas, TRTTIWriter:
  + get_rtti_label, get_rtti_label_ord2str & get_rtti_label_str2ord: add new "indirect" parameter and pass that along to rtti_mangledname
hlcgobj.pas, thlcgobj:
  * g_incrrefcount, g_initialize, g_finalize, g_array_rtti_helper: for now pass along False to get_rtti_label()
ncgvmt.pas, TVMTWriter:
  * writevmt: for now pass along False to get_rtti_label()
ncgld.pas, tcgrttinode:
  * pass_generate_code: for now pass along False to the get_rtti_label*() methods
........
Provide possibility to select between using a direct and an indirect RTTI reference. This way the references can be changed for selected cases.

ncgrtti, TRTTIWriter:
  * ref_rtti: new "indirect" parameter that's relayed to rtti_mangledname()
  * write_rtti_reference: new "indirect" paramater that's relayed to ref_rtti()
........
Switch properties to use the indirect type information without breaking backwards compatiblity. :)

compiler/ncgrtti.pas, TRTTIWriter:
  * published_properties_write_rtti_data: use the indirect reference, not the direct one
rtl/objpas/typinfo.pp:
  * to allow compilation with both 2.6.x and 2.7.1 and too avoid too many ifdefs at least in the declarations we define a macro TypeInfoPtr which is either PTypeInfo (2.6.x) or PPTypeInfo (2.7.1 and newer)
  * TPropInfo: rename PropType to PropTypeRef and change type to TypeInfoPtr
  + TPropInfo: add a new property PropType which returns a PTypeInfo out of the PropTypeRef depending on the compiler version
........
Switch further simple types (sets, enums, class references, pointers) to indirect type information (again without breaking backwards compatibility).

compiler/ncgrtti.pas, TRTTIWriter.write_rtti_data:
  * enumdef_rtti, setdef_rtti, classrefdef_rtti & pointerdef_rtti: write an indirect RTTI reference

rtl/objpas/typinfo.pp, TTypeData:
  * rename BaseType to BaseTypeRef, CompType to CompTypeRef, InstanceType to InstanceTypeRef and RefType to RefTypeRef and change their type to TypeInfoPtr
  + add properties BaseType, CompType, InstanceType & RefType which return a PTypeInfo out of the corresponding *Ref field depending on the compiler version
........
Switch class and interface parent as well as extended type to indirect type information

compiler/ncgrtti.pas, TRTTIWriter:
  * write_rtti_data.objectdef_rtti.objectdef_rtti_class_full: use indirect reference for class parent and extended type
  * write_rtti_data.objectdef_rtti.objectdef_rtti_interface_full: use indirect reference for interface parent

rtl/objpas/typinfo.pp, TTypeData:
  + add new method DerefTypeInfoPtr which returns Nil if the indirect reference is Nil and otherwise returns the dereferences indirect reference (for 2.6.x the direct reference is returned as is)
  * rename ParentInfo to ParentInfoRef, HelperParent to HelperParentRef, ExtendedInfo to ExtendedInfoRef, IntfParent ot IntfParentRef and RawIntfParent to RawIntfParentRef and change their type to TypeInfoPtr
  + introduce ParentInfo, HelperParent, ExtendedInfo, IntfParent and RawIntfParent properties that return a PTypeInfo and use the new DerefTypeInfoPtr to return the correct type info value
  * change the other newly introduced properties of TTypeData to use DerefTypeInfoPtr as well to be on the safe side
........
Switch record/object fields to indirect type information references.

compiler/ncgrtti.pas, TRTTIWriter.fields_write_rtti_data:
  * use the indirect reference for the object parent type
  * use the indirect reference for the field type

rtl/inc/rtti.inc:
  * TRecordElement: change TypeInfo to PPointer for 2.7.1 and newer
  * RecordRTTI: correctly dereference the element type for 2.7.1 and newer
  * fpc_copy: correctly reference the element type for 2.7.1 and newer
........
Switch static arrays to indirect RTTI reference.

compiler/ncgrtti.pas, TRTTIWriter.write_rtti_data:
  * arraydef_rtti: write the dimension types and the final field type as indirect references

rtl/inc/rtti.inc:
  * TArrayInfo: switch ElInfo to PPointer for 2.7.1+
  * ArrayRTTI & fpc_copy: correctly dereference ElInfo for 2.7.1+
rtl/objpas/typinfo.pp, TArrayTypeData:
  * switch ElType and Dims to PPTypeInfo; no backwards compatibility needed here as TArrayTypeData was added in 2.7.1 only

tests/test/trtti8.pp: fix test
........
Switch dynamic arrays to indirect RTTI references.

compiler/ncgrtti.pas, TRTTIWriter.write_rtti_data.arraydef_rtti:
  * write indirect references for the two element entries

rtl/inc/dynarr.inc:
  * tdynarraytypedata: change elType2 to PPointer for 2.7.1+
  * fpc_dynarray_clear, fpc_dynarray_setlength & fpc_dynarray_copy: correctly dereference elType2 for 2.7.1+
rtl/objpas/typinfo.pp, TTypeData:
  * rename elType and elType2 to elTypeRef and elType2Ref respectively and change type to TypeInfoPtr
  * add properties elType and elType2 which return PTypeInfo by dereferencing elTypeRef and elType2Ref respecively correctly
  * remove a few stray "inline" directives in the implementation
........
Switch procedure parameters and result type to indirect RTTI references.

compiler/ncgrtti.pas, TRTTIWriter.write_rtti_data.procvardef_rtti:
  * write_procedure_param: use indirect RTTI reference
  * write result info for both methods and procvars as indirect RTTI reference
  * write parameters for procvars as indirect RTTI reference

rtl/objpas/typinfo.pp:
  * TProcedureParam: change type of ParamType to PPTypeInfo (no backwards compatiblity needed here; was added for 2.7.1)
  * TProcedureSignature: change type of RseultType to PPTypeInfo (no backwards compatibility needed here; was added for 2.7.1)
  * TTypeData: remark in the comments of tkMethod that ResultTypeRef and ParamTypeRefs are of type PPTypeInfo and not PTypeInfo

tests/test/trtti9.pp: 
  * fix test
........
Remove no longer needed "indirect" parameter for TRTTIWriter methods.

ncgrtti.pas, TRTTIWriter:
  - ref_rtti & write_rtti_reference: remove "indirect" parameter
  * ref_rtti: call rtti_mangledname with "indirect" always set to "true"
  - remove "true" parameter on callsites of write_rtti_reference & ref_rtti
........

git-svn-id: trunk@33944 -
2016-06-10 17:01:51 +00:00
florian
8c5fdc9dc2 * softfpu patch by Max Nazhalov: Small fixes to softfpu.pp complementing r27215
git-svn-id: trunk@33923 -
2016-06-05 21:16:01 +00:00
svenbarth
fd66d70449 innr.inc:
+ add constants for the Delete and Insert intrinsics
compproc.inc:
  * use the new constants instead of magic values to denote the relationship of the compilerprocs to the intrinsics

git-svn-id: trunk@33901 -
2016-06-04 08:58:38 +00:00
svenbarth
a2c9c75e97 Convert Insert() and Delete() to intrinsics in preparation for dynamic array support for these two procedures.
Since overloading compilerprocs does not work each procedure got its own unique name, but they are using the new compilerproc extension to map them to the Insert and Delete symbol so that error messages can be shown with the respective name for the procedure declarations instead of fpc_shortstr_delete for example.

git-svn-id: trunk@33895 -
2016-06-03 21:25:49 +00:00
michael
9f9abd525a * Patch from Luiz Americo to add const to some string params (Bug ID 30197)
git-svn-id: trunk@33829 -
2016-05-27 19:11:48 +00:00
nickysn
c78f406d99 + implemented proper stack checking for the i8086
git-svn-id: trunk@33787 -
2016-05-24 23:57:47 +00:00
Jonas Maebe
9d2bba1917 * create a separate type and def for the LLVM "i1" type, because reusing
pasbool8type for this results in too much trouble (we mustn't use i1
    for parameters, because then LLVM will try to apply the ABI convention
    for passing "1 bit" values, or in records because then this may
    result in unwanted bitpacking). Downside: the new LLVMBool1 type is
    also exposed in the system unit, because we need it to define LLVM
    intrinsics...

git-svn-id: trunk@33726 -
2016-05-20 20:51:44 +00:00
svenbarth
e15816e35b Fix for Mantis #30110. Speed up finalization of array of primitive/simple records (aka records not containing managed types).
rtl/inc/dynarr.inc:
  + add elType field to tdynarraytypedata (this tells us whether a finalization is needed)
  * fpc_dynarray_clear: don't finalize the array elements if elType is Nil
  * fpc_dynarray_setlength: only call int_addref() and int_finalizearray() if elType is set
  * fpc_dynarray_copy: don't check for tkManagedTypes, but instead check whether elType is assigned

git-svn-id: trunk@33719 -
2016-05-20 16:04:14 +00:00
pierre
06b0bb56c1 Disable SysFreeMem call for argv for win16 OS, which does not use SysFreeMem
git-svn-id: trunk@33715 -
2016-05-20 15:19:18 +00:00
pierre
fe6feb741b Use macros for msdos OS to translate SysGetMem into SysTinyGetMem and similar, fixes several RTE 203 isssues for msdos target OS
git-svn-id: trunk@33682 -
2016-05-11 14:38:46 +00:00
pierre
91595447c6 Add SysTinyGetHeapStatus and SysTinyGetFPCHeapStatus functions
git-svn-id: trunk@33681 -
2016-05-11 14:37:38 +00:00
pierre
4af209ac50 Add SysTinyGetMem and similar to interface to allow use in heaptrc unit
git-svn-id: trunk@33680 -
2016-05-11 14:36:19 +00:00
pierre
cbb29a7e5d Use FPC_NO_DEFAULT_HEAP to turn out RelocateHeap or MemoryManager.InitThread functions, used for msdos OS
git-svn-id: trunk@33679 -
2016-05-11 14:34:55 +00:00
pierre
effa0154c5 Use FPC_NO_DEFAULT_MEMORYMANAGER define to guard SysGetmem/SysFreemem functions, also used for msdos OS
git-svn-id: trunk@33678 -
2016-05-11 14:33:00 +00:00
pierre
c8ad916710 Use FPC_NO_DEFAULT_MEMORYMANAGER define to guard SysGetmem/SysFreemem function definitions, also used for msdos OS
git-svn-id: trunk@33677 -
2016-05-11 14:32:02 +00:00
svenbarth
788393c298 Change WideString initialization to work correctly with indirect main information as well
rtl/inc/systemh.inc & rtl/java/jsystemh_types.inc:
  - TEntryInformation: remove WideInitTables
rtl/win/sysosh.inc:
  + TEntyrInformationOS: add WideInitTables
rtl/win/syswin.inc:
  * adjust WStrInitTablesTable, so that it is now a pointer and can be used both with direct and indirect main entry
  * InitWin32Widestrings: WStrInitTablesTable is now a pointer
rtl/win32/sysinit.inc:
  * WideInitTables has moved to the OS specific part of the entry information
rtl/win32/system.pp:
  * OsSetupEntryinformation: setup WStrInitTablesTable

git-svn-id: trunk@33571 -
2016-04-29 13:13:14 +00:00
pierre
57f2df1f62 * Remove sysutils in _USES clause, to avoid exception handling importation,
especially when exeinfo unit is implicitly loaded when -gl compilation option
  is used.
  + LocalError, new ExitProc procedure, used to catch any error that could happen
  inside GetExeInMemoryBaseAddr procedure.
  * Use SetJmp/LongJmp instead of Try/except in GetExeInMemoryBaseAddr function,
  together with local change and restoration of ExitProc.

git-svn-id: trunk@33561 -
2016-04-27 13:13:31 +00:00
Károly Balogh
1192978152 m68k: software mod/div and mul helper requirement has nothing to do with the softfpu, CF and plain 68k simply needs it
git-svn-id: trunk@33532 -
2016-04-18 02:20:08 +00:00
florian
2b082d88a6 * generic implementation of fpc_pchar_length uses IndexByte instead of a simple while loop
git-svn-id: trunk@33490 -
2016-04-12 18:11:27 +00:00
florian
71b7cd7e1d * the size of DW_FORM_ref_addr entries depends on the DWARF version
git-svn-id: trunk@33477 -
2016-04-10 19:46:05 +00:00
florian
a7346b2f9d + make use of .debug_aranges section for faster name search when generating stack backtraces
git-svn-id: trunk@33470 -
2016-04-10 12:21:35 +00:00
michael
9d75d3aae8 * Fix by Laco for bug ID #29037
git-svn-id: trunk@33339 -
2016-03-26 23:54:13 +00:00
michael
1bdae1edc8 * Correct comments about sizes/offsets in invisible string header record
git-svn-id: trunk@33247 -
2016-03-13 19:03:40 +00:00
florian
bb1f2b8062 * make NativeInt and NativeUInt unique types, resolves #29444
git-svn-id: trunk@33234 -
2016-03-13 15:30:38 +00:00
florian
feb15f08b3 * abbrev section must be re-read for each chunk of debug info, should resolve #29825
git-svn-id: trunk@33233 -
2016-03-13 14:41:56 +00:00
florian
928027a7a4 * read Dwarf data blocks correctly
git-svn-id: trunk@33232 -
2016-03-13 12:52:25 +00:00
florian
8a2917639b * improved comments
* tried to make code more robust

git-svn-id: trunk@33231 -
2016-03-13 12:28:26 +00:00
florian
5109ad9c55 + write also the function name in stack backtraces when dwarf debugging info is used, resolves #17574
git-svn-id: trunk@33228 -
2016-03-12 22:35:29 +00:00
michael
463c9f6e42 * Apply patch to improve pos() for widestring (mimicking unicodestring), bug ID #29790
git-svn-id: trunk@33210 -
2016-03-09 20:42:23 +00:00
Jonas Maebe
60632d0f18 * changed first parameter of gen_digits_32/64() from 'out' to 'var', as that
routine gets called multiple times with the same buffer as parameter and
    then updates it (fixes errors when compiled with -gt)

git-svn-id: trunk@33203 -
2016-03-07 19:59:02 +00:00
michael
805385791b * Change some types from integer to sizeint (bug ID 29789)
git-svn-id: trunk@33194 -
2016-03-06 15:01:07 +00:00
sergei
feeb50be4f * Changed signature of frexp() to match one in Math unit, so eventually a duplicate implementation in Math can be removed. Currently this frexp() remains private to unit System.
git-svn-id: trunk@33173 -
2016-03-06 00:43:54 +00:00
Jonas Maebe
a100309350 * made utf8tostring() Delphi-compatible (mantis #29585):
o removed utf8string overload
   o always ignore any code page information from the input, and interpret the
     contents of the input directly as utf8-encoded bytes
 * made utf8tostring() compatible with the JVM backend (mantis #29497)

git-svn-id: trunk@33159 -
2016-03-05 15:32:22 +00:00
Jonas Maebe
0deacf9fba * fixed missing range checks in r33056
* fixed pos(unicodestring) with a non-zero offset added in r33056 (fixes
    tests/test/units/system/tstring.pp)

git-svn-id: trunk@33120 -
2016-02-25 19:56:49 +00:00
svenbarth
6afda909d4 Rework TlsKey handling on Windows so that it works as intended with indirect main information
rtl/inc/system.inc:
  * SetupEntryInformation: call new, optional function OSSetupEntryInformation to handle platform specific entry information initialization
rtl/win/sysosh.inc, TEntryInformationOS:
  + new field TlsKeyAddr which will hold the address to the main binary's TlsKey variable
win32/sysinit.inc:
  + provide the variable holding the TlsKey and pass that on to the entry information record
win32/system.pp:
  + new OS specific entry information initialization (currently only the TlsKey)
win/systhrd.inc:
  * declare TlsKey as a pointer to a DWord value instead of a DWord; on non-indirect entry platforms this is initialized with the address of new variable TlsKeyVar, on indirect entry platforms it will be initialized by the entry information initialization
  * adjust usages of TlsKey from DWord to PDWord
win/systlsdir.inc:
  * TlsKey is now a PDWord and (in sysinit) points to TlsKeyVar
win/syswin.inc:
  * adjust TlsKey usage
inc/heaptrc.pp:
  * TlsKey is now a PDWord, thus adjust the import and the usage

git-svn-id: trunk@33091 -
2016-02-12 17:03:52 +00:00
svenbarth
77cb13c38c Revert r33057. MaxLen is the maximum value that Pos can return and does not need to be adjusted by (Offset - 1). Also there's no buffer that could be overrun as i is not used to access the string's buffer. Fixes failure of tests/test/units/system/tstring.pp
git-svn-id: trunk@33089 -
2016-02-12 16:07:26 +00:00
michael
eb2e614ae9 * Power no longer in system, but in Math
git-svn-id: trunk@33063 -
2016-02-06 18:57:49 +00:00
michael
39c404d342 * Some fixes from Ondrej Pokorny (bug ID 29538)
git-svn-id: trunk@33062 -
2016-02-06 15:03:28 +00:00
michael
e2733c9a50 * Small correction in POS (prevent moving out of buffer if offset<>1)
git-svn-id: trunk@33057 -
2016-02-06 12:17:13 +00:00
michael
6d051892e5 * Added Offset argument to Pos (exists in wide and ansi/short, forgotten for unicode)
git-svn-id: trunk@33056 -
2016-02-06 12:16:00 +00:00
pierre
fd612990e5 Fix number of frames requested when calling CaptureBackTrace function
git-svn-id: trunk@33038 -
2016-01-31 22:08:15 +00:00
svenbarth
1951b8aaaa Fix threadvar handling. Basically a merge of r31913 of my packages branch.
rtl/inc/system.inc:
  * provide a public alias for SetupEntryInformation so that it can be used in SysInit as well without globally exporting it
rtl/win/systlsdir.inc:
  * Exec_tls_callback: call SetupEntryInformation before initalizing the heap and multithreading so that the threadvar tables can be referenced correctly

git-svn-id: trunk@33035 -
2016-01-30 23:10:35 +00:00
michael
fe1e18eb8d * Fixed TRect setwith and setheight (from Ondrej Pokorny)
git-svn-id: trunk@33030 -
2016-01-29 20:50:21 +00:00
Jonas Maebe
9c3cab8224 * replaced pure LGPL Mersenne Twister implementation with a public domain
version

git-svn-id: trunk@33029 -
2016-01-29 18:03:14 +00:00
svenbarth
e3060130a4 Adjustments so that the resource string related tables are provided inside the system unit (both for indirect and direct entry targets).
rtl/inc/system.inc:
  + new variables that hold pointers to the tables
  + new procedure SetupEntryInformation() that should be used in the entry points of indirect entry targets to setup cross target fields
  + for direct entry targets the two resource string tables are imported here and supplied as initialization to the table pointers
objpas/objpas.pp:
  * adjust table declarations so that the pointers provided from the System unit are used
  * adjust usages of the tables as they are now pointers
win32/system.pp:
  * Exe_Entry: use SetupEntryInformation()
win/syswin.inc:
  * Dll_Entry: use SetupEntryInformation()

git-svn-id: trunk@33028 -
2016-01-29 17:19:33 +00:00
svenbarth
7b67ead440 Pass further main program data through the indirect entry information.
rtl/inc/systemh.inc:
  + TEntryInformation: add Pointer fields ResourceStringTables, ResStrInitTables, WideInitTables (for targets with separate WideString type) and ResLocation (not used on Windows, but since most other targets don't have Windows' resource system it's not part of OS)
rtl/java/jsystemh_types.inc:
  + TEntryInformation: adjust for consistency reasons
rtl/win32/sysinit.inc:
  * SysInitEntryInformation: initialize with pointers to the correct tables

git-svn-id: trunk@33027 -
2016-01-29 16:51:27 +00:00
svenbarth
0491bca72a inc/system.inc:
+ add (uninitialized) global variable EntryInformation for systems that use indirect main information
win32/system.pp:
  - remove initialized EntryInformation and instead rely on the one passed by the sysinit* units

git-svn-id: trunk@33026 -
2016-01-29 16:24:53 +00:00
svenbarth
3da7675eb1 Add a possiblity for targets to specify additional fields for TEntryInformation using an optional sub record called TEntryInformationOS
rtl/inc/systemh.inc:
  + add field OS of type TEntryInformationOS if the target specifies HAS_ENTRYINFORMATION_OS
rtl/java/jsystemh_types.inc:
  + same adjustments as above for consistency reasons despite it being not used there anyway

git-svn-id: trunk@33024 -
2016-01-29 15:32:33 +00:00
svenbarth
b525cecad8 - get rid of the calling convention modifier for PascalMain as it's generated using the default calling convention anyway (without any parameters this luckily doesn't matter that much ;) )
(Note: adjusted merge info as in my packages branch there is a less complete commit for this)

git-svn-id: trunk@33023 -
2016-01-29 14:51:15 +00:00
pierre
3de617c79e Fix phdr pointer increment and use envp variable from system unit for Solaris operating system
git-svn-id: trunk@33008 -
2016-01-27 10:47:16 +00:00
pierre
90359bcb3c Add code to find base address in unix ELF aux vector above enviroment in startup stack
git-svn-id: trunk@33007 -
2016-01-26 14:44:31 +00:00
michael
e7a722cdd9 * Patch from Ondrej Pokorny to make Trect methods more Delphi compatible (Bug ID 29479)
git-svn-id: trunk@32998 -
2016-01-24 15:16:18 +00:00
michael
9225ff3293 * Fix for bug ID #28283 by Denis Kozlov
git-svn-id: trunk@32919 -
2016-01-10 20:14:28 +00:00
michael
5e9c34ff47 * Patch from Denis Kozlov to fix bug ID #28288
git-svn-id: trunk@32918 -
2016-01-10 20:02:08 +00:00
michael
ee2f34588d * Fix bug #28258, missing UTF8ToString, patch by Stocki
git-svn-id: trunk@32824 -
2016-01-01 17:27:44 +00:00
florian
a7f1ce2e98 * patch by Dmitry Boyarintsev: initialize dyn. arrays more cleverly in a setlength call with ref. count>1, resolves issue #29250
git-svn-id: trunk@32721 -
2015-12-26 08:53:56 +00:00
florian
91c59cb512 * fix Fill* code for CPUs with 8 Bit ALU
git-svn-id: trunk@32645 -
2015-12-12 15:49:51 +00:00
Jonas Maebe
db2a02fb63 * clarified missing unicodestring manager error message
git-svn-id: trunk@32627 -
2015-12-10 11:00:00 +00:00
Jeppe Johansen
5ec4d38231 Add support for ram-less AVR chips and simultanously optimize flash/ram size the initfinal calling sequence.
git-svn-id: trunk@32448 -
2015-11-22 00:37:10 +00:00
nickysn
0f6b5161e6 * the 'count' parameter of Move and FillChar on i8086 made 16-bit unsigned,
instead of signed (BP7 compatibility)

git-svn-id: trunk@32443 -
2015-11-21 17:55:47 +00:00
Jonas Maebe
f22c7cc3fc - removed "packed" and dummy field (that was required because of
the "packed" keyword) from the TResourceStringRecord record

git-svn-id: trunk@32393 -
2015-11-21 12:36:03 +00:00
marco
08f9400070 * adding puint64 mantis #29020
git-svn-id: trunk@32351 -
2015-11-16 20:39:38 +00:00
marco
1407995a37 * part of advanced record patch
git-svn-id: trunk@32335 -
2015-11-15 18:48:26 +00:00
florian
70b8789262 o basic extended pascal support:
+ automatically loaded helper unit
  * Makefiles adapted
  * mode switch
  * mode switches reorganized
+ TimeStamp support

git-svn-id: trunk@32330 -
2015-11-15 15:13:36 +00:00
Jonas Maebe
21a4a9034d * commented out all untested (and on non-Win32: unimplemened) TCompareOption
flags

git-svn-id: trunk@32275 -
2015-11-08 19:43:26 +00:00
michael
fde42ca8ef * Type helpers, compatible to Delphi XE 8
git-svn-id: trunk@32262 -
2015-11-07 09:40:54 +00:00
marco
d95b95e648 * fix for #28940 also add PSizeUint
git-svn-id: trunk@32257 -
2015-11-06 15:54:54 +00:00
Jonas Maebe
0c904e92ff * moved TResourceStringRecord from the objpas to the system unit so it can be
used in the compiler when emitting resourcestrings

git-svn-id: trunk@32208 -
2015-10-30 20:45:19 +00:00
nickysn
e2ed8f2251 * fixed various procvars being casted to pointer instead of codepointer in the rtl
git-svn-id: trunk@32167 -
2015-10-27 17:25:27 +00:00
Jonas Maebe
80902035e0 * moved excepth.inc include from the system unit implementation to interface
so that we can still find the type definitions in it once we don't store
    the entire implementation symtable to the ppu anymore

git-svn-id: trunk@32151 -
2015-10-25 19:21:54 +00:00
nickysn
db7b743139 * yet another longint replaced with objpasint in fpc_shortstr_compare_equal
git-svn-id: trunk@32098 -
2015-10-19 16:53:40 +00:00
nickysn
b561b3c2ba * use objpasint (generates better code on 16-bit and 8-bit cpus) instead of
longint in several generic shortstr helpers

git-svn-id: trunk@32097 -
2015-10-19 16:36:12 +00:00
Jonas Maebe
1294dc1ede * when inserting a non-empty ansistring into an empty ansistring, the
destination must get the code page of the source (mantis #28850)

git-svn-id: trunk@32066 -
2015-10-16 19:15:40 +00:00
yury
7688639a10 * Return a real base address for ELF executables by GetModuleByAddr() instead of hard-coded 0.
* Obtain a real processaddress for ELF images by OpenExeFile() instead of hard-coded 0.
* It fixes line info information for Position Independent Executables (PIE).

git-svn-id: trunk@32052 -
2015-10-13 20:08:03 +00:00
nickysn
385f0d4ee8 - do not set the parameter to nil in strings.strdispose, because it's not a var
parameter and the operation is therefore useless

git-svn-id: trunk@32025 -
2015-10-12 14:28:46 +00:00
nickysn
4454332d7a * fixed the sysutils.GetEnvironment* functions for i8086-msdos
- removed the envp variable from the msdos system unit, because it's not
  compatible with ppchar in all memory models (we use ppfarchar to avoid copying
  the environment in the program's data segment in near data memory models)

git-svn-id: trunk@32017 -
2015-10-11 13:23:59 +00:00
nickysn
12a9664181 * use 16-bit offsets for threadvars on CPUs with 16-bit address space
git-svn-id: trunk@32013 -
2015-10-11 12:16:26 +00:00
nickysn
3faf91a270 * replaced nested ifdefs with an elseif sequence
git-svn-id: trunk@31957 -
2015-10-05 22:08:53 +00:00
nickysn
c9b3279e3c + added unit dynlibs to the win16 rtl
git-svn-id: trunk@31901 -
2015-10-01 13:10:40 +00:00
nickysn
4b61981ad9 * changed the return type of GetProcAddress in the generic dynlibs interface to
FarPointer on i8086

git-svn-id: trunk@31892 -
2015-09-29 16:30:27 +00:00
nickysn
7f086bb154 * use a farpointer on i8086 in the getintvec and setintvec generic "do nothing"
implementation to match the interface declaration in dosh.inc

git-svn-id: trunk@31888 -
2015-09-29 13:16:56 +00:00
yury
7c62aadf65 * Fixed string conversion warnings in RTL.
git-svn-id: trunk@31752 -
2015-09-17 17:25:57 +00:00