Commit Graph

289 Commits

Author SHA1 Message Date
Jonas Maebe
7566ddcc8f * add a tdef to each parameter location and set it for all target
backends (not yet used, will be used in high level code generator)

git-svn-id: trunk@24761 -
2013-06-02 10:24:02 +00:00
Jonas Maebe
f985149163 * fixed compilation after r24661 (added dummy overloads for newly
implemented LOC_MMREGISTER hlcgobj methods)

git-svn-id: trunk@24731 -
2013-06-01 16:48:11 +00:00
florian
0e41df598e * merge i8086 branch by Nikolay Nikolov
git-svn-id: trunk@24324 -
2013-04-25 20:23:51 +00:00
Jonas Maebe
abc79bc4cf * override tcgraisenode.pass_1 so that the JVM raise support will keep
working after r24288 is merged to trunk

git-svn-id: trunk@24301 -
2013-04-22 14:47:06 +00:00
nickysn
7b8e18ba40 * updated aint to tcgint in jvm/hlcgcpu.pas as well (needed after r23761)
git-svn-id: branches/i8086@24088 -
2013-03-31 12:52:56 +00:00
Jonas Maebe
477eeadaca * made alloctemp more generic
git-svn-id: trunk@24023 -
2013-03-27 17:16:26 +00:00
Jonas Maebe
185f71762f * fixed automatic setter generation if only a setter and no getter prefix
has been specified

git-svn-id: trunk@23561 -
2013-02-02 15:21:58 +00:00
Jonas Maebe
8f96ace589 * fixed -CTauto(g|s)etterprefix automatically generated helpers in case they
have to wrap an existing (g|s)etter that was marked as "abstract" (don't
    mark the helper also as abstract, sicnce it contains code)

git-svn-id: trunk@23545 -
2013-01-30 22:35:59 +00:00
Jonas Maebe
2ed4b295fe * only change the visibility of an existing getter/setter to that of
its property in case the visibility of the property is higher than
    that of the getter/setter (on the JVM target when automatically
    generating getters/setters)

git-svn-id: trunk@23523 -
2013-01-26 16:52:32 +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
3abc7b0d9c * removed superfluous check (a procvardef can never be a constructor) and
typecasts

git-svn-id: trunk@23509 -
2013-01-24 09:45:06 +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
Jonas Maebe
69c29a415f * pass the procdef to getintparaloc instead of only the proccalloption, so
that the type of the parameters can be determined automatically
   o added compilerproc declarations for all helpers called in the compiler
     via their assembler name, so we can look up the corresponding procdef

git-svn-id: trunk@23325 -
2013-01-06 15:05:40 +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
Jonas Maebe
4aa05f5133 + support for automatically generating setters/getters for properties on the
JVM target, since Java bytecode itself has no support for properties and
    hence exposing properties to external Java code can only be done through
    getters/setters. Use the new parameters to do so:
      -CTautogetterprefix=XXX
      -CTautosetterprefix=YYY
    The getter/setter will get the same visibility as the property. If a
    getter/setter with the same naming convention was already specified for a
    property and this getter/setter is declared in the same class as the
    property, then the visibility of this existing getter/setter is
    modified and no new routine is generated.

    Newly generated getters/setters are virtual methods, because that is
    the only way in Java bytecode to allow redefining these getters/setters
    in child classes. However, that also means that using these switches can
    change the behvaviour of code, since normally the used property definition
    is only determined by the declared type of its associated class instance,
    and not by the actual instance type. The compiler will therefore warn when
    such an automatically generated getter/setter is overridden by another
    automatically generated getter/setter in a child class.

git-svn-id: trunk@22959 -
2012-11-08 20:18:08 +00:00
Jonas Maebe
29263eb343 + full support for overflow checking on the JVM target (note: significantly
increases code size, because not natively supported by the JVM)

git-svn-id: trunk@22808 -
2012-10-21 17:56:33 +00:00
Jonas Maebe
6abc6106e1 - removed unused local variable
git-svn-id: trunk@22806 -
2012-10-21 17:56:20 +00:00
Jonas Maebe
62c8e47547 + override unnecessary abstract thlcgobj methods with internal errors
git-svn-id: trunk@22281 -
2012-09-02 14:32:31 +00:00
Jonas Maebe
f9c6967c36 * fixed not(pasbool64) (has to be "xor 1" rather than "xor -1")
git-svn-id: trunk@22167 -
2012-08-21 20:04:19 +00:00
Jonas Maebe
b353a2ff27 * fixed writing jvm type for string constants after r22020
git-svn-id: trunk@22123 -
2012-08-19 13:47:50 +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
0a1157da38 * fixed memory leaks in the compiler introduced in r21862 by marking and
releasing temporarily created function result locations

git-svn-id: trunk@21953 -
2012-07-23 13:49:29 +00:00
Jonas Maebe
7717e43929 * moved setting the call result to a separate method, so it can still be
used across multiple levels of inheritance such as on MIPS (and the code
    has to be reusable for a_call_ref/reeg in the future anyway)

git-svn-id: trunk@21906 -
2012-07-12 20:56:25 +00:00
Jonas Maebe
56fcc87cb2 * add get_frame as an internal symbol for the jvm target because that target
defines INTERNAL_BACKTRACE (which assumes get_frame to be internal rather
    than a system unit procedure)
  * changed fpc_assert() declaration for jvm to be the same as for other
    targets, so the same code can be used to call it in ninl now that's
    called from the first pass

git-svn-id: trunk@21903 -
2012-07-12 13:25:02 +00:00
Jonas Maebe
1955255dda * let thlcg.a_call_name() return the tcgpara representing the function
result location (NR_FUNCTION_RESULT_REG is not valid on all platforms)
   o this requires passing the forced function result type (if any) to this
     method
   o a generic, basic thlcg.a_call_name() is now available that sets the
     function result location; can be called by descendants
  * the availability under all circumstances of the correct function return
    type enables g_call_system_proc() on the JVM platform to now determine
    by itself how many stack slots are removed by the call -> do so, instead
    of manually counting them (or forgetting to do so and messing up the
    maximum evaluation stack height calculations)

git-svn-id: trunk@21862 -
2012-07-11 08:25:58 +00:00
Jonas Maebe
882351bb21 * don't insert a conversion to widechar for ansistr[x]:='y' assignments on
the jvm target  (forgot to adapt code after adding ansistring support)

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

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

git-svn-id: trunk@21736 -
2012-06-29 21:24:35 +00:00
Jonas Maebe
7c21cba1e2 * migrated g_copyshortstring, g_incrrefcount and g_array_rtti_helper to thlcg
git-svn-id: trunk@21699 -
2012-06-24 21:36:28 +00:00
Jonas Maebe
7a0ae38700 + also specify the parameter def when allocating a parameter via
getintparaloc + adapted all call sites of getintparaloc. This
    led to a number of additional, related changes:
   o corrected the type information for some getintparaloc parameters
   o don't allocate some intparalocs in cases they aren't used
   o changed "const tvardata" parameter into "constref tvardata" for
     fpc_variant_copy_overwrite to make pass-by-reference semantics
     explicit
   o moved a number of routines that now have to call find_system_type()
     from cgobj to hlcgobj so that cgobj doesn't have to start depending
     on the symtable unit
   o added versions of the cpureg alloc/dealloc methods to hlcgobj that
     call through to their cgobj counter parts, so we can call save/restore
     the cpu registers before/after calling system helpers from hlcgobj
     (not implemented in hlcgobj itself, because all basic register
      allocator functionality is still part of cgobj/cgcpu)

git-svn-id: trunk@21696 -
2012-06-24 15:02:12 +00:00
Jonas Maebe
708a2532fc * consistently define empty saved_mm_registers arrays as containing a single
RS_INVALID superregister (instead of sometimes RS_NO and sometimes
    RS_INVALID)
  * check for RS_INVALID in tcg.g_save_registers() and ignore such entries

git-svn-id: trunk@21622 -
2012-06-15 18:24:25 +00:00
Jonas Maebe
8234a842e6 * fixed conversion of empty ansistring/widestring constants to pchar on
the jvm target + test

git-svn-id: trunk@21391 -
2012-05-26 11:32:20 +00:00
Jonas Maebe
85a3fd3357 + ossinttype/osuinttype defs that correspond to OS_SINT/OS_INT for use in
the high level code generator

git-svn-id: trunk@21279 -
2012-05-12 16:03:15 +00:00
Jonas Maebe
8a7123eed8 * override a_call_reg() with an internalerror rather than a_call_ref(),
since it's the former that is abstract in the base class

git-svn-id: trunk@21126 -
2012-04-29 22:26:51 +00:00
Jonas Maebe
1345b7d107 * changed ref parameter of thlcgobj.a_call_ref() into a const parameter
git-svn-id: trunk@21115 -
2012-04-29 13:13:42 +00:00
Jonas Maebe
4fced5d142 + generic implementation of thlcgobj.a_call_ref()
* override thlcg.a_call_reg() in JVM hlcgcpu with dummy that calls
    internalerror

git-svn-id: trunk@21099 -
2012-04-28 14:27:45 +00:00
Jonas Maebe
e20639732f + cghlcpu unit with thlbasecgcpu class that overrides all abstract tcg
methods that don't have to be implemented by targets using the high
    level code generator, with dummy implementations that raise an internal
    error (to remove warnings about instantiating classes with abstract
    methods)
  * let the JVM tcg descendent derive from this new thlbasecgcpu class

git-svn-id: trunk@21098 -
2012-04-28 14:27:31 +00:00
pierre
857abd87ee + Implement create_varargs_paraloc_info, to allow compilation without warnings
git-svn-id: trunk@21073 -
2012-04-27 08:25:19 +00:00
Jonas Maebe
834026bfb5 * synchronised with trunk up to r21067
git-svn-id: branches/jvmbackend@21068 -
2012-04-26 21:24:20 +00:00
Jonas Maebe
0659058e44 * fixed ansistring -> pchar type conversion on JVM target now that empty
ansistrings are represented by nil
  * fixed type conversion of constant empty ansistring/unicodestring to
    pchar/pwidechar on the JVM target

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

git-svn-id: branches/jvmbackend@20887 -
2012-04-15 15:54:10 +00:00
Jonas Maebe
622eb4b782 * call getbasedef before getting the classdef of an enum (only the basedef
has an associated class)

git-svn-id: branches/jvmbackend@20870 -
2012-04-14 17:38:02 +00:00
Jonas Maebe
21722802fa * also allow taking the address of a derefence expression on the JVM target
(required for taking the address of threadvars, used by the current RTL)

git-svn-id: branches/jvmbackend@20869 -
2012-04-14 17:37:56 +00:00
Jonas Maebe
94bdf8a086 * adjust integer type information before stores part of a_op_const_ref for
Dalvik type checker

git-svn-id: branches/jvmbackend@20628 -
2012-03-25 14:46:37 +00:00
Jonas Maebe
94b058fe19 * fixed version of r20547: can't check the number of abstract methods of a
class before its VMT has been built, because that's the process that looks
    for inherited abstract methods that are overridden -> instead use a new
    synthetic method kind (tsk_callthrough_nonabstract) that will call
    through to another method (in this case a constructor) if the owning
    class does not contain any abstract methods, and generates an
    empty routine otherwise

git-svn-id: branches/jvmbackend@20589 -
2012-03-23 11:26:30 +00:00
Jonas Maebe
94bffa65e9 * don't create an instance of abstract classes inside their virtual
constructors (simply do nothing), because creating an abstract class
    is not possible in the JVM (and while the JVM only triggers an
    exception when you actually execute code that tries to create an
    abstract class, the Android platform checks this using the bytecode
    verifier at class verification time and therefore stumbled over the
    old code)

git-svn-id: branches/jvmbackend@20547 -
2012-03-20 21:59:57 +00:00
Jonas Maebe
fc6be612fd * also insert an explicit conversion from byte/char/bytebool/... to smallint
on Dalvik, because those values are obtained via an "and 255" operation
    which again turns them into longint values as var as the Dalvik type
    system is concerned

git-svn-id: branches/jvmbackend@20527 -
2012-03-16 20:57:22 +00:00
Jonas Maebe
83235a483b * always return a LOC_JUMP from tjvmnotnode.second_boolean: required both
to correctly handle non-pasbool types (can't just "not" their value),
    and for Dalvik (a "not pasbool" became "xori 1", which turned the value
    from a boolean into an integer as far as the Dalvik type checker was
    concerned)

git-svn-id: branches/jvmbackend@20525 -
2012-03-16 17:23:55 +00:00
Jonas Maebe
0248258670 * always size the value on top of the stack back down to its original size
after an 8/16 bit operation on Dalvik (even if the value cannot have
    become too big), because otherwise its type checker complains

git-svn-id: branches/jvmbackend@20520 -
2012-03-15 17:05:50 +00:00
Jonas Maebe
85ef5e109c + assert() support for the JVM target (currently ignores the Java classloader
assertionStatus setting)

git-svn-id: branches/jvmbackend@20388 -
2012-02-20 11:28:59 +00:00
Jonas Maebe
3916a32f9e * created generic version of thlcgobj.g_reference_loc() and only override
JVM-specific case (needed for future trunk marge to prevent abstract
    method warning)

git-svn-id: branches/jvmbackend@20387 -
2012-02-20 11:28:50 +00:00