Commit Graph

338 Commits

Author SHA1 Message Date
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