Commit Graph

43289 Commits

Author SHA1 Message Date
svenbarth
81c7b22199 Mantis #25236 was fixed by partial specializations addition in revision 27861
+ added test

git-svn-id: trunk@27902 -
2014-06-08 15:51:33 +00:00
svenbarth
45e2e91536 Mantis #22468 was fixed by partial specializations addition in revision 27861
+ added test

git-svn-id: trunk@27901 -
2014-06-08 15:47:13 +00:00
svenbarth
60ef0a61bc Mantis #22792 was fixed by partial specializations addition in revision 27861
+ added test

git-svn-id: trunk@27900 -
2014-06-08 15:43:46 +00:00
sergei
ed46a07f62 * Using x86-specific capability of shifting with carry flag helps to reduce amount of instructions.
git-svn-id: trunk@27899 -
2014-06-08 14:01:41 +00:00
svenbarth
1ebff1a963 Mantis #21622 was fixed by partial specializations addition in revision 27861
+ added test

git-svn-id: trunk@27898 -
2014-06-08 11:38:24 +00:00
svenbarth
8b290f4cb2 Mantis #24690 was fixed by partial specializations addition in revision 27861
+ added test

git-svn-id: trunk@27897 -
2014-06-08 11:34:32 +00:00
svenbarth
47407d2d7a Mantis #23279 was fixed by partial specializations addition in revision 27861
+ added test

git-svn-id: trunk@27896 -
2014-06-08 11:26:44 +00:00
svenbarth
1a22175553 Mantis #23653 was fixed by partial specializations addition in revision 27861
+ added test

git-svn-id: trunk@27895 -
2014-06-08 11:23:31 +00:00
svenbarth
69a8445472 Mantis #22790 was fixed by partial specializations addition in revision 27861
+ added test

git-svn-id: trunk@27894 -
2014-06-08 11:18:04 +00:00
svenbarth
c1fdce5166 Mantis #22540 was fixed by partial specializations addition in revision 27861
+ added test

git-svn-id: trunk@27893 -
2014-06-08 11:12:03 +00:00
sergei
ae627a4ba8 * tcgx86.a_op_const_reg_reg: optimize trivial cases before considering more complex ones.
git-svn-id: trunk@27892 -
2014-06-08 00:08:56 +00:00
sergei
c184d9740c + Implemented target-independent optimization of signed "mod 2**N" as
"sign:=left sar sizeof(left)*8-1; result:=(((left xor sign)-sign) and 2**N-1) xor sign)-sign;"
  This solution yields larger code than one suggested by Mantis #21152, however its speed on i386 is approximately the same, and it is also suitable for all operand sizes, all powers of two and all targets.

git-svn-id: trunk@27891 -
2014-06-07 22:19:10 +00:00
reiniero
da91ac9726 * fcl-db: sql parser: correct hex error message
git-svn-id: trunk@27890 -
2014-06-07 10:32:06 +00:00
reiniero
dcdfa2f307 * fcl-db: cosmetic
git-svn-id: trunk@27889 -
2014-06-07 10:11:35 +00:00
reiniero
614bc64200 * fcl-db: sql parser:
- fix for double precision followed by other subclauses (e.g. DEFAULT)
- of course, associated test

git-svn-id: trunk@27888 -
2014-06-07 09:55:15 +00:00
reiniero
e1d9a068c0 * fcl-db: sql parser: Allow:
- double precision datatype
- blob subtype text and blob subtype binary (instead of only blob subtype 0 and 1)
- Associated tests

git-svn-id: trunk@27887 -
2014-06-07 09:31:12 +00:00
reiniero
9898474fa7 * fcl-db: sql parser: fix for test case r27868,27885
git-svn-id: trunk@27886 -
2014-06-07 08:13:15 +00:00
reiniero
050be49b16 * fcl-db: correct test committed in r27868
git-svn-id: trunk@27885 -
2014-06-07 08:10:52 +00:00
sergei
92cf25b9a5 * Reworked i386 division by constant optimization to reuse code from powerpc64. The algorithm is slightly different, signed version is one instruction shorter, unsigned one is one instruction longer (typically). The new algorithm is easily scalable for x86_64 target, unlike the old one.
git-svn-id: trunk@27884 -
2014-06-07 00:20:05 +00:00
sergei
90d2009a31 * Moved procedures calculating "magic" numbers for division by constants from powerpc64/cgcpu.pas to cgutils.pas, so they can be reused for all targets.
* "Shift" parameter for signed calculation changed from aint to byte, since it only holds values up to 63. It is consistent with unsigned routine.

git-svn-id: trunk@27883 -
2014-06-07 00:00:53 +00:00
Károly Balogh
af95876eba arm: an attempt to improve the a_op_const_ref patch in r27881
git-svn-id: trunk@27882 -
2014-06-06 20:48:31 +00:00
Károly Balogh
5b262df7d0 arm: have a CPU specific op_const_ref, so the reference doesn't get fixed up both in a_load_reg_ref and a_load_ref_reg
git-svn-id: trunk@27881 -
2014-06-06 17:44:45 +00:00
Károly Balogh
17657ca11d m68k: more minor reference usage tweaking, hopefully fixes Mantis 26286
git-svn-id: trunk@27880 -
2014-06-06 16:41:40 +00:00
svenbarth
94f47443f0 Mantis #25043 was fixed by partial specializations addition in revision 27861
+ added test

git-svn-id: trunk@27879 -
2014-06-06 15:52:02 +00:00
svenbarth
6f962e817a Mantis #24072 was fixed by partial specializations addition in revision 27861
+ added test

git-svn-id: trunk@27878 -
2014-06-06 15:39:30 +00:00
svenbarth
49a9f4c1ea Fix for Mantis #26123.
pdecobj.pas, object_dec:
  * Always check for genericdef and genericlist and not genericdef and ifnot then genericlist.

+ added test

git-svn-id: trunk@27877 -
2014-06-06 15:19:45 +00:00
Károly Balogh
381cf72023 m68k: minor bits, addq/subq works also on address regs, remove reference validity check in a_op_const_ref because we have fixref() later anyway
git-svn-id: trunk@27876 -
2014-06-06 15:15:03 +00:00
svenbarth
34394d6925 Fix for Mantis #26180. Accept undefineddef as first parameter type of an Assert if it is used inside a generic.
ninl.pas, tinlinenode.pass_typecheck:
  * if the first parameter of an Assert is a undefineddef node then accept it as well if the node is part of a generic function/method

+ added test

git-svn-id: trunk@27875 -
2014-06-06 14:39:27 +00:00
svenbarth
aca48a4cf2 Fix for Mantis #26288. Types declared inside a generic must have the df_generic flag set. Period.
ptype.pas, read_named_type:
  * array_dec & procvar_dec: set df_generic of the array/procvar if parse_generic was originally set

+ added test

git-svn-id: trunk@27874 -
2014-06-06 14:22:17 +00:00
svenbarth
12f5cb85e8 Forgot to include option to trash variables for the test for Mantis #26271.
git-svn-id: trunk@27873 -
2014-06-06 14:10:54 +00:00
svenbarth
4a0d27ebfe Fix for Mantis #26271: Don't trash local variables that are used for the Default() intrinsic.
* ngenutil.pas, tnodeutils.trashable_sym:
    check for vo_is_default_var flag and don't consider such as trashable

+ added test

git-svn-id: trunk@27872 -
2014-06-06 13:59:52 +00:00
reiniero
a025a87c19 * fcl-db: test sql scanner: fix test case
git-svn-id: trunk@27871 -
2014-06-06 13:39:21 +00:00
svenbarth
1bbcc08a8b Fix for Mantis #26176. Don't handle "type helper" as unique.
ptype.pas:
  * read_named_type: change hadtypetoken from a value to a var parameter and set it to false if a type helper is parsed so that calling code does not handle it as unique
  * read_anon_type: handle that hadtypetoken is now a var parameter

pgenutil.pas, generate_specialization:
  * handle that hadtypetoken of read_named_type is now a var parameter

+ added test

git-svn-id: trunk@27870 -
2014-06-06 13:26:21 +00:00
svenbarth
9ab5affd55 Contrary to popular believe the VMT for a generic needs to be at least generated so that check for inherited methods can be done correctly. This does however not mean that the VMT is written to the object file which is handled at a completely different place. Fixes Mantis #26193.
pdecl.pas, types_dec:
  * invoke the VMT builder for generic classes as well

+ added test

git-svn-id: trunk@27869 -
2014-06-06 13:05:39 +00:00
reiniero
79d2abd1ca * fcl-db: sql parser test: test for create domain with check constraint, default and not null, a la
CREATE DOMAIN PRODTYPE AS VARCHAR(12)
         DEFAULT 'software'
         CHECK (VALUE IN ('software', 'hardware', 'other', 'N/A')) NOT NULL;

git-svn-id: trunk@27868 -
2014-06-06 12:59:01 +00:00
reiniero
9ee1ec412f * fcl-db: sql parser: fix failing STARTING WITH test committed in r27854
git-svn-id: trunk@27867 -
2014-06-06 12:45:42 +00:00
reiniero
02014da511 * fcl-db: cosmetic
git-svn-id: trunk@27866 -
2014-06-06 12:44:12 +00:00
reiniero
86e54269a0 * fcl-db: cosmetic
git-svn-id: trunk@27865 -
2014-06-06 12:43:56 +00:00
Károly Balogh
e89669bedc rewrite SpinLock to still work without the need to accidentally disable optimizations for a large part of the classes unit
git-svn-id: trunk@27864 -
2014-06-06 11:05:57 +00:00
reiniero
d3bb0d4a17 + fcl-db: add GUI for tests in testsqlscanner
git-svn-id: trunk@27863 -
2014-06-06 08:49:16 +00:00
Károly Balogh
df7af34de9 m68k: very early optimizer implementation experiments
git-svn-id: trunk@27862 -
2014-06-06 07:38:50 +00:00
svenbarth
639a59df92 Added support for partial specialization. This should fix a few problems with generics, the tests for which will be added in the next days after I've verified them.
For partial specialization only the declaration is reparsed, but not method bodies.

The way generic parameters are passed around inside the compiler is changed: instead of creating new type symbols we keep a (name,def) pair so that the code in insert_generic_parameter_types can decide whether it needs to add a type symbol (for new undefined defs) or not (for real types and undefined defs that were passed on from the parent generic). This required the tfpobjectlist type of the genericlist variables/parameters to be changed to tfphashobjectlist.

For correctly parsing Delphi specializations as parameters in functions of records (or objects) the relationship between the def and its typesym must already be established during the parsing. For this the checks for forcing a "type is not completely defined" message needed to be adjusted to correctly handle nested types as well. This should as a sideeffect also allow the usage of nested constants, etc like was fixed for classes some months ago.

ToDo: 
  - if a generic is specialized with only fully defined types then we could generate the in the unit where it's used. This is not yet done.
  - currently we don't specialize generics that are currently parsed; maybe this could be improved in the future for better type compatibility checks
  - check whether the pausing of token recording for partial specializations works correct in context of hint modifiers

pgenutil.pas:
  * parse_generic_parameters: return a tfphashobjectlist instead of a tfpobjectlist (requires a few type adjustments in various other declarations)
  * maybe_insert_generic_rename_symbol, insert_generic_parameter_types: change genericlist from tfpobjectlist to tfphashobjectlist
  * parse_generic_specialization_types_internal: use is_generic instead of checking for df_generic
  * generate_specialization:
      + add a nested function to disable the requirement to check for method bodies
      * use the "simple" parameter parsing only for error recovery
      * instead of already creating a new type symbol for a parameter we use the found symbol's name and its def and maybe create it later on (therefor the type of tfpobjectlist was changed to tfphashobjectlist)
      * a partial specialization is specialized into the symtable of the def it is specialized in instead of one of the two global symtables
      * for now we handle partial specializations of generics we are currently parsing like before
      * don't continue recording generic tokens while we do a partial specialization
      * use the new unset_forwarddef function on the newly created defs
  * insert_generic_parameter_types: only create a new type symbol if the found type symbol does not yet have an owner (thus was freshly created for this generic declaration)

pdecobj.pas, object_dec:
  * change type of genericlist from tfpobjectlist to tfphashobjectlist
  * set the type sym for all object types that can be generic or inside a generic (needed for correctly parsing Delphi style generic declarations)

pdecsub.pas, parse_proc_head:
  * consume_generic_interface: always generate the specialization name as now all generics are "specialized" inside a generic
  * the assumption that the def index numbers are the same is no longer true as the genericdef might contain the defs of partial specializations which are not generated for full specializations

pdecvar.pas, read_record_fields:
  * we also need to check nested types whether they contain a not yet completely parsed record or object

ptype.pas:
  * read_named_type: 
      * change genericlist from tfpobjectlist to tfphashobjectlist
      * pass the typesymbol along to record_dec
  * resolve_forward_types: use is_generic instead of checking for df_generic
  * single_type: 
      * use is_generic instead of checking for df_generic
      * no need to check generic parameters
  * parse_record_members:
      + add parameter for the record's type symbol
      * setup the typesym <=> def relationship
  + record_dec: add parameter for the type symbol and pass it to parse_record_members
  * read_named_type, expr_type: use is_generic instead of checking for df_generic
  * array_dec & procvar_dec: change genericlist from tfpobjectlist to tfphashobjectlist

symdef.pas, tstoreddef:
  * improve the checks used in is_generic and is_specialization to really only work on true generics and true (and partial) specializations respectively
  * don't search the type parameters in the symtable, but store them in the PPU and load them from there
  - remove fillgenericparas method (including the calls in the descendants tarraydef, tprocvardef, tobjectdef and trecorddef)

defcmp.pas, compare_defs_ext:
  * handle partial specializations: specializations with only undefineddefs are compatible to generic defs

pdecl.pas, types_dec:
  * switch generictypelist from tfpobjectlist to tfphashobjectlist

ppu.pas:
  * increase PPU version

+ added tests that ensure that "not completely defined" checks for records (and objects) still work correctly

git-svn-id: trunk@27861 -
2014-06-05 20:05:05 +00:00
sergei
bcddc40150 * powerpc64: removed references to global variables 'cg' (it is implicit 'self' in methods of tcg descendants) and 'current_asmdata.currasmlist' (the asmlist to use is passed as argument).
git-svn-id: trunk@27860 -
2014-06-05 16:06:36 +00:00
Károly Balogh
0fe656e82d m68k: simplified code generated by g_concatcopy and cleaned up the old mess from the code
git-svn-id: trunk@27859 -
2014-06-05 12:42:36 +00:00
lacak
feff396633 fcl-db: sqldb: simplify code, remove unused field (FSQLBuf)
git-svn-id: trunk@27858 -
2014-06-05 10:42:23 +00:00
sergei
217ab9879c * Enabled internal handling of Abs(longint) for all targets. It has been implemented in cross-platform way ages ago (see tcginlinenode.second_abs_long), but not enabled on MIPS,SPARC and m68k.
- RTL: removed MIPS,SPARC and m68k-specific implementations of Abs(longint), and marked the generic one as  required for bootstrapping purposes only.

git-svn-id: trunk@27857 -
2014-06-05 10:35:51 +00:00
reiniero
c853c29c3c * fcl-db: cosmetic
git-svn-id: trunk@27856 -
2014-06-05 10:33:44 +00:00
reiniero
c13396ad0a * fcl-db: cosmetic
git-svn-id: trunk@27855 -
2014-06-05 10:21:41 +00:00
reiniero
493d38ff95 * fcl-db: sqlparser: test domain creation with check constraint like CHECK (VALUE STARTING WITH 'V');
Test currently fails: line 1, pos 53: Unexpected token: WITH

git-svn-id: trunk@27854 -
2014-06-05 08:43:43 +00:00
reiniero
7275f30360 * fcl-db: readme for sql parser/scanner/lexer; based on Michael's message http://www.mail-archive.com/fpc-devel%40lists.freepascal.org/msg18680.html
git-svn-id: trunk@27853 -
2014-06-05 08:15:37 +00:00