Commit Graph

154 Commits

Author SHA1 Message Date
florian
aadd93847f -- Zusammenführen von r43620 in ».«:
U    compiler/nadd.pas
U    compiler/ncnv.pas
U    compiler/ncon.pas
U    compiler/node.pas
A    tests/test/tcurrency1.pp
A    tests/webtbs/tw33963.pp
A    tests/webtbs/tw36179.pp
-- Aufzeichnung der Informationen für Zusammenführung von r43620 in ».«:
 U   .

git-svn-id: branches/fixes_3_2@43621 -
2019-12-01 20:29:52 +00:00
Jonas Maebe
858bf743ef --- Merging r43347 into '.':
C    compiler/nmat.pas
--- Recording mergeinfo for merge of r43347 into '.':
 G   .
--- Merging r43436 into '.':
U    compiler/defutil.pas
U    compiler/nadd.pas
U    compiler/ncnv.pas
U    compiler/ncon.pas
U    compiler/ngtcon.pas
U    compiler/ninl.pas
G    compiler/nmat.pas
U    compiler/nutils.pas
U    compiler/pstatmnt.pas
--- Recording mergeinfo for merge of r43436 into '.':
 G   .
--- Merging r43438 into '.':
A    tests/test/tinlrange1.pp
A    tests/test/tinlrange2.pp
A    tests/test/tinlrange3.pp
--- Recording mergeinfo for merge of r43438 into '.':
 G   .
--- Merging r43451 into '.':
U    tests/test/tinlrange1.pp
--- Recording mergeinfo for merge of r43451 into '.':
 G   .
--- Merging r43497 into '.':
C    compiler/nmat.pas
A    tests/test/tinlrange4.pp
--- Recording mergeinfo for merge of r43497 into '.':
 G   .

git-svn-id: branches/fixes_3_2@43498 -
2019-11-16 15:18:43 +00:00
florian
b6e7ebdd3c -- Zusammenführen von r42272 in ».«:
U    compiler/defutil.pas
A    tests/webtbf/tw35671.pp
-- Aufzeichnung der Informationen für Zusammenführung von r42272 in ».«:
 U   .
-- Zusammenführen von r42274 in ».«:
U    compiler/cgbase.pas
-- Aufzeichnung der Informationen für Zusammenführung von r42274 in ».«:
 G   .
-- Zusammenführen von r42275 in ».«:
U    compiler/defcmp.pas
C    compiler/defutil.pas
U    compiler/ncnv.pas
U    compiler/ncon.pas
U    compiler/ngtcon.pas
U    compiler/ninl.pas
U    compiler/pstatmnt.pas
A    tests/webtbf/tw35753.pp
-- Aufzeichnung der Informationen für Zusammenführung von r42275 in ».«:
 G   .

git-svn-id: branches/fixes_3_2@43367 -
2019-11-02 18:07:58 +00:00
Jonas Maebe
fc9e9e804a --- Merging r40512 into '.':
A    tests/webtbs/tw33607.pp
U    compiler/aarch64/hlcgcpu.pas
--- Recording mergeinfo for merge of r40512 into '.':
 U   .
--- Merging r40566 into '.':
U    compiler/aarch64/cpupara.pas
--- Recording mergeinfo for merge of r40566 into '.':
 G   .
--- Merging r40567 into '.':
G    compiler/aarch64/cpupara.pas
--- Recording mergeinfo for merge of r40567 into '.':
 G   .
--- Merging r40573 into '.':
G    compiler/aarch64/cpupara.pas
--- Recording mergeinfo for merge of r40573 into '.':
 G   .
--- Merging r40629 into '.':
U    compiler/ncnv.pas
U    compiler/llvm/nllvmcnv.pas
--- Recording mergeinfo for merge of r40629 into '.':
 G   .
--- Merging r40637 into '.':
U    compiler/ncon.pas
A    tests/webtbs/tw33666.pp
--- Recording mergeinfo for merge of r40637 into '.':
 G   .
--- Merging r40729 into '.':
U    compiler/ncal.pas
U    compiler/jvm/njvminl.pas
U    compiler/ninl.pas
--- Recording mergeinfo for merge of r40729 into '.':
 G   .

git-svn-id: branches/fixes_3_2@40735 -
2019-01-01 16:49:46 +00:00
florian
68eb921d46 * broken compilation after r39347 fixed
git-svn-id: trunk@39349 -
2018-06-30 12:30:25 +00:00
Jonas Maebe
4da6039f40 * simplify empty-dynamic-string-to-pointer (non-p(wide)char) type conversions
so that they cannot result in "cmp const, const" at the assembler level
    (mantis #33548)

git-svn-id: trunk@38662 -
2018-04-02 18:35:00 +00:00
Jonas Maebe
8cfe7e0a0c * when creating a realconstn, cast the value to the specified type
(mantis #25121)
   o note that this means that single_const1/single_const2 will now be rounded
     to single, instead of staying the at maximum precision
   o fixed FahrenheitToCelcius() to handle this change correctly

git-svn-id: trunk@37911 -
2018-01-04 20:51:36 +00:00
florian
b1dff29cbf * removed unused units
git-svn-id: trunk@36165 -
2017-05-09 19:53:14 +00:00
Jonas Maebe
a2bd07bfd6 * fixed compilation of 64-bit cross-compilers on 32 bit platforms
(mantis #31487)

git-svn-id: trunk@35532 -
2017-03-06 21:37:34 +00:00
florian
13b3866552 * convert (s*[const. set])<>/=[] for var. sets into or'ed in nodes, if const. set contains only a few elements
git-svn-id: trunk@35526 -
2017-03-05 20:29:22 +00:00
Károly Balogh
5426c11611 marked a few uses of TConstExprInt as const during parameter passing, to avoid a few unnecessary record copying
git-svn-id: trunk@35509 -
2017-03-03 17:29:59 +00:00
Jonas Maebe
1afab1ab69 * moved the floating point constant range checking code from
pass_generate_code to pass_typecheck, so that it's also used by targets
    that override pass_generate_code (fixes webtbs/tw16315b for LLVM)

git-svn-id: trunk@35021 -
2016-11-29 21:54:33 +00:00
Jonas Maebe
974c2363c0 - removed tdataconstnode, as it is no longer used and is not type safe.
Use a typed constant builder instead.

git-svn-id: trunk@34155 -
2016-07-19 14:30:42 +00:00
Jonas Maebe
a65ab73e8b * support unicodestring constants in "case string of" (mantis #29353)
git-svn-id: trunk@32970 -
2016-01-20 21:11:26 +00:00
florian
495b7181a8 + write the value of a pointer constant node in printnodedata
git-svn-id: trunk@31469 -
2015-08-31 20:03:47 +00:00
Jonas Maebe
b57c95043f + support overriding tdef/tsym methods with target-specific functionality:
o made all (non-abstract) tdef and tsym constructors virtual
   o added c*def/c*sym classref types for every (non-abstract) t*def/t*sym
     class
   o added cpusym unit for every architecture that derives a tcpu*def/tcpu*sym
     class from the base classes, and initialises the c*def/c*sym classes with
     them. This is done so that the llvm target will be able to derive from
     the tcpu*def/sym classes without umpteen ifdefs, and it also means that
     the WPO can devirtualise everything because the c* variables are only
     initialised with one class type
   o replaced all t*def/t*sym constructor calls with c*def/c*sym constructor
     calls

git-svn-id: trunk@27361 -
2014-03-29 22:31:55 +00:00
nickysn
22acb2e44b * moved the i8086 specific code from tpointerconstnode.create to the i8086
descendant class

git-svn-id: trunk@27285 -
2014-03-25 22:00:23 +00:00
florian
4d5119bf1c * fixes several issues which cause warnings by the dfa code when using it to detect uninitialized variables
git-svn-id: trunk@26161 -
2013-12-01 17:02:08 +00:00
florian
99eadb91b3 * run CheckAndWarn to get proper locations for warnings about uninitialized variables
* several fixes to liveness analysis
* get rid of old version defines
+ tests

git-svn-id: trunk@26159 -
2013-12-01 17:01:51 +00:00
Jonas Maebe
90fb63db26 * also compare the type of tordconstnode in docompare, so that the node CSE
doesn't replace e.g. 32 bit and 64 bit constants with the same value by
    a single 32 bit constant (mantis #25090)

git-svn-id: trunk@25593 -
2013-09-28 14:12:50 +00:00
svenbarth
b57a587842 Fix for Mantis #24903.
ncon.pas, tstringconstnode:
  * buildderefimpl: don't build the deref if we don't need to
  * derefimpl: do not try to resolve the deref if it wasn't stored at all

git-svn-id: trunk@25329 -
2013-08-22 20:18:14 +00:00
Jonas Maebe
fb8fb29574 * record/use the code page of string constants typecasted to an ansistring
type with a non-default code page
   TODO: ensure that string constants typecasted to ansistring become
     ansistrings rather than typeless string constants

git-svn-id: trunk@25207 -
2013-08-02 13:23:32 +00:00
nickysn
ed29f7a92d + far pointer support in tpointerconstnode
git-svn-id: trunk@24566 -
2013-05-24 12:41:53 +00:00
florian
9375529430 + put guids in a constant pool as well
git-svn-id: trunk@24061 -
2013-03-29 18:48:55 +00:00
florian
f6b78719bc * fix trealconstnode.dogetcopy and trealconstnode.docompare, taking care of all fields, resolves #23486
git-svn-id: trunk@23241 -
2012-12-28 14:16:09 +00:00
sergei
c766c50907 * Proper fix for SPARC cycling with -dCHECK_PIC, pi_needs_got additionally must be set in following cases:
1) tguidconstnode.pass_1 (location is LOC_CREFERENCE)
  2) tonnode.pass_1 (generic secondpass references VMT of exception class)
  3) Conversion from unsigned to floating-point involves 'magic constant' as GOT-relative data object.
  4) Case jumptable address is loaded relative to GOT.

(1) and (2) also provide more accurate setting of pi_needs_got for all targets.

git-svn-id: trunk@23188 -
2012-12-18 17:56:56 +00:00
pierre
bc04e83b25 Add pi_needs_got to current_procinfo.flags in pass_1 method if a label reference is used
git-svn-id: trunk@22448 -
2012-09-24 15:39:26 +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
paul
a26bc50ca6 compiler: change ShortString->(Some)String and AnsiString->(Some)String overload precedence both for variables and string constants, change unicode constant type from widestring to unicodestring (Delphi compatibility)
new ShortString->(Some)String precedence: ShortString, UTF8String, AnsiString, AnsiString(CodePage) and RawByteString, UnicodeString, WideString and other string types
new AnsiString->(Some)String precedence: RawByteString, UTF8String, AnsiString, AnsiString(CodePage), UnicodeString, WideString, ShortString and other string types

The new logic makes UTF8String more preferrable than other AnsiString types, AnsiString more preferrable than other  AnsiStrings(codepage) and also makes UnicodeString more preferrable than WideString.

git-svn-id: trunk@21057 -
2012-04-26 02:33:57 +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
d1acb76df8 * don't replace "expr1 or expr1" or "expr1 and expr1" with just "expr1"
if expr1 has sideeffects. This can't be done safely even in case of
    short boolean evaluation, because expr1 may return the inverse the
    second time its called (and "0 or 1" is not the same as "0", and
    neither is "1 and 0"), based on comment by Michael Karcher
  * perform a full string compare when comparing stringconstnodes
    before the string constant labels have been generated (patch by
    Michael Karcher, mantis #21255)

git-svn-id: trunk@20485 -
2012-03-09 20:26:32 +00:00
Jonas Maebe
74e721517d * keep track of the type of symbolic floating point constants rather
than always forcing them to bestreal (mantis #21151)

git-svn-id: trunk@20190 -
2012-01-28 18:38:06 +00:00
paul
c6ca9e5091 compiler:
- add helper function getansistringcodepage which returns explicitly set codepage or 0 in other case
  - add helper function getansistringdef which return a def with explicitly set codepage or cansistringtype in other case
  - change tstoreddef.createnai constructor to allow set codepage in constructor
  - don't convert string constants to rawbytestring. if string constant already has a codepage - preserve it or convert to ansistring codepage (delphi compatible)
  - don't perform string conversion from ansistring to strings with explicitly set codepage (by directive or by compiler switch) and vice versa (delphi compatible)
  + test which covers most of the cases

git-svn-id: trunk@19510 -
2011-10-19 02:45:52 +00:00
paul
56ecf146be compiler: fix error in length retrieving during the unicode to utf8 conversion
git-svn-id: trunk@19475 -
2011-10-12 08:13:48 +00:00
paul
85c2f195d6 compiler: convert string constants from and to codepage 0. use compiler codepage during the conversion + test
git-svn-id: trunk@19473 -
2011-10-12 06:10:36 +00:00
paul
6ec879219e compiler: fix tstringconstnode.changestringtype() for case of unicode to ansi conversion. remove hackish and incorrect change of ansistring def
git-svn-id: trunk@19461 -
2011-10-11 08:56:29 +00:00
paul
a99ffb3097 compiler: apply patches from Inoussa and Jonas:
defcmp: Address code paged' string type comparison taking care of the code page
  ncnv: Remove un-needed code page comparison to CP_UTF8, some fixes regarding shortstrings and wide char/string 
  ncon: For the case of tstringconstnode.changestringtype (ncon.pas) where the code page are of CP_NONE or 0 no translation is done as :
    * CP_NONE is compatible to all
    * For 0 the raw bytes are just copied.
 My changes:
  - change ascii2unicode to allow pass source codepage, 
  - convert in both cases when source or destination is UTF8

git-svn-id: trunk@19457 -
2011-10-11 01:21:07 +00:00
paul
6266b88b74 compiler: fix string const conversion from one codepage to another
git-svn-id: trunk@19222 -
2011-09-25 06:41:59 +00:00
paul
4d3da666db compiler: replace string codepage comparison to numeric. store codepage as number in current settings
git-svn-id: trunk@19144 -
2011-09-19 00:48:43 +00:00
paul
723f3424d4 merge r17484 from cpstrnew branch by michael:
* Patch from Inoussa:
* defcmp.pas
    ** ansistring to/from RawByteString are evaluated "te_equal"
    ** ansistring to UTF8string is evaluated (te_convert_l1,tc_string_2_string)

* ncnv.pas
    ** "ttypeconvnode.typecheck_char_to_string" : WideChar to AnsiString/ShortString
        is possible if the source code page is not utf8
    ** "ttypeconvnode.typecheck_char_to_char" : WideChar to AnsiChar
        is possible if the source code page is not utf8

* ncon.pas
    ** "tstringconstnode.changestringtype" : Unicode to utf8string bug fix(set the encoding),
       constants in the source code with code page set utf8 should be converted back to utf8

* nopt.pas
    ** "genmultistringadd" : fpc_<stringname>_concat_multi have a new parameter "cp"
        to indicate the "DestS" code page if the variable content is nil. This is required
        in order not to loose the declared code page.

* pinline.pas
    ** "inline_setlength" : a new parameter "cp" to indicate the code page if the variable content
       is nil. This is required in order not to loose the declared code page.
* ptconst.pas
    ** "parse_arraydef" : for string const to array of ansichar/widechar conversion check for wide string and
        convert if it is required. For char const to array of ansichar/widechar conversion check for wide char and
        convert if it is required.

git-svn-id: trunk@19113 -
2011-09-17 13:30:09 +00:00
paul
1db610ecbd merge r17434 from cpstrnew branch by michael:
* Patch from Inoussa to fix constant strings with codepage

git-svn-id: trunk@19109 -
2011-09-17 13:19:59 +00:00
florian
a1381c1240 * some aint -> tcgint changes to avoid range check errors on systems with sizeof(aint)<4
git-svn-id: trunk@18966 -
2011-09-04 14:26:27 +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
Jonas Maebe
67c2c7c166 * renamed cchartype to cansichartype
git-svn-id: branches/jvmbackend@18779 -
2011-08-20 08:35:24 +00:00
Jonas Maebe
37aa2d8443 + full support for sets on the JVM target
o sets of enums are handled as JUEnumSet instances, others as JUBitSet
     derivatives (both smallsets and varsets, to make interoperability with
     Java easier)
   o special handling of set constants: these have to be constructed at run
     time. In case of constants in the code, create an internal constsym to
     represent them. These and regular constsyms are then aliased by an
     another internal staticvarsym that is used to initialise them in the
     unit initialisation code.
   o until they are constructed at run time, set constants are encoded as
     constant Java strings (with the characters containing the set bits)
   o hlcgobj conversion of tcginnode.pass_generate_code() for the genjumps
     part (that's the only part of the generic code that's used by the JVM
     target)
   o as far as explicit typecasting support is concerned, currently the
     following ones are supported (both from/to setdefs): ordinal types,
     enums, any other set types (whose size is the same on native targets)
   o enum setdefs also emit signatures
   o overloading routines for different ordinal set types, or for different
     enum set types, is not supported on the JVM target

git-svn-id: branches/jvmbackend@18662 -
2011-08-20 08:22:22 +00:00
Jonas Maebe
7200245337 + cs_unicodestrings global switch to indicate that the default string type
is unicodestring (does *not* change the type of "char" to "unicodechar"
    (yet)). Not yet (un)selectable via a directive.
  + systems_default_unicodestring set containing systems on which the
    default string type is unicodestring

git-svn-id: branches/jvmbackend@18415 -
2011-08-20 07:57:45 +00:00
sergei
ba700ad2ff * Improvements to Dispatch call handling:
o All signed and unsigned ordinal types are made automatable.
  o Non-automatable types are rejected when parsing dispinterface declarations.
  o Simplified translate_disp_call() a bit.
  o translate_disp_call() now supports non-automatable parameters which can be typecasted to automatable ones. UnicodeString is not yet there, though.
  o Partially fixes #17904: parameters of Variant Dispatch calls are passed by reference when they can be mapped to a variable.

git-svn-id: trunk@16360 -
2010-11-18 16:17:50 +00:00
Jonas Maebe
14b95b3b9b * always force range checking for the upper and lower bounds of for-loops if
they are constants (instead of only on 32 bit systems), and always use the
    actual upper/lower bound of the loop variable instead of hardcoding the
    bounds of longint (mantis #17646)

git-svn-id: trunk@16213 -
2010-10-24 14:55:48 +00:00
Jonas Maebe
769eb3f604 * moved the initialisation of the nodetree and tai class reference constants
from the unit initialisation sections to the variable declaration sections
    to prevent the base units from overriding derived classes (based on patch
    by Hans-Peter Dietrich, mantis #17516)

git-svn-id: trunk@16118 -
2010-10-09 18:52:22 +00:00
Jonas Maebe
45d25bbe77 * fixed storing/loading widestring constant nodes into/from ppu files
(mantis #15909)
  * fixed storing/loading widestring constants into/from token streams
  * made storing/loading widestring constant nodes into/from ppu files
    endian safe

git-svn-id: trunk@15017 -
2010-03-14 13:27:00 +00:00