Commit Graph

13027 Commits

Author SHA1 Message Date
Jonas Maebe
c9ebd433db * fixed array indexing via LOC_JUMP on the JVM target
git-svn-id: branches/jvmbackend@18981 -
2011-09-05 17:41:40 +00:00
Jonas Maebe
015ed4d0b6 * fixed getsingletonarraydef() so that it actually returns are arraydef of
one element rather than of two elements

git-svn-id: branches/jvmbackend@18980 -
2011-09-05 17:41:35 +00:00
Jonas Maebe
c163a327d7 * fixed abstract method accounting for external Objective-C/Java classes:
in that case if an "override" directive is missing but we interpret
    the declaration as an "override" anyway, make sure to replace the vmtpd
    with the overriding definition or child classes will keep seeing
    the abstract method in the base class and keep decreasing their abstract
    method count below zero
  * only decrease the abstract method count in case we're not processing
    category methods

git-svn-id: branches/jvmbackend@18923 -
2011-08-31 19:20:59 +00:00
Jonas Maebe
1a7c024ad3 * sign extend all byte/ansichar/word parameters before passing them
to and returning them from sub routines, in order to follow the JVM
    specs to the letter (not checked by the JVM bytecode verifiers, but
    checked by the Android DEX verifier)
  * -> also zero-extend them again at the caller side after returning
    from such a function

git-svn-id: branches/jvmbackend@18919 -
2011-08-30 23:34:12 +00:00
Jonas Maebe
f21b34c954 * also resize the value on the stack in a_load_reg_ref() when
required based on the source/destination sizes (like in
    a_load_reg_reg(), a_load_ref_reg() and a_load_ref_ref())

git-svn-id: branches/jvmbackend@18918 -
2011-08-30 23:34:07 +00:00
Jonas Maebe
0e80844e33 * also zero-extend incoming byte/word const-parameters (instead of only
value parameters)
  * fixed upper bound check to determine whether zero-extending is required

git-svn-id: branches/jvmbackend@18917 -
2011-08-30 23:34:02 +00:00
Jonas Maebe
a4cf406189 * use generic string concatentation and comparison infrastructure for the
JVM target (and also the generic routines in case of shortstrings)

git-svn-id: branches/jvmbackend@18910 -
2011-08-29 22:59:25 +00:00
Jonas Maebe
1fbd8750f2 * preparations to use generic string concatentation/comparison code for JVM
targets:
   o initialize managed temps that are passed as var-parameters to the
     dests-parameter of the concat routines, because they will be read and
     stored in the var-parameter array (they are finalized and hence work
     fine on native targets, but finalization is a nop on the JVM target)
   o do not take the shortcut of comparing with nil when checking for an
     empty ansi/unicodestring on managed VM targets

git-svn-id: branches/jvmbackend@18909 -
2011-08-29 22:59:19 +00:00
Jonas Maebe
b570ddf010 * fixed comparing pointers on the JVM target: typecast both to JLObject rather
than to pchar, since all pointers are compatible with the former but not with
    the latter

git-svn-id: branches/jvmbackend@18908 -
2011-08-29 22:59:15 +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
3a423b331c * full implementation of all routines in rtl/inc/ustringh.inc (except for
val/str for enums for now) for the JVM target: insert/delete/pos/...
  * use generic unicodestring helper routines where possible for the JVM
    target (not that many as for shortstrings since unicodestring is
    handled using java.lang.String)
  + complete widestring manager implementation for the JVM target. It uses
    a class with virtual methods rather than a record with function pointers
    for speed reasons though (since no existing widestring manager will be
    compatible anyway, that shouldn't cause any problems)

git-svn-id: branches/jvmbackend@18882 -
2011-08-28 19:22:22 +00:00
Jonas Maebe
1403e3df29 * renamed fpc_WChar_To_ShortStr() compilerproc to fpc_UChar_To_ShortStr() for
consistency with other helpers
  + added lowercase(unicodechar) and lowercase(unicodestring) overloads (for some
    reason only upcase() existed for them)

git-svn-id: branches/jvmbackend@18881 -
2011-08-28 19:22:15 +00:00
Jonas Maebe
65925be6fe * skip vo_is_funcret parameters when building a JVM mangled procdef name,
rather than aborting the creation of the mangled name

git-svn-id: branches/jvmbackend@18879 -
2011-08-28 19:22:05 +00:00
Jonas Maebe
3d22aa3cd1 + support for synthetic procdefs that are not part of a structdef
(previously, they would not get an implementation)

git-svn-id: branches/jvmbackend@18878 -
2011-08-28 19:22:00 +00:00
Jonas Maebe
7117264f96 * fixed assigning ansi/unicodestrings to shortstrings on the JVM target
(and cleaned up implementing support for special x_to_shortstring
     assignments in the process)

git-svn-id: branches/jvmbackend@18877 -
2011-08-28 19:21:46 +00:00
Jonas Maebe
9fb06fcb8f * support g_call_system_proc() inside the system unit for routines whose
implementation hasn't been parsed yet

git-svn-id: branches/jvmbackend@18876 -
2011-08-28 19:21:29 +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
3bf71d8d04 * fixed unsigned comparisons after r18734 (comparison operator is now
used to determine the signedness of the comparison, not the types
    of the arguments)

git-svn-id: branches/jvmbackend@18833 -
2011-08-24 22:11:22 +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
bb593346a9 * fixed typecasts between widechars and non-widechars in case an array
element is involved

git-svn-id: branches/jvmbackend@18831 -
2011-08-24 22:11:05 +00:00
Jonas Maebe
ea544f01c4 * allow pocall_internproc to be declared external (-> we can declare the
overloads for several routines that conflict on the JVM target because
    their parameter types are encoded into the same signature simply as
    external, e.g. swap, swapendian, odd, sqr, ...)

git-svn-id: branches/jvmbackend@18823 -
2011-08-23 22:02:21 +00:00
Jonas Maebe
f40c893084 * when determining whether taking the address of an array element is
valid, check for the array's actual lower bound instead of always for
    zero

git-svn-id: branches/jvmbackend@18822 -
2011-08-23 20:39:17 +00:00
Jonas Maebe
a2a0436347 + support for threadvars in the JVM based on JLThreadLocal; see
rtl/java/jtvarh.inc for the details

git-svn-id: branches/jvmbackend@18820 -
2011-08-23 17:45:01 +00:00
Jonas Maebe
992cc352c6 * generalized handling of pointers to non-implicit pointer types:
as far as Java is concerned, they're now all arrays of JLObject.
    When loading a value from them, we typecast the loaded value
    to the appropriate type. This allows typecasting one pointer
    type to another without getting verification errors (since an
    "array of JLObject" is not compatible with "array of JLString")
  - no longer allow dereferencing untyped pointers on the JVM
    target, since that always results in invalid bytecode

git-svn-id: branches/jvmbackend@18819 -
2011-08-23 17:44:55 +00:00
Jonas Maebe
0364b7acf9 * also allow taking the address of the first element of an array in
case of non-implicit pointer types

git-svn-id: branches/jvmbackend@18818 -
2011-08-23 17:44:49 +00:00
Jonas Maebe
d063ae10cb * use correct location.size after dereferencing pointers to non-implicit
pointer types instead of hardcoded OS_ADDR

git-svn-id: branches/jvmbackend@18817 -
2011-08-23 16:07:19 +00:00
Jonas Maebe
9aa40f5a08 * give a warning that packrecords settings are ignored when compiling for
managed VM targets

git-svn-id: branches/jvmbackend@18815 -
2011-08-23 15:26:14 +00:00
Jonas Maebe
7010116096 * if a mangledbasename is set for staticvarsyms, also use if when emitting
definitions

git-svn-id: branches/jvmbackend@18814 -
2011-08-23 15:26:06 +00:00
Jonas Maebe
54f9947406 * no need to zero-extend after a load of a widechar
git-svn-id: branches/jvmbackend@18813 -
2011-08-23 15:26:01 +00:00
Jonas Maebe
7fe0485a4e * always allow typecasts between enums and pointers/classes on the JVM target
and treat them like tc_equal rather than tc_int_2_int, because enums /are/
    class instances there

git-svn-id: branches/jvmbackend@18811 -
2011-08-23 15:25:47 +00:00
Jonas Maebe
3a5b3a0cce * don't crash after invalid JVM class definitions while trying to add
a default constructor

git-svn-id: branches/jvmbackend@18807 -
2011-08-23 15:25:11 +00:00
Jonas Maebe
10efb5b6e2 * handle records returned in floating point registers in the high->low level
code generator translation (as done by some ABIs, such as most x86-64
    platforms and darwin/i386)
   -> all regressions in jvmbackend branch for darwin/i386 fixed

git-svn-id: branches/jvmbackend@18806 -
2011-08-23 15:25:01 +00:00
Jonas Maebe
8a7982fe9e * fixed wrong notes about declaring two destructors after r18427:
oo_has_destructor is inherited from the parent class (because it
    influences whether a VMT is required for TP-style objects),
    so use separate oo_has_new_destructor flag instead

git-svn-id: branches/jvmbackend@18797 -
2011-08-21 09:11:50 +00:00
Jonas Maebe
5e641a8fcd * re-enabled tx86addnode.second_addsmallset() after its disabling was
accidentally committed a long time ago (it was done to test the
    generic hlcg conversion -- which in a sense was good, because it
    just uncovered the bug fixed in svn trunk r18792, i.e. a bug
    not specific to the hlcg conversion)

git-svn-id: branches/jvmbackend@18795 -
2011-08-20 21:02:55 +00:00
Jonas Maebe
1d2748fa69 * fixed insertion of typed constants twice in bss after r18723
for non-jvm targets (and once using a mangled name for global
    variables rather than for typed constants)

git-svn-id: branches/jvmbackend@18794 -
2011-08-20 20:37:14 +00:00
Jonas Maebe
7da5987d03 * fixed passing single elements to open array var-parameters on non-managed
platforms after r18561 (newly introduced element-to-open-array type
    conversion retains the value location on those platforms)

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

git-svn-id: branches/jvmbackend@18781 -
2011-08-20 08:35:47 +00:00
Jonas Maebe
c4ffef0a40 * fixed initializing arrays of ansi/unicodestring and of open arrays
removing the array initialization from tgcpu

git-svn-id: branches/jvmbackend@18780 -
2011-08-20 08:35:30 +00:00
Jonas Maebe
67c2c7c166 * renamed cchartype to cansichartype
git-svn-id: branches/jvmbackend@18779 -
2011-08-20 08:35:24 +00:00
Jonas Maebe
26ee54b1a2 * fixed compilation with 2.4.4
git-svn-id: branches/jvmbackend@18778 -
2011-08-20 08:35:19 +00:00
Jonas Maebe
f6ddabde85 + "raw" resource support for the JVM target. The "raw" means that no
resource compilation happens and that the standard FPC resource
    helpers are not available. What happens is that all files specified
    in {$r xxx} statements are packed together into an <appname>.jar
    file, under the namespace "org.freepascal.rawresources". They
    can be loaded using the java.lang.Class.getResource/getResourceAsStream()
    api

git-svn-id: branches/jvmbackend@18776 -
2011-08-20 08:34:57 +00:00
Jonas Maebe
c22394a9f4 * converted second_array_to_pointer() to thlcg
git-svn-id: branches/jvmbackend@18775 -
2011-08-20 08:34:51 +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
d1f424561e + getsingletonarraydef() function to get a (reused if possible) def for
an array of one element of the specified type

git-svn-id: branches/jvmbackend@18773 -
2011-08-20 08:34:41 +00:00
Jonas Maebe
ee77d5a6f2 * some changes to handleformalcopyoutpara() so that in the future it can
also handle non-formal parameters
  * do not copy in the original value in handleformalcopyoutpara() if it's
    an out parameter

git-svn-id: branches/jvmbackend@18772 -
2011-08-20 08:34:36 +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
d7cff1cd31 * give an error when trying to typecast a unicodestring into a pwidechar
on the JVM target (we can't access the characters of a JLString as an
    array)

git-svn-id: branches/jvmbackend@18769 -
2011-08-20 08:34:21 +00:00
Jonas Maebe
224aae8993 + support for typecasting ansistrings into pchars on the JVM platform
+ support for indexing pointers as arrays on the JVM platform (with
    JVM-provided range checking, obviously)

git-svn-id: branches/jvmbackend@18768 -
2011-08-20 08:34:16 +00:00
Jonas Maebe
27731e342c + support for array-of-const on the JVM target. Even though the
implementation is a bit different from that on native targets, the
    result is quite compatible

git-svn-id: branches/jvmbackend@18765 -
2011-08-20 08:34:00 +00:00