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 -
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 -
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 -
(= 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 -
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 -
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 -
* 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 -
* 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 -