Commit Graph

36 Commits

Author SHA1 Message Date
Jonas Maebe
fcaad5baf2 * perform -CTlowercaseprocstart conversion it tprocsym.create rather than
when building the mangled name, because the latter can also be performed
    when compiler another unit (and therefore if that other unit's setting
    is different from that of the original unit, a wrong mangled name was
    generated) + test for this case

git-svn-id: trunk@25388 -
2013-08-29 22:43:06 +00:00
Jonas Maebe
a14ceba791 + -CTinitlocals switch for the JVM that initialises all local variables
that may trigger JVM bytecode verification errors if they are used
    before they are initialised (this includes passing them as a "var"
    parameter) + test
  * sorted -CT parameters alphabetically and alligned them

git-svn-id: trunk@25387 -
2013-08-29 22:21:23 +00:00
Jonas Maebe
6013606a97 + -CTlowercaseprocstart switch to lowercase the first character of routines
so that code written according to Delphi coding standards can be compiled
    into JVM bytecode with routine names conforming to JVM coding standards

git-svn-id: trunk@25385 -
2013-08-29 22:21:15 +00:00
Jonas Maebe
1ce93f7430 * when automatically generating an overriding getter/setter method (because
a property in a child class has a higher visibility than the getter/
    setter), ensure that we call the inherited method and not the method
    itself (causing a stack overflow due to infinite recursion)

git-svn-id: trunk@25223 -
2013-08-06 21:50:56 +00:00
nickysn
3853d06ac0 + added n8086cal.pas, based on n386cal.pas; this pulls in nx86cal.pas as well and fixes compilation of the system unit on i8086 after the merge of the i8086 branch to trunk
git-svn-id: trunk@24335 -
2013-04-26 20:19:57 +00:00
Jonas Maebe
e621bff943 * don't make a deep copy of records (and in the future, objects) in with-
statements on the JVM target (mantis #24089)

git-svn-id: trunk@23945 -
2013-03-20 16:23:25 +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
e7315d035c * inherit po_auto_raised_visibility flag when the visibility of a method is
raised because it was automatically raised in the parent class (can happen
    for the JVM target when letting the compiler generate getters/setters for
    properties)

git-svn-id: trunk@23522 -
2013-01-26 16:52:28 +00:00
Jonas Maebe
4dd2aff6c6 * explicitly disable overflow checking because that blows up the code far
beyond the 64kb per method limit (so that all tests can be compiled/run
    with the -Co command line parameter to check that functionality against
    false positives)

git-svn-id: trunk@22810 -
2012-10-21 17:56:50 +00:00
Jonas Maebe
027776a708 + test for range checking (and against false positives for overflow checking)
git-svn-id: trunk@22809 -
2012-10-21 17:56:42 +00:00
Jonas Maebe
ae56841ee6 * do not apply node CSE to nested loads on high level cpu targets, because
their nested tree already contains the load (subscriptn) for the variable
    itself and there is no clean/easy way to avoid that in a completely
    portable way in ncgnstld + test

git-svn-id: trunk@22519 -
2012-10-02 18:12:24 +00:00
Jonas Maebe
e7cb2e9a28 * test for mantis #22807 (bug fixed in jasmin)
git-svn-id: trunk@22347 -
2012-09-06 18:50:29 +00:00
Jonas Maebe
3f5ae8b05f * forgot to commit, part of r21765
git-svn-id: trunk@21766 -
2012-07-03 21:23:20 +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
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
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
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
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
71068ae7eb * made the tests Android-compatible (use the androidr14 unit instead
of the jdk15 unit in that case)
  * adjusted testall.sh script so it can also be used to test class
    files compiled for Android (still with the JVM though)

git-svn-id: branches/jvmbackend@19835 -
2011-12-12 20:34:02 +00:00
Jonas Maebe
f4f70f99b2 * call all operators with invokestatic, since they are always
class methods

git-svn-id: branches/jvmbackend@19823 -
2011-12-11 17:25:42 +00:00
Jonas Maebe
21e6401921 * no longer encode all pointers to other pointer types (such as
classes, interfaces, dynamic arrays, ...) as "array of JLObject",
    but instead as an array of the actual pointed-to type. The reason
    for the previous behaviour was mainly that the JVM threadvar
    implementation internally stores all threadvars that are
    such double pointer types into an "array of JLObject". Type casting
    this array to e.g. an "array of array of byte" causes an exception
    even if it only contains "array of byte" instances (since the outer
    array type is different). This is now solved by first taking the
    element of the array and then typecasting it to the destination
    type (so dynarrbyte(arr[0]) instead of pdynarrbyte(arr)^[0]).

    The reason for the new (more accurate) behaviour is because the
    old one caused type errors in case a double pointer field was
    internally created for the nestedfpstruct support (see added
    test)

git-svn-id: branches/jvmbackend@19821 -
2011-12-11 17:25:09 +00:00
Jonas Maebe
4dee36b64b * copy the implicit pointer rather than the contents of var/out/constref
implicit pointer types into the nestedfpstruct, so that the original
    parameter is properly changed when updated from inside nested routines

git-svn-id: branches/jvmbackend@19645 -
2011-11-18 21:09:38 +00:00
Jonas Maebe
cfca607b9b * in case of an enum without a type name (e.g., "type xx = set of (ea,eb)"),
set the external name of the underlying class type to the internal name
    instead of to an (invalid) empty string

git-svn-id: branches/jvmbackend@19555 -
2011-10-28 21:19:12 +00:00
Jonas Maebe
39adb3dfae * fixed loading the nested framepointer when calling another nested
routine at the same or a higher nesting level in case the current
    nested routine's framepointer was not part of the nestedfpstruct
    (because it doesn't have nested routines itself, or because those
     don't access any data in parent routines) on targets with explicit
    parentfpstruct management (JVM) + adapted test

git-svn-id: branches/jvmbackend@19164 -
2011-09-20 22:22:26 +00:00
Jonas Maebe
583c9a3360 * replace assigned(dynarray) and dynarray=/<>nil with length(dynarray)=/<>0
on the JVM target because empty dynarrays are not always nil there

git-svn-id: branches/jvmbackend@19154 -
2011-09-19 19:59:32 +00:00
Jonas Maebe
125c0cf225 + support for generics on the JVM target:
o don't try to create .class files for generic types
   o still generate all JVM-specific wrappers for generic types even though they
     won't be written out, because when specializing all the defid's have to
     match exactly
   o add synthetic routine implementations after generating the specializations,
     so that the synthetic routines for those specializations are also generated
     (we don't specialize generic versions of the synthetic generic routines
      because it's not easy or even always possible to create valid generic
      versions of synthetic routines)
   o Note: these are Pascal-style generics, not Java-style generics. The generic
     types nor their specializations are usable from Java code (specializations
     may become usable in the future)

git-svn-id: branches/jvmbackend@19047 -
2011-09-11 11:54:37 +00:00
Jonas Maebe
5496436349 * the generic astrings.inc is now also used to the extent possible on
the JVM target, and pos/insert/delete/val/str/uniquestring/setstring/
    stringofchar/... are now also available for ansistrings on the JVM
    target

git-svn-id: branches/jvmbackend@18906 -
2011-08-29 22:59:03 +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
1e329866b4 + tval5, also already works
git-svn-id: branches/jvmbackend@18880 -
2011-08-28 19:22:10 +00:00
Jonas Maebe
1f96763b9d * renamed Java-specific sstrings.inc/sstringh.inc to jsstrings.inc/
jsstringh.inc -> use generic inc/sstrings.inc
  * added a bunch of extra {$ifdef FPC_HAS_XXX} protections around
    routines in inc/sstrings.inc and implemented those routines for
    the JVM target in java/jsstrings.inc
  * use the majority of the generic routine in sstrings.inc now also
    for the JVM target! Only a few changes were needed:
   o in a few places, calls to move() for copying shortstring->shortstring
     or shortstring->chararray were replaced with calls to a new inline
     helper that calls move() in the version in inc/sstrings.inc, and
     JLSystem.arraycopt() in in the version in java/jsstrings.inc
   o changed the currency argument to str() for the JVM target to constref
     so its address can be taken (has to be typecasted to int64 without
     changing the value), and similarly changed the temporary result
     inside that routine to an array of 1 elements so the address can be
     taken
   o don't typecast the real value to a record type in str_real for the
     JVM target, but work via an int64 instead to extract sign/mantissa/exp
   o everything else compiled and worked as is!!
  -> val, str, hexstr/octstr/binstr, delete, pos, insert, setstring and
     comparetext now all work for shortstrings on the JVM target

git-svn-id: branches/jvmbackend@18836 -
2011-08-24 22:11:43 +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
c07c633b6a * also test passing enums to formal parameter types
git-svn-id: branches/jvmbackend@18812 -
2011-08-23 15:25:56 +00:00
Jonas Maebe
a3d4d05454 * support specifying different compiler binary on the command line
git-svn-id: branches/jvmbackend@18783 -
2011-08-20 08:36:04 +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
740e7ca6b5 + a bunch of jvm-specific tests: partly new, partly derived from existing
tests
   o currently not yet integrated in the makefile system, use testall.sh/
     testall.bat to run the tests

git-svn-id: branches/jvmbackend@18777 -
2011-08-20 08:35:11 +00:00