Commit Graph

133 Commits

Author SHA1 Message Date
florian
8de49997ea * align compiler generated constants according to constant aligment settings
git-svn-id: trunk@29652 -
2015-02-08 11:23:01 +00:00
florian
632f43c490 * fix assembling with masm according to #25858
git-svn-id: trunk@29635 -
2015-02-05 21:22:39 +00:00
sergei
a67478e033 * Simplified, removed redundant asmlist and duplicate call to maybe_new_object_file.
git-svn-id: trunk@29509 -
2015-01-20 07:52:11 +00:00
svenbarth
b38fb606cc Fix for Mantis #27185.
ngenutil.pas:
  * AddToStructInits: also process the class constructors/destructors of nested types

+ added test

git-svn-id: trunk@29308 -
2014-12-21 14:01:32 +00:00
Jonas Maebe
37009c917b * pass alignment to tnodeutils.insertbsssym()
git-svn-id: branches/hlcgllvm@28751 -
2014-10-06 20:53:14 +00:00
Jonas Maebe
7949bebb8d * synchronised with r28168 of trunk
git-svn-id: branches/hlcgllvm@28169 -
2014-07-05 21:30:28 +00:00
svenbarth
4a0d27ebfe Fix for Mantis #26271: Don't trash local variables that are used for the Default() intrinsic.
* ngenutil.pas, tnodeutils.trashable_sym:
    check for vo_is_default_var flag and don't consider such as trashable

+ added test

git-svn-id: trunk@27872 -
2014-06-06 13:59:52 +00:00
Jonas Maebe
bacd303208 * synchronized with trunk up to r27758
git-svn-id: branches/hlcgllvm@27779 -
2014-05-12 16:12:34 +00:00
Jonas Maebe
b57c95043f + support overriding tdef/tsym methods with target-specific functionality:
o made all (non-abstract) tdef and tsym constructors virtual
   o added c*def/c*sym classref types for every (non-abstract) t*def/t*sym
     class
   o added cpusym unit for every architecture that derives a tcpu*def/tcpu*sym
     class from the base classes, and initialises the c*def/c*sym classes with
     them. This is done so that the llvm target will be able to derive from
     the tcpu*def/sym classes without umpteen ifdefs, and it also means that
     the WPO can devirtualise everything because the c* variables are only
     initialised with one class type
   o replaced all t*def/t*sym constructor calls with c*def/c*sym constructor
     calls

git-svn-id: trunk@27361 -
2014-03-29 22:31:55 +00:00
Jonas Maebe
e9268a0a14 * synchronised with trunk up till r26975
git-svn-id: branches/hlcgllvm@26976 -
2014-03-06 21:36:58 +00:00
nickysn
5242ed7864 * changed TResStrInitTable.Count and TWStrInitTablesTable.Count to nativeint
git-svn-id: trunk@26921 -
2014-03-02 13:27:59 +00:00
nickysn
73e6ffe675 * the TableCount and InitCount fields in the INITFINAL table changed to
nativeint (generates smaller and more efficient code on i8086)

git-svn-id: trunk@26913 -
2014-03-01 14:33:10 +00:00
florian
15df4a4f80 + support iso pascal like program parameters in iso mode
git-svn-id: trunk@26437 -
2014-01-12 20:17:51 +00:00
Jonas Maebe
aa5823a454 * factored out inserting a single bss symbol in ngenutil so it can be
overridden by the llvm target
  * override a bunch of other ngenutil methods with empty stubs for things
    that are not yet supported when targeting llvm

git-svn-id: branches/hlcgllvm@26051 -
2013-11-11 11:16:13 +00:00
Jonas Maebe
a14ceba791 + -CTinitlocals switch for the JVM that initialises all local variables
that may trigger JVM bytecode verification errors if they are used
    before they are initialised (this includes passing them as a "var"
    parameter) + test
  * sorted -CT parameters alphabetically and alligned them

git-svn-id: trunk@25387 -
2013-08-29 22:21:23 +00:00
nickysn
e4f84b0f5d * i8086 medium model fixes in tnodeutils.InsertResourceTablesTable
git-svn-id: trunk@25290 -
2013-08-18 20:37:18 +00:00
nickysn
10db067372 * specify Tasmsymtype=AT_FUNCTION and use Create_nil_codeptr when generating the code pointers in the InitFinal table
git-svn-id: trunk@25286 -
2013-08-18 18:27:48 +00:00
svenbarth
ff3bb9322a Fix for Mantis #24848.
ngenutil.pas, AddToStructsInit:
  * don't add class constructors/destructors to the init table if they belong to a generic type

+ test

git-svn-id: trunk@25234 -
2013-08-11 11:20:12 +00:00
florian
380bc56e32 + create a default heap on embedded targets and register this default heap
* sysutils for the embedded target depends on a working heap manager

git-svn-id: trunk@23853 -
2013-03-16 10:37:18 +00:00
paul
5d74e0578a compiler: remove unused variables and unneeded assignments
git-svn-id: trunk@23467 -
2013-01-21 01:24:36 +00:00
sergei
1116bc3542 * Fixed incorrect condition (a linked list always has at least one dummy element) which was causing every unit to have a threadvar table, regardless of actual presence of threadvars. For units without code, this was causing creation of .o files which aren't necessary otherwise.
git-svn-id: trunk@23201 -
2012-12-21 14:13:30 +00:00
Jonas Maebe
289486346b * factored out code to decide when an asmsym for a staticvarsym has to be
global, and no longer make it global for all symbols when smartlinking
    is enabled on systems that use section-based smartlinking

git-svn-id: trunk@22241 -
2012-08-25 15:12:39 +00:00
Jonas Maebe
baa8fa39a8 * converted code to trash variables (-gt) to operate at the node tree level,
and also use this code to trash local variables in inlined routines
   o fixes mantis #22088
   o makes it possible to also implement it for the jvm target in the future

git-svn-id: trunk@21393 -
2012-05-26 11:32:39 +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
Jonas Maebe
aee5380ae0 * merged trunk up to r20882
o support for the new codepage-aware ansistrings in the jvm branch
   o empty ansistrings are now always represented by a nil pointer rather than
     by an empty string, because an empty string also has a code page which
     can confuse code (although this will make ansistrings harder to use
     in Java code)
   o more string helpers code shared between the general and jvm rtl
   o support for indexbyte/word in the jvm rtl (warning: first parameter
     is an open array rather than an untyped parameter there, so
     indexchar(pcharvar^,10,0) will be equivalent to
     indexchar[pcharvar^],10,0) there, which is different from what is
     intended; changing it to an untyped parameter wouldn't help though)
   o default() support is not yet complete
   o calling fpcres is currently broken due to limitations in
     sysutils.executeprocess() regarding handling unix quoting and
     the compiler using the same command lines for scripts and directly
     calling external programs
   o compiling the Java compiler currently requires adding ALLOW_WARNINGS=1
     to the make command line

git-svn-id: branches/jvmbackend@20887 -
2012-04-15 15:54:10 +00:00
Jonas Maebe
40cf2cefa0 * when the user calls initialize(), force initialization to happen on the
JVM platform (normally it's not necessary because all types are
    automatically initialized)

git-svn-id: branches/jvmbackend@18672 -
2011-08-20 08:23:16 +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
e9e72e6de0 * fixed copyright date
git-svn-id: branches/jvmbackend@18581 -
2011-08-20 08:12:24 +00:00
Jonas Maebe
739c654e3a + support for main programs for the JVM target
o moved several routines from pmodules to ngenutil and overrode them
     in njvmutil (for unit initialisation tables, resource strings, ...)
   o force the evaluation stack size to at least 1 for the main program,
     because the unit initialisation triggers are inserted there afterwards
     and they require one stack slot

git-svn-id: branches/jvmbackend@18507 -
2011-08-20 08:05:38 +00:00
Jonas Maebe
41624e8102 * pd.owner.defowner -> pd.struct
git-svn-id: branches/jvmbackend@18484 -
2011-08-20 08:03:42 +00:00
Jonas Maebe
43c5ed20c2 + support for initialising typed constants via compiler-generated
assignment-nodes. For global typed constants and typed constants/
    local variable initialisers in regular functions/procedurs, the
    assignments are performed in the unit initialisation code. For
    those in object/record definitions and their methods, it's done
    in the class constructor. Since we may not yet have parsed all
    method implementations when the class constructor is parsed, part
    of these may be initialised in a helper routine called from the
    class constructor. The ones known when the class constructor is
    parsed are inited there, because the ones marked as "final" and
    declared as static class fields must be initialised in the class
    constructor for Java
   o new set systems_typed_constants_node_init in systems unit that
     indicates that a target uses node trees to initialise typed consts
     instead of an initialised data section
   o mark typed constants in {$j-} mode as "final" for JVM
   o mangle the name of staticvarsyms inside localtables a bit to avoid
     name clashes (only with procedure names for now, no parameters yet
     so can still cause problems with overloaded routines)
   o after a routine has been parsed, it is now processed by
     cnodeutils.wrap_proc_body(), which can add extra nodes before code
     generation (used for injected the typed constant node trees)

git-svn-id: branches/jvmbackend@18475 -
2011-08-20 08:02:58 +00:00
Jonas Maebe
c264c24fb0 + support for unit initialisation sections for the JVM target,
and initialise global variables that are wrapped (records, arrays)
    in those sections
   o check whether pd.localst is assigned in dbgjasm, because it's
     not for the unit initialisation routine
   o moved insertbssdata() from ncgutil to ngenutil and override it
     njvmutil (it does nothing in the latter, since global variables
     are added as fields to the class representing the unit; the
     initialisation is done in gen_initialize_code() in thlcgjvm)
   o added force_init() and force_final() methods to ngenutil, so
     that targets can force init/final routines separate from the
     regular managed types infrastructure (used by JVM for forcing
     an init section in case of records/arrays)

git-svn-id: branches/jvmbackend@18460 -
2011-08-20 08:01:39 +00:00
Jonas Maebe
ab5b1fb686 * turned call_fail_node, initialize_data_node, and finalize_data_node from
nutils.pas into virtual class methods of a new tnodeutils class defined
    in ngenutil (global factory: cnodeutils), so they can be overridden by
    architecture-specific implementations (required by the JVM backend)

git-svn-id: branches/jvmbackend@18364 -
2011-08-20 07:52:11 +00:00