Commit Graph

35158 Commits

Author SHA1 Message Date
Jonas Maebe
52b62732e2 * mark classes representing records as final
* mark sealed classes as final
  * mark "final" fields as final

git-svn-id: branches/jvmbackend@18609 -
2011-08-20 08:14:50 +00:00
Jonas Maebe
0f15664ffa * check whether symtablestack.top is a javaclass/interface rather than
pd.struct to determine whether a directive is allowed or not, because
    pd.struct is also set for nested routines (also has to be changed for
    objcclass)

git-svn-id: branches/jvmbackend@18608 -
2011-08-20 08:14:45 +00:00
Jonas Maebe
4f52639871 * use procdef.defid instead of procdef.procsym.symid to make the names of
parentfpstructs unique (a single procsym can have multiple overloaded
    procdefs, but a single procdef is unique)

git-svn-id: branches/jvmbackend@18607 -
2011-08-20 08:14:41 +00:00
Jonas Maebe
9aae0c47bd * manual merge of svn r17800 (open array overload choosing)
git-svn-id: branches/jvmbackend@18606 -
2011-08-20 08:14:36 +00:00
Jonas Maebe
b0d777e16b * keep dynamic array -> open array type conversion nodes for the JVM target,
so that the result type of random dynamic array expressions doesn't suddenly
    get changed into open array (causes internalerror if the size is requested),
    and instead simply change the conversion type to tc_equal

git-svn-id: branches/jvmbackend@18605 -
2011-08-20 08:14:30 +00:00
Jonas Maebe
887248af2d * support var/out managed types on the callee side in location_get_data_ref()
git-svn-id: branches/jvmbackend@18604 -
2011-08-20 08:14:26 +00:00
Jonas Maebe
7e6261ff55 * fixed return opcode for enums and smallsets
git-svn-id: branches/jvmbackend@18603 -
2011-08-20 08:14:21 +00:00
Jonas Maebe
6bc68a11d9 * determine size of aword/aint/asizeint based on type size instead of based
on defines

git-svn-id: branches/jvmbackend@18602 -
2011-08-20 08:14:14 +00:00
Jonas Maebe
c943d703fd * fixed range check error when compiling with -dTest_Double_checksum
(although it crashes later for other reasons)

git-svn-id: branches/jvmbackend@18601 -
2011-08-20 08:14:09 +00:00
Jonas Maebe
16cb75a5da * also free the regular code generator when freeing the hl code generator
git-svn-id: branches/jvmbackend@18600 -
2011-08-20 08:14:05 +00:00
Jonas Maebe
4c6388df6f * fixed memory leaks when ending a macro
git-svn-id: branches/jvmbackend@18599 -
2011-08-20 08:14:00 +00:00
Jonas Maebe
f3f378496f * fixed memory leaks
git-svn-id: branches/jvmbackend@18598 -
2011-08-20 08:13:55 +00:00
Jonas Maebe
ce88df680b + symansistr conditional define that, when activated, makes the symbol/
mangled name handling ansistring rather than pshortstring based (required
    for JVM target; little effect on speed, some extra memory usage)

git-svn-id: branches/jvmbackend@18597 -
2011-08-20 08:13:50 +00:00
Jonas Maebe
54f96997b9 + support for JVM additions and some other fixes
git-svn-id: branches/jvmbackend@18596 -
2011-08-20 08:13:44 +00:00
Jonas Maebe
d0a3b49e6c * fixed memory leak
git-svn-id: branches/jvmbackend@18595 -
2011-08-20 08:13:36 +00:00
Jonas Maebe
f1652a6c87 * copy dispid in tprocdef.getcopy()
git-svn-id: branches/jvmbackend@18594 -
2011-08-20 08:13:31 +00:00
Jonas Maebe
7cf06b9aa6 * fixed accessing var-parameters from nested routines
o support for JVM arrays in JVM addrnodes and derefnodes (so we
     can take the address of var parameters to store them in the
     parentfpstruct and later dereference them)
   o process loadnode.left also in tjvmloadnode.pass_generate_code() when
     handling var-parameters

git-svn-id: branches/jvmbackend@18593 -
2011-08-20 08:13:27 +00:00
Jonas Maebe
23e4405c78 * copyout parameters also have to return "true" for is_addr_param_load()
git-svn-id: branches/jvmbackend@18592 -
2011-08-20 08:13:21 +00:00
Jonas Maebe
4be0ba267a * moved creating block/statement for reference temps into
maybereplacewithtempref() helper

git-svn-id: branches/jvmbackend@18591 -
2011-08-20 08:13:16 +00:00
Jonas Maebe
ad6ae44093 * force mode objfpc for synthetic method implementations (to guarantee
that e.g. "out" and &-escaping are possible)

git-svn-id: branches/jvmbackend@18590 -
2011-08-20 08:13:11 +00:00
Jonas Maebe
4fbc1b5369 * better internal names for anonymous records (can't use characters that
are not valid for Pascal identifiers though, because the names are used
    in auto-generated source code)

git-svn-id: branches/jvmbackend@18589 -
2011-08-20 08:13:05 +00:00
Jonas Maebe
8fa42c206f + support for nested procedures for the JVM target
o since the JVM target has no stack/framepointer that can be passed
     on to nested routines, all local variables and parameters accessed
     from nested routines are grouped into a local record whose address
     is passed to nested routines. The same technique is also required
     for LLVM in the future

git-svn-id: branches/jvmbackend@18588 -
2011-08-20 08:12:59 +00:00
Jonas Maebe
874095a1c0 * don't skip pushing self parameters for methods of empty structures
git-svn-id: branches/jvmbackend@18587 -
2011-08-20 08:12:53 +00:00
Jonas Maebe
00086c3dfc * don't give an internalerror when encountering an invalid type while
creating procdef's JVM mangled name, because this situation can also
    arise in case there's a simple error in the source code

git-svn-id: branches/jvmbackend@18586 -
2011-08-20 08:12:48 +00:00
Jonas Maebe
9d0fdb3150 * explicitly specify symtable to jvm_guarantee_record_typesym() instead of
hardcoding symtablestack.top

git-svn-id: branches/jvmbackend@18585 -
2011-08-20 08:12:43 +00:00
Jonas Maebe
0fad10179c * fixed some voidpointerdef handling
git-svn-id: branches/jvmbackend@18584 -
2011-08-20 08:12:39 +00:00
Jonas Maebe
ba5e264a93 * make the mangled names of symbols in the local scope of
procedures/functions/methods on the JVM platform unique

git-svn-id: branches/jvmbackend@18583 -
2011-08-20 08:12:34 +00:00
Jonas Maebe
1bc846dd3c + TSymtablestack.getcopyuntil() method that creates a copy of a
symtablestack up to and including a particular symtable

git-svn-id: branches/jvmbackend@18582 -
2011-08-20 08:12:29 +00:00
Jonas Maebe
e9e72e6de0 * fixed copyright date
git-svn-id: branches/jvmbackend@18581 -
2011-08-20 08:12:24 +00:00
Jonas Maebe
528882dc68 * allow typeconversions of formaldef to anything else (make sure to
transform into an as-node when converting into a class/array type)

git-svn-id: branches/jvmbackend@18580 -
2011-08-20 08:12:20 +00:00
Jonas Maebe
c995e56370 * internalerror if constructor not found in record
git-svn-id: branches/jvmbackend@18579 -
2011-08-20 08:12:15 +00:00
Jonas Maebe
223057f1a7 + support for is/as and Java interfaces
git-svn-id: branches/jvmbackend@18578 -
2011-08-20 08:12:09 +00:00
Jonas Maebe
225e866800 - removed superfluous check that could use uninitialized location
git-svn-id: branches/jvmbackend@18577 -
2011-08-20 08:12:04 +00:00
Jonas Maebe
8ec21eb426 * fixed flow control handling in case of empty try-blocks and in case of
no default exception catching block

git-svn-id: branches/jvmbackend@18576 -
2011-08-20 08:11:59 +00:00
Jonas Maebe
1dca48bce5 * set reused left node to nil for JVM loadvmtaddrnodes that need to call a
helper
  * never call a helper for classrefdefs (in that case we have to load the
    classrefdef itself, not the classrefdef for the class representing
    classrefdefs)

git-svn-id: branches/jvmbackend@18575 -
2011-08-20 08:11:54 +00:00
Jonas Maebe
0706cb5eb6 + support for pointers to types that are implicit pointer types in the JVM
(non-dynamic arrays, records, shortstrings)
  - removed the ability to typecast such types directly into related class
    types, you have to use the @-operator first now to get a pointer to
    the type
   o updated the RTL and internal compiler code to properly use this
     new convention
   o allowed removing several special cases from
     tjvmtypeconvnode.target_specific_general_typeconv(), and that
     method can probably be removed completely over time
  * no longer give compile time errors for pointer-related typecasts that
    will fail at run time, because the checking was too complex and could
    be worked around via actual pointer typecasts anyway
  * removed some unnecessary checkcast operations (for shortstring/
    shortstringclass)

git-svn-id: branches/jvmbackend@18574 -
2011-08-20 08:11:49 +00:00
Jonas Maebe
207a4a32d3 * internalerror in case a stringdef manages to get through to
tjvmvecnode.pass_generate_code() (should be handled earlier)

git-svn-id: branches/jvmbackend@18573 -
2011-08-20 08:11:43 +00:00
Jonas Maebe
564b8a2cf7 - removed "{$ifdef unsupported}" block for jvm (is handled in njvmmem
already)

git-svn-id: branches/jvmbackend@18572 -
2011-08-20 08:11:38 +00:00
Jonas Maebe
71cd31159c * encode java_jlstring instead of using a hardcoded string constant for
the type encoding of unicodestring

git-svn-id: branches/jvmbackend@18571 -
2011-08-20 08:11:33 +00:00
Jonas Maebe
6857dde33e + shortstring support for the JVM target (including accessing character 0 as
the "length byte")

git-svn-id: branches/jvmbackend@18570 -
2011-08-20 08:11:28 +00:00
Jonas Maebe
f2d3203bb6 * commented out unimplemented pos() variant
git-svn-id: branches/jvmbackend@18569 -
2011-08-20 08:11:22 +00:00
Jonas Maebe
13cf0e031e * removed unused variables
* char -> ansichar

git-svn-id: branches/jvmbackend@18568 -
2011-08-20 08:11:17 +00:00
Jonas Maebe
87f812c778 * fixed typo in comment
git-svn-id: branches/jvmbackend@18567 -
2011-08-20 08:11:12 +00:00
Jonas Maebe
db1d22aeae * fixed header comments
git-svn-id: branches/jvmbackend@18566 -
2011-08-20 08:11:08 +00:00
Jonas Maebe
eb40756d35 * zero-extend byte/word field loads (get/putstatic sign-extends)
* move the incstack() from a load before the potential "and" to
    zero-extend, so that the maximum stack height get calculated
    properly

git-svn-id: branches/jvmbackend@18565 -
2011-08-20 08:11:03 +00:00
Jonas Maebe
baad29373e + ansistr_to_shortstr and vice versa stub helpers
git-svn-id: branches/jvmbackend@18564 -
2011-08-20 08:10:54 +00:00
Jonas Maebe
6374b473ff * convert string constants passed to JLString to unicode
git-svn-id: branches/jvmbackend@18563 -
2011-08-20 08:10:46 +00:00
Jonas Maebe
446d91eaab + ansistring support. Items of note:
o support for ansistring constants. It's done via a detour because the
      JVM only supports UTF-16 string constants (no array of byte or anything
      like that): store every ansicharacter in the lower 8 bits of an
      UTF-16 constant string, and at run time copy the characters to an
      ansistring. The alternative is to generate code that stores every
      character separately to an array.
    o the base ansistring support is implemented in a class called
      AnsistringClass, and an ansistring is simply an instance of this
      class under the hood
    o the compiler currently does generate nil pointers as empty
      ansistrings unlike for unicodestrings, where we always
      explicitly generate an empty string. The reason is that
      unicodestrings are the same as JLString and hence common
      for Java interoperation, while ansistrings are unlikely to
      be used in interaction with external Java code

  * fixed indentation

git-svn-id: branches/jvmbackend@18562 -
2011-08-20 08:10:39 +00:00
Jonas Maebe
aa1f299a17 + added hook for "individual value to open array of one element"-conversion,
so it can be intercepted by the JVM backend (it has to create an actual
    array)
  + JVM support for the elem_2_open_array hook

git-svn-id: branches/jvmbackend@18561 -
2011-08-20 08:10:31 +00:00
Jonas Maebe
8248e6762f * support opcode+operands > 255 characters (e.g. when loading string constants)
git-svn-id: branches/jvmbackend@18560 -
2011-08-20 08:10:26 +00:00