Commit Graph

37295 Commits

Author SHA1 Message Date
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
Jonas Maebe
9d1063f94c * adjustments/fixes for AIX/ppc64
git-svn-id: trunk@21053 -
2012-04-25 20:28:32 +00:00
Jonas Maebe
0278d67764 * use generic ppc version of a_loadaddr_ref_reg() for AIX/ppc64
* also recognize addr_pic_no_got as a PIC'ed address

git-svn-id: trunk@21052 -
2012-04-25 20:28:27 +00:00
Jonas Maebe
b33b744f78 * enabled null pointer load checking for AIX/ppc64
git-svn-id: trunk@21051 -
2012-04-25 20:28:23 +00:00
Jonas Maebe
cec20e1c34 * specify the branch opcode to use for a_call_name_direct/a_jmp_name_direct,
because it's sometimes different for AIX and other platforms (AIX uses
    absolute branches for entry/exit code helpers)

git-svn-id: trunk@21050 -
2012-04-25 20:28:18 +00:00
Jonas Maebe
3fc1a274c8 - removed ifdefed/inactive "ti386addnode.second_addmmx" from ppc code
generator

git-svn-id: trunk@21049 -
2012-04-25 20:28:14 +00:00
Jonas Maebe
cecdff01e0 * corrected sharedClibext for AIX/ppc32
git-svn-id: trunk@21048 -
2012-04-25 20:28:09 +00:00
Jonas Maebe
52d1172f6d * correctly call assembler for AIX/ppc64
* corrected target flags for AIX/ppc64
  * corrected some file extensions for AIX/ppc64

git-svn-id: trunk@21047 -
2012-04-25 20:28:05 +00:00
Jonas Maebe
d43387dff8 * equivalent of r20829 for AIX/ppc64 (and linux/ppc64): automatically create
dotted names when calling functions from assembler

git-svn-id: trunk@21046 -
2012-04-25 20:28:00 +00:00
Jonas Maebe
b99a8c129d * write pointer data on AIX/ppc64 using .vbyte rather than using .llong
(= equivalent of gas .quad), because .llong forces the alignment to
    8 bytes and this causes problems with some typed constant records (such
    as RTTI)

git-svn-id: trunk@21045 -
2012-04-25 20:27:56 +00:00
Jonas Maebe
6502717e67 * align all code/data sections to sizeof(pint), instead of sometimes
to 0 or 1 (section alignment <> alignment of individual data
    elements in section on some platforms, such as AIX)
  * set constalignmin and varalignmin to 8 bytes for AIX/ppc64

git-svn-id: trunk@21044 -
2012-04-25 20:27:41 +00:00
marco
e59be6884e * Some minor changes that make the recent changes more backwards compatible. Mantis #21837
git-svn-id: trunk@21043 -
2012-04-25 19:47:54 +00:00
sergei
5b09fa8a8c * Changed tagVariant.pbstrVal to ^WideString and added a comment about impossibility of having managed members in this record (Mantis #21075).
git-svn-id: trunk@21042 -
2012-04-25 18:14:47 +00:00
Jonas Maebe
81d1cfb3ca + -prefix_constants <x>, -prefix_fields <x> and -prefix_innerclasses <x>
options to customise the prefixes that the translator adds to to resp.
  constant, field and inner class names. For an empty prefix, use "".
  Defaults: nothing for constants, "f" for fields and "Inner" for inner
  classes.

git-svn-id: branches/jvmbackend@21041 -
2012-04-25 18:14:35 +00:00
Jonas Maebe
9a10c5aea8 * don't mark final class methods as virtual
git-svn-id: branches/jvmbackend@21040 -
2012-04-25 18:14:29 +00:00
marco
6b93cbcbea * Fix for #21636, TFPSList.Pack several fixes.
git-svn-id: trunk@21039 -
2012-04-25 17:25:00 +00:00
marco
69fbbcedf3 * fix passing of only one parameter on non unix platforms. Mantis #21630
git-svn-id: trunk@21038 -
2012-04-25 17:21:16 +00:00
marco
8f39076a69 * changed tbookmark to tbytes, bookmarkstr to ansistring. Delphi 2009+ compat.
git-svn-id: trunk@21037 -
2012-04-25 16:51:05 +00:00
sergei
5f93d9992a * Ignore FPU/MM registers in tcg.(de)allocallcpuregisters if they are not used in current procedure. This is consistent with logic of tcgcallnode and removes a lot of useless xmm regallocs on win64.
git-svn-id: trunk@21036 -
2012-04-25 15:42:50 +00:00
sergei
3edaa66ee7 * For Win64, handle environment variables the same way as on Win32 (the generic version of GetEnvPChar does not return nil for non-existent environment variables).
git-svn-id: trunk@21035 -
2012-04-25 15:28:55 +00:00
sergei
6fd9dc6d32 * Fixed 64-bit compilation warnings (Integer -> PtrUInt)
git-svn-id: trunk@21034 -
2012-04-25 11:26:00 +00:00
Legolas
0976d0304f * Updated libogcfpc to ver.1.8.11 and devkitPPC to r26
git-svn-id: trunk@21033 -
2012-04-25 08:24:27 +00:00
Legolas
6bf0bc70a1 * Updated libndsfpc to ver.1.5.6 and devkitARM to r38
git-svn-id: trunk@21032 -
2012-04-25 08:23:07 +00:00
pierre
1b3fd997fc + Regenerate all Makefiles's after adding x86_64 netbsd target
git-svn-id: trunk@21031 -
2012-04-24 23:15:18 +00:00
pierre
1b6c45455e + Add x86_64 netbsd target
git-svn-id: trunk@21030 -
2012-04-24 23:12:30 +00:00
pierre
2684c3fec4 Define USE_SIGACTION_SIGTRAMP for x86_64
git-svn-id: trunk@21029 -
2012-04-24 23:06:22 +00:00
pierre
e0aa5839a9 * Add missing sc_arg6 to sc_arg9 fields in x86_64 SigContext record
git-svn-id: trunk@21028 -
2012-04-24 23:05:20 +00:00
pierre
23f21254bd + Add USE_SIGACTION_SIGTRAMP
git-svn-id: trunk@21027 -
2012-04-24 23:03:08 +00:00
florian
13e152f8a9 * even if currency is handle by an int64, it needs no extra handling in handle_default
git-svn-id: trunk@21025 -
2012-04-24 18:47:58 +00:00
florian
aa2a9dbf2e patches by Nico Erfurth to improve the arm peephole optimizer:
* Introduce MatchInstruction and MatchOperand

MatchInstruction allows to match an instruction by condition and
oppostfix. MatchOperand checks if an operand is a register and matches
another operand. In the future this could be overloaded with other
versions not only accepting TRegister.

* Optimize cmp,moveq,movne sequence on ARM

This patch implements an peephole optimizer for the following sequence:

  cmp   reg,const1
  movne reg,const2
  moveq reg,const1

* Small improvements to the ARM peephole optimizer

Most instructions in the ARM ISA have taicpu(p).oper[0]^.typ = top_reg
as the only option, so there is no need to check for it if we're
looking at those instructions.

* Remove redundant mov instructions on ARM

This is an addition to the ARM PeepHole Optimizer.
It folds code like this:

mov reg1, reg2
add reg1, reg1, (const|reg)

git-svn-id: trunk@21024 -
2012-04-24 18:25:19 +00:00
marco
7800cd4ff5 * Cleanup of adding records to bufdatasets with indexes. Mantis #20514, patch by Lacak2.
git-svn-id: trunk@21023 -
2012-04-24 17:47:18 +00:00
pierre
bf1690458a Partial fix for x86_64 peephole optimization
git-svn-id: trunk@21022 -
2012-04-24 15:38:07 +00:00
sergei
13e513fdf7 * Pass NR_FUNCTION_RESULT_REG to FPC_SAFECALLCHECK in target-independent way.
* Added missing call to paramanager.freecgpara.
* Handle safecall stuff after deallocating registers of the main call in order to keep allocations balanced.

git-svn-id: trunk@21021 -
2012-04-24 14:50:56 +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