Commit Graph

409 Commits

Author SHA1 Message Date
marco
7ef8f00100 * more occured -> occurred spelling fixes.
git-svn-id: trunk@35130 -
2016-12-14 20:05:21 +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
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
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
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
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
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
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
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
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
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
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
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
yury
7c62aadf65 * Fixed string conversion warnings in RTL.
git-svn-id: trunk@31752 -
2015-09-17 17:25:57 +00:00
Jonas Maebe
c7aabaa3b6 - removed FPC_OBJFPC_EXTENDED_IF-related code, FPC 2.6.4 has it
git-svn-id: trunk@31696 -
2015-09-15 11:52:02 +00:00
Jonas Maebe
3f736f6114 * handle the loading of VMT entries at the node level, so it's done in a
type-safe way (for LLVM, and also internal consistency checking between
    the VMT as generated in nobj.pas and ncgvmt.pas)
   o also converted the VMT validity checking to the node level

git-svn-id: trunk@30950 -
2015-05-31 16:50:47 +00:00
florian
10dc944d35 * disable some function using ansistrings if the ansistring feature is turned off
git-svn-id: trunk@30630 -
2015-04-17 20:12:36 +00:00
michael
81fa382c42 * Rename WriteExceptionToStdErr -> WriteErrorsToStdErr
git-svn-id: trunk@30555 -
2015-04-12 15:37:46 +00:00
michael
94e57aa463 * Moved WriteExceptionToStdErr to system unit, so it is observed even in absence of sysutils (bug ID 27708)
git-svn-id: trunk@30551 -
2015-04-12 13:58:49 +00:00
florian
9ab9e03650 * limit number of possible units with initialization/finalization for a certain architecture to high(aint)
+ give an error if the number of possible units is exceeded

git-svn-id: trunk@30450 -
2015-04-05 21:06:58 +00:00
Jonas Maebe
67b8aceaee * synchronized with privatetrunk till r30095
git-svn-id: branches/hlcgllvm@30101 -
2015-03-05 20:32:15 +00:00
Jonas Maebe
dad442c7e3 + aarch64 fpu init, atomic routines and memory barriers
git-svn-id: trunk@29885 -
2015-02-23 22:51:06 +00:00
pierre
f56990ee29 Revert aligntoptr to RTTIAlign rename
git-svn-id: trunk@29739 -
2015-02-17 07:35:31 +00:00
sergei
72315c9bee * Finalize units after printing the runtime error message. Rationale:
* Unit finalization executes arbitrarily large amount of code. Doing it when error occurred can cause
    other errors, overwriting the original error information.
  * Code that prints error message depends on everything and a kitchen sink (most notably, Unicode manager
    and lineinfo unit). Running it after finalizing units can be successful only by coincidence.
  * Last but not least, this sequence (ExitProc -> print RTE -> finalize units) is same as one used in Delphi.

git-svn-id: trunk@29733 -
2015-02-16 22:05:54 +00:00
sergei
7666cd5c0e + Overloaded procedure dump_stack that calls CaptureBacktrace, thus encapsulating internals of stack traversing.
* Use this new procedure in heaptrc unit.

git-svn-id: trunk@29713 -
2015-02-15 20:00:24 +00:00
sergei
d93d36e6d3 * Win64: Use separate implementation of CaptureBacktrace that calls RtlCaptureStackBackTrace. This way it does not require non-optimized code to work correctly.
git-svn-id: trunk@29692 -
2015-02-14 11:41:33 +00:00
sergei
438c433c50 * CaptureBacktrace: fixed off-by-one error. Caller's context must be captured if skipframes=0.
git-svn-id: trunk@29691 -
2015-02-14 02:50:03 +00:00
svenbarth
2d454dc8fa Move DynLibs support to System unit using a manager approach like for Threads, WideStrings, etc.. This is needed so that we can support features like "delayed" and loading of dynamic packages.
Each port that allows the usage of dynamic libraries should call InitSystemDynLibs during initialization of the System unit.
The DynLibs unit has been adjusted to be a forwarder for the functions that now reside in the System unit (for backwards compatiblity just in case). Additionally the unit will register the DynLibsManager if it doesn't reside in the System unit anyway.
Currently only the Windows targets (Win32, Win64 and WinCE) implement the DynLibsManager inside the System unit. For other systems using the LoadLibrary, etc. functions will lead to a run error/exception.
If a port wants to implement its own DynLibsManager then it needs to define DISABLE_NO_DYNLIBS_MANAGER. TLibHandle, NilHandle and optionally TOrdinalEntry (it's set to SizeUInt otherwise) should be defined in sysdlh.inc which needs to be enabled using the define FPC_SYSTEM_HAS_SYSDLH (because there are targets which have FEATURE_DYNLIBS enabled, but don't support them... e.g. powerpc-wii -.-).
The DynLibsManager contains methods for loading a library based on a RawByteString and based on a UnicodeString. BOTH should be implemented, but internally one can forward to the other.
The loading by ordinal *can* be be implemented. If it is set to Nil then the implementation of GetProcAddress(lib,ordinal) will return Nil.

+ new functions SetDynLibsManager and GetDynLibsManager to set and retrieve the current DynLibsManager
* provide interface of DynLibs unit in unit System

git-svn-id: trunk@29613 -
2015-02-03 20:00:00 +00:00
florian
714901ce45 * fixes feature defines after recent changes
git-svn-id: trunk@28743 -
2014-10-04 18:12:09 +00:00
Károly Balogh
83cf14d5dd removed unnecessary masking in Swap() calls
git-svn-id: trunk@28613 -
2014-09-07 23:17:52 +00:00
Jonas Maebe
6e1d370417 * split off the texceptaddr declaration into rtl/inc/excepth.inc, so it can
be included at the start of the implementation of the system unit (before
    the rest of except.inc)
  * catch declarations in/loading from the system unit of the TExceptAddr type
  * use this type instead of hardcoded size constants in the compiler
  * in generic code that is active for all targets, puts its use in a virtual
    method since it's only valid for targets using setjmp/longjmp-style
    exception handling (and the record is not defined at all in the JVM RTL)

git-svn-id: branches/hlcgllvm@28376 -
2014-08-10 19:40:29 +00:00
Jonas Maebe
bacd303208 * synchronized with trunk up to r27758
git-svn-id: branches/hlcgllvm@27779 -
2014-05-12 16:12:34 +00:00
nickysn
fb20791cbe * replaced all the remaining uses of nativeint in the rtl with either sizeint
or objpasint

git-svn-id: trunk@27237 -
2014-03-23 13:38:16 +00:00
nickysn
a176c2d4f5 + add overloaded versions of HexStr(pointer) for i8086 near and far pointers
- rm ifdefs for i8086 far code memory model when doing stack traces. The
  compiler will now choose the correct overload of HexStr according to the
  CodePointer type.

git-svn-id: trunk@27163 -
2014-03-16 17:40:31 +00:00
nickysn
3ec4c378aa + added the ObjpasInt type (an integer type equivalent to Objpas.Integer) to the
system unit implementation part.

git-svn-id: trunk@27142 -
2014-03-15 12:19:04 +00:00
sergei
baa18dfcb4 * Introduced a new function CaptureBacktrace, using it to handle most of back-tracing in heaptrc unit.
* Use StackTop instead of StackBottom+StackLength in a few remaining locations.

git-svn-id: trunk@27141 -
2014-03-15 05:16:37 +00:00
sergei
3a55c4301e * Since StackTop=StackBottom+StackLength, any two variables are sufficient to describe stack, the third one is redundant.
* As a first part of cleanup, replaced StackTop with function returning StackBottom+StackLength.
* On Win32 and Win64, StackTop returns the stack base from TIB instead.

git-svn-id: trunk@27119 -
2014-03-12 19:48:03 +00:00
sergei
2f05e8b389 * PushExceptObject and dump_stack: use get_caller_stackinfo instead of get_caller_addr and get_caller_frame.
git-svn-id: trunk@27094 -
2014-03-11 12:51:46 +00:00
Jonas Maebe
e9268a0a14 * synchronised with trunk up till r26975
git-svn-id: branches/hlcgllvm@26976 -
2014-03-06 21:36:58 +00:00
Jeppe Johansen
9b79f2f68d Added support for 8-bit CPU's in RTL. Mostly for missing implementations of int<->string conversion and console/text output.
git-svn-id: trunk@26958 -
2014-03-04 20:00:03 +00:00
nickysn
0d1342a791 * don't call FinalizeHeap from InternalExit if FPC_NO_DEFAULT_HEAP is defined.
This reduces i8086-msdos executable sizes by 1.5-1.7k depending on the memory
  model.

git-svn-id: trunk@26919 -
2014-03-02 11:38:11 +00:00
nickysn
73e6ffe675 * the TableCount and InitCount fields in the INITFINAL table changed to
nativeint (generates smaller and more efficient code on i8086)

git-svn-id: trunk@26913 -
2014-03-01 14:33:10 +00:00
Jonas Maebe
9e6764e443 * converted program termination to compilerproc/hlcg
git-svn-id: branches/hlcgllvm@26029 -
2013-11-11 11:14:43 +00:00
Jonas Maebe
cd92791d09 * converted unit initialization to compilerproc/hlcg
git-svn-id: branches/hlcgllvm@26028 -
2013-11-11 11:14:38 +00:00
sergei
f2a4d1bbbc - Do not compile generic threadvar code if tf_section_threadvars flag is enabled for target (currently there are no such targets).
git-svn-id: trunk@25736 -
2013-10-10 12:55:30 +00:00
Károly Balogh
c108a24cc8 reverted r25622 which was an accidental commit of some highly experimental debug code (sorry)
git-svn-id: trunk@25623 -
2013-10-02 18:31:28 +00:00
Károly Balogh
d004b44406 really fixed FillChar and fixed FillWord. fixes 8 tests.
git-svn-id: trunk@25622 -
2013-10-02 14:11:09 +00:00
pierre
22e9cb48dd Fix get_caller_stackinfo function: Addr parameter must also be by var
git-svn-id: trunk@25537 -
2013-09-23 09:51:20 +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
Jonas Maebe
de56f909d5 * synchronized with trunk up to and including r25430
git-svn-id: branches/cpstrrtl@25431 -
2013-09-06 10:09:26 +00:00
florian
a240e74591 * check cputhumb/cputhumb2 to detect instruction set
git-svn-id: trunk@25417 -
2013-09-04 21:00:44 +00:00
Jonas Maebe
29132f45b7 * synchronised with trunk up to r25167 (fixes glib compilation via r25164,
and occasional crashes in executeprocess on libc platforms via r25167)

git-svn-id: branches/cpstrrtl@25169 -
2013-07-24 14:24:49 +00:00
Jonas Maebe
197b949dfa * fixed chdir/rmdir/mkdir(rawbytestring) on FPCRTL_FILESYSTEM_SINGLE_BYTE_API
when the passed in string has an encoding that is not a subset of
    DefaultFileSystemCodePage

git-svn-id: branches/cpstrrtl@25139 -
2013-07-19 16:31:47 +00:00
Jonas Maebe
df6a2dce00 + unicodestring support for assign/erase/rename
+ codepage support for textrec/filerec and the above routines
  * textrec/filerec now store the filename by default using widechar. It is
    possible to switch back to ansichars using the FPC_ANSI_TEXTFILEREC define.
    In that case, from now on the filename will always be stored in
    DefaultFileSystemEncoding
  * fixed potential buffer overflows and non-null-terminated file names in
    textrec/filerec
  + dodirseparators(pwidechar), changed the dodirseparators(pchar/pwidechar)
    parameters into var-parameters and gave those routines an extra parameter
    that indicates whether the p(wide)char can be changed in place if
    necessary or whether a copy must be made first (avoids us having to make
    all strings always unique everywhere, because they might be changed on
    some platforms via a pchar)
  * do_open/do_erase/do_rename got extra boolean parameters indicating whether
    the passed pchars point to data that can be freely changed (to pass on to
    dodirseparators() if applicable)
  * objects.pp: force assign(pchar) to be called, because
    assign(array[0..255]) cannot choose between pchar and rawbytestring
    versions (and removing the pchar version means that assign(pchar) will
    be mapped to assign(shortstring) in {$h-})
  * fixed up some routines in other units that depend on the format of
    the textrec/filerec.name field

git-svn-id: branches/cpstrrtl@25137 -
2013-07-19 16:30:51 +00:00
Jonas Maebe
0ef0206417 * fixed off-by-one error in the optimised rawbytestring/unicodestring
dodirseparators() routines + added test (only testable under Windows)

git-svn-id: branches/cpstrrtl@25089 -
2013-07-12 17:18:16 +00:00
Jonas Maebe
d66d15aad3 + added mkdir/chdir/rmdir(rawbytestring) and (unicodestring) to the system unit
* renamed platform-specific pchar versions of those rouines to do_*() and
    changed them to either rawbytestring or unicodestring depending on the
    FPCRTL_FILESYSTEM_SINGLE_BYTE_API/FPCRTL_FILESYSTEM_TWO_BYTE_API setting
  * implemented generic shortstring versions of those routines on top of either
    rawbytestring or unicodestring depending on the API-kind (in case of the
    embedded target, if ansistring are not supported they will map directly
    to shortstring routines instead)
  * all platform-specific *dir() routines with rawbytestring parameters now
    receive their parameters in DefaultFileSystemCodePage
  - removed no longer required ansistring variants from the objpas unit
  - removed no longer required FPC_SYS_MKDIR etc aliases
  * factored out empty string and inoutres<>0 checks from platform-specific
    *dir() routines to generic ones
  o platform-specific notes:
   o amiga/morphos: check new pathconv(rawbytestring) function
   o macos TODO: convert PathArgToFSSpec (and the routines it calls) to
     rawbytestring
   o nativent: added SysUnicodeStringToNtStr() function
   o wii: convert dirio callbacks to use rawbytestring to avoid conversion
  + test for unicode mk/ch/rm/getdir()

git-svn-id: branches/cpstrrtl@25048 -
2013-07-04 22:28:37 +00:00
Jonas Maebe
62ee16278b * changed getdir(ansistring):ansistring to
getdir(rawbytestring):rawbytestring so it can accept strings in any
    encoding and cleanly return results in DefaultRTLFileSystemCodePage
  + getdir(unicodestring):unicodestring
  * renamed the getdir implementation of all platforms except for embedded-
    without-ansistring-support to do_getdir(), and depending on the
    FPCRTL_FILESYSTEM_SINGLE_BYTE_API/FPCRTL_FILESYSTEM_TWO_BYTE_API define
    changed its shortstring parameter to ansistring or unicodestring. The
    do_getdir(rawbytestring) routine should just set the code page of the
    return value to DefaultFileSystemCodePage without conversion (not
    DefaultRTLFileSystemCodePage with conversion, that conversion is performed
    in getdir if necessary; this avoids double conversions in case
    getdir(unicodestring) is called)
  + generic getdir(shortstring) for platforms supporting either ansistrings or widestrings
  o platform maintainers:
   o OS/2: adjust code to supports paths > 255 characters if those are supported
   o Wii: adjust used callback to use rawbytestring to support paths > 255 characters and
     avoid shortstring->rawbytestring conversion overhead
   o Windows: GetCurrentDirectoryW is now always used (to prevent data loss)

git-svn-id: branches/cpstrrtl@24993 -
2013-06-27 21:37:47 +00:00
Jonas Maebe
679785f90c + rawbytestring and unicodestring versions of DoDirSeparators (optimised to
prevent calling uniquestring multiple times)

git-svn-id: branches/cpstrrtl@24992 -
2013-06-27 21:37:43 +00:00
florian
844806cb19 * renamed parameter bp (x86 ism) into fp for dump_stack
* more sanity checks if fp really points into the stack

git-svn-id: trunk@24975 -
2013-06-25 19:46:08 +00:00
Jonas Maebe
5a72bc3656 * export filerec/textrec from the system unit and use them in the compiler
to determine their size, rather than hardcoding the size for all possible
    configurations

git-svn-id: branches/cpstrrtl@24957 -
2013-06-24 09:39:50 +00:00
nickysn
10f7f0231e * TExitProcInfo.SaveExit changed to CodePointer
git-svn-id: trunk@24852 -
2013-06-09 20:19:28 +00:00
nickysn
fe404d2891 + rtl implementation of ptr(seg,ofs) for i8086
git-svn-id: trunk@24565 -
2013-05-24 12:11:55 +00:00
paul
d90445e5ee compiler, rtl, tests: write Delphi compatible (more or less) type information for Class Reference and Pointer types (mantis #0024367)
git-svn-id: trunk@24421 -
2013-05-04 12:47:05 +00:00
florian
0e41df598e * merge i8086 branch by Nikolay Nikolov
git-svn-id: trunk@24324 -
2013-04-25 20:23:51 +00:00
nickysn
5f5402f479 * changed ifdef, so that HandleErrorAddrFrame uses the default calling convention on i8086 (whatever that may be), instead of register
git-svn-id: branches/i8086@24257 -
2013-04-16 08:20:51 +00:00
nickysn
ceb76808e7 + implemented the CSeg, DSeg and SSeg functions on the i8086
git-svn-id: branches/i8086@24041 -
2013-03-28 21:29:14 +00:00
pierre
503b8c73c2 Avoid infinite loops with RTE 204 if heap is corrupted
git-svn-id: trunk@23845 -
2013-03-15 15:40:23 +00:00
nickysn
3768914a3d slight rtl update for i8086-msdos
git-svn-id: branches/i8086@23777 -
2013-03-10 16:57:15 +00:00
florian
21c154d60a Merged r22903
git-svn-id: trunk@23757 -
2013-03-09 20:56:07 +00:00
florian
1eeeb309c7 * intial armv6m support, it is not working yet, constant pool insertation and conditional branch fixup is not working yet
git-svn-id: trunk@23682 -
2013-03-03 12:20:10 +00:00
pierre
6e5be15087 Add PT convinience variable to ba able to debug InitFinalTable
git-svn-id: trunk@23558 -
2013-02-01 21:13:55 +00:00
Jonas Maebe
69c29a415f * pass the procdef to getintparaloc instead of only the proccalloption, so
that the type of the parameters can be determined automatically
   o added compilerproc declarations for all helpers called in the compiler
     via their assembler name, so we can look up the corresponding procdef

git-svn-id: trunk@23325 -
2013-01-06 15:05:40 +00:00
florian
24f518f232 + redirect calls to empty virtual methods to FPC_EMPTYMETHOD
* do empty subroutine/method optimization only for O2 and higer

git-svn-id: trunk@23276 -
2013-01-01 16:43:27 +00:00
Jeppe Johansen
3ee29eb219 Fixed ARMv7-EM code generation and RTL compilation
Added LM4F120H5 controller type and startup code

git-svn-id: branches/laksen/arm-embedded@22903 -
2012-11-01 17:25:01 +00:00
tom_at_work
f252fd369e Tried to reorganize the ARM define mess in rtl/arm/arm.inc. Instead of requiring to enumerate all possible ARM variants each time a CPU feature is used, add a define of the format CPUARM_HAS_XXX and use that. Note that a better solution would be to properly implement the compiler cpuinfo infrastructure, however that is much more work.
+ CPUARM_HAS_BX is defined if the CPU supports the BX* instruction
  + CPUARM_HAS_REV is defined if the CPU supports the REV instruction. Note that you still have to check for compiler versions > 2.6.0 since the assembler reader of 2.6.0 does not understand that instruction.
  + CPUARM_HAS_IDIV is defined if the CPU supports the sdiv, udiv instructions. Use of this fixes a bug where previously these instruction were only used for armv7-m, while cortex3m cpus also support it.
  + CPUARM_HAS_LDREX is defined if the CPU supports the ldrex/strex instructions. Use of this fixes a bug with armv7(-a) cpus where this path has not been used.
  + SYSTEM_HAS_KUSER_CMPXCHG is defined if the system (mainly OS) support the kuser_cmpxchg functions. Use of this fixes a bug where ARMHF systems did not use it for synchronization (although ARMHF is armv7+ only, i.e. the LDREX path is used anyway)

git-svn-id: trunk@22081 -
2012-08-14 19:45:03 +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
pierre
ca8cc759ac Add HandleErrorAddrFrameInd to restore same behavior for RTEs as for 2.6.0, i.e. avoid an additional line at fpc_XXX level in stack dump
git-svn-id: trunk@21899 -
2012-07-12 10:19:58 +00:00
Jonas Maebe
aba6923187 * moved g_test_self() from cgobj to hlcgobj
git-svn-id: trunk@21861 -
2012-07-11 08:25:51 +00:00
pierre
f340ef87e3 * get_addr function renamed to get_pc_addr
+ get_caller_stackinfo procedure added.

git-svn-id: trunk@21707 -
2012-06-25 22:17:49 +00:00
pierre
8469741700 + Added additional addr pointer parameter to
get_caller_frame, get_caller_addr and dump_stack
  with default NIL value to systemh.inc.
  + Added new get_addr function.
  system.inc: Use get_addr and get_frame to call
  HandleErrorAddrFrame instead of HandleErrorFrame
  in several error functions.
  Modify dump_stack to use frame and addr parameters.
  Provide a dummy get_addr function returning nil.
  i386/i386.inc, x86_64./x86_64.inc: Provide real
  implementation of get_addr function.

git-svn-id: trunk@21697 -
2012-06-24 21:22:09 +00:00
pierre
be67af4374 * Adapt to mipsel compiler defining cpumipsel and cpumipsel32 but not cpumips anymore
git-svn-id: trunk@21541 -
2012-06-08 09:33:03 +00:00
Jonas Maebe
baa8fa39a8 * converted code to trash variables (-gt) to operate at the node tree level,
and also use this code to trash local variables in inlined routines
   o fixes mantis #22088
   o makes it possible to also implement it for the jvm target in the future

git-svn-id: trunk@21393 -
2012-05-26 11:32:39 +00:00
florian
6c8eed21c4 + implement auto inlining (-Ooautoinline)
+ implement trashing of local variables if subroutine is inlined
* fix some errors releated to interproc. gotos and inlining
+ node_count function
* inline cannot be used with iochecking and safecall calling conventions
* track inherited usage
* don't inline if inherited is used

git-svn-id: trunk@21335 -
2012-05-19 13:30:02 +00:00
Jonas Maebe
7aa3b99fb5 + -CN/{$CHECKLOWADDRLOADS+/-} switch to enable explicit checks for accesses
to low addresses in case the target cpu/OS does not support this (enabled
    for reads on AIX/PPC because on AIX the first 16KB are readable)

git-svn-id: trunk@20832 -
2012-04-11 18:05:50 +00:00
svenbarth
bd19a16be9 Add support for Default() intrinsic. For now this is only (fully) supported
in code and not in constants. In the case of primitive types constant nodes
are used while complex types like arrays, records and objects use a local
variable which is initialized to zero once at the entry of the method (the
variable is reused if Default() is used for the same type multiple times in
the same method). For this a new compilerproc was added which uses FillChar
to initialize the given memory area to zero.
This fixes Mantis #9420.

+ psystem.pas: Added Default symbol to system unit
+ htypechk.pas: Added function "is_valid_for_default" which checks recursively
                whether the given type can be used with Default at all. 
                Forbidden types are files, helpers, ObjC and C++ types. This
                check is used for records, arrays and objects only if the mode
                is a non-Delphi one, as Delphi ignores these types on lower
                levels.
+ msg/errore.msg: Added error message for unsupported types for Default()
+ symconst.pas: Added a new enum value vo_is_default_var which is used for the
                local variables utilized by Default() so their initalization
                and finalization can be avoided.
+ pexpr.pas: Add handling of Default() intrinsic to "statement_syssym"
+ ninl.pas: Extended tinlinenode by a method which returns the correct node for
            a Default() and used that method in handle_typecheck.
* ncgutil.pas: Check for new flag "vo_is_default_var" when initializing and
               finalizing local variables.
* ppu.pas: increase PPU version
+ psub.pas: 
  * Added a new routine which zeros defaultvars of a symtable.
  * Use this routine inside "initializevars".
  * Also use this routine to initialize the staticsymtable of the unit/program.
* Adjusted ppudump, because of the new enum value.
+ Added implementation of fpc_zeromem to system unit.
+ Added tests for Default()

git-svn-id: trunk@20629 -
2012-03-25 16:02:27 +00:00
pierre
b058593b53 * Fix compilation for cpu i386
git-svn-id: trunk@20264 -
2012-02-05 18:51:23 +00:00
florian
a2009af76e * updated MIPS code so the compiler gets through the system unit
git-svn-id: trunk@20259 -
2012-02-05 08:14:46 +00:00
florian
6a1a2d3464 * get rid of some feature checks, probably the whole feature stuff is plainly the wrong way, embedded rtl compiles again, resolves #20913
git-svn-id: trunk@19907 -
2011-12-29 14:06:30 +00:00
sergei
ebe1d74d6e * Moved multiple similar checks for FPC_HAS_FEATURE_EXITCODE and FPC_LIMITED_EXITCODE to Halt() procedure. Now these checks appear only once.
git-svn-id: trunk@19597 -
2011-11-05 16:48:12 +00:00
florian
d7f7a9bb76 * patch by Alexander Shishkin to clean up $ifopt usage by $push/$pop, resolves #20346
git-svn-id: trunk@19256 -
2011-09-27 20:22:40 +00:00
florian
375f83c874 * moved heap manager on embedded systems into a separate unit
* moved console io on embedded systems into a seperate unit, this unit might setup input/output e.g. to be redirected to a serial port
* cleanup of the embedded system unit

git-svn-id: trunk@19168 -
2011-09-21 20:57:37 +00:00
florian
e3e1e4b7c6 * fpc_LibInitializeUnits can be empty if the target has no shared lib support
git-svn-id: trunk@18871 -
2011-08-27 22:45:49 +00:00
sergei
d9c399f6a1 * Partially reverted rev.17798: printing the runtime error message must remain in InternalExit.
Moving it to SysFlushStdIo causes a multithreaded program to print several messages with meaningless stack traces.

git-svn-id: trunk@17944 -
2011-07-06 17:40:34 +00:00
pierre
2d5ca71a06 + New procedure SysFlushStdIO (code taken from InternalExit).
* InternalExit: now calls new procedure SysFlushStdIO
 * DoneThread: Also calls SysFlushStdIO to avoid loosing output
 if standard files are redirected.

git-svn-id: trunk@17798 -
2011-06-22 16:16:27 +00:00