Commit Graph

622 Commits

Author SHA1 Message Date
Jonas Maebe
4d0e4e1b56 * treat "[var + rip]" in intel assembler mode as addr_pic_no_got on x86-64
(mantis #22665)
  + support "[var wrt ..gotpcrel]" nasm/yasm syntax in intel assembler mode
    for GOT-relative accesses on x86-64, + give an error when trying to do
    this on win64 (it doesn't have a GOT)
  * moved code that give a warning when using GOT-relative accesses to
    static data on x86-64 from the AT&T reader to rax86 so it's also
    active for the Intel assembler reader
  + added warning when not using GOT-relative accesses (but plain
    RIP-relative instead) to global data on non-Win64 x86-64

git-svn-id: trunk@22243 -
2012-08-25 15:12:49 +00:00
Jonas Maebe
288d1ec74a * support referencing "result" in nostackframe pure assembler routines if
the result location is a simple location (a single register/reference)
    (mantis #22490)
  * print an error when accessing "result" in a nostack pure assembler routine
    if the result location is not simple

git-svn-id: trunk@22166 -
2012-08-21 19:51:40 +00:00
florian
4d86d25c6c * -O4 switch for optimizations which are correct but which might have unexpected effects
like field reordering (possible problems cracker classes) or using ebp as normal register (broken
      stack traces from dump_stack)
    + niln is also valid in a cse domain
    * parameters passed by reference shall have a complexity >1
    * load nodes from outer scopes shall have a complexity >1
    * better cse debugging
    + more node types added to cse
    * consider parameters passed by reference in cse
    * take care of cse in parameters in simple cases

git-svn-id: trunk@22050 -
2012-08-09 18:58:54 +00:00
florian
fb7f25f410 * removed wrong -N switch (switch is not used) description
git-svn-id: trunk@22037 -
2012-08-08 17:02:05 +00:00
Jonas Maebe
aad3ce960a * give an error when trying to give a parameter of a non-simple type a
default value (mantis #22343)
  * give an error when specifying an invalid default value (e.g. a
    floating point number for a longint parameter)

git-svn-id: trunk@22021 -
2012-08-06 20:13:20 +00:00
sergei
684bf4fba2 + Reject object types without VMT as arguments of typeof(). Without this check, an undefined reference to VMT is generated which fails at the linking stage.
git-svn-id: trunk@21923 -
2012-07-17 05:46:55 +00:00
Jonas Maebe
c2be657671 * give an error instead of a note on the JVM target when overriding a
method by one with a lower visibility, because calling the overriding
    method results in a java.lang.AbstractMethodError in that case

git-svn-id: trunk@21839 -
2012-07-10 09:20:11 +00:00
Jonas Maebe
b0462d27cc * by default, no longer initialize enumeration fields of classes/objects
with the enum instance corresponding to ordinal 0 in JVM constructors,
    because a virtual method called by a parent constructor may already
    have assigned a different value (see tests/test/jvm/tenum2.pp). This
    will result in null pointer exceptions when using such fields without
    first explicitly assigning a value to them though.

    The old behaviour can be restored with the new -CTenumfieldinit command
    line parameter

git-svn-id: trunk@21736 -
2012-06-29 21:24:35 +00:00
Jonas Maebe
9f0fb9cf10 - removed "<<<<<<< HEAD" leftover from a conflicting merge
git-svn-id: trunk@21409 -
2012-05-28 12:08:14 +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
958600e74b * by default disable the warning about interfaces raising a particular
method's visibility, because this is common practice in Object-Pascal.
    It can be re-enabled with {$warn INTF_RAISE_VISIBILITY on} (mainly
    useful when trying to keep code compatible with the JVM target)

git-svn-id: trunk@21329 -
2012-05-19 10:19:49 +00:00
paul
d79eee8ed1 compiler: write a warning if unit should be compiled with built-in system codepage for ansistring constants but this codepage is not known by the compiler
git-svn-id: trunk@21269 -
2012-05-10 01:24:18 +00:00
Jonas Maebe
64f3ba3299 * clarified description of -Xd, it is not always required for
cross-compiling (mantis #21963)

git-svn-id: trunk@21248 -
2012-05-06 15:44:52 +00:00
Jonas Maebe
834026bfb5 * synchronised with trunk up to r21067
git-svn-id: branches/jvmbackend@21068 -
2012-04-26 21:24:20 +00:00
Jonas Maebe
3380b58695 * when we get near the limit of the maximum number of TOC entries that can
be generated for a single object file on AIX, automatically switch to
    an indirection scheme that uses much less TOC entries, but is slower to
    access global variables
  * manually merged infrastructure for target-specific code generation
    switches from JVM branch (-CTxxx switches)
  * -CTsmalltoc switch for AIX that forces the indirection scheme for TOC
    entries from the start in case the automatic one does not conserve
    a sufficient amount (or in case you bump up against the global TOC
    entries limit during linking)

git-svn-id: trunk@20963 -
2012-04-21 20:17:46 +00:00
Jonas Maebe
aee5380ae0 * merged trunk up to r20882
o support for the new codepage-aware ansistrings in the jvm branch
   o empty ansistrings are now always represented by a nil pointer rather than
     by an empty string, because an empty string also has a code page which
     can confuse code (although this will make ansistrings harder to use
     in Java code)
   o more string helpers code shared between the general and jvm rtl
   o support for indexbyte/word in the jvm rtl (warning: first parameter
     is an open array rather than an untyped parameter there, so
     indexchar(pcharvar^,10,0) will be equivalent to
     indexchar[pcharvar^],10,0) there, which is different from what is
     intended; changing it to an untyped parameter wouldn't help though)
   o default() support is not yet complete
   o calling fpcres is currently broken due to limitations in
     sysutils.executeprocess() regarding handling unix quoting and
     the compiler using the same command lines for scripts and directly
     calling external programs
   o compiling the Java compiler currently requires adding ALLOW_WARNINGS=1
     to the make command line

git-svn-id: branches/jvmbackend@20887 -
2012-04-15 15:54:10 +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
Tomas Hajny
b11a2b169a * fixed inconsistent license files references
git-svn-id: trunk@20763 -
2012-04-08 20:00:45 +00:00
Tomas Hajny
a5a7c2aa3e * directions for reporting bugs are different from those for asking questions nowadays
git-svn-id: trunk@20747 -
2012-04-07 16:43:15 +00:00
Tomas Hajny
20ebbefc2b * e-mail address for reporting bugs is not valid since long time ago
git-svn-id: trunk@20746 -
2012-04-07 16:31:08 +00:00
Tomas Hajny
b12c38984b * fpc binary supported options made localizable and not shown separately from those handled by ppc* any longer
git-svn-id: trunk@20694 -
2012-04-02 22:11:21 +00:00
Jonas Maebe
6ba8dc7146 + support for the ARM hard float EABI on Linux (patch by Peter Green):
o new eabihf (hard float) abi
   o vfpv3_d16 variant of VFP (default variant used by EABI assemblers: VFPv3
     with only 16 double registers instead of 32) and pass it to GNU as
   o make the odd numbered single precision floating point VFP registers
     available for explicit allocation for use by the calling convention
  * fixed copy/paste error in stdname of S30 register
  -> use -dFPC_ARMHF to create an ARM eabi hard float compiler
  (mantis #21554)

git-svn-id: trunk@20660 -
2012-03-29 20:50:09 +00:00
svenbarth
c9ca2a6c0c Correct messages that should not have been changed (merge during update gone wrong). Resolves Mantis #21553
git-svn-id: trunk@20631 -
2012-03-25 19:33:26 +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
florian
f4af507321 * inline is only a hint to the compiler which might be ignored so throw only a hint and not a warning if subroutine cannot be inlined
git-svn-id: trunk@20626 -
2012-03-25 14:19:45 +00:00
florian
0a118768c0 * updated copyright message to 2012
git-svn-id: trunk@20605 -
2012-03-23 18:38:05 +00:00
Jonas Maebe
3589f90cf8 * also show the valid bounds in most cases when signalling a range check
warning/error while evaluating constants (mantis #21299)

git-svn-id: trunk@20507 -
2012-03-10 21:53:36 +00:00
Jonas Maebe
eb2cccffda + -WM<X> and -WP<x> command line parameters to specify the minimally required
Mac OS X/iOS version for the compiler code
   o such a parameter is not passed, extract the information from the
     environment variables MACOSX_DEPLOYMENT_TARGET/IPHONEOS_DEPLOYMENT_TARGET,
     like gcc
   o if neither the parameter nor the environment variable is used, use preset
     default values
   o pass on this version setting on to the Darwin linker
   o use this setting to determine which version of the startup code (crt1.o
     etc) to use, if any (based on information gathered from the GCC sources)
   o define a symbol called MAC_OS_X_VERSION_MIN_REQUIRED/
     IPHONE_OS_VERSION_MIN_REQUIRED based on this parameter
   o for usage information, see
     http://wiki.freepascal.org/FPC_New_Features_Trunk#Support_for_specifying_and_querying_the_deployment_version

git-svn-id: trunk@20503 -
2012-03-10 19:31:57 +00:00
Jonas Maebe
a6a43c71ec * give an error message when including a file starting with an UTF-8 BOM
in a compilation module parsed using a different code page, because this
    changes the default ansistring type and {$codepage xxx} is also not
    allowed in the middle of a unit (mantis #21445)

git-svn-id: trunk@20488 -
2012-03-09 22:50:14 +00:00
Tomas Hajny
f1b81f12b5 * indicate -an being only useful with -dEXTDEBUG
git-svn-id: trunk@20433 -
2012-02-26 20:49:45 +00:00
florian
96e8e89e16 * write error code if an object file cannot be created
git-svn-id: trunk@20083 -
2012-01-15 10:59:10 +00:00
florian
ea8ae7c867 * update of Portuguese compiler message file by Marcelo B Paula, resolves #20963
git-svn-id: trunk@19898 -
2011-12-28 17:44:46 +00:00
marco
28c27c409e * fixed up messages compilation after last commit.
git-svn-id: trunk@19780 -
2011-12-08 20:49:18 +00:00
paul
031eb4d51c compiler: fix 'class class' message
git-svn-id: trunk@19682 -
2011-11-25 08:34:24 +00:00
pierre
8f7ea8718b + Add message for TExternalLinker.CatFileContent method
git-svn-id: trunk@19646 -
2011-11-18 21:28:46 +00:00
Jonas Maebe
74510f9069 + generic infrastructure for target-specific switches
+ -CTcompactintarrayinit command line option to change the code generation
    for typed array of some kind of integer-type initialization so that it
    takes up less space in the bytecode (because the bytecode for all
    routines, including the class initialization code that contains the
    typed constant init code, is limited 64kb, large array or multiple
    array constants could fairly easily bump into that limit)

git-svn-id: branches/jvmbackend@19638 -
2011-11-14 22:57:41 +00:00
paul
26f66897cd compiler:
- warn if compiler finds implicit or explicit string type conversion from a form of ansi string to a form of unicode string and vice versa
  - mark explicit warnings as OFF by default
  - warn if compiler finds an assignment of an unicode char const to ansi string or char type (warn for assignment of unicode string const to be implemented)
  - revert a piece of code from r19457 regards shortstring handling because shortstring handling should not differ from ansistring in this paticular case

git-svn-id: trunk@19574 -
2011-11-03 00:39:22 +00:00
florian
6ec0f2549a * factored load node flags out of node flags to gain space
+ implemented iso mode mod, resolves #17685

git-svn-id: trunk@19558 -
2011-10-30 15:14:21 +00:00
sergei
6a3fe72de9 + Support .rva directive in AT&T reader. Put it into base class because it generally applies to all targets with COFF output, but enabled for Windows targets only (others need additional testing).
+ Support .seh_handlerdata directive in Win64.

git-svn-id: trunk@19546 -
2011-10-25 15:18:47 +00:00
sergei
85f7914906 * Don't generate .seh_endprologue if SEH directives are present in the text of (pure assembler) procedure, as it results in duplicate .seh_endprologue.
* Added checks for .seh_endprologue presence and correct position.

git-svn-id: trunk@19388 -
2011-10-06 03:29:35 +00:00
sergei
0db44ae108 + Support SEH directives in x86_64 AT&T asmreader.
git-svn-id: trunk@19366 -
2011-10-04 12:26:41 +00:00
Jonas Maebe
3b47c40ed2 * check whether methods that implement interface methods are public
or published, because interface methods are always public and
    hence mapping them to a private/protected method increases the
    visibility of the underlying method (error on JVM target because
    the JVM doesn't like that, warning on other platforms)

git-svn-id: branches/jvmbackend@19156 -
2011-09-19 21:22:44 +00:00
Jonas Maebe
f96f5f9e94 + {$VARPARACOPYOUTCHECK+/-} / -Cv switch to enable checking
var-parameters on the JVM target for changes to the value passed
    as var-parameter during the function call (because they are handled
    via copy-in/copy-out, this may indicate unexpected bahviour later on).

    out-parameters are checked in the same way, except if the out-parameter
    is a local variable because then reading it before the call may result
    in a bytecode verification error (since the variable may not yet be
    initialized)

git-svn-id: branches/jvmbackend@19153 -
2011-09-19 19:59:26 +00:00
paul
8a4634a7b1 merge r13481 from cpstrnew branch by florian
+ support parsing of strings with code page specification
+ added encoding and elementsize field to ansi- and unicodestring records
+ some basic rtl support routines for encoding aware strings
+ DefaultSystemCodePage
+ DefaultUnicodeCodePage
+ ppu writing/loading of code page aware strings

git-svn-id: trunk@19080 -
2011-09-17 10:37:36 +00:00
pierre
a5d2840980 + Fix commit 19061, by restoring cs_link_smart code and disabling
cs_create_smart if using dwarf information and external assembler
   debug information as this is not compatible.
 * Added a different message for cs_create_smart.

git-svn-id: trunk@19065 -
2011-09-14 13:38:15 +00:00
pierre
5a671336c7 Fix go32v2 rtl compilation error and add warning for %es:Const
git-svn-id: trunk@19057 -
2011-09-13 16:20:12 +00:00
Jonas Maebe
633de3fe30 * give an error when calling a virtual constructor from another constructor
on the JVM target, because the generated code was invalid and I can't think
    of a generic way to solve it (see added comments in njvmcal.pas)

git-svn-id: branches/jvmbackend@19055 -
2011-09-12 18:08:46 +00:00
florian
1491d77c9d * avoid ugly space in compilation summary
git-svn-id: trunk@18865 -
2011-08-27 21:21:24 +00:00
Jonas Maebe
9aa40f5a08 * give a warning that packrecords settings are ignored when compiling for
managed VM targets

git-svn-id: branches/jvmbackend@18815 -
2011-08-23 15:26:14 +00:00
Jonas Maebe
28c20cfc5e * the default string type for the JVM target is no longer automatically
unicodestring = java.lang.String. The reason this was the default in
    the past is that this was the first string type that was implemented,
    and without it being the default most code involving string operations
    would fail. Now the default strings types are the same as for other
    targets
  + new {$modeswitch unicodestrings} directive, that when activated
    *together* with {$h+},
   1) changes char into an alias for widechar
   2) changes string into an alias for unicodestring
   3) changes the preferred string evaluation type (in case of uncertainty)
      to unicodestring
    {$modeswitch unicodestrings} with {$h-} does not change anything at all
    regarding the string type (it still changes the char type)
  + new uuchar unit that redefines char as widechar, and which is automatically
    included by the compiler if {$modeswitch unicodestrings} is enabled

git-svn-id: branches/jvmbackend@18781 -
2011-08-20 08:35:47 +00:00