Commit Graph

37329 Commits

Author SHA1 Message Date
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
florian
48d3eb86a6 * fixes _haltproc, Hello world works on mipsel
git-svn-id: trunk@21125 -
2012-04-29 21:34:03 +00:00
florian
366e2027fc * rename TMIPSELParaManager into TMIPSParaManager
git-svn-id: trunk@21124 -
2012-04-29 21:32:52 +00:00
florian
2c5a2857e5 * Move for MIPS is broken, commented out for now
git-svn-id: trunk@21123 -
2012-04-29 21:31:46 +00:00
florian
31f54a7810 * use separate build directory for mipsel
git-svn-id: trunk@21122 -
2012-04-29 21:30:46 +00:00
florian
25e82bb1af * fix stack frame generation on mips(el)
git-svn-id: trunk@21121 -
2012-04-29 21:29:06 +00:00
Jonas Maebe
14cfe770a4 * replaced most (if not all) remaining fields/parameters in the compiler
that deal with paths/filenames with TPathStr (= ansistring) to prevent
    cutting off long paths (no change in speed when compiling the compiler,
    1% extra memory usage)

git-svn-id: trunk@21120 -
2012-04-29 17:36:23 +00:00
Jonas Maebe
9e0bc92b88 * prevent crash in dotest in case a test file contains a line at the start
with only whitespace on it (such as webtbf/tw21873.pp)

git-svn-id: trunk@21119 -
2012-04-29 17:36:11 +00:00
florian
aadeba4d1a * started to fix stack frame generation on MIPS(EL)
git-svn-id: trunk@21118 -
2012-04-29 16:58:19 +00:00
florian
9c845e9f76 * put types unit into a shared rtl
git-svn-id: trunk@21117 -
2012-04-29 14:20:09 +00:00
florian
5966fcce74 * PIC does not require using the external assembler anymore
- removed 2.0.x-ism

git-svn-id: trunk@21116 -
2012-04-29 14:19:32 +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
3abd5d3882 * changed inlinelevel (which is used to track whether or not we have to
generate line number information) from longint into cardinal, since it
    should never become < 0 (allows catching errors by enabling range
    checking)

git-svn-id: trunk@21114 -
2012-04-29 13:13:36 +00:00
Jonas Maebe
7742dc0006 * don't remove ait_markers between unconditional jumps and the next label,
to prevent removing the start/end of assembler blocks, and the start/end
    of nolineinfo blocks (solves the problem that with -O2 -al most of the
    source lines were missing from classes.s)

git-svn-id: trunk@21113 -
2012-04-29 13:13:31 +00:00
Jonas Maebe
06b17111da * also recognize scurrency as an "originally was a 64 bit value" in
try_make_mul32to64()
  * when inserting a 32x32->64 multiplication, change the typeconversions
    of the original nodes into internal type conversions, because they
    may have been currency (e.g., in case of an integer-to-currency
    conversion, which is performed via integer*currency(10000)) and
    since r21097 implicit conversions from currency to ordinal are no
    longer allowed

git-svn-id: trunk@21112 -
2012-04-29 13:13:22 +00:00
sergei
7f96fee752 + Added a comment on tcgprocinfo.generate_exceptfilter operation.
git-svn-id: trunk@21111 -
2012-04-29 10:34:29 +00:00
sergei
a85bb08a74 * Save/restore high-level code generator when processing exception filters, fixes building in Win64 with -dTEST_WIN64_SEH, Mantis #21879.
git-svn-id: trunk@21110 -
2012-04-29 07:35:19 +00:00
Jonas Maebe
6850653296 * replaced "set1<=set2" expression with "(set1*set2)=set1", because the
SPARC code generator of 2.6.0 compiles the former expression wrongly
    (which was fixed in r21095)

git-svn-id: trunk@21109 -
2012-04-28 22:38:14 +00:00
Jonas Maebe
4ac396bd74 * and now the actual test object files...
git-svn-id: trunk@21108 -
2012-04-28 22:28:26 +00:00
Jonas Maebe
39e74ba80c + AIX/ppc64 test object files
git-svn-id: trunk@21107 -
2012-04-28 22:27:52 +00:00
Jonas Maebe
562b968b16 * now that copy() expressions are only translated into calls during the
first pass, we have to manually set the varstate of its parameters during
    the typecheck pass (mantis #21878)

git-svn-id: trunk@21106 -
2012-04-28 21:33:29 +00:00
sergei
be5a5d6ae6 - Removed redundant fillchar() calls, class instances are cleared on construction.
git-svn-id: trunk@21101 -
2012-04-28 17:16:33 +00:00
sergei
c08ab0f745 * Re-raising exceptions must be allowed only in 'except' block itself, not in 'try' block of a nested try..except statement. Mantis #21873.
git-svn-id: trunk@21100 -
2012-04-28 15:59:34 +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
Jonas Maebe
99e70e7128 * do not allow implicit conversions from currency to orddef even if currency
is implemented via int64 (prevents e.g. calling abs(int64) for
    abs(currency) on non-x86)

git-svn-id: trunk@21097 -
2012-04-28 14:27:17 +00:00
Jonas Maebe
aa92d78c46 * fixed round(currency) after r18746 (in particular on platforms where
currency is implemented via int64)

git-svn-id: trunk@21096 -
2012-04-28 13:00:15 +00:00
Jonas Maebe
54f3db3141 * fixed "set <=/=> set"
git-svn-id: trunk@21095 -
2012-04-28 09:32:09 +00:00
paul
1a724f3e11 compiler:
- prefer UnicodeString, WideString, PWideChar, PAnsiChar, AnsiString, ShortString when passing a string constant if default string is UnicodeString,
  - change default string type to UnicodeString for MODE DelphiUnicode

git-svn-id: trunk@21094 -
2012-04-28 08:19:10 +00:00
paul
c7e057a835 compiler: use is_wide_or_unicode_string() istead of using is_widestring() or is_unicodestring()
git-svn-id: trunk@21086 -
2012-04-28 03:32:06 +00:00
paul
290295db3e compiler: remove UTF8 sequences from 2 comments + minor formatting
git-svn-id: trunk@21085 -
2012-04-28 02:46:06 +00:00
marco
759b927a9b * fix compilation after r17747
git-svn-id: trunk@21084 -
2012-04-27 19:49:27 +00:00
pierre
5f58dd6395 Fix Makefile for openbsd
git-svn-id: trunk@21082 -
2012-04-27 14:19:54 +00:00
pierre
a1b5945d20 Fix Makefile for openbsd
git-svn-id: trunk@21081 -
2012-04-27 14:19:43 +00:00
sergei
cd89a90841 * Cleanup: removed empty destructors and redundant 'with' statement.
* Removed TElfObjectOutput.Elf32data field, passing ObjData to methods in parameter, similar to how COFF output works.

git-svn-id: trunk@21080 -
2012-04-27 13:42:38 +00:00
sergei
3aaa62b2e3 * Removed separate 64-bit specific copy of location_force_reg, reusing part of 32-bit version to handle 64-bit cases. The difference is that the handling of LOC_CREGISTER locations that was previously available only for 32-bit targets is now applied to 64-bit targets too, reducing amount of redundant move instructions.
git-svn-id: trunk@21079 -
2012-04-27 13:15:46 +00:00
pierre
8e91872ce6 * Fix RequotedExecuteProcess
git-svn-id: trunk@21078 -
2012-04-27 12:10:32 +00:00
sergei
a54e342060 + Reduce the amount of RTTI by not generating 'init' information if it will end up being the same as the 'full' one (which is the case of most simple types). The new behavior can be customized for every tdef by overriding needs_separate_initrtti method.
git-svn-id: trunk@21077 -
2012-04-27 10:17:59 +00:00
Jonas Maebe
564445da8c * re-enabled enum -> dispinterface typecasts after r21069, bug noticed by
Paul

git-svn-id: trunk@21076 -
2012-04-27 09:30:25 +00:00
Jonas Maebe
e2243e6f4e * fixed "make install" for non-JVM targets after r21069
git-svn-id: trunk@21075 -
2012-04-27 09:17:50 +00:00
Jonas Maebe
6d628a794b * fixed merge error in r21069: netbsd/x86-64 is supported, not haiku/x86-64
(fortunately, the makefiles were generated using a correct fpcmake)

git-svn-id: trunk@21074 -
2012-04-27 09:16:20 +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
4e0df2d3a4 * increased ppu version after jvmbackend merge
git-svn-id: trunk@21070 -
2012-04-26 22:48:43 +00:00
Jonas Maebe
9fed3ee04c * merged the jvmbackend branch
General:
    o support for Java/JVM and Android/JVM targets, with support for most
      common language features (classes, records, all array types,
      enumerations, signed and unsigned integers, currency, threadvar,
      typed constants, generics, exceptions, ansistring, ...) and limited
      support for others (such as pointers and formal var/out parameters).
      See http://wiki.freepascal.org/FPC_JVM/Language for more details
    o fpcjres utility to pack "resource files" (= any file specified via
      {$r xxx}, without any processing) into jar files
    o {$modeswitch unicodestrings} modeswitch that changes "string" into
      "unicodestring", "char" unto "widechar" and "pchar" into "pwidechar".
      Note that the latter two are achieved by automatically adding a unit
      (uuchar) to the uses clause that overrides these types, so it does not
      (yet) work for the system unit. If this modeswitch is enabled, {$H+/-}
      switches between string=unicodestring and string=shortstring, but the
      state of the {$H}-switch has no effect on the definition of char/pchar.
    o {$namespace x.y.z} directive to set the package namespace of a unit
      on the JVM target (does not do anything on other targets). Dotted unit
      names do not yet influence the namespace of generated JVM classes
    o javapp utility to create Pascal headers from Java class files

   Compiler:
    o new high level code generator in the compiler that uses high level type
      information, including a wrapper that passes everything through to the
      existing low level code generators for existing native targets
      (hlcgobj.pas, hlcg2ll.pas, <arch>/hlcgcpu.pas). Several routines have
      also migrated from ncgutil.pas to hlcgobj.pas
    o quite a bit of code in ncg*.pas has been converted to use the new
      high level code generator so that it works for both existing targets
      and the new JVM target (mostly replacing tcgsize parameters with tdef
      parameters, or adding some tdef size parameters) -- this one should
      always be used in common code, tgobj.gettemp() should only be used in
      architecture-specific code from now on
    o new tgobj.gethltemp() routine that also specifies the tdef of the
      requested temp for high level code generator use
    o tcgpara now also contains the def of the parameter for use by the
      high level code generator
    o support for nested routines without making use of a framepointer, by
      grouping variables accessed from nested routines into a record and
      passing a pointer to this record to the nested routines (ncgnstld.pas,
      ncgnstmm.pas)
    o support for internally generating and parsing Pascal code in the
      compiler for routine declarations and implementations (symcreat.pas)
    o parsing a recorddef and an objectdef method declaration has been
      factored out so this code can be reused by symcreat.pas
    o support for duplicating and slightly modifying procdefs
      (symdef.tprocdef.getcopy, symcreat.finish_copied_procdef)
    o cchartype has been renamed into cansichartype
    o new TSymStr type that is used as string type for symbols and mangled
      names. The default is still pshortstring on all platforms, but for the
      JVM targets it's ansistring because it sometimes needs symbols > 255
      characters
    o it is no longer allowed to use sysutils.executeprocess() from the
      compiler, except via the the wrapper cfilutil.RequotedExecuteProcess()
      so that the compiler can correctly deal with the
      sysutils.executeprocess() limitation of only supporting double quotes
    o new getpointerdef(def), getsingletonarraydef(def) and
      getarraydef(def,count) helpers in symdef to create/get reusable pointer/
      arraydefs for another def (mostly used for the JVM target currently)
    o several parameter parsing helpers have been moved from pdecsub.pas to
      pparautl.pas
    o the type checking and firstpass for setlength() and copy() has been
      moved from pinline.pas to ninl.pas so it can be overridden by target-
      specific versions
    o commented the ttempinfoflag values in nbas, and the ttemptype flags
      in globtype
    o new "reference" ttempcreatenode type, which can be used to create a
      reference to (~ hold the address of) another node, even on targets that
      do not support taking the address of an arbitrary memory location and
      store it into a virtual register (such as the JVM target).
    o secondpass no longer takes a var-parameter, since it doesn't change
      the received node
    o many routines from pmodules.pas and some from nutils.pas have been
      moved to ngenutil.pas as virtual class methods so they can be
      overridden with target-specific versions
    o the code of a single JVM routine is limited to 64KB bytecode, which can
      be fairly easily reached when having large array constants because they
      have to be initialized element by element in the unit initialisation
      code -> -CTcompactarrayinit switch to use alternate (slightly slower)
      initialisation of arrays on the JVM targets that uses much less code
      space
    o it is now possible to override the individual typecheck helpers of
      ttypeconvnode
    o most of the code from ptconst.pas has moved to ngtcon.pas, and has been
      turned into a class that splits most of the parsing and data/code
      generation for typed constants into separate routines. Separate
      implementations are now available that either generate initialised data
      (native targets) or assignment nodes for explicit initialisation at
      run time (JVM)

   RTL:
    o many extra ifdefs to common RTL include files to enable overriding
      helpers with JVM-specific helpers
    o some internal move-alternatives for the RTL that also can be overridden
      by the JVM target to enable sharing more code between managed and
      native targets

   Tests:
     o a number of JVM-specific tests have been added to tests/test/jvm.
       They can be executed via the provided testall.sh/.bat scripts.
       Because standard I/O is not yet available in the Java/Android RTL,
       most regular tests can't be compiled yet.

   Note: currently, compiling a JVM compiler requires adding ALLOW_WARNINGS=1
     to the make command line

git-svn-id: trunk@21069 -
2012-04-26 22:36:18 +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
florian
2959d596f9 * patch by Nico Erfurth: Remove superfluous mov from MovStrMov sequences
git-svn-id: trunk@21067 -
2012-04-26 20:31:13 +00:00
paul
a26bc50ca6 compiler: change ShortString->(Some)String and AnsiString->(Some)String overload precedence both for variables and string constants, change unicode constant type from widestring to unicodestring (Delphi compatibility)
new ShortString->(Some)String precedence: ShortString, UTF8String, AnsiString, AnsiString(CodePage) and RawByteString, UnicodeString, WideString and other string types
new AnsiString->(Some)String precedence: RawByteString, UTF8String, AnsiString, AnsiString(CodePage), UnicodeString, WideString, ShortString and other string types

The new logic makes UTF8String more preferrable than other AnsiString types, AnsiString more preferrable than other  AnsiStrings(codepage) and also makes UnicodeString more preferrable than WideString.

git-svn-id: trunk@21057 -
2012-04-26 02:33:57 +00:00
Jonas Maebe
ca57ab2c99 * support storing the scanner state when the current token is _ID
* recognise that we can't store the scanner state yet when the current
    token is _CSTRING

git-svn-id: branches/jvmbackend@21056 -
2012-04-25 22:29:25 +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
9b6c426369 * also redefine pchar as pwidechar in {$modeswitch unicodestrings}
git-svn-id: branches/jvmbackend@21054 -
2012-04-25 22:29:15 +00:00