Commit Graph

34927 Commits

Author SHA1 Message Date
Jonas Maebe
460c7a519b * also handle tc_int_2_int,tc_int_2_bool,tc_bool_2_int in
target_specific_general_typeconv() for enum type conversions

git-svn-id: branches/jvmbackend@18628 -
2011-08-20 08:16:37 +00:00
Jonas Maebe
815ab863b6 * fixed external name for inner classes (must not contain the name for
the outer class)
  * migrated some types that will be required for set support from jdk15
    to java_sys

git-svn-id: branches/jvmbackend@18627 -
2011-08-20 08:16:30 +00:00
Jonas Maebe
f59a2b38bf + string conversion for oo_is_enum_class
git-svn-id: branches/jvmbackend@18626 -
2011-08-20 08:16:24 +00:00
Jonas Maebe
94a4e1e069 + string version of vis_none
git-svn-id: branches/jvmbackend@18625 -
2011-08-20 08:16:19 +00:00
Jonas Maebe
622ac7184c * fixed string length for varspez strings
git-svn-id: branches/jvmbackend@18624 -
2011-08-20 08:16:14 +00:00
Jonas Maebe
6f2b7ca830 * never use the target_specific_explicit_typeconv() code for non-tc_equal
type conversions (those are/can be intercepted in the specific handlers)

git-svn-id: branches/jvmbackend@18623 -
2011-08-20 08:16:09 +00:00
Jonas Maebe
325b5cae6b * fixed int_to_int conversion for larger->smaller types in mem locations
(cannot reuse the memory location on the JVM)
  * optimized int_to_int conversions for certain smaller->larger types
    in mem locations (can reuse the memory location on the JVM, because
    stack locations are always at least 4 bytes)

git-svn-id: branches/jvmbackend@18622 -
2011-08-20 08:16:04 +00:00
Jonas Maebe
bf2854dae5 * when internally taking the address of shortstrings to typecast
them to shortstringclass, make sure the address operator is
    "typed" so that we don't insert useless checkcast instructions

git-svn-id: branches/jvmbackend@18621 -
2011-08-20 08:15:59 +00:00
Jonas Maebe
569228447d * converted all enum handling for the JVM target so that it uses the
JDK class-style enums rather than plain ordinals like in Pascal
   o for Pascal code, nothing changes, except that for the JVM target
     you can always typecast any enum into a class instance (to interface
     with the JDK)
   o to Java programs, FPC enums look exactly like Java enum types

git-svn-id: branches/jvmbackend@18620 -
2011-08-20 08:15:54 +00:00
Jonas Maebe
d64f5d14d6 * fixed compilation with -dnounsupported
git-svn-id: branches/jvmbackend@18619 -
2011-08-20 08:15:48 +00:00
Jonas Maebe
297f3d087d * don't write field definitions for varsyms marked as external
git-svn-id: branches/jvmbackend@18618 -
2011-08-20 08:15:43 +00:00
Jonas Maebe
1c3f0c7a2f * also wrap the initcode of main programs, so that typed constants get
initialized there as well for systems_typed_constants_node_init

git-svn-id: branches/jvmbackend@18617 -
2011-08-20 08:15:39 +00:00
Jonas Maebe
13b0ac91d9 + generate java.lang.Enum descendant classes for Pascal enum types
o these classes get an "enum" flag in the class files
   o these classes get a class field (whose type is that same enum
     class) per enum in the type, which also gets the "enum" flag
   o those class fields are initialised in the class constructor
     with the name of the enum and their order in the declaration
   o if the enum has jumps in FPC (lowest value is not 0, or not
     all values are contiguous), then we add an extra field
     to hold the FPC ordinal value of the enum
   o these classes get a class field valled $VALUES that contains
     a reference to the aforementioned class fields in order of
     declaration (= ordinal->instance mapping, JDK-mandated)
   o apart from the JDK-mandated instance methods (values, valueOf),
     also add FPCOrdinal (returns FPC ordinal value; same as order
     of declaration in case of no jumps) instance method and FPCValueOf
     (returns enum corresponding to FPC ordinal value) static class
     method
   o the mapping between FPC ordinals and enum instances in case of
     jumps is stored in a hashmap whose size is the next prime number
     greater or equal than the number of enum elements
   o moved several extra JDK types to the system unit for the enum
     support, and for future boxing and Java set support
   o several new synthetic method identifiers to generate the enum class
     methods/constructor/class constructor
   o enums with jumps are ordered by FPC ordinal value in the JVM
     $VALUES array so that the java.lang.Enum.doCompare() method
     will properly compare them

git-svn-id: branches/jvmbackend@18616 -
2011-08-20 08:15:28 +00:00
Jonas Maebe
d0b1bfa52d * mark sp_internal fields as "synthetic"
* don't mark class var fields as sp_internal (since they're user-visible)

git-svn-id: branches/jvmbackend@18615 -
2011-08-20 08:15:20 +00:00
Jonas Maebe
30478a14b6 + new vis_none visibility specifier that can be used as "neutral"
* make it possible to force the visibility of added constructors
    in add_missing_parent_constructors_intf() to a particular
    setting (use vis_none to keep the visibility of the inherited
    constructor)

git-svn-id: branches/jvmbackend@18614 -
2011-08-20 08:15:15 +00:00
Jonas Maebe
1302017b21 + support class variables in propaccesslist_to_node() (use regular loadn,
no subscriptn)

git-svn-id: branches/jvmbackend@18613 -
2011-08-20 08:15:10 +00:00
Jonas Maebe
11957cdd5f * changed argument/result of internal_static_field_name() from
shortstring to tsymstr

git-svn-id: branches/jvmbackend@18612 -
2011-08-20 08:15:05 +00:00
Jonas Maebe
3320fee51c * use symbol type instead of sp_static flag to determine whether a final
symbol can only be assigned in the constructor or class constructor

git-svn-id: branches/jvmbackend@18611 -
2011-08-20 08:15:00 +00:00
Jonas Maebe
9a6ab55c97 * correctly handle "class fields" in record definitions
git-svn-id: branches/jvmbackend@18610 -
2011-08-20 08:14:55 +00:00
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