Commit Graph

752 Commits

Author SHA1 Message Date
florian
63f6afffd5 + make empty proc. removal switchable by removeemptyprocs
git-svn-id: trunk@23621 -
2013-02-14 21:40:04 +00:00
svenbarth
344571cb4e Added support for type helpers. In non Delphi modes they use "type helper" and in mode Delphi they use "record helper". They can also be used on constants.
symconst.pas:
  + extend "thelpertype" by "ht_type" which tells the code in "pdecobj.parse_extended_type" that a type helper declaration has been parsed
node.pas:
  + add a constant which identifies all constant node types
ptype.pas:
  + read_named_type: add a parameter "hadtypetoken" to tell the code whether a "type" token had been parsed before
  + read_named_type: if an identifier "helper" is parsed we need to check whether "hadtypetoken" is true and the modeswitch "m_class" is set, but the "m_delphi" one is not; in that case we have a "type helper" declaration
pgenutil.pas, generate_specialization:
  * adjust call to read_named_type
pdecl.pas, types_dec:
  * adjust call to read_named_type

pdecobj.pas:
  * parse_extended_type: extend for correct handling of primitive types (includes Delphi compatible handling as well) and reject types that are explicitly not allowed
  * method_dec: require "static" for class methods in type helpers
  * method_doc: allow constructors for type helpers as well
paramgr.pas, tparamanager:
  * set_common_funcretloc_info: handle type helper constructors like record constructors
  * handle_common_ret_in_param: the "self" value of a type helper constructor is also returned in a parameter
pexpr.pas:
  + add a function to postfixoperators which tries to find and apply a type helper for a given type
  * postfixoperators: try to apply type helpers for ordinal constants
  * postfixoperators: use the correct string type for string constants
  * postfixoperators: try to apply type helpers for enum constants
  * postfixoperators: try to apply type helpers for arrays
  * postfixoperators: try to apply type helpers for Variant
  * postfixoperators: try to apply type helpers for pointer types
  * postfixoperators: try to apply type helpers for other types
  * factor: check postfixoperators after _REALNUMBER, _CCHAR, _CWCHAR, _TRUE and _FALSE
  * factor: also check postfixoperators if a _POINT follows a _NIL

symdef.pas, tdefawaresymtablestack.addhelpers:
  * use "generate_objectpascal_helper_key" to generate the key
symtable.pas:
  + add function to generate the key value for the map of extended types using the extended def
  * adjust "search_last_objectpascal_helper" and "search_objectpascal_helper" to handle primitive types as well
  * use the new "generate_objectpascal_helper_key" function to generate the key

pparautl.pas:
  * insert_self_and_vmt_para: don't insert the $vmt symbol for record or type helpers (ToDo: check whether class helpers really need the symbol as well)
  * insert_self_and_vmt_para: pass "self" as var parameter for type helpers as well
psub.pas, generate_bodyentry_block: 
  * also allow type helpers for constructor methods
ncal.pas, tcallnode.gen_self_tree:
  * also use a temp variable for type helper constructors
ncgcal.pas, tcgcallnode.secondcallparan:
  * allow Pointers to be passed as address param if it is the Self value of a type helper extending a pointer type
  * correctly handle the location in case of type helper constructors

+ add tests

git-svn-id: trunk@23580 -
2013-02-06 09:49:35 +00:00
Jonas Maebe
9cbff6f5a6 + support for record constructors for the JVM target
git-svn-id: trunk@23510 -
2013-01-24 09:45:12 +00:00
Jonas Maebe
9145f1d67d * integrated potype_constructor check in maybe_create_funcret_node
git-svn-id: trunk@23507 -
2013-01-24 09:44:52 +00:00
florian
cad1309935 * don't write directly to the function result destination if we are inlining and if the destination is too complex to evaluate (threadvar etc.)
git-svn-id: trunk@23415 -
2013-01-16 20:25:49 +00:00
paul
b2a613c17f compiler: implement record constructors + tests
git-svn-id: trunk@23395 -
2013-01-16 02:07:42 +00:00
paul
51825b6f2e compiler: change ret_in_param to accept tabstractprocdef instead of tproccalloption to allow check more options (required for record constructor implementation)
git-svn-id: trunk@23394 -
2013-01-16 01:14:23 +00:00
florian
329257d76e * check for empty procedures after helper test so even empty helper methods cannot be called directly
* don't remove calls to subroutines taking arrays of const

git-svn-id: trunk@23302 -
2013-01-03 22:58:56 +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
florian
4d6471fef6 * get rid of calls to empty procedures having parameters without side effect
git-svn-id: trunk@23274 -
2013-01-01 15:58:05 +00:00
Jonas Maebe
d9e67fc835 * don't add a separate high parameter for array-of-const parameters on the
JVM target (just like for open array parameters), since the array length
    is already encoded in the array itself there

git-svn-id: trunk@22968 -
2012-11-10 20:26:42 +00:00
svenbarth
2db54da2b3 m68k also uses a non fixed stack with an equivalent to PUSH/POP so don't reorder parameters
if the required stack offset tells otherwise.

git-svn-id: trunk@22742 -
2012-10-18 20:11:56 +00:00
Jonas Maebe
f5de7e34d3 * only remove the calculation of unused parameters of inline routines if
they don't have explicit side-effects, and if -Oodeadvalues (part of -O4)
    is active (because it can result in the removal of range check errors,
    segmentation faults, etc)

git-svn-id: trunk@22254 -
2012-08-26 21:04:46 +00:00
florian
1cd6f2355b * don't copy const parameters passed by reference even if their complexity is >1,
this is handled by wrapcomplexinlinepara

git-svn-id: trunk@22160 -
2012-08-21 16:31:58 +00:00
Jonas Maebe
f3ad4af343 * make sure valid_for_assign() returns false for inlined function bodies
(mantis #22613)

git-svn-id: trunk@22099 -
2012-08-16 19:22:17 +00:00
florian
bd47ba6ba4 * the address of complex inline parameters can be hold always in a register
git-svn-id: trunk@22076 -
2012-08-13 15:09:11 +00:00
florian
5b90a02e75 * inherit nf_write/nf_modify in tcallnode.replaceparaload also when replacing parameters
git-svn-id: trunk@22075 -
2012-08-13 15:06:16 +00:00
florian
2c122a9bf6 * inherit modification flag from load nodes when creating temp nodes when inlining, dfa/cse need this information
git-svn-id: trunk@22056 -
2012-08-10 21:16:54 +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
Jonas Maebe
b50d0aa3d0 * only don't pre-finalize funcret temps that are passed by reference to the
called function, fixes webtbs/tw3742.pp after r21955 (looked at wrong
    testsuite results :/ )

git-svn-id: trunk@21963 -
2012-07-23 23:55:00 +00:00
Jonas Maebe
3414f91590 * minor reformatting, and removed superfluous assigned test (the value is
already used before that test)

git-svn-id: trunk@21502 -
2012-06-06 18:51:14 +00:00
Jonas Maebe
9412d4abd2 * add a reference to the procsym corresponding to the chosen overloaded
procdef, so that the unit containing it is marked as "used" (mantis #15966)

    Even better would be if the unit containing the originally found procsym
    were not also marked as used, but that would require a significant
    rewrite (all symbols found using symboltable helpers are automatically
    marked by those routines)

git-svn-id: trunk@21501 -
2012-06-06 18:46:01 +00:00
florian
af7bb6faab * ignore unused parameters when inlining
git-svn-id: trunk@21445 -
2012-05-31 18:48:38 +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
834026bfb5 * synchronised with trunk up to r21067
git-svn-id: branches/jvmbackend@21068 -
2012-04-26 21:24:20 +00:00
sergei
04ca8a9126 * translate_disp_call: improved building the parameter block by using ttemprefnode.create_offset instead of taking address/pointer additions/dereference. Results in simpler node tree and lesser CPU instructions generated.
git-svn-id: trunk@21018 -
2012-04-24 12:51:36 +00:00
sergei
6d0dd50be3 * tcallnode.maybe_load_in_temp: treat asnode like callnode, because asnodes are converted into helper calls in pass 1. Improves code generated for expressions "(a as b).SomeMethod".
git-svn-id: trunk@21017 -
2012-04-24 12:31:21 +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
florian
a7b46fc36f * don't create a temp. for a dereferenced pointer which is passed to a var parameter of an inline procedure
git-svn-id: trunk@20478 -
2012-03-07 21:17:09 +00:00
Jonas Maebe
1f83203117 * make self-pointer passed by reference not regable. Was not necessary
when we only had objects because they are never put in registers,
    but (advanced) records can be (mantis #21177)

git-svn-id: trunk@20192 -
2012-01-29 11:30:12 +00:00
Jonas Maebe
7f15423d76 * fixed copying order of callnode siblings (callcleanupblock must be
copied before funcretnode because it may contain tempdeletenodes
    that turn a temp to "delete on next use", with the use in the
    funcretnode)

git-svn-id: branches/jvmbackend@20141 -
2012-01-21 19:35:52 +00:00
sergei
cbad0abab5 + Platform-specific exception support for x86_64-win64. Enable by cycling with OPT=-dTEST_WIN64_SEH.
git-svn-id: trunk@20098 -
2012-01-16 23:13:31 +00:00
Jonas Maebe
0d5b2b84a8 + Android/JVM target, including a translation of the Android r14 SDK
(= Android 4.0) java headers: java.*, javax.*, org.*, junit.*, android.*).
    The RTL can also be used to target earlier versions of the Android
    platform, but you manually have to take care of not using APIs that
    weren't available yet. Adding separate units for separate platform
    versions would only partly solve the problem, because some of the
    classes used inside the system unit have also changed across
    versions.

    Use -Tandroid while compiling to select the Android OS as target
    platform.

git-svn-id: branches/jvmbackend@19830 -
2011-12-12 02:34:34 +00:00
Jonas Maebe
84bf45f0e2 * give an error when trying to call an interface/protocol/category method
using the type name of the interface/protcol/category (they are not
    entities themselves on which you can invoke those methods,
    mantis #20661)

git-svn-id: trunk@19651 -
2011-11-18 22:33:33 +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
964eb8772a * Fixed tcallnode.expectloc for x87 floating-point results
git-svn-id: trunk@19514 -
2011-10-19 11:42:02 +00:00
florian
df75368d0b --- Merging r19281 into '.':
U    compiler\pdecsub.pas
U    compiler\symdef.pas
U    compiler\pdecobj.pas
U    compiler\htypechk.pas
U    compiler\ncal.pas
U    compiler\symtable.pas
--- Recording mergeinfo for merge of r19281 into '.':
 U   .
--- Merging r19282 into '.':
A    tests\webtbf\tw19975.pp
--- Recording mergeinfo for merge of r19282 into '.':
 G   .

git-svn-id: trunk@19343 -
2011-10-03 20:43:19 +00:00
Jonas Maebe
cf47b8d422 * fixed all known memory leaks in the code added for the JVM port
git-svn-id: branches/jvmbackend@19248 -
2011-09-26 19:31:34 +00:00
Jonas Maebe
6a7ff1cf75 * use temp-reference nodes rather than addrnodes to create references to
complex parameters passed to inlined routines on the JVM target, because
    it is not possible to take the address of any kind of node on the JVM
    target (temp-reference nodes work for any kind of LOC_(C)REFERENCE, but
    are currently only implemented for the JVM platform)

git-svn-id: branches/jvmbackend@18905 -
2011-08-29 22:58:55 +00:00
Jonas Maebe
951c023ca2 * when inlining, do not force creating a value-copy of const-parameters when
their address is taken if they are normally passed by reference (since then
    taking this address in the callee normally also gets the address of the
    original variable rather than of a copy)

git-svn-id: branches/jvmbackend@18834 -
2011-08-24 22:11:31 +00:00
Jonas Maebe
eb268fb2c4 + tcallnode.createinternmethodres() that allows specifying a forced
resultdef for internally generated method calls
  * force the resulttype of methods used to build non-unicode string
    constants on the JVM platform to the stringconstn's resultdef

git-svn-id: branches/jvmbackend@18832 -
2011-08-24 22:11:16 +00:00
Jonas Maebe
2428ea65c1 * replaced the old hack for non-formal var/out/constref support with
a generalized version of the formal var/out/constref support (this
    also fixes passing string[xyz] expressions to non-formal var/out/constref
    parameters)

git-svn-id: branches/jvmbackend@18774 -
2011-08-20 08:34:46 +00:00
Jonas Maebe
1a23a7cd27 * removed all remaining nounsupported ifdefs (except for the one about
variants)

git-svn-id: branches/jvmbackend@18770 -
2011-08-20 08:34:26 +00:00
Jonas Maebe
d6966e545b + support for formal var/out parameters on the JVM target:
o primitive types are first boxed
   o the parameter is passed inside an array of one class instance
   o changing the parameter inside the routine (by assigning a value to it
     like in Delphi.NET and different from regular Pascal code) will replace
     this class instance (again boxing the value if required)
   o on return, the class instance is extracted, unboxed if required, and
     assigned back to the original location
   o formal const parameters are handled without the extra array indirection,
     since they cannot be changed

  TODO: while writing tjvmcallparanode.handleformalcopyoutpara() I forgot that
    calling getcopy on ttemprefnodes whose ttempcreatenode hasn't been copied
    yet works fine, so that code is more complex than needed. Still have to
    fix.

git-svn-id: branches/jvmbackend@18675 -
2011-08-20 08:23:33 +00:00
Jonas Maebe
9ebf623895 + tcallnode.createinternmethod() constructor to easily call methods
(both instance and class/static methods)

git-svn-id: branches/jvmbackend@18661 -
2011-08-20 08:22:15 +00:00
Jonas Maebe
466f6751c8 + getpointerdef() function that returns a pointerdef for the passed def.
Multiple calls to getpointerdef() for the same def in a single module
    return the same pointerdef

git-svn-id: branches/jvmbackend@18644 -
2011-08-20 08:20:51 +00:00
Jonas Maebe
6154f1b0d9 * keep track of the number of abstract methods per class via a counter
* use this counter to mark classes containing abstract methods as
    "abstract" in the bytecode per the JVM spec
  * also use the counter to short-circuit printing of all abstract
    methods in a class when creating a new instance (we build the list
    of abstract methods every time a new instance is created, which is
    a waste of time if there are none in the first place)

git-svn-id: branches/jvmbackend@18635 -
2011-08-20 08:17:12 +00:00
Jonas Maebe
84640fe7f0 + support for non-static class methods on the JVM target
git-svn-id: branches/jvmbackend@18557 -
2011-08-20 08:10:11 +00:00
Jonas Maebe
694ccf3df3 + dummy support for untyped var/const/out parameters on the JVM target
o includes basic "auto-boxing" infrastructure to support Delphi.NET-
     compatible untyped parameters as described at
     http://hallvards.blogspot.com/2007/10/dn4dp24-net-vs-win32-untyped-parameters.html

git-svn-id: branches/jvmbackend@18510 -
2011-08-20 08:05:54 +00:00
Jonas Maebe
d1a1d30e04 * unless compiled with -dnounsupported, the compiler will now accept not
only JVM constructs that are already implemented, but also ones that
    will be supported in the future but that aren't implemented yet (to
    make it easier to already adapt code to the future changes)

git-svn-id: branches/jvmbackend@18498 -
2011-08-20 08:04:51 +00:00
Jonas Maebe
96b0ee0827 * added more options to format the result of tprocdef.fullprocname() via
a new customprocname() method and tprocnameoption flags (add parameter
    names, add "function"/"procedure", add name of owning struct or not,
    don't add the "class" prefix for class methods)
   Reason: for internal use by the compiler so it can output the procdef
    into something that can be fed back to the parser for reuse (seems
    easier than manually constructing a new procdef, or duplicating it
    inside of another objectdef)

git-svn-id: branches/jvmbackend@18426 -
2011-08-20 07:58:39 +00:00
Jonas Maebe
28740dce2d - removed extra "fordefinition" parameter again from tprocdef.mangledname(),
since the definition-specific adorning of JVM mangled names is Jasmin-
    specific, and such code has no place in symdef
  * moved code to adorn JVM mangled names for Jasmin definitions to agjasmin

git-svn-id: branches/jvmbackend@18346 -
2011-08-20 07:49:31 +00:00
Jonas Maebe
eb5814a868 * implemented declaring and calling constructors for Java classes
o handle them like for regular classes (return a class instance,
     although this is technically not true since they don't return
     anything; will be changed in the future)
   o because of the previous point, make sure that we handle the
     "function result" properly and don't pop too many values from
     the evaluation stack when calling one constructor from another
   o added "extra_pre_call_code" method used by njvmcal to insert
     the "new" opcode to create the new class instance before
     calling a constructor
   o when a constructor does not call any other constructor (inherited
     or otherwise), automatically insert a call to the inherited
     parameterless constructor as required by the jvm standard)
   TODO: check that *if* an inherited or other constructor is called
     from another constructor, that it does so as the first statement/
     call

git-svn-id: branches/jvmbackend@18328 -
2011-08-20 07:46:37 +00:00
Jonas Maebe
9a9ea1f257 + limited thlcg.gen_load_cgpara_loc() implementation (only loc_reference
support), passed through to original ncgutils version in thlcg2ll
  + thlcgobj.location_force_mem() implementation
  * order parameters for jvm similar to those for i386 without fixed_stack,
    so we don't need temporary paralocations
  * converted most of ncgcal to thlcg
  * disabled special handling for virtual methods for jvm in ncgcal, as all
    invocations are name-based there
  + njvmcal with special jvm callnode support:
   o always move the function result into a memory temp
   o when freeing an unused function result, use a_pop(2) and adjust
     the internal evaluation stack height counter
   o after the call instruction, adjust the evaluation stack height counter
     by subtracting the number of the pushed parameter slots, adjusted for
     the slots taken up by the function result

git-svn-id: branches/jvmbackend@18325 -
2011-08-20 07:46:22 +00:00
Jonas Maebe
0ee702b3a2 * tprocdef.mangledname now gets an extra boolean parameter indicating
whether the mangled name is for defining a symbol, or for referencing
    it later (e.g. for a call or load of its address). The reason is that
    on the JVM both cases are different.
  + jvmdef unit to encode types according to the JVM rules
  + tprocdef.jvmmangledname() to encode a procdef's JVM mangled name
    (the common part of defining/referencing it; tprocdef.mangledname
     afterwards adorns it as required)

git-svn-id: branches/jvmbackend@18288 -
2011-08-20 07:22:00 +00:00
Jonas Maebe
9195506c56 * make sure that anonymous inherited calls only call through to the
overridden method, rather than to any method that can accept similar
    parameters as the current one (Delphi-compatible, and corresponds to
    what is described in our documentation)
  * do not flag "inherited" call nodes that are not "anonymous inherited"
    calls using the cnf_anon_inherited flag

git-svn-id: trunk@18162 -
2011-08-10 17:26:19 +00:00
Jonas Maebe
20c3809c3a * when a constant Objective-C class reference is used for anything but
the methodpointer of a call, transform it into a call to the classclass
    method because otherwise it can be used before the first call to any
    method of the class (such as in the packages/cocoaint/src/IvarSize test)
    and this can result in crashes

git-svn-id: trunk@18124 -
2011-08-06 19:49:59 +00:00
florian
570f3c4b39 * merges recent class helper fixes by Sven Barth
git-svn-id: trunk@17887 -
2011-06-30 18:54:46 +00:00
florian
d35d1ed357 + initial support for pascal booleans with sizes 2, 4 and 8
git-svn-id: branches/pasboolxx@17836 -
2011-06-26 15:02:37 +00:00
florian
fda10ff098 * insert type conversions to the prototype type for internal procedures as well, rol/ror/sar and friends require the exact type
git-svn-id: trunk@17808 -
2011-06-23 20:50:47 +00:00
florian
58893a7342 * fix formatting: mainly wrapped extremely long lines
git-svn-id: trunk@17351 -
2011-04-20 08:18:50 +00:00
svenbarth
24243f87e8 Added a check similar to the "allowed" one to be able to remove the "current_syssym" variable again.
* nld.pas:
- added "helperallowed" boolean field to ttypenode which is set to false by default
- check that field in ttypenode.pass_1 and generate an error if it's false
* ncal.pas:
check the "helperallowed" field if the methodpointer node is a typenode and contains a helper; this is needed, because pass_1 of ttypenode is never called in case of "TSomeHelper.SomeMethod"
* pexpr.pas: 
- allow helpers in "sizeof" and "typeinfo"
- remove the check against "TSomeHelper.SomeMethod", but leave an explaining comment there

git-svn-id: branches/svenbarth/classhelpers@17308 -
2011-04-12 07:10:36 +00:00
svenbarth
d0705a1779 Rebase to revision 17236
git-svn-id: branches/svenbarth/classhelpers@17241 -
2011-04-03 17:24:35 +00:00
sergei
48d93dc40e * Fixed handling of "open array of managed type" out-parameters at caller side. Reference count should be decremented only for those array elements which are actually passed to the called procedure; it may be a part of original array if range or slice is used. Concludes work on #18859.
+ Test

git-svn-id: trunk@17136 -
2011-03-15 09:17:24 +00:00
svenbarth
963a4d7b23 Commit of a completely restructured helper implementation. Instead of changing objectdefs with odt_classhelper to odt_class, they'll have the odt_helper type assigned to and this will be kept. This also implies that the parent of a helper is its true parent while the extended type is set to a field in tobjectdef (extendeddef).
This change became necessary of the following reasons:
- Records don't support inheritance, thus for "record helpers" some creativity would have been necessary to implement them; with the new implementation this is more easily
- the new approach allows for easy checks regarding virtual methods and their overrides which would have been more complicated in the old variant
- if someone feels the need the types of helpers (object, interface) can be added rather easily
- unnecessary things like VMT generation can be disabled now

details:
- msg*: 
* moved some messages from parser to type
* adjusted a message ("class helper" => "helper")
- symdef.pas:
* renamed "helperparent" to "extendeddef" and changed its type from "tobjectdef" to "tabstractrecorddef", so records can be extended as well (somewhen in the near future)
* removed "finish_class_helper" method as it isn't necessary (luckily I haven't yet adjusted the ObjC variant)
* changed name of "is_objectpascal_classhelper" to "is_objectpascal_helper" to reflect that this function applies to all helper types
* tobjectdef.create: ImplementedInterfaces isn't created for odt_helper anymore
* tobjectdef.alignment: for helpers it's the same as for classes although this shouldn't be used anywhere...
* tobjectdef.vmtmethodoffset: set to 0 for helpers to be sure...
* tobjectdef.needs_inittable: not needed for helpers (no fields allowed)
* is_objectpascal_helper: only needs check for "odt_helper" object type
- symconst.pas:
* changed odt_classhelper to more general odt_helper
* added new type "thelpertype" which is used to check that "(record|class) helper" corresponds with the given extended type (as Delphi XE checks this as well this strict solution can be kept for modes Delphi and ObjFPC)
- symtable.pas:
* extended "searchsym_in_class" with the possibility to disable the search for helper methods (needed for inherited) => this implies changing all occurences of "searchsym_in_class" with a "true" except some special locations
* renamed "search_objectpascal_classhelper" to "search_objectpascal_helper"
* searchsym_in_class: 
** when an extended method is defined with "overload" it can be that a same named method of the extended class might be called (sadly this means that this search was unnecessary...)
** contextclassh is the def of the helper in the case of an inherited call inside the helper's implementation
** when methods inside a helper are searched, it must be searched in the extended type first
- ptype.pas:
* single_type is used to parse the parent of a helper as well, so allow a helper if the stoParseClassParent is given (needs check in pdecobj.pas/parse_class_parents for normal classes)
* read_named_type: currently the only case when something <> ht_none is passed to the modified parse_objdec (see below) is when the combination "class helper" is encountered ("record helper" will be another one)
- pinline.pas: adjustment for extended "searchsym_in_class"
- pexpr.pas:
* adjustments regarding "searchsym_in_class" and "is_objectpascal_helper"
* factor/factor_read_id: moved the check for "TSomeClassType.SomeMethod" outside of the "is_class" check
* factor: 
** in case of an inherited we need to search inside the extended type first (Note: this needs to be extended to find methods in the helper parent if no method is found in the extended type)
** we also need to disable the search for helper methods when searching for an inherited method (Note: it might be better to introduce a enum to decide whether a helper method should search before or after the methods of the extended type or even never)
- pdecsub.pas:
* insert_self_and_vmt_para: in a helper the type of Self is of the extended type
* pd_abstract, pd_final: more nice error message
* pd_override, pd_message, pd_reintroduce: adjusted checks because now "is_class" is no longer true for helpers
* proc_direcdata: allowed "abstract" for helpers (only to produce a more nice error message)
* parse_proc_direc: adjustment because of "is_objectpascal_helper"
- pdecobj.pas:
* adjustments regarding "is_objectpascal_helper"
* adjusted object_dec to take the type of the helper (class, record) as a parameter to be able to check whether the correct extended type was given
* struct_property_dec: properties are allowed in helpers
* parse_object_options: nothing to be parsed for helpers (at least I hope so ^^)
* parse_parent_classes: 
** the parent of a helper is now parsed as a normal parent, the extended type is parsed in an extra procedure
** check for "sealed" no longer needed
** added check that the parsed parent of a helper is indeed a helper
** allow to parse the closing ")" of the helper's parent
* parse_extended_class:
** new procedure that parses the type which is extended
** it checks that the extended type is a class for "class helper" and a record for "record helper"
** it checks that a helper extends the same class or a subclass for class helpers
** it checks that a helper extends the same record for record helpers
* parse_object_members:
** "type", "const", "var" is allowed in helpers
** don't exclude flags regarding virtual methods, they are needed for the checks in mode Delphi (this implies that VMT loading must be disabled for helpers)
* object_dec:
** don't change "odt_helper" to "odt_class", but still include the "oo_is_classhelper" flag
** allow the parsing of object options (there are none)
** parse the extended type for helpers
- pdecl.pas
* adjustment because of extension of object_dec
* types_dec: remove the call to finish_classhelper
- objcdef.pas
* objcaddencodedtype, objcdochecktype: add references to helpers as implicit pointers although that should not be used in any way...
- nld.pas
* tloadnode.pass_typecheck: self is a reference to the extended type
- nflw.pas
* create_for_in_loop: adjustment because of changed procedure and inheritance type
- ncgrtti.pas
* TRTTIWriter.write_rtti_data: disable for helpers for now (I need to check what Delphi does here)
- ncgld.pas
* tcgloadnode.pass_generate_code: virtual methods of helpers are treated as normal methods
- ncgcal.pas
* tcgcallnode.pass_generate_code: virtual methods of helpers are treated as normal methods
- ncal.pas
* tcallnode.pass_typecheck: adjust for extension of tcallcandidates constructor
- htypechk.pas
* tcallcandidates declaration: extend some methods to (dis)allow the search for helper methods (needed for inherited)
* tcallcandidates.collect_overloads_in_struct: 
** search first in helpers for methods and stop if none carries the "overload" flag
** move the addition of the procsyms to an extra nested procedure because it's used for helper methods and normal struct methods

git-svn-id: branches/svenbarth/classhelpers@16947 -
2011-02-20 11:41:55 +00:00
svenbarth
d12b198c7f Rebase to revision 16888
git-svn-id: branches/svenbarth/classhelpers@16891 -
2011-02-07 20:30:48 +00:00
sergei
4aeef5b150 Fixes to dispatch calls:
* Pass dispinterfaces with correct type (varDispatch).
* Pass skipped parameters as EmptyParam (vType=varError, vError=DISP_E_PARAMNOTFOUND), as COM requires to preserve correct argument count and positions.
* Since ttempcreatenode.size can be set after creation, don't calculate parameter size in first pass, this simplifies things a bit.

git-svn-id: trunk@16863 -
2011-02-01 16:43:18 +00:00
sergei
0a9fdb71e5 - translate_disp_call: removed a couple of unnecessary variables.
git-svn-id: trunk@16858 -
2011-01-30 21:11:20 +00:00
sergei
58f37dc952 Improvements to dispinterface property handling:
* Create implicit access methods, which hold type information for property parameters and allow parsing/typechecking occur the same way as for regular (non-dispinterface) properties.
+ Introduce separate proctypeoptions for property access methods. They are translated into correct dispatch call types and used to distinguish property access from regular method calls.
* Bump PPU version because new information has been introduced.
- Code specific to dispinterface properties in expression parser is no longer necessary, removed.
* Allow access to default property with [] for dispinterfaces.
+ Extended the test with basic correctness checks for property dispatching.

git-svn-id: trunk@16810 -
2011-01-24 20:30:48 +00:00
paul
ae7bfbb578 compiler: don't connect parasyms to procdefinition in tcallnode.derefimpl if procdefinition is not defined (a possible case for a generic method) (fixes issue #0018573)
git-svn-id: trunk@16808 -
2011-01-24 06:42:47 +00:00
sergei
3a23a3ebe0 Initial support of parametrized dispinterface properties:
* When parsing dispinterface properties, pass parameter/index nodes to translate_disp_call() instead of dropping them.
* Distinguish property getters from regular method calls and generate appropriate call descriptors.

git-svn-id: trunk@16753 -
2011-01-12 00:39:11 +00:00
paul
b7f1ea0a93 compiler: remove unneeded check that def is objectdef when we have another check that object has vmt. records don't have vmt so we can leave only one check there
git-svn-id: trunk@16668 -
2010-12-31 02:26:41 +00:00
paul
cdca5f42b7 compiler: extend internal error 200305061 check for records
git-svn-id: trunk@16630 -
2010-12-24 09:27:34 +00:00
paul
742b0bb686 compiler: partly revert r16560 and disable (at least temporary) constructors in records
git-svn-id: branches/paul/extended_records@16568 -
2010-12-16 03:37:16 +00:00
paul
11d4eddf67 compiler: a trial to implement record constructor
- map self to constructor result
  - don't push vmt for records

At the moment generated assembler has errors although node tree is correct

git-svn-id: branches/paul/extended_records@16560 -
2010-12-13 06:39:29 +00:00
paul
289c9bd192 compiler: remove unneeded checks and typecasting caused by move of objectoptions into tabstractrecorddef
git-svn-id: branches/paul/extended_records@16542 -
2010-12-11 07:00:46 +00:00
paul
56bf42de57 compiler: implement record methods and class methods:
- rename tprocdef._class to tprocdef.struct and change the type from tobjectdef to tabstractrecorddef because methods can belong not to classes only now but to records too
  - replace in many places use of current_objectdef to current_structdef with typcast where is needed
  - add an argument to comp_expr, expr, factor, sub_expr to notify that we are searching type only symbol to solve the problem with records,objects,classes which contains fields with the same name as previosly declared type (like:
  HWND = type Handle;
  rec = record 
    hWnd: HWND;
  end;)
  - disable check in factor_read_id which was made for object that only static fields can be accessed as TObjectType.FieldName outside the object because it makes SizeOf(TObjectType.FieldName) imposible and since the same method was extended to handle records it also breaks a52 package compilation
  - rename tcallcandidates.collect_overloads_in_class to tcallcandidates.collect_overloads_in_struct and addapt the code to handle overloads in records too
  - fix searchsym_type to search also in object ancestors if we found an object symtable
  - add pd_record, pd_notrecord flags to mark procedure modifies which can or can't be used with records. Disallow the next modifiers for records: abstract, dynamic, export, external, far, far16, final, forward, internconst, internproc, interrupt, message, near, override, public, reintroduce, virtual, weakexternal,
Allow the next modifiers for records: static

git-svn-id: branches/paul/extended_records@16526 -
2010-12-09 02:24:46 +00:00
sergei
7dd93b1282 * Variant types: renamed varunicodestring to varustring and changed its value to $102 (for Delphi compatibility), introduced varUStrArg=$73, added some description comments.
* ncal.pas, translate_disp_call:
  * pass UnicodeString as varUStrArg
  * do not typecast ordinal consts to Integer, so typecasts in source (if any) are preserved.
+ test for correct passing of Dispatch method arguments, concludes work on Mantis #17904.

git-svn-id: trunk@16456 -
2010-11-27 16:17:43 +00:00
sergei
b4ac714201 * defutil.pas: added UnicodeString to automatable types, fixes compilation of webtbs/tw2649.pp after r16360. However it requires RTL support similar to one for AnsiString to be complete.
* ncal.pas, translate_disp_call(): fixed parameter alignment once more, this time it should be correct for both 32 and 64 bit platforms.

git-svn-id: trunk@16394 -
2010-11-21 18:10:11 +00:00
sergei
9d8d518029 * translate_disp_call, support passing Variants by-value (still pass a pointer, but reset ByRef bit in CallDesc.Args[]).
git-svn-id: trunk@16389 -
2010-11-20 21:43:15 +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
sergei
2d860e356c * Fixed parameter generation for dispatch calls: assuming that everything is passed by reference and needs only sizeof(ptruint) bytes is wrong. 64-bit primitive types (Double,Int64) are passed by value and require twice more space on 32-bit platforms.
git-svn-id: trunk@16350 -
2010-11-16 11:55:09 +00:00
joost
07bf44517c * Merged XPCom branch into trunk, added support for constref and changed
the IInterface implementation to be XPCom-compatible
--- Merging r15997 through r16179 into '.':
U    rtl/inc/variants.pp
U    rtl/inc/objpash.inc
U    rtl/inc/objpas.inc
U    rtl/objpas/classes/persist.inc
U    rtl/objpas/classes/compon.inc
U    rtl/objpas/classes/classesh.inc
A    tests/test/tconstref1.pp
A    tests/test/tconstref2.pp
A    tests/test/tconstref3.pp
U    tests/test/tinterface4.pp
A    tests/test/tconstref4.pp
U    tests/webtbs/tw10897.pp
U    tests/webtbs/tw4086.pp
U    tests/webtbs/tw15363.pp
U    tests/webtbs/tw2177.pp
U    tests/webtbs/tw16592.pp
U    tests/tbs/tb0546.pp
U    compiler/sparc/cpupara.pas
U    compiler/i386/cpupara.pas
U    compiler/pdecsub.pas
U    compiler/symdef.pas
U    compiler/powerpc/cpupara.pas
U    compiler/avr/cpupara.pas
U    compiler/browcol.pas
U    compiler/defcmp.pas
U    compiler/powerpc64/cpupara.pas
U    compiler/ncgrtti.pas
U    compiler/x86_64/cpupara.pas
U    compiler/opttail.pas
U    compiler/htypechk.pas
U    compiler/tokens.pas
U    compiler/objcutil.pas
U    compiler/ncal.pas
U    compiler/symtable.pas
U    compiler/symsym.pas
U    compiler/m68k/cpupara.pas
U    compiler/regvars.pas
U    compiler/arm/cpupara.pas
U    compiler/symconst.pas
U    compiler/mips/cpupara.pas
U    compiler/paramgr.pas
U    compiler/psub.pas
U    compiler/pdecvar.pas
U    compiler/dbgstabs.pas
U    compiler/options.pas
U    packages/fcl-fpcunit/src/testutils.pp

git-svn-id: trunk@16180 -
2010-10-17 20:58:22 +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
94d976bc87 * when simplifying ordinal expressions during inlining, keep the resultdef
that was set during the typecheck pass because typeconversion nodes
    may have been optimised away previously and sometimes the resultdef is
    important (e.g. for the value of callparanodes) (mantis #17458)

git-svn-id: trunk@16101 -
2010-10-07 15:08:52 +00:00
mazen
b127fc154a * Fixed spell error revealed by lintian.
git-svn-id: trunk@16094 -
2010-10-06 20:33:57 +00:00
Jonas Maebe
f13f6627c4 * moved use_fixed_stack from cgutils to a method in paramgr so it can
be used outside the code generator
  * renamed tabstractprocdef.requiredargarea into callerargareasize,
    and also added calleeargareasize field; added init_paraloc_info(side)
    method to init the parameter locations and init those size fields and
    replaced all "if not procdef.has_paraloc_info then ..." blocks with
    procdef.init_paraloc_info(callersize)"
  * moved detection of stack tainting parameters from psub to
    symdef/tabstractprocdef
  + added tcallparanode.contains_stack_tainting_call(), which detects
    whether a parameter contains a call that makes use of stack paramters
  * record for each parameter whether or not any following parameter
    contains a call with stack parameters; if not, in case the current
    parameter itself is a stack parameter immediately place it in its
    final location also for use_fixed_stack platforms rather than
    first putting it in a temporary location (part of mantis #17442)
  * on use_fixed_stack platforms, always first evaluate parameters
    containing a stack tainting call, since those force any preceding
    stack parameters of the current call to be stored in a temp location
    and copied to the final location afterwards

git-svn-id: trunk@16050 -
2010-09-26 21:24:14 +00:00
Jonas Maebe
c43fda1fe1 * enabled maybe_call_procvar() also for macpas mode (calls procvars that
don't have any parameters in most expressions, rather than using them
    as the procvar itself) -> replaced procvar<>nil with assigned(procvar)
    in test/tmacprocvar.pp to keep it compiling (otherwise it now called
    the procvar); necessary in combination with the next fix to compile
    webtbs/tw17379a.pp
  * automatically disambiguate the use of the function name when used as a
    parameter in macpas mode (if the formal parameter type is a procvar
    type then interpret it as the current function definition, otherwise
    as the current function result) (mantis #17379)

git-svn-id: trunk@15971 -
2010-09-12 16:03:00 +00:00
joost
65ab1e820b * Safecall on linux/i386 now behaves like cdecl plus hidden exception support.
* Adapted tests because safecall on linux/i386 now does not include high() 
   support anymore

git-svn-id: trunk@15913 -
2010-08-27 19:07:22 +00:00
Jonas Maebe
5ca1bd2a32 * if the unit of a procedure call is explicitly specified, limit the search
for (overloaded) procsyms to that unit (mantis #17220)

git-svn-id: trunk@15887 -
2010-08-23 20:51:40 +00:00
florian
3a07adf27e * reduce redundant temporary interfaces variables, resolves #14092
git-svn-id: trunk@15880 -
2010-08-23 11:56:17 +00:00
Jonas Maebe
57bd6d2685 + merged nestedprocvars branch
+ support for nested procedural variables:
    o activate using {$modeswitch nestedprocvars} (compatible with all
      regular syntax modes, enabled by default for MacPas mode)
    o activating this mode switch changes the way the frame pointer is
      passed to nested routines into the same way that Delphi uses (always
      passed via the stack, and if necessary removed from the stack by
      the caller) -- Todo: possibly also allow using this parameter
      passing convention without enabling nested procvars, maybe even
      by default in Delphi mode, see mantis #9432
    o both global and nested routines can be passed to/assigned to a
      nested procvar (and called via them). Note that converting global
      *procvars* to nested procvars is intentionally not supported, so
      that this functionality can also be implemented via compile-time
      generated trampolines if necessary (e.g. for LLVM or CIL backends
      as long as they don't support the aforementioned parameter passing
      convention)
    o a nested procvar can both be declared using a Mac/ISO Pascal style
      "inline" type declaration as a parameter type, or as a stand-alone
      type (in the latter case, add "is nested" at the end in analogy to
      "of object" for method pointers -- note that using variables of
      such a type is dangerous, because if you call them once the enclosing
      stack frame no longer exists on the stack, the results are
      undefined; this is however allowed for Metaware Pascal compatibility)

git-svn-id: trunk@15694 -
2010-08-02 22:20:36 +00:00
Jonas Maebe
f72526b95f * allow function results of inlined functions to be regvars
git-svn-id: trunk@15494 -
2010-06-29 20:58:08 +00:00
Jonas Maebe
835899524b + support for Objective-Pascal for-in loops ("fast enumerations")
+ {$modeswitch objectivec2}, which is required before you can use
    Objective-C 2.0 features (such as the above). It automatically
    also implies {$modeswitch objectivec1}
  + genloadfield() helper to load a field of a node representing
    a record/object/class

git-svn-id: trunk@15460 -
2010-06-20 12:38:45 +00:00
Jonas Maebe
82b65a1f93 * made internalerror unique
git-svn-id: trunk@15364 -
2010-06-03 18:38:43 +00:00
Jonas Maebe
283018a3bf * changed tprocdef.funcretloc[] from a tlocation into a tcgpara so it can
represent complex locations (required for full x86-64 ABI support,
    which is not yet implemented) -> lots of special result handling
    code has been removed and replaced by the parameter handling
    routines
  + added support for composite parameters (and hence function
    results) to tcg.a_load_ref_cgpara() (so it can be used for
    handling, e.g., 64 bit parameters on 32 bit platforms)
  * the above fixed writing past the end of allocated memory when
    handling records returned in registers on x86-64 whose size is
    not a multiple of 8 bytes (mantis #16357)
  - removed the x86-64 and PPC specific versions of a_load_ref_cgpara(),
    as they are now handled correctly by the generic version
  * moved the responsibility of allocating tcgpara cpu registers
    (using paramanager.allocparaloc()) from the callers of
    cg.a_load*_cgpara() to the cg.a_load*_cgpara() methods
    themselves (so the register allocation can be done efficiently
    when dealing with function results)
  * for the above, renamed paramanager.alloc/freeparaloc() to
    paramanager.alloc/freecgpara(), and use paramanager.allocparaloc()
    to allocate individual pcgparalocations instead
  * fixed the register size of SSE2 function result registers for
    x86-64 (when used for floating point), which results in removing
    a few superfluous "movs? %xmm0,%xmm0" instructions
  * fixed compilation of paramanagers of avr, m68k and mips after r13695
    and also updated them for these new changes

git-svn-id: trunk@15350 -
2010-05-30 21:12:57 +00:00
Jonas Maebe
f5c52b25cd * removed "and not is_class()" condition from is_managed_type(), because
tobjectdef.needs_inittable returns false for classes nowadays (and already
    since quite some time)
  * nevertheless replaced all usages in the compiler of x.needs_inittable with
    is_managed_type(x) (in case some other condition is added again in the
    future) and removed all remaining accompanying "and not is_class(x)"
    checks

git-svn-id: trunk@15320 -
2010-05-22 21:28:24 +00:00
Jonas Maebe
34cf323f7a * don't use hardcoded expectloc for certain types for callnodes (was wrong
for floatdefs handled via vectorfpu)

git-svn-id: trunk@15274 -
2010-05-13 19:12:18 +00:00
Jonas Maebe
2911435c5a * do replace one temp with another while inlining in case the former can
be a regvar while the latter cannot be (mantis #16018)

git-svn-id: trunk@15218 -
2010-05-03 16:29:03 +00:00
Jonas Maebe
34487fa455 * part of r15163, forgot to commit
git-svn-id: trunk@15164 -
2010-04-24 12:49:53 +00:00
paul
24d8a7d833 compiler: start implementation of class constructors/destructors: parsing is ready but at the moment neither class constructors nor destructors are called - this is to be implemented
git-svn-id: trunk@15109 -
2010-04-03 09:14:12 +00:00
Jonas Maebe
6db635210a * don't give an internalerror when passing a constant string to an
openstring parameter (mantis #16022)

git-svn-id: trunk@15030 -
2010-03-21 14:51:12 +00:00
Jonas Maebe
0cfc6e1cac + support for "univ" in macpas mode: a parameter modifier that allows
passing any value to that parameter which has the same size as the
    parameter (it basically acts as if there is an explicit type conversion
    to the parameter type around the value at the caller side). If a procvar
    has an univ parameter, all procvars whose corresponding parameter
    has the same size as that univ parameter are similarly compatible.

    This transparent compatibility can however cause crashes in case of
    of the procvars when one of the types is passed on the stack and the
    other isn't (because then the called routine will a) load the parameter
    from a wrong location and b) pop the wrong amount off of the stack at
    then end). Therefore FPC will warn in most cases where this can happen.
    (mantis #15777)

git-svn-id: trunk@15010 -
2010-03-13 22:13:20 +00:00
paul
ba3744b38e compiler: translate_disp_call:
- fix arguments description if the first argument is empty
  - fix restype field value (describes result value type in variant types)

git-svn-id: trunk@14790 -
2010-01-24 12:06:52 +00:00
paul
fe6a0d27a1 compiler: fix variant dispatch after r14782
git-svn-id: trunk@14788 -
2010-01-24 05:45:27 +00:00
paul
8511a3e1e4 compiler: fix an assumption that para.parasym is always assigned
git-svn-id: trunk@14783 -
2010-01-23 19:31:50 +00:00
paul
ca99f902d6 compiler: fix a memory leak in translate_disp_call
git-svn-id: trunk@14782 -
2010-01-23 19:16:17 +00:00
paul
7aede2018f compiler: mark 'var' and 'out' arguments as they are passed by reference for dispatch invoke
git-svn-id: trunk@14781 -
2010-01-23 19:01:30 +00:00
paul
f0f7837fdd compiler: fix interface type passing to dispinterface/IDispatch methods (part of issue #0015562)
git-svn-id: trunk@14780 -
2010-01-23 18:13:00 +00:00
paul
b16653e099 compiler: fix translate_disp_call for cases with method calling with no arguments
git-svn-id: trunk@14746 -
2010-01-19 09:50:25 +00:00
paul
58f43def5c compiler: write dummy restype to calldescnode if we are calling by dipid
git-svn-id: trunk@14744 -
2010-01-19 08:15:10 +00:00
paul
fa729dd252 compiler: fix calling of dispinterface procedures (issue #0015528)
git-svn-id: trunk@14683 -
2010-01-16 18:02:55 +00:00
paul
3ed4c58502 compiler:
- implement class properties: properties which can access only static fields and static class methods
  - tests
  - fix a possibility to call an instance method from the class method

git-svn-id: trunk@14585 -
2010-01-09 18:37:54 +00:00
florian
c1f3d8dcaa * unified names of system_*/systems_* sets
git-svn-id: trunk@14566 -
2010-01-07 18:16:20 +00:00
Jonas Maebe
985c74adde * sizeof(voidpointertype.size) -> voidpointertype.size (although they
happen to be the same currently on all platforms, this is not
     guaranteed)

git-svn-id: trunk@14297 -
2009-12-03 13:29:02 +00:00
Jonas Maebe
af85e45b67 + support for id.anyobjcmethodinscope() calls for Objective-Pascal code,
using standard FPC overload selection logic
  * fixed detection of references to static symbol tables for class
    helpers

git-svn-id: trunk@14234 -
2009-11-21 00:14:21 +00:00
Jonas Maebe
559e284bd0 * merged r13762-14047 from trunk
git-svn-id: branches/objc@14048 -
2009-11-04 15:50:26 +00:00
paul
e784ec1079 merge revisions 13898-13899:
- compiler: allow message after the *deprecated* keyword
 - compiler: raise an internal error if deprecated message is trying to set to a non clear string pointer

git-svn-id: trunk@13997 -
2009-11-01 14:06:30 +00:00
Jonas Maebe
3660bf7f98 * integrated the transformation of an Objective-C method call into a call
to objc_msgSend* into the callnode. This allows reusing the current
    call node rather than having to create a new one, and is in particular
    necessary because even though the objc_msgSend* functions are declared
    as varargs, you're supposed to typecast them to the function type
    describing the method before calling them (so they should *not* use
    varargs calling conventions!)
  * for the above, a field called fobjcforcedprocname has been added to the
    callnode, which can be set to a string that will be used as the (mangled)
    name of the function to call instead of the mangled name of the procsym
  -> fixes calling obj-c methods with floating point arguments on ppc

git-svn-id: branches/objc@13783 -
2009-10-01 12:05:11 +00:00
Jonas Maebe
a149674a75 Merged revisions 13458-13596 via svnmerge from
svn+ssh://jonas@svn.freepascal.org/FPC/svn/fpc/trunk

git-svn-id: branches/objc@13598 -
2009-08-25 19:47:36 +00:00
Jonas Maebe
acdb0bbb3e * don't change current_filepos in pass_typecheck when not generating
errornodes (so the that the parser won't afterwards suddenly start
    creating nodes with this different fileinfo)

git-svn-id: trunk@13577 -
2009-08-22 20:21:56 +00:00
florian
c0d4efed2e * forbid passing derived classes to call by reference parent classes (for objects, this is still allowed), resolves #13135
git-svn-id: trunk@13551 -
2009-08-17 21:46:25 +00:00
Jonas Maebe
335e159c11 Merged revisions 13351-13373,13376-13457 via svnmerge from
svn+ssh://jonas@svn.freepascal.org/FPC/svn/fpc/trunk

git-svn-id: branches/objc@13458 -
2009-07-26 14:31:50 +00:00
Jonas Maebe
754696d1f5 * enable converting procedure callnodes with only default parameters into
procvars in tp/delphi mode (mantis #11771)

git-svn-id: trunk@13400 -
2009-07-17 10:29:56 +00:00
Jonas Maebe
92de010fe1 Merged revisions 13218-13347 via svnmerge from
svn+ssh://jonas@svn.freepascal.org/FPC/svn/fpc/trunk

git-svn-id: branches/objc@13350 -
2009-06-28 16:09:53 +00:00
Jonas Maebe
1f6ec379de * moved field definitions before method/property definitions (see mantis
#13971)

git-svn-id: trunk@13330 -
2009-06-27 11:27:31 +00:00
Jonas Maebe
e42842b31c * don't allow skipping property parameters if the getter/setter has default
parameters (mantis #13956)
  * when reporting an error about too few specified parameters to a call,
    return the column of the call itself rather than after the last parameter
    (because this ends up after the end of an indexed property in case of
     properties, which is confusing)

git-svn-id: trunk@13326 -
2009-06-26 17:31:41 +00:00
Jonas Maebe
c0e51f3e97 * use reference-counted temps for the method pointer when the method
pointer is of a reference-counted type (reverts r2165, fixes mantis #14019)
  * modified test for mantis #4086 (which was "fixed" by r2165) so it still
    works and no longer depends on whether or not the compiler uses a
    refcounted temp to evaluate certain expressions

git-svn-id: trunk@13310 -
2009-06-21 12:17:51 +00:00
Jonas Maebe
b1b9894ae3 * initial Objective-C 1.0 support:
o support for declaring external Objective-C classes (see
      rtl/inc/objcbase.pas), including derived classes
    o support for converting methods of objcclasses into selectors
      (see tests/test/tobjc1.pp)
    o support for loading from/storing to fields of objcclasses
    o support for calling Objective-C methods using regular
      Object Pascal syntax (see tests/test/tobjc1.pp)
    o some things that are known to be not yet working:
      o automatic conversion from ID to objcclasses and back
      o declaring and implementing new objcclasses/methods in Pascal code
      o debug information (objcclasses are currently plain pointers
        as far as the debugger knows)

git-svn-id: branches/objc@13162 -
2009-05-17 13:42:50 +00:00
Jonas Maebe
d3cec25dce * small indentation fix
git-svn-id: trunk@13150 -
2009-05-16 10:31:35 +00:00
Jonas Maebe
630aa5c493 * do not use voidtype for temporary parameter/result locations when
inlining, because that results in alignment settings of "0"
    (voidtype.savesize = 0 -> size2align(0) = 0), which is interpreted
    by the code generators as unaligned (and is actually even invalid
    nowadays). This caused errors on NDS when writing to memory mapped
    I/O devices (mantis #13343)

git-svn-id: trunk@12916 -
2009-03-18 22:25:06 +00:00
Jonas Maebe
da461c5154 * fixed calling static class methods from inside other static class methods
git-svn-id: trunk@12866 -
2009-03-08 12:38:02 +00:00
Jonas Maebe
5474004dcc * fixed calling inherited class methods from a regular method (mantis
#11825)

git-svn-id: trunk@12810 -
2009-02-27 17:05:41 +00:00
Jonas Maebe
7d459cf12a * the compiler now explicitly keeps track of the minimally guaranteed
alignment for each memory reference (mantis #12137, and
    test/packages/fcl-registry/tregistry1.pp on sparc). This also
    enables better code generation for packed records in many cases.
  o several changes were made to the compiler to minimise the chances
    of accidentally forgetting to set the alignment of memory references
    in the future:
    - reference_reset*() now has an extra alignment parameter
    - location_reset() can now only be used for non LOC_(C)REFERENCE,
      use location_reset_ref() for those (split the tloc enum so the
      compiler can catch errors using range checking)

git-svn-id: trunk@12719 -
2009-02-08 13:00:24 +00:00
Jonas Maebe
060d81b8fa Merged revisions 11878,11881-11882,11889,11891-11893,11895,11899-11902,11935,11938,12212,12304,12308-12310,12316,12330-12332,12334,12339-12340 via svnmerge from
svn+ssh://jonas@svn.freepascal.org/FPC/svn/fpc/branches/wpo

........
r11878 | jonas | 2008-10-11 02:25:18 +0200 (Sat, 11 Oct 2008) | 19 lines

  + initial implementation of whole-program optimisation framework
  + implementation of whole-program devirtualisation
  o use:
     a) generate whole-program optimisation information (no need
        to completely compile the program and all of its units
        with -OW/-FW, only the main program is sufficient)
      fpc -OWdevirtcalls -FWmyprog.wpo myprog
     b) use it to optimise the program
      fpc -B -Owdevirtcalls -Fwmyprog.wpo myprog
     (the -B is not required, but only sources recompiled during
      the second pass will actually be optimised -- if you want,
      you can even rebuild the rtl devirtualised for a particular 
      program; and these options can obviously also be used         
      together with regular optimisation switches)
  o warning:
    - there are no checks yet to ensure that you do not use 
      units optimised for a particular program with another
      program (or with a changed version of the same program)

........
r11881 | jonas | 2008-10-11 19:35:52 +0200 (Sat, 11 Oct 2008) | 13 lines

  * extracted code to detect constructed class/object types from
    tcallnode.gen_vmt_tree into its own method to avoid clutter
  * detect x.classtype.create constructs (with classtype = the
    system.tobject.classtype method), and treat them as if a
    "class of x" has been instantiated rather than a
    "class of tobject". this required storing the instantiated
    classrefs in their own array though, because at such a
    point we don't have a "class of x" tdef available (so
    now "x", and all other defs instantiated via a classref,
    are now stored as tobjectdefs in a separate array)
  + support for devirtualising class methods (including
    constructors)

........
r11882 | jonas | 2008-10-11 20:44:02 +0200 (Sat, 11 Oct 2008) | 7 lines

  + -Owoptvmts whole program optimisation which replaces vmt entries
    with method names of child classes in case the current class'
    method can never be called (e.g., because this class is never
    instantiated). As a result, such methods can then be removed
    by dead code removal/smart linking (not much effect for either
    the compiler, lazarus or a trivial lazarus app though).

........
r11889 | jonas | 2008-10-12 14:29:54 +0200 (Sun, 12 Oct 2008) | 2 lines

  * some comment fixes

........
r11891 | jonas | 2008-10-12 18:49:13 +0200 (Sun, 12 Oct 2008) | 4 lines

  * fixed twpofilereader.getnextnoncommentline() when reusing a previously
    read line
  * fixed skipping of unnecessary wpo feedback file sections

........
r11892 | jonas | 2008-10-12 23:42:43 +0200 (Sun, 12 Oct 2008) | 31 lines

  + symbol liveness wpo information extracted from smartlinked programs
    (-OW/-Owsymbolliveness)
  + use symbol liveness information to improve devirtualisation (don't
    consider classes created in code that has been dead code stripped).
    This requires at least two passes of using wpo (first uses dead code
    info to locate classes that are constructed only in dead code,
    second pass uses this info to potentially further devirtualise).
    I.e.:
     1) generate initial liveness and devirtualisation feedback
       fpc -FWtt.wpo -OWall tt.pp -Xs- -CX -XX
     2) use previously generated feedback, and regenerate new feedback
        based on this (i.e., disregard classes created in dead code)
       fpc -FWtt-1.wpo -OWall -Fwtt.wo -Owall tt.pp -Xs- -CX -XX
     3) use the newly generated feedback (in theory, it is possible
        that even more opportunities pop up afterwards; you can
        continue until the program does not get smaller anymore)
       fpc -Fwtt-1.wpo -Owall tt.pp -CX -XX
  * changed all message() to cgmessage() calls so the set codegenerror
  * changed static fsectionhandlers field to a regular field called
    fwpocomponents
  * changed registration of wpocomponents: no longer happens in the
    initialization section of their unit, but in the InitWpo routine
    (which has been moved from the woinfo to the wpo unit). This way
    you can register different classes based on the target/parameters.
  + added static method to twpocomponentbase for checking whether
    the command line parameters don't conflict with the requested
    optimisations (e.g. generating liveness info requires that
    smartlinking is turned on)
  + added static method to twpocomponentbase to request the
    section name

........
r11893 | jonas | 2008-10-12 23:53:57 +0200 (Sun, 12 Oct 2008) | 3 lines

  * fixed comment error (twpodeadcodeinfo keeps a list of live,
    not dead symbols)

........
r11895 | jonas | 2008-10-13 00:13:59 +0200 (Mon, 13 Oct 2008) | 2 lines

  + documented -OW<x>, -Ow<x>, -FW<x> and -Fw<x> wpo parameters

........
r11899 | jonas | 2008-10-14 22:14:56 +0200 (Tue, 14 Oct 2008) | 2 lines

  * replaced hardcoded string with objdumpsearchstr constant

........
r11900 | jonas | 2008-10-14 22:15:25 +0200 (Tue, 14 Oct 2008) | 2 lines

  * reset wpofeedbackinput and wpofeedbackoutput in wpodone

........
r11901 | jonas | 2008-10-14 22:16:07 +0200 (Tue, 14 Oct 2008) | 2 lines

  * various additional comments and comment fixes

........
r11902 | jonas | 2008-10-15 18:09:42 +0200 (Wed, 15 Oct 2008) | 5 lines

  * store vmt procdefs in the ppu files so we don't have to use a hack to
    regenerate them for whole-program optimisation
  * fixed crash when performing devirtualisation optimisation on programs
    that do not construct any classes/objects with optimisable vmts

........
r11935 | jonas | 2008-10-19 12:24:26 +0200 (Sun, 19 Oct 2008) | 4 lines

  * set the vmt entries of non-class virtual methods of not instantiated
    objects/classes to FPC_ABSTRACTERROR so the code they refer to can
    be thrown away if it is not referred to in any other way either

........
r11938 | jonas | 2008-10-19 20:55:02 +0200 (Sun, 19 Oct 2008) | 7 lines

  * record all classrefdefs/objdefs for which a loadvmtaddrnode is generated,
    and instead of marking all classes that derive from instantiated
    classrefdefs as instantiated, only mark those classes from the above
    collection that derive from instantiated classrefdefs as
    instantiated (since to instantiate a class, you have to load its vmt
    somehow -- this may be broken by using assembler code though)

........
r12212 | jonas | 2008-11-23 12:26:34 +0100 (Sun, 23 Nov 2008) | 3 lines

  * fixed to work with the new vmtentries that are always available and
    removed previously added code to save/load vmtentries to ppu files

........
r12304 | jonas | 2008-12-05 22:23:30 +0100 (Fri, 05 Dec 2008) | 4 lines

  * check whether the correct wpo feedback file is used in the current
    compilation when using units that were compiled using wpo information
    during a previous compilation run

........
r12308 | jonas | 2008-12-06 18:03:39 +0100 (Sat, 06 Dec 2008) | 2 lines

  * abort compilation if an error occurred during wpo initialisation

........
r12309 | jonas | 2008-12-06 18:04:28 +0100 (Sat, 06 Dec 2008) | 3 lines

  * give an error message instead of crashing with an io exception if the
    compiler is unable to create the wpo feedback file specified using -FW

........
r12310 | jonas | 2008-12-06 18:12:43 +0100 (Sat, 06 Dec 2008) | 3 lines

  * don't let the used wpo feedback file influence the interface crc (there's
    a separate check for such changes)

........
r12316 | jonas | 2008-12-08 19:08:25 +0100 (Mon, 08 Dec 2008) | 3 lines

  * document the format of the sections of the wpo feedback file inside the
    feedback file itself

........
r12330 | jonas | 2008-12-10 22:26:47 +0100 (Wed, 10 Dec 2008) | 2 lines

  * use sysutils instead of dos to avoid command line length limits

........
r12331 | jonas | 2008-12-10 22:31:11 +0100 (Wed, 10 Dec 2008) | 3 lines

  + support for testing whole program optimisation tests (multiple
    compilations using successively generated feedback files)

........
r12332 | jonas | 2008-12-10 22:31:40 +0100 (Wed, 10 Dec 2008) | 2 lines

  + whole program optimisation tests

........
r12334 | jonas | 2008-12-10 22:38:07 +0100 (Wed, 10 Dec 2008) | 2 lines

  - removed unused local variable

........
r12339 | jonas | 2008-12-11 18:06:36 +0100 (Thu, 11 Dec 2008) | 2 lines

  + comments for newly added fields to tobjectdef for devirtualisation

........
r12340 | jonas | 2008-12-11 18:10:01 +0100 (Thu, 11 Dec 2008) | 2 lines

  * increase ppu version (was no longer different from trunk due to merging)

........

git-svn-id: trunk@12341 -
2008-12-11 17:40:18 +00:00
peter
9086a2549d * refactor overload collection in tcallcandidates. separate
the collecting of overloads. The actual building of
    candidate list is now common

git-svn-id: trunk@12064 -
2008-11-12 22:38:38 +00:00
peter
af437d5beb * refactor the forward type declaration handling, remove
global typecanbeforward and move 'class of ..' parsing
    to ptype

git-svn-id: trunk@12045 -
2008-11-09 22:07:36 +00:00
Jonas Maebe
1e178d324f * explicitly check whether the methodpointer isn't the same as the result
before optimising function result assignment, because at this point the
    hidden self parameter is not yet inserted (mantis #12597)
  * changed ttypeconvnode.actualtargetnode to use the same logic as what
    is used to determine whether something can be assigned to the result
    of a type conversion (so the above check also works if the methodpointer
    contains a typecast to a different object type)

git-svn-id: trunk@12038 -
2008-11-09 10:19:29 +00:00
florian
b178b08ba7 Merged revisions 11665-11738 via svnmerge from
http://svn.freepascal.org/svn/fpc/branches/unicodestring

........
  r11665 | florian | 2008-08-30 13:30:17 +0200 (Sat, 30 Aug 2008) | 1 line
  
  * continued to work on unicodestring type support
........
  r11666 | florian | 2008-08-30 19:02:26 +0200 (Sat, 30 Aug 2008) | 2 lines
  
  * expectloc for wide/ansi/unicode strings is LOC_CONSTANT or LOC_REGISTER now
........
  r11667 | florian | 2008-08-30 20:42:37 +0200 (Sat, 30 Aug 2008) | 1 line
  
  * more unicodestring stuff fixed, test results on win32 are already good
........
  r11670 | florian | 2008-08-30 23:21:48 +0200 (Sat, 30 Aug 2008) | 2 lines
  
  * first fixes for unix bootstrapping
........
  r11683 | ivost | 2008-09-01 12:46:39 +0200 (Mon, 01 Sep 2008) | 2 lines
  
      * fixed 64bit bug in iconvenc.pas
........
  r11689 | florian | 2008-09-01 23:12:34 +0200 (Mon, 01 Sep 2008) | 1 line
  
  * fixed several errors when building on unix
........
  r11694 | florian | 2008-09-03 20:32:43 +0200 (Wed, 03 Sep 2008) | 1 line
  
  * fixed unix compilation
........
  r11695 | florian | 2008-09-03 21:01:04 +0200 (Wed, 03 Sep 2008) | 1 line
  
  * bootstrapping fix
........
  r11696 | florian | 2008-09-03 21:07:18 +0200 (Wed, 03 Sep 2008) | 1 line
  
  * more bootstrapping fixed
........
  r11698 | florian | 2008-09-03 22:47:54 +0200 (Wed, 03 Sep 2008) | 1 line
  
  + two missing compiler procs exported
........
  r11701 | florian | 2008-09-04 16:42:34 +0200 (Thu, 04 Sep 2008) | 2 lines
  
  + lazarus project for the linux rtl
........
  r11702 | florian | 2008-09-04 16:43:27 +0200 (Thu, 04 Sep 2008) | 2 lines
  
  + set unicode string procedures
........
  r11707 | florian | 2008-09-04 23:23:02 +0200 (Thu, 04 Sep 2008) | 2 lines
  
  * fixed several type casting stuff
........
  r11712 | florian | 2008-09-05 22:46:03 +0200 (Fri, 05 Sep 2008) | 1 line
  
  * fixed unicodestring compilation on windows after recent unix changes
........
  r11713 | florian | 2008-09-05 23:35:12 +0200 (Fri, 05 Sep 2008) | 1 line
  
  + UnicodeString support for Variants
........
  r11715 | florian | 2008-09-06 20:59:54 +0200 (Sat, 06 Sep 2008) | 1 line
  
  * patch by Martin Schreiber for UnicodeString streaming
........
  r11716 | florian | 2008-09-06 22:22:55 +0200 (Sat, 06 Sep 2008) | 2 lines
  
  * fixed test
........
  r11717 | florian | 2008-09-07 10:25:51 +0200 (Sun, 07 Sep 2008) | 1 line
  
  * fixed typo when converting tunicodestring to punicodechar
........
  r11718 | florian | 2008-09-07 11:29:52 +0200 (Sun, 07 Sep 2008) | 3 lines
  
  * fixed writing of UnicodeString properties
  * moved some helper routines to unicode headers
........
  r11734 | florian | 2008-09-09 22:38:55 +0200 (Tue, 09 Sep 2008) | 1 line
  
  * fixed bootstrapping
........
  r11735 | florian | 2008-09-10 11:25:28 +0200 (Wed, 10 Sep 2008) | 2 lines
  
  * first fixes for persisten unicodestrings
........
  r11736 | florian | 2008-09-10 14:31:00 +0200 (Wed, 10 Sep 2008) | 3 lines
  
  Initialized merge tracking via "svnmerge" with revisions "1-11663" from 
  http://svn.freepascal.org/svn/fpc/trunk
........
  r11737 | florian | 2008-09-10 21:06:57 +0200 (Wed, 10 Sep 2008) | 3 lines
  
  * fixed unicodestring <-> variant handling
  * fixed unicodestring property reading
........

git-svn-id: trunk@11739 -
2008-09-10 20:14:31 +00:00
peter
060bdbcb47 * fix writing of goto node to ppu
* replace derefnode with resolveppuidx method that only needs to be
    implemented for nodes referencing other nodes
  * fix IE when a label is not defined in inline function

git-svn-id: trunk@11697 -
2008-09-03 20:46:04 +00:00
florian
615619804a + set node complexity of const. string nodes to 1
+ better approximation if a tmp. location for a parameter when inlining can be omitted

git-svn-id: trunk@11635 -
2008-08-23 07:25:53 +00:00
Jonas Maebe
5feba9b3d7 * also free memory when a destructor is called without an explicit
instance reference (mantis 11896)
  * fixed double destructor call in tests/test/cg/tcalcla1.pp which
    caused an error after this change

git-svn-id: trunk@11599 -
2008-08-17 12:38:41 +00:00
Jonas Maebe
6d0326a55b * don't call procvars passed to formal parameters (mantis #11861)
git-svn-id: trunk@11592 -
2008-08-16 14:40:51 +00:00
yury
d5c0ba9a1e * Improved warning about constructing class instance with abstract methods. Warning is issued for each method and method name is specified in the message. It makes easy to find out which abstract methods still not overrode.
git-svn-id: trunk@11450 -
2008-07-23 12:24:25 +00:00
yury
491f0fa1d8 * Replaced all user defined warnings by TODO comments to reduce compiler noise.
git-svn-id: trunk@11443 -
2008-07-23 11:00:03 +00:00
yury
e25713515b * Fixed memory leak.
git-svn-id: trunk@11437 -
2008-07-23 08:59:25 +00:00
Jonas Maebe
6ac63bcafe * also process tcallnode.funcretnode in nutils.foreachnode*(),needed
for properly synchronizing regvars after loops. The absense of this
    causes the crash in the test program of mantis #11290 under 2.2.1,
    and while it doesn't crash under 2.3.1 due to differences in the
    code generation, the bug could cause errors in other situations
    here as well)

git-svn-id: trunk@10959 -
2008-05-12 20:50:43 +00:00
micha
83b7f81f81 + add no-fpu support to compiler/rtl for powerpc-linux (-Cfnone)
git-svn-id: trunk@10422 -
2008-03-02 12:59:02 +00:00
Jonas Maebe
59d9169bbd * perform typechecking of callinit/callcleanup statements immediately when
they are added (mantis #10807), because
   a) the typecheckpass of the entire blocks has to be postponed until firstpass
      because new statements may still be added in the firstpass (otherwise
      the newly added statements in the firstpass are never typechecked due to
      the blocknode already having a resultdef set)
   b) simplify can be called between the typecheck and firstpass, and it needs
      the typeinfo

git-svn-id: trunk@10263 -
2008-02-10 11:13:33 +00:00
peter
169516ffc0 * don't optimize funcret with assignment result if the value is also used
as a parameter and the funcret is also passed as parameter. Because in that
    case both are pointing to the same memory location

git-svn-id: trunk@10159 -
2008-02-02 17:39:28 +00:00
Jonas Maebe
3521d64f4b - removed "do_count" parameter from tcallparanode.insert_typeconv
because the method was always called the same way (and it did not
    affect any counting anymore)
  * fixed and simplified read/write checking of methodpointer (mantis
    #10736)

git-svn-id: trunk@10155 -
2008-02-02 16:34:48 +00:00
Jonas Maebe
482b83c3cb * typecheckpass before calling do_simplify, as the siplify methods
assume that the resultdefs are available

git-svn-id: trunk@9652 -
2008-01-06 15:30:04 +00:00
Jonas Maebe
742ff35c48 + also optimize assignments from calls to by-reference "results":
o it's a by-reference parameter, but ignore that since it's
      guaranteed to be safe because of the escape analysis
    o it's wrapped in an absolute type conversion -> added
      actualtargetnode method to tnode which digs through that

git-svn-id: trunk@9412 -
2007-12-07 17:58:25 +00:00
Jonas Maebe
f38e190892 * don't substitute the result variable of an inlined function with
a regable variable, because this result variable of the inlined
    function may not be regable + test (mantis #10371)

git-svn-id: trunk@9409 -
2007-12-07 13:29:16 +00:00
Jonas Maebe
543faa46ad * do not inline functions/procedures called with things like "nil^"
(that can be passed to a const-by-reference or var parameter,
     but leads to errors when inlining)

git-svn-id: trunk@9281 -
2007-11-18 14:29:19 +00:00
Jonas Maebe
8f187bf6e2 * fixed r9243: that change should only be applied in case both the
parasym and the actual parameter  are a shortstring rather than
    when at least one isn't a shortstring

git-svn-id: trunk@9275 -
2007-11-17 19:58:19 +00:00
yury
4e3547c7bf * Improved warning "Converting pointers to signed integers may result in wrong comparison results and range errors, use an unsigned type instead.":
- check for procedure and class pointers as well;
  - do not warn if typecasted pointer is passed as parameter or directly assigned to a variable. 

git-svn-id: trunk@9264 -
2007-11-16 13:52:19 +00:00
Jonas Maebe
2e9db26750 * truncate constant shortstrings at the callee side if they are passed
to a value parameter with a shorter length, and if they would not be
    implicitly passed by reference (if they are passed by reference, then
    the callee will perform a shortstring assign which will do the length
    truncation). Fixes tarray3 on x86_64

git-svn-id: trunk@9243 -
2007-11-13 20:21:29 +00:00
florian
a5ccf16016 + disp. var. property setting, resolves #10133 and #9134
git-svn-id: trunk@9189 -
2007-11-11 14:14:05 +00:00
florian
7878f0feb3 * made all fpc_*_to_shortstr helpers a procedure, resolves #8580
git-svn-id: trunk@8898 -
2007-10-21 17:33:18 +00:00
peter
6b8aed593f * remove registers{int/mmx/fpu} from firstpass
* small cleanups of unused variables in firstpass
  * node_resources_fpu() created to get an approximation of the
    required fpu registers
  * for the moment use node_complexity in the CG until the
    node_resource_int() is created

git-svn-id: trunk@8655 -
2007-09-26 21:12:01 +00:00
Jonas Maebe
b79e4ff3f0 * fixed typo that broke non-i386 compilation after r8603
git-svn-id: trunk@8609 -
2007-09-22 20:46:45 +00:00
Jonas Maebe
93aad97c22 * Also take into account the node complexity of parameters to determine
the order in which they are evaluated (except for LOC_REFERENCE
    parameters on i386, because the code generator expects them in their
    original order). This saves quite a lot of spilling and uses of
    non-volatile registers when the parameters themselves also contain
    calls

git-svn-id: trunk@8603 -
2007-09-22 17:22:17 +00:00
peter
4525df9ea0 * nf_is_funcret node flag added
* remove ti_is_funcret, use new node flag instead
  * check for funcret node in doreplace instead of funcretsym

git-svn-id: trunk@8578 -
2007-09-20 20:24:30 +00:00
Jonas Maebe
2146ad614c * fixed toperator5 after r8558. The inlining logic did not take into
account that an unmodified value parameter's address could also be
    passed as the address of the complex return value (and thus be modified
    indirectly after all)

git-svn-id: trunk@8570 -
2007-09-20 18:27:59 +00:00
Jonas Maebe
4d1c4091ba + added pm_preprocess support to foreachnode
* preprocess rather than postprocess the replaceparaloads in ncal
    when inlining, because after r8558 a node is now sometimes replaced
    by a tree which still contains this same node (so postprocess
    causes endless recursion in those cases)

git-svn-id: trunk@8561 -
2007-09-19 09:17:57 +00:00
peter
e0cf015159 * refactor function result handling
* rename methodpointerinit/done to callinitblock/callcleanupblock
  * moved checks in callnode to separate functions
  * funcretnode is now always a simple node instead of a block of
    statements
  * funcret and methodpointer are generated/optimized only in pass_1 so
    a conversion from calln to loadn is much easier
  * function result assignments are much more often optimized to use the
    assignment destination location instead of using a temp

git-svn-id: trunk@8558 -
2007-09-18 22:12:07 +00:00
Jonas Maebe
666d156e8e * disabled inlining when passing a refcounted parameter typecasted to
a non-refcounted type to a procedure, as this is incompatible with
    the inlining process

git-svn-id: trunk@8391 -
2007-09-07 10:40:26 +00:00
Jonas Maebe
e1aefdbac5 * Improved escape analysis so the improved tretopt no longer fails.
The downside is that because it is context-insensitive, several
    (correct) optimizations which were performed in the past no longer
    are now (and while some new ones are done now, the downside is bigger
    -- but at least the code should be correct in all cases now)

git-svn-id: trunk@8385 -
2007-09-05 13:29:22 +00:00
Jonas Maebe
df84ca49b4 * fixed tests/cg/opt/tretopt, and also in more cases
perform the transformation of x:=f(hiddencomplexresult, ..)
    -> f(x, ...) (the compiler now performs some very
    conservative escape analysis for such types)

git-svn-id: trunk@8361 -
2007-09-02 21:27:37 +00:00
Jonas Maebe
b1631b6918 * fixed wrong uninitialized warnings with passing array elements
as out-parameters

git-svn-id: trunk@8337 -
2007-08-29 20:23:59 +00:00
peter
98cc116dd2 * fix passing string to open array of string
git-svn-id: trunk@8137 -
2007-07-22 19:44:56 +00:00
Jonas Maebe
49a2084ea0 * fixed calling inline functions (with exit statements) from inside
finally blocks
  * fixed the handling of function results of inlined functions with
    exit statements
  + test for the above two issues and for bug fixed in r8091
  * copy may_be_in_reg field inside ttempcreatenode.dogetcopy (allows
    some more temps which were needlessly forced into memory to be in
    registers)

git-svn-id: trunk@8108 -
2007-07-20 16:49:35 +00:00
Jonas Maebe
28bab3fb4f - removed some unused variables
* fixed some (harmless) ptrint warnings
  - removed some commented code in agppcmpw
  * added one missing field in a typed constant in cp1251

git-svn-id: trunk@8081 -
2007-07-17 13:57:15 +00:00
florian
7cbe76b8dc * pass only a pointer to a result when the result is used when invoking idispatch, resolves #9162
git-svn-id: trunk@7908 -
2007-07-01 15:37:36 +00:00
yury
a4dfa3b4fd * fixed bug #9107: procedure which have pushed parameters in its body fails if only -OoSTACKFRAME switch is used.
+ test.

git-svn-id: trunk@7731 -
2007-06-19 12:09:11 +00:00
daniel
9adb202a92 * Rework the constexprint to allow operations from low(int64) to high(qword).
+ Some initial work on a formaldef which also carries the typinfo of a parameter.

git-svn-id: trunk@7639 -
2007-06-13 07:41:18 +00:00
Jonas Maebe
21f87ef1de * fixed instances of passing properties as var parameter
git-svn-id: trunk@7249 -
2007-05-03 11:02:38 +00:00
florian
0d9609d614 * convert extended to double when passing it to automation dispatchers
* fix code generation for automation dispatching of doubles

git-svn-id: trunk@7184 -
2007-04-28 19:35:51 +00:00
daniel
d0e162317b * Fix indentation.
git-svn-id: trunk@6998 -
2007-03-25 14:38:45 +00:00
daniel
d4de54402c * In genhightree, do typecheckpass later to prevent references to possibly
optimizes away nodes.

git-svn-id: trunk@6994 -
2007-03-25 13:11:29 +00:00
Jonas Maebe
168e652d42 + support for simplifying simple inline functions down to a single
constant node (rather than to just a blocknode with a statement
    assigning a constant to a temp)

git-svn-id: trunk@6832 -
2007-03-13 22:27:55 +00:00
Jonas Maebe
c13ff3729b * Merged 2.3 branch changes:
+ darwin/ppc64 support
    + val/str/read(ln)/write(ln) support for enums
    + simple cse at the node tree level
    + if-node simplify support
    + simple ssa support for memory locations
    + support for optional overflow/rangecheck boolean parameters for
      operators
    * a lot of unification of the ppc32/ppc64 code generators


........
r6380 | jonas | 2007-02-08 21:25:36 +0100 (Thu, 08 Feb 2007) | 4 lines
Changed paths:
   M /branches/fpc_2_3/compiler/ncgld.pas
   M /branches/fpc_2_3/compiler/tgobj.pas
   A /branches/fpc_2_3/tests/webtbs/tw8283.pp

  + support for replacing the memory location of a temp (including
    local variables) with that of another temp to avoid unnecessary
    copies (mantis #8283)

........
r6381 | jonas | 2007-02-08 22:53:36 +0100 (Thu, 08 Feb 2007) | 2 lines
Changed paths:
   M /branches/fpc_2_3/compiler/nflw.pas
   A /branches/fpc_2_3/tests/webtbs/tw8282.pp

  + simplify support for ifn (based on patch by Florian)

........
r6386 | peter | 2007-02-09 13:48:53 +0100 (Fri, 09 Feb 2007) | 2 lines
Changed paths:
   M /branches/fpc_2_3/compiler/htypechk.pas
   M /branches/fpc_2_3/compiler/ncal.pas
   M /branches/fpc_2_3/compiler/symconst.pas

  * overflow,rangecheck optional parameters for operators, patch from 8281

........
r6391 | jonas | 2007-02-09 23:52:13 +0100 (Fri, 09 Feb 2007) | 4 lines
Changed paths:
   M /branches/fpc_2_3/compiler/powerpc/agppcgas.pas
   M /branches/fpc_2_3/compiler/powerpc64/cpunode.pas
   D /branches/fpc_2_3/compiler/powerpc64/nppcinl.pas
   M /branches/fpc_2_3/compiler/ppcgen/ngppcinl.pas

  * merged fsqrt(s) support to common powerpc unit, activate for ppc32
    if -Op970 is used (still default for ppc64, since default cpu there
    is already ppc970)

........
r6394 | jonas | 2007-02-10 18:58:47 +0100 (Sat, 10 Feb 2007) | 4 lines
Changed paths:
   M /branches/fpc_2_3/compiler/powerpc/cgcpu.pas
   M /branches/fpc_2_3/compiler/powerpc64/cgcpu.pas
   M /branches/fpc_2_3/compiler/ppcgen/cgppc.pas

  * adapted a_jmp_name for darwin/ppc64
  * merged g_intf_wrapper for ppc32 and ppc64, and added darwin/ppc64
    support to it

........
r6396 | jonas | 2007-02-10 20:16:06 +0100 (Sat, 10 Feb 2007) | 2 lines
Changed paths:
   M /branches/fpc_2_3/compiler/cgobj.pas

  + darwin/ppc64 support for g_indirect_sym_load

........
r6397 | jonas | 2007-02-10 20:22:49 +0100 (Sat, 10 Feb 2007) | 4 lines
Changed paths:
   M /branches/fpc_2_3/compiler/powerpc/cgcpu.pas
   M /branches/fpc_2_3/compiler/powerpc64/cgcpu.pas
   M /branches/fpc_2_3/compiler/ppcgen/cgppc.pas

  + darwin/ppc64 support to ppc64's fixref
  * moved ppc32 a_load_store to cgppc and use it for darwin/ppc64 as
    well (its relocatable symbols are only 32 bits large)

........
r6399 | jonas | 2007-02-10 22:02:37 +0100 (Sat, 10 Feb 2007) | 4 lines
Changed paths:
   M /branches/fpc_2_3/compiler/systems.pas

  + system_x86_64_darwin identifier
  + set default source system for system_x86_64_darwin and
    system_powerpc64_darwin

........
r6404 | jonas | 2007-02-10 23:01:23 +0100 (Sat, 10 Feb 2007) | 5 lines
Changed paths:
   M /branches/fpc_2_3/compiler/aasmdata.pas
   M /branches/fpc_2_3/compiler/aggas.pas
   M /branches/fpc_2_3/compiler/cgobj.pas
   M /branches/fpc_2_3/compiler/cgutils.pas
   M /branches/fpc_2_3/compiler/cresstr.pas
   M /branches/fpc_2_3/compiler/dbgdwarf.pas
   M /branches/fpc_2_3/compiler/dbgstabs.pas
   M /branches/fpc_2_3/compiler/ncgutil.pas
   M /branches/fpc_2_3/compiler/ogelf.pas
   M /branches/fpc_2_3/compiler/pdecvar.pas
   M /branches/fpc_2_3/compiler/pmodules.pas
   M /branches/fpc_2_3/compiler/symdef.pas
   M /branches/fpc_2_3/compiler/systems.pas

  + system_x86_64_darwin identifier
  + systems_darwin set which collects all darwin variants
  + added support for darwin/ppc64 and darwin/x86_64 where needed in
    the generic code

........
r6406 | jonas | 2007-02-10 23:24:32 +0100 (Sat, 10 Feb 2007) | 2 lines
Changed paths:
   M /branches/fpc_2_3/compiler/cgobj.pas

  * ifdef cpu64 -> ifdef cpu64bit

........
r6409 | jonas | 2007-02-11 00:34:04 +0100 (Sun, 11 Feb 2007) | 2 lines
Changed paths:
   M /branches/fpc_2_3/compiler/pdecvar.pas

  * fixed ppc64 compilation

........
r6413 | jonas | 2007-02-11 12:41:27 +0100 (Sun, 11 Feb 2007) | 2 lines
Changed paths:
   M /branches/fpc_2_3/rtl/bsd/system.pp
   M /branches/fpc_2_3/rtl/darwin/powerpc/sig_cpu.inc
   M /branches/fpc_2_3/rtl/darwin/signal.inc

  + darwin/ppc64 support for signal routines

........
r6415 | jonas | 2007-02-11 13:54:53 +0100 (Sun, 11 Feb 2007) | 2 lines
Changed paths:
   M /branches/fpc_2_3/compiler/systems/i_linux.pas

  * set abi of linux/ppc64 to abi_powerpc_sysv

........
r6416 | jonas | 2007-02-11 13:55:51 +0100 (Sun, 11 Feb 2007) | 2 lines
Changed paths:
   M /branches/fpc_2_3/compiler/powerpc64/cputarg.pas
   M /branches/fpc_2_3/compiler/systems/i_bsd.pas
   M /branches/fpc_2_3/compiler/systems/t_bsd.pas

  + darwin/ppc64 source and target information

........
r6418 | jonas | 2007-02-11 14:19:55 +0100 (Sun, 11 Feb 2007) | 2 lines
Changed paths:
   M /branches/fpc_2_3/rtl/powerpc64/math.inc

  * darwin/ppc64 compilation fixes

........
r6419 | jonas | 2007-02-11 14:22:22 +0100 (Sun, 11 Feb 2007) | 2 lines
Changed paths:
   M /branches/fpc_2_3/compiler/powerpc/cgcpu.pas
   M /branches/fpc_2_3/compiler/powerpc64/cgcpu.pas
   M /branches/fpc_2_3/compiler/ppcgen/cgppc.pas

  * darwin/ppc64 needs the 32 bit version of a_loadaddr_ref_reg

........
r6420 | jonas | 2007-02-11 14:22:55 +0100 (Sun, 11 Feb 2007) | 2 lines
Changed paths:
   M /branches/fpc_2_3/utils/fpcm/fpcmmain.pp

  + darwin/ppc64 support

........
r6426 | jonas | 2007-02-11 16:13:19 +0100 (Sun, 11 Feb 2007) | 2 lines
Changed paths:
   M /branches/fpc_2_3/compiler/powerpc64/rappcgas.pas

  * fixed refaddr parsing for darwin/ppc64

........
r6427 | jonas | 2007-02-11 16:14:21 +0100 (Sun, 11 Feb 2007) | 2 lines
Changed paths:
   M /branches/fpc_2_3/compiler/powerpc/agppcgas.pas
   M /branches/fpc_2_3/compiler/powerpc64/agppcgas.pas
   A /branches/fpc_2_3/compiler/ppcgen/agppcutl.pas

  * moved ppc32/ppc64 assembler writer helpers to a common unit

........
r6430 | jonas | 2007-02-11 17:53:23 +0100 (Sun, 11 Feb 2007) | 4 lines
Changed paths:
   D /branches/fpc_2_3/rtl/darwin/powerpc/sig_cpu.inc
   D /branches/fpc_2_3/rtl/darwin/powerpc/sighnd.inc
   A /branches/fpc_2_3/rtl/darwin/powerpc64
   A /branches/fpc_2_3/rtl/darwin/powerpc64/sig_cpu.inc
   A /branches/fpc_2_3/rtl/darwin/powerpc64/sighnd.inc
   A /branches/fpc_2_3/rtl/darwin/ppcgen
   A /branches/fpc_2_3/rtl/darwin/ppcgen/ppchnd.inc (from /branches/fpc_2_3/rtl/darwin/powerpc/sighnd.inc:6422)
   A /branches/fpc_2_3/rtl/darwin/ppcgen/sig_ppc.inc (from /branches/fpc_2_3/rtl/darwin/powerpc/sig_cpu.inc:6422)
   M /branches/fpc_2_3/rtl/darwin/signal.inc

  * fixed ppc/ppc64 signal include handling (both real files are in
    ppcgen, dummies in powerpc and powerpc64 which include those files)
    (1st step because pre-commit filter can't handle replaced files)

........
r6431 | jonas | 2007-02-11 17:53:47 +0100 (Sun, 11 Feb 2007) | 2 lines
Changed paths:
   A /branches/fpc_2_3/rtl/darwin/powerpc/sig_cpu.inc
   A /branches/fpc_2_3/rtl/darwin/powerpc/sighnd.inc

  * second step of signal include patch

........
r6432 | jonas | 2007-02-11 19:00:12 +0100 (Sun, 11 Feb 2007) | 2 lines
Changed paths:
   M /branches/fpc_2_3/compiler/systems/t_bsd.pas

  * changed darwin checks to use systems_darwin constant

........
r6433 | jonas | 2007-02-11 19:05:38 +0100 (Sun, 11 Feb 2007) | 3 lines
Changed paths:
   M /branches/fpc_2_3/compiler/powerpc64/cgcpu.pas

  * handle non-multiple-of-4 offsets with 64 bit loads/stores for
    darwin/ppc64

........
r6434 | jonas | 2007-02-11 19:05:56 +0100 (Sun, 11 Feb 2007) | 2 lines
Changed paths:
   D /branches/fpc_2_3/compiler/powerpc/agppcgas.pas
   D /branches/fpc_2_3/compiler/powerpc64/agppcgas.pas
   A /branches/fpc_2_3/compiler/ppcgen/agppcgas.pas (from /branches/fpc_2_3/compiler/ppcgen/agppcutl.pas:6427)
   D /branches/fpc_2_3/compiler/ppcgen/agppcutl.pas

  * completely merged ppc assembler writers

........
r6435 | jonas | 2007-02-11 19:06:40 +0100 (Sun, 11 Feb 2007) | 2 lines
Changed paths:
   M /branches/fpc_2_3/rtl/darwin/console.pp
   M /branches/fpc_2_3/rtl/darwin/termiosproc.inc

  * fixed 64 bit compilation

........
r6436 | jonas | 2007-02-11 19:09:28 +0100 (Sun, 11 Feb 2007) | 3 lines
Changed paths:
   M /branches/fpc_2_3/packages/extra/Makefile.fpc

  * universal interfaces aren't 64 bit ready yet -> only compile for
    darwin/ppc and darwin/i386

........
r6438 | jonas | 2007-02-11 19:22:34 +0100 (Sun, 11 Feb 2007) | 2 lines
Changed paths:
   A /branches/fpc_2_3/tests/test/cg/obj/darwin/powerpc64
   A /branches/fpc_2_3/tests/test/cg/obj/darwin/powerpc64/ctest.o
   A /branches/fpc_2_3/tests/test/cg/obj/darwin/powerpc64/tcext3.o
   A /branches/fpc_2_3/tests/test/cg/obj/darwin/powerpc64/tcext4.o
   A /branches/fpc_2_3/tests/test/cg/obj/darwin/powerpc64/tcext5.o

  + compiled for darwin/ppc64

........
r6439 | jonas | 2007-02-11 20:24:42 +0100 (Sun, 11 Feb 2007) | 2 lines
Changed paths:
   M /branches/fpc_2_3/compiler/ppcgen/cgppc.pas

  * patch from Thomas to fix linux/ppc64

........
r6440 | jonas | 2007-02-11 20:25:15 +0100 (Sun, 11 Feb 2007) | 2 lines
Changed paths:
   M /branches/fpc_2_3/compiler/systems.pas

  * fixed setting source OS for darwin/ppc64

........
r6444 | florian | 2007-02-11 22:24:20 +0100 (Sun, 11 Feb 2007) | 2 lines
Changed paths:
   M /branches/fpc_2_3/compiler/globtype.pas
   M /branches/fpc_2_3/compiler/nopt.pas
   M /branches/fpc_2_3/compiler/nutils.pas
   M /branches/fpc_2_3/compiler/optcse.pas
   M /branches/fpc_2_3/compiler/psub.pas

+ first node cse implementation

........
r6445 | jonas | 2007-02-11 22:30:07 +0100 (Sun, 11 Feb 2007) | 6 lines
Changed paths:
   M /branches/fpc_2_3/compiler/cresstr.pas

  * hack to work around strange darwin/ppc64 linker bug: it seems to
    have problems if you put a global symbol at the end of a section
    without any data following (at least in case of the resource strings
    section) -> add dummy byte at the end for darwin/ppc64 (otherwise
    it messes up the address of the first symbol stub entry)

........
r6449 | jonas | 2007-02-11 23:23:44 +0100 (Sun, 11 Feb 2007) | 4 lines
Changed paths:
   M /branches/fpc_2_3/compiler/systems/i_bsd.pas

  * cpupowerpc is defined for both ppc32 and ppc64 ->
    changed to cpupowerpc32 to avoid defining source
    wrongly on ppc64

........
r6450 | jonas | 2007-02-11 23:26:34 +0100 (Sun, 11 Feb 2007) | 3 lines
Changed paths:
   M /branches/fpc_2_3/compiler/ppcgen/ngppcset.pas

  * disable jump tables for darwin/ppc64 for now, don't work
    yet for some reason

........
r6451 | florian | 2007-02-11 23:54:37 +0100 (Sun, 11 Feb 2007) | 3 lines
Changed paths:
   M /branches/fpc_2_3/compiler/ncal.pas
   M /branches/fpc_2_3/compiler/nutils.pas
   M /branches/fpc_2_3/compiler/optcse.pas

* improved cse
* better complexity calculation for subscript nodes with classes or interfaces

........
r6456 | jonas | 2007-02-12 19:33:22 +0100 (Mon, 12 Feb 2007) | 4 lines
Changed paths:
   M /branches/fpc_2_3/compiler/nutils.pas

  + support for notn,shln,shrn,equaln,unequaln,gtn,gten,ltn,lten in
    node_cplexity()
  * mark muln,divn,modn as more complex

........
r6469 | jonas | 2007-02-13 15:56:01 +0100 (Tue, 13 Feb 2007) | 2 lines
Changed paths:
   M /branches/fpc_2_3/compiler/optcse.pas

  * fixed when cross-compiling a 64 bit compiler from a 32 bit platform

........
r6471 | jonas | 2007-02-13 16:17:16 +0100 (Tue, 13 Feb 2007) | 3 lines
Changed paths:
   M /branches/fpc_2_3/compiler/powerpc64/cputarg.pas

  * include stabs support (can work on darwin/ppc64, but doesn't work
    yet)

........
r6473 | jonas | 2007-02-13 16:45:48 +0100 (Tue, 13 Feb 2007) | 3 lines
Changed paths:
   M /branches/fpc_2_3/compiler/powerpc64/cgcpu.pas
   M /branches/fpc_2_3/compiler/powerpc64/cpupara.pas

  * R2 is a volatile and usable register under darwin/ppc64
  * R13 is a reserved non-volatile register under darwin/ppc64 (tls)

........
r6479 | jonas | 2007-02-13 20:40:50 +0100 (Tue, 13 Feb 2007) | 3 lines
Changed paths:
   M /branches/fpc_2_3/compiler/systems/i_bsd.pas

  * maxCrecordalign seems to have to be 8 rather 4, in spite of what
    the ABI docs say (although they are contradictory to some extent)

........
r6487 | jonas | 2007-02-14 15:57:40 +0100 (Wed, 14 Feb 2007) | 2 lines
Changed paths:
   M /branches/fpc_2_3/tests/webtbs/tw8153a.pp

  * fixed for darwin/ppc64

........
r6488 | jonas | 2007-02-14 15:58:56 +0100 (Wed, 14 Feb 2007) | 2 lines
Changed paths:
   M /branches/fpc_2_3/tests/webtbs/tw7851a.pp

  * fixed for darwin/ppc64

........
r6494 | jonas | 2007-02-15 19:36:55 +0100 (Thu, 15 Feb 2007) | 3 lines
Changed paths:
   M /branches/fpc_2_3/compiler/systems/i_bsd.pas

  * set default debug info for darwin/ppc64 to dwarf2 since
    it works better than stabs currently

........
r6500 | jonas | 2007-02-15 21:38:16 +0100 (Thu, 15 Feb 2007) | 2 lines
Changed paths:
   M /branches/fpc_2_3/compiler/version.pas

  * updated version to 2.3.0

........
r6505 | jonas | 2007-02-15 22:39:28 +0100 (Thu, 15 Feb 2007) | 2 lines
Changed paths:
   M /branches/fpc_2_3/compiler/version.pas

  * changed version to 2.3.1

........
r6511 | jonas | 2007-02-16 15:17:24 +0100 (Fri, 16 Feb 2007) | 2 lines
Changed paths:
   M /branches/fpc_2_3/compiler/powerpc64/itcpugas.pas

  * system_powerpc_darwin -> system_powerpc64_darwin

........
r6546 | daniel | 2007-02-18 15:48:54 +0100 (Sun, 18 Feb 2007) | 2 lines
Changed paths:
   M /branches/fpc_2_3/compiler/ncginl.pas
   M /branches/fpc_2_3/compiler/ncgld.pas
   M /branches/fpc_2_3/compiler/ncgrtti.pas
   M /branches/fpc_2_3/compiler/ncnv.pas
   M /branches/fpc_2_3/compiler/ninl.pas
   M /branches/fpc_2_3/compiler/nld.pas
   M /branches/fpc_2_3/compiler/nutils.pas
   M /branches/fpc_2_3/compiler/pinline.pas
   M /branches/fpc_2_3/rtl/inc/astrings.inc
   M /branches/fpc_2_3/rtl/inc/compproc.inc
   M /branches/fpc_2_3/rtl/inc/sstrings.inc
   M /branches/fpc_2_3/rtl/inc/text.inc
   M /branches/fpc_2_3/rtl/inc/wstrings.inc

  + Val/str/read/write support for enumeration types.

........
r6547 | daniel | 2007-02-18 17:01:20 +0100 (Sun, 18 Feb 2007) | 2 lines
Changed paths:
   M /branches/fpc_2_3/rtl/inc/sstrings.inc

  * Fix val code that I broke.

........
r6571 | daniel | 2007-02-20 09:27:44 +0100 (Tue, 20 Feb 2007) | 2 lines
Changed paths:
   M /branches/fpc_2_3/rtl/inc/astrings.inc
   M /branches/fpc_2_3/rtl/inc/sstrings.inc
   M /branches/fpc_2_3/rtl/inc/text.inc
   M /branches/fpc_2_3/rtl/inc/wstrings.inc

  * o2s -> ord2str, s2o -> str2ord

........
r6572 | daniel | 2007-02-20 09:33:30 +0100 (Tue, 20 Feb 2007) | 2 lines
Changed paths:
   M /branches/fpc_2_3/compiler/ncgld.pas
   M /branches/fpc_2_3/compiler/ncgrtti.pas
   M /branches/fpc_2_3/compiler/ninl.pas
   M /branches/fpc_2_3/compiler/nld.pas

  * o2s -> ord2str, s2o -> str2ord

........
r6574 | daniel | 2007-02-20 12:07:58 +0100 (Tue, 20 Feb 2007) | 2 lines
Changed paths:
   M /branches/fpc_2_3/rtl/inc/compproc.inc

  * o2s -> ord2str, s2o -> str2ord

........
r6578 | daniel | 2007-02-20 22:18:49 +0100 (Tue, 20 Feb 2007) | 2 lines
Changed paths:
   M /branches/fpc_2_3/rtl/inc/text.inc

  * Change longint to valsint.

........
r6579 | daniel | 2007-02-20 22:29:09 +0100 (Tue, 20 Feb 2007) | 2 lines
Changed paths:
   M /branches/fpc_2_3/compiler/ninl.pas

  * Handle ordinal currency types.

........
r6580 | jonas | 2007-02-20 22:29:11 +0100 (Tue, 20 Feb 2007) | 2 lines
Changed paths:
   M /branches/fpc_2_3/compiler/ncgrtti.pas

  * fixed compilation for cpurequiresproperalignment

........
r6581 | jonas | 2007-02-20 22:30:21 +0100 (Tue, 20 Feb 2007) | 2 lines
Changed paths:
   M /branches/fpc_2_3/compiler/ninl.pas

  * fixed typo

........
r6582 | daniel | 2007-02-20 22:36:19 +0100 (Tue, 20 Feb 2007) | 2 lines
Changed paths:
   M /branches/fpc_2_3/compiler/ninl.pas

  * Set is_real to true.

........
r6590 | jonas | 2007-02-21 20:23:54 +0100 (Wed, 21 Feb 2007) | 2 lines
Changed paths:
   M /branches/fpc_2_3/compiler/systems/i_bsd.pas

  * set tf_dwarf_only_local_labels for darwin/ppc64

git-svn-id: trunk@6720 -
2007-03-04 20:16:57 +00:00
florian
fd392dc2b6 * allow inherited; calling abstract methods in delphi mode, resolves #5896
git-svn-id: trunk@6651 -
2007-02-25 18:46:10 +00:00
tom_at_work
106fe68ce6 * renamed TStringList to TCmdStrList, in general use TCmdStr instead of shortstrings to fix bug #6351
git-svn-id: trunk@6215 -
2007-01-26 22:29:39 +00:00
Jonas Maebe
d614eab0fb * don't call afterconstruction/beforedestruction in case an exception
is raised in a constructor (mantis 8222)

git-svn-id: trunk@6202 -
2007-01-26 17:38:53 +00:00
Jonas Maebe
3e153102a8 * fixed calling class methods via classrefdefs (mantis #8145)
git-svn-id: trunk@6075 -
2007-01-19 18:05:58 +00:00
Jonas Maebe
3d99dcc178 * object constructors/methods obviously can also read the object
git-svn-id: trunk@6022 -
2007-01-17 10:09:41 +00:00
Jonas Maebe
9ad579855e * fixed webtbf/tw3631
* properly set vs_read/written status for tp-style objects
    without vmt of which a method is called

git-svn-id: trunk@6005 -
2007-01-16 21:15:21 +00:00
Jonas Maebe
38d54234d7 * fixed crash when calling a procvar with too many parameters
(mantis 8109)

git-svn-id: trunk@5951 -
2007-01-13 18:38:04 +00:00
peter
d2c8e7429e * include parameter types for checking abstract calls
git-svn-id: trunk@5911 -
2007-01-11 22:23:04 +00:00
peter
0f70e42920 * abstractmethodlist to tfphashlist
git-svn-id: trunk@5908 -
2007-01-11 21:53:12 +00:00
Jonas Maebe
2ddeca21e6 * don't give warning about constructing instance with abstract methods
for self.create calls + tests

git-svn-id: trunk@5810 -
2007-01-04 13:02:23 +00:00
florian
a2ec2e72b6 * better hint about abstract methods (fixes 5098)
+ code generation for invoking dispinterface methods
* small dispinterface problems fixed

git-svn-id: trunk@5798 -
2007-01-03 19:14:31 +00:00
florian
d5291d0e18 + handle variant dispatching
git-svn-id: trunk@5771 -
2006-12-31 17:50:29 +00:00
Jonas Maebe
47ff7b62e7 * fixed overload choosing algorithm so it's Delphi-compatible +
tests (and test generator) (also fixes mantis 6641)

git-svn-id: trunk@5732 -
2006-12-28 16:54:07 +00:00
Jonas Maebe
e4a2fb7f35 * fixed mantis 7975 and 7107 (ie 200311075 when working using somewhat
complex method calls in inlined procedures)

git-svn-id: trunk@5666 -
2006-12-21 21:03:47 +00:00
Jonas Maebe
89349c2f1a * fixed web bug #7963 (crash when trying to print the name of a procvar
with too few parameters specified)

git-svn-id: trunk@5591 -
2006-12-14 15:57:17 +00:00
Jonas Maebe
d7633e9dd0 * removed wrong comment from r5389 (no longer applicable since r5390)
git-svn-id: trunk@5539 -
2006-12-04 14:13:45 +00:00
Jonas Maebe
7c387c9f82 - removed double initialisation of local typed constants/initialised
variables (initialization code of inlined routines is stored/loaded
    from ppu as wel)

git-svn-id: trunk@5538 -
2006-12-04 14:10:10 +00:00
Jonas Maebe
9e60d6791d * show name of procedure/function called with too few parameters
git-svn-id: trunk@5522 -
2006-12-01 20:15:57 +00:00
tom_at_work
3b6d5c3676 - cleanup, fixing of uninitialized variables, missing return values and unused variables
git-svn-id: trunk@5502 -
2006-11-26 21:54:23 +00:00
Jonas Maebe
5444207df8 * better fix for tw1623 (generates more optimal code)
git-svn-id: trunk@5390 -
2006-11-15 14:15:00 +00:00
Jonas Maebe
248046320a * fixed inlining of functions called in their own parameters (tw1623)
git-svn-id: trunk@5389 -
2006-11-15 09:56:11 +00:00
peter
0557ddc342 * removed typed const, it is now handled by staticvarsym
* globalvarsym renamed to staticvarsym
  * fixed invalid regvar use in init when the finalize also uses the var

git-svn-id: trunk@5290 -
2006-11-08 21:04:22 +00:00
peter
f88e6a834e * typo
git-svn-id: trunk@5255 -
2006-11-05 21:19:41 +00:00
florian
5cbc15b339 * some variant dispatching stuff fixed
git-svn-id: trunk@5254 -
2006-11-05 21:07:59 +00:00
florian
a13d358f1e * first partially working implementation of variant com invoking
git-svn-id: trunk@5247 -
2006-11-05 15:34:15 +00:00
florian
c947295cb8 + ttertiarynode
* traise node refactored using tertiarynode
* more dipatch stuff

git-svn-id: trunk@5215 -
2006-11-03 23:03:31 +00:00
peter
e17b424e28 * refactor procsym procdef list
git-svn-id: trunk@5210 -
2006-11-03 18:44:46 +00:00
peter
658c46b903 * remove tdictionary and tindexarray
* symtables based on TFPHashObjectList and TFPObjectList
  * rename torddef.typ to torddef.ordtype
  * rename tfloatdef.typ to tfloatdef.floattype
  * rename tdef.deftype to tdef.typ
  * remove obsolete browser code, browcol is kept so the ide
    can still be compiled

git-svn-id: trunk@5192 -
2006-11-03 00:30:30 +00:00
florian
be2b715d3c + parsing of disp variant invokes
git-svn-id: trunk@5162 -
2006-11-01 21:23:04 +00:00
florian
ef7bd58c54 * germanism removed (aktfilepos -> current_filepos)
git-svn-id: trunk@5099 -
2006-10-30 22:37:31 +00:00
florian
85d63d9fa9 * settings refactored
git-svn-id: trunk@5094 -
2006-10-30 18:02:58 +00:00
daniel
1406181aa5 * Fix incorrect usage of result value.
git-svn-id: trunk@5090 -
2006-10-30 10:32:56 +00:00
peter
3078a1927f * remove ttype
* rename old ttype variables *type to *def
  * rename resulttypepass to pass_typecheck
  * rename pass_2 to pass_generate_code

git-svn-id: trunk@5077 -
2006-10-29 22:19:39 +00:00
daniel
de423ab5b0 + stringvar[l..h] now valid parameter for open array of char.
git-svn-id: trunk@5038 -
2006-10-27 22:23:25 +00:00
daniel
068c0f7952 * Cleaner implementation of pointer index to open array, codegen changes
no longer necessary and therefore reverted.

git-svn-id: trunk@5037 -
2006-10-27 20:57:51 +00:00
daniel
2450f5a778 + First working concept of open_array_procedure(Pbyte_var[0..9]);
git-svn-id: trunk@5028 -
2006-10-26 20:30:16 +00:00
Jonas Maebe
0a23786605 - reverted r4880 (wrong varargs reform) and r4838 (wrong removal of
varargs/array of const overloads)
  * arrayconstructor and array of const are no longer compatible with
    the extra varargs parameters (so overloaded varargs and array of
    const cdecl functions can be distinguished)
  * fixed tprintf2 for the correct varargs syntax

git-svn-id: trunk@4909 -
2006-10-14 17:39:00 +00:00
florian
9288a2f76d + more verbose printnode for call nodes
git-svn-id: trunk@4892 -
2006-10-13 21:19:14 +00:00
Jonas Maebe
e9cabd17e1 * fixed handling of "varargs" procedures (i.e., those without an explicit
array-of-const parameter)

git-svn-id: trunk@4880 -
2006-10-13 12:35:17 +00:00
florian
02d0ac4c3e + only procedures doing recursive calls are checked for tail recursivity
+ parameters are tested if they are usable with tail recursion removal

git-svn-id: trunk@4853 -
2006-10-10 20:29:48 +00:00
peter
d07f470b71 * remove ifdef fpc
git-svn-id: trunk@4819 -
2006-10-07 13:43:34 +00:00
micha
d704af7216 fix compilation for {$T+} linux/win
git-svn-id: trunk@4794 -
2006-10-04 20:43:55 +00:00
peter
2f0ce31751 * string concat changed from function to procedure to
allow runtime optimization if the destination is the
    same as a source parameter
  * tassignmentnode now sets aktassignmentnode global that can be used
    to use the left node as a destination parameter and
    skip the assignment
  * disabled all cpu specific shortstr concat/append

git-svn-id: trunk@4770 -
2006-10-02 20:00:06 +00:00
Jonas Maebe
733f559267 * also perform C varargs type conversions for cdecl procedures declared
as "varargs" instead of using an array of const parameter

git-svn-id: trunk@4572 -
2006-09-08 16:04:15 +00:00
yury
2df42b29af * removed "Note: Local variable "X" is assigned but never used" when the variable is passed to procedure/function as OUT parameter.
git-svn-id: trunk@4257 -
2006-07-19 18:19:41 +00:00
Jonas Maebe
84d1fc929f * properly set regvarability of parameters and local variables of inlined
functions
  * fixed setting of expectloc for fields of regvar'ed records

git-svn-id: trunk@3607 -
2006-05-20 23:37:55 +00:00
Jonas Maebe
e0250bcdb4 * never remove regvar-ability of parameters passed by reference
(previously worked only for var/out, now also for const and
     is more generic)

git-svn-id: trunk@3554 -
2006-05-17 13:38:02 +00:00
peter
ae0010ad6c * support proc to procvar conversion for overloaded procdefs passed to parameters
git-svn-id: trunk@2997 -
2006-03-21 07:51:54 +00:00
Jonas Maebe
4db6e1ddb8 * moved type conversion of C varargs from tcallnode to
tarrayconstructornode.inset_typeconvs() and fixed them:
    * integers < 32 bit are converted to 32 bit (this was previously
      done in the code generator for some targets, and not for others)
    * currency is also converted to double for targets where currency = int64
    * single is converted to double, except for x86_64 (is at least
      necessary on darwin/ppc, darwin/i386 and linux/i386)
    * enums are converted to 32 bit ints
    * procvars are converted to pointers
    * proper errors are given for various unsupported types
   NOTE: in C, floating point constants are by default double, while in
    FPC they are of type extended. On platforms where extended <> double,
    such constants when passed to C varargs are automatically converted
    to double by default (gives warning). If you want to pass them as
    single or extended or get rid of the warning, use an explicit typecast
  * increased ppu version because of introduction of new node flag
    (nf_cvarargs for tarrayconstructornode)
  * fixed tests/test/cg/tprintf
  * changed tests/test/cg/cdecl/taoc5 to use explicit typecasts for
    floating point constants passed to C varargs functions.

git-svn-id: trunk@2949 -
2006-03-17 22:26:48 +00:00
peter
b6e35a200e * rewrite of optimizer options
git-svn-id: trunk@2901 -
2006-03-13 09:05:50 +00:00
peter
38c0ae73da Merged revisions 2775,2788-2789 via svnmerge from
http://svn.freepascal.org/svn/fpc/branches/linker/compiler

........
r2775 | peter | 2006-03-05 22:43:30 +0100 (Sun, 05 Mar 2006) | 2 lines

  * merge ppu changes to keep ppus the same

........
r2788 | peter | 2006-03-06 12:59:14 +0100 (Mon, 06 Mar 2006) | 2 lines

  * Add TFPList and TFPObjectList

........
r2789 | peter | 2006-03-06 13:01:37 +0100 (Mon, 06 Mar 2006) | 2 lines

  * fix powerpc

........

git-svn-id: trunk@2790 -
2006-03-06 12:04:44 +00:00
Jonas Maebe
791be20f28 * committed wrong file in r2614 (ncal.pas instead of pexpr.pas)
git-svn-id: trunk@2616 -
2006-02-17 09:05:03 +00:00
Jonas Maebe
a15505521c * fixed handling of wrong invocations of slice + improved error reporting
git-svn-id: trunk@2614 -
2006-02-16 20:27:31 +00:00
Jonas Maebe
765fe2b2ab * fixed bug #4737 (check for potential range errors in for-loop
assignment, report correct column for potential range errors of
    call parameters)
  * refactored code to check potential range check errors (check_ranges
    in htypechk)

git-svn-id: trunk@2501 -
2006-02-09 17:39:22 +00:00
Jonas Maebe
0dc6d51c08 * fixed displaying of hints such for procedures and functions
(and moved check_hints from pbase to htypechk) (forgot to commit earlier)

git-svn-id: trunk@2469 -
2006-02-07 14:23:38 +00:00
peter
232555904e * symtablestack cleanup and rewrite
git-svn-id: trunk@2448 -
2006-02-05 22:24:18 +00:00
peter
45176ea2a8 * split tstringtype for stringdef and stringconstnode
to prevent wrong typecasts

git-svn-id: trunk@2276 -
2006-01-13 17:20:27 +00:00
Jonas Maebe
9c2ee3a722 * fixed web bug #4086: do not create a refcounted temp for
interface temps created for complex callnodes

git-svn-id: trunk@2165 -
2006-01-04 21:07:10 +00:00
florian
f7d2c47f73 + no stackframe is generated for i386 if possible
git-svn-id: trunk@2162 -
2006-01-04 19:19:06 +00:00
Jonas Maebe
cbb59be2f1 * fixed web bug #4651 + test
git-svn-id: trunk@2108 -
2006-01-01 20:19:38 +00:00
Jonas Maebe
d6559f594d * also make "out" parameters unique
git-svn-id: trunk@2043 -
2005-12-23 23:48:48 +00:00
Károly Balogh
238964e443 Various m68k fixes/additions:
- fixes in asmreader, basic stuff works again, the rest is untested
  - removed lot of unnecessary ungetcpuregister()s
  - various other fixes i forgot
  + basic amigaos syscalls support. still lacks explicit funcretloc

git-svn-id: trunk@1943 -
2005-12-13 20:42:15 +00:00
Jonas Maebe
52ca5e6922 * use more precise vs_* information to replace less parameters of inlined
procedures with const and value parameters with temps, allowing a bit
    more value propagation
  + tinline6.pp for testing wrong propagation of value parameters in
    dangerous situations

git-svn-id: trunk@1914 -
2005-12-10 17:01:07 +00:00
Jonas Maebe
42ec76598c * new categories for vs_*: vs_declared, vs_initialised, vs_read,
vs_written, vs_readwritten. vs_initialised is the old vs_assigned;
    vs_used has been replaced by vs_read, vs_written and vs_readwritten
  * the valid_for_*() routines in htypechk now get an extra parameter to
    decide whether or not errors should be reported

git-svn-id: trunk@1913 -
2005-12-10 16:51:26 +00:00
peter
f622915690 * fix infinite loop in createinlineparas
git-svn-id: trunk@1456 -
2005-10-18 05:51:13 +00:00
florian
71b90d4d00 + slice implemented
git-svn-id: trunk@1384 -
2005-10-15 16:48:27 +00:00