Commit Graph

112 Commits

Author SHA1 Message Date
Jonas Maebe
ab0531f0ce * fixed JVM stack height calculation after calls returning an
implicit pointer tpe

git-svn-id: trunk@48832 -
2021-02-27 19:30:34 +00:00
yury
0a021be803 * Corrected visibility of overridden methods.
git-svn-id: trunk@48385 -
2021-01-24 12:41:12 +00:00
florian
637976e83f * patch by Marģers to unify internal error numbers, resolves #37888
git-svn-id: trunk@47103 -
2020-10-13 19:59:01 +00:00
Jonas Maebe
1b6425176b * synchronised with trunk till r42049
git-svn-id: branches/debug_eh@42050 -
2019-05-12 18:44:05 +00:00
Jonas Maebe
281b3ad276 * fix case completeness and unreachable code warnings in compiler that would
be introduced by the next commit

git-svn-id: trunk@42046 -
2019-05-12 14:29:03 +00:00
Jonas Maebe
4cd6f59bc3 * changed create_hlcodegen into a procvar, so that we don't have to insert
hlcgllvm in the uses clause of every unit that calls create_hlcodegen
   o prevents dependency cycles that can cause llvm codegen units to init
     before the cpu variants, which is bad since the llvm versions have to
     override the cpu variants in their init code (+ added checks in the
     init code that they are in fact initialised later)

git-svn-id: branches/debug_eh@40410 -
2018-11-29 21:31:15 +00:00
Jonas Maebe
0b246f3dbd * converted Boolean8 to an internal type, and mapped Boolean to the
new internal pasbool1(type) (part of mantis #34411)
   o apply the _Bool x86-64 parameter passing rules only to pasbool1

git-svn-id: trunk@39949 -
2018-10-16 21:14:18 +00:00
Jonas Maebe
4686f61002 * keep track of the temp position separately from the offset in references,
so that they can still be freed after the reference has been changed
    (e.g. in case of array indexing or record field accesses) (mantis #33628)

git-svn-id: trunk@38814 -
2018-04-22 17:03:16 +00:00
Jonas Maebe
a25ebbba3e + added volatility information to all memory references
o separate information for reading and writing, because e.g. in a
     try-block, only the writes to local variables and parameters are
     volatile (they have to be committed immediately in case the next
     instruction causes an exception)
   o for now, only references to absolute memory addresses are marked
     as volatile
   o the volatily information is (should be) properly maintained throughout
     all code generators for all archictures with this patch
   o no optimizers or other compiler infrastructure uses the volatility
     information yet
   o this functionality is not (yet) exposed at the language level, it
     is only for internal code generator use right now

git-svn-id: trunk@34996 -
2016-11-27 18:17:37 +00:00
Jonas Maebe
aa1be3276f - removed default value of _typ parameter of TAsmData.(Weak)RefAsmSymbol():
it was AT_NONE, which is invalid and should never be used
  * explicitly pass the correct value for all calls to those methods elsewhere
    in the compiler

git-svn-id: trunk@34250 -
2016-08-05 07:09:16 +00:00
Jonas Maebe
06feac07a5 + support for the text/file types on the JVM platform
git-svn-id: trunk@31683 -
2015-09-15 11:51:19 +00:00
Jonas Maebe
3be51e1455 * fixed endless recursion in tabstractrecorddef.contains_float_field() in
case a record contains an internal typed constant of its own type
    (which happened becuase such a typed constant is also fieldvarsym, solved
     by checking for sp_static) (mantis #27880)
  * fixed several other similar cases in the compiler where we are only
    interested in instance fields, but processed all fieldvarsyms

git-svn-id: trunk@30614 -
2015-04-16 21:25:22 +00:00
Jonas Maebe
67b8aceaee * synchronized with privatetrunk till r30095
git-svn-id: branches/hlcgllvm@30101 -
2015-03-05 20:32:15 +00:00
Jonas Maebe
2ab7f5c35d * moved x86-specific requirements from the generic bsr/bsf code to the
x86 code generator (register size constraints)

git-svn-id: trunk@29984 -
2015-02-23 22:57:18 +00:00
Jonas Maebe
1516661249 + new chlcgobj class reference variable that can be used to call thlcg*
virtual methods even when hlcg doesn't contain a valid instance

git-svn-id: branches/hlcgllvm@28143 -
2014-07-03 22:28:31 +00:00
Jonas Maebe
bf617cb389 * changed hlcgobj.def2reg() into a class method so it can also be called
when there's no instantiated tlhcg

git-svn-id: branches/hlcgllvm@28115 -
2014-07-01 16:30:30 +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
93d50bc287 * moved jvm-specific classdef-related fields from tenumdef to a platform-
specific descendant

git-svn-id: trunk@27439 -
2014-04-01 21:41:30 +00:00
Jonas Maebe
f4c0daddb4 * moved jvm-specific exprasm field from tprocdef to jvm-specific descendant
git-svn-id: trunk@27394 -
2014-03-30 21:04:25 +00:00
Jonas Maebe
11c7d5223c * moved ifdef'd jvm code from tprocvardef to jvm-specific descendant
git-svn-id: trunk@27386 -
2014-03-30 17:15:57 +00:00
nickysn
26b53607f8 + added method reference_reset_base with support for different pointer types to
the high level code generator. All hlcg code, except for the jvm code
  generator, updated to use the new method. I didn't update jvm (it still uses
  the method from cgutils), because I'm not familiar with that platform, so I
  might get the types wrong.

git-svn-id: trunk@27309 -
2014-03-28 00:01:18 +00:00
Jonas Maebe
73a3f5ced4 * moved ncgutil.maybechangeloadnodereg() to hlcg.maybe_change_load_node_reg()
and moved ifdef'd jvm code to overridden method

git-svn-id: trunk@27153 -
2014-03-16 11:24:40 +00:00
Jonas Maebe
81427523ab * pass a list of (pointers to) the paralocs to hlcgobj.a_call/g_call*, as
required for the LLVM support (LLVM parameter support is not yet
    included)
  * always return the function return loc from a_call*, again as required
    for the LLVM support

git-svn-id: branches/hlcgllvm@26992 -
2014-03-06 21:40:57 +00:00
Jonas Maebe
8065fc24d9 * fixed indentation of stack slot allocation debug statements
git-svn-id: trunk@26474 -
2014-01-15 20:36:59 +00:00
florian
4d5119bf1c * fixes several issues which cause warnings by the dfa code when using it to detect uninitialized variables
git-svn-id: trunk@26161 -
2013-12-01 17:02:08 +00:00
Jonas Maebe
d2bad665fa * fixed a_op_*_reg() for OP_NOT/OP_NEG (due to the register allocation the
generated code often was still valid though)

git-svn-id: trunk@25415 -
2013-09-04 19:16:59 +00:00
Jonas Maebe
f985149163 * fixed compilation after r24661 (added dummy overloads for newly
implemented LOC_MMREGISTER hlcgobj methods)

git-svn-id: trunk@24731 -
2013-06-01 16:48:11 +00:00
nickysn
7b8e18ba40 * updated aint to tcgint in jvm/hlcgcpu.pas as well (needed after r23761)
git-svn-id: branches/i8086@24088 -
2013-03-31 12:52:56 +00:00
Jonas Maebe
29263eb343 + full support for overflow checking on the JVM target (note: significantly
increases code size, because not natively supported by the JVM)

git-svn-id: trunk@22808 -
2012-10-21 17:56:33 +00:00
Jonas Maebe
6abc6106e1 - removed unused local variable
git-svn-id: trunk@22806 -
2012-10-21 17:56:20 +00:00
Jonas Maebe
62c8e47547 + override unnecessary abstract thlcgobj methods with internal errors
git-svn-id: trunk@22281 -
2012-09-02 14:32:31 +00:00
Jonas Maebe
f9c6967c36 * fixed not(pasbool64) (has to be "xor 1" rather than "xor -1")
git-svn-id: trunk@22167 -
2012-08-21 20:04:19 +00:00
Jonas Maebe
7717e43929 * moved setting the call result to a separate method, so it can still be
used across multiple levels of inheritance such as on MIPS (and the code
    has to be reusable for a_call_ref/reeg in the future anyway)

git-svn-id: trunk@21906 -
2012-07-12 20:56:25 +00:00
Jonas Maebe
1955255dda * let thlcg.a_call_name() return the tcgpara representing the function
result location (NR_FUNCTION_RESULT_REG is not valid on all platforms)
   o this requires passing the forced function result type (if any) to this
     method
   o a generic, basic thlcg.a_call_name() is now available that sets the
     function result location; can be called by descendants
  * the availability under all circumstances of the correct function return
    type enables g_call_system_proc() on the JVM platform to now determine
    by itself how many stack slots are removed by the call -> do so, instead
    of manually counting them (or forgetting to do so and messing up the
    maximum evaluation stack height calculations)

git-svn-id: trunk@21862 -
2012-07-11 08:25:58 +00:00
Jonas Maebe
b0462d27cc * by default, no longer initialize enumeration fields of classes/objects
with the enum instance corresponding to ordinal 0 in JVM constructors,
    because a virtual method called by a parent constructor may already
    have assigned a different value (see tests/test/jvm/tenum2.pp). This
    will result in null pointer exceptions when using such fields without
    first explicitly assigning a value to them though.

    The old behaviour can be restored with the new -CTenumfieldinit command
    line parameter

git-svn-id: trunk@21736 -
2012-06-29 21:24:35 +00:00
Jonas Maebe
7c21cba1e2 * migrated g_copyshortstring, g_incrrefcount and g_array_rtti_helper to thlcg
git-svn-id: trunk@21699 -
2012-06-24 21:36:28 +00:00
Jonas Maebe
8a7123eed8 * override a_call_reg() with an internalerror rather than a_call_ref(),
since it's the former that is abstract in the base class

git-svn-id: trunk@21126 -
2012-04-29 22:26:51 +00:00
Jonas Maebe
1345b7d107 * changed ref parameter of thlcgobj.a_call_ref() into a const parameter
git-svn-id: trunk@21115 -
2012-04-29 13:13:42 +00:00
Jonas Maebe
4fced5d142 + generic implementation of thlcgobj.a_call_ref()
* override thlcg.a_call_reg() in JVM hlcgcpu with dummy that calls
    internalerror

git-svn-id: trunk@21099 -
2012-04-28 14:27:45 +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
94bdf8a086 * adjust integer type information before stores part of a_op_const_ref for
Dalvik type checker

git-svn-id: branches/jvmbackend@20628 -
2012-03-25 14:46:37 +00:00
Jonas Maebe
fc6be612fd * also insert an explicit conversion from byte/char/bytebool/... to smallint
on Dalvik, because those values are obtained via an "and 255" operation
    which again turns them into longint values as var as the Dalvik type
    system is concerned

git-svn-id: branches/jvmbackend@20527 -
2012-03-16 20:57:22 +00:00
Jonas Maebe
0248258670 * always size the value on top of the stack back down to its original size
after an 8/16 bit operation on Dalvik (even if the value cannot have
    become too big), because otherwise its type checker complains

git-svn-id: branches/jvmbackend@20520 -
2012-03-15 17:05:50 +00:00
Jonas Maebe
3916a32f9e * created generic version of thlcgobj.g_reference_loc() and only override
JVM-specific case (needed for future trunk marge to prevent abstract
    method warning)

git-svn-id: branches/jvmbackend@20387 -
2012-02-20 11:28:50 +00:00
Jonas Maebe
764502fbe4 * don't "and" loaded unsigned values of 1/2 bytes with 255/65535 in case
their upper bound is lower than 127/32767: not necessary, and in case
    of booleans not even allowed for Dalvik (because the "and" operation
    turns the boolean into an integer as far as Dalvik is concerned)

git-svn-id: branches/jvmbackend@19825 -
2011-12-11 17:25:58 +00:00
Jonas Maebe
f4f70f99b2 * call all operators with invokestatic, since they are always
class methods

git-svn-id: branches/jvmbackend@19823 -
2011-12-11 17:25:42 +00:00
Jonas Maebe
bd990d1173 * generate JVM bytecode that passes the stringent requirements of the Dalvik
verifier when -Cpjvmdalvik is used (including debug information). Using
    -Cpjvmdalvik changes the semantics at the language-level in one case:
    boolean(bytevar) will no longer return a boolean that contains the same
    value as bytevar did, but will map the value to 0/1 (that also means that
    such expressions cannot be passed to var-parameters in case of
    -Cpjvmdalvik). Code compiled with -Cpjvmdalvik will also work fine on
    the regular JVM, but it may be somewhat slower (it won't necessarily
    be slower on Dalvik, because the .class -> .dex transformation
    applies many optimizations itself)

git-svn-id: branches/jvmbackend@19743 -
2011-12-04 14:48:54 +00:00
Jonas Maebe
1a7c024ad3 * sign extend all byte/ansichar/word parameters before passing them
to and returning them from sub routines, in order to follow the JVM
    specs to the letter (not checked by the JVM bytecode verifiers, but
    checked by the Android DEX verifier)
  * -> also zero-extend them again at the caller side after returning
    from such a function

git-svn-id: branches/jvmbackend@18919 -
2011-08-30 23:34:12 +00:00
Jonas Maebe
f21b34c954 * also resize the value on the stack in a_load_reg_ref() when
required based on the source/destination sizes (like in
    a_load_reg_reg(), a_load_ref_reg() and a_load_ref_ref())

git-svn-id: branches/jvmbackend@18918 -
2011-08-30 23:34:07 +00:00
Jonas Maebe
0e80844e33 * also zero-extend incoming byte/word const-parameters (instead of only
value parameters)
  * fixed upper bound check to determine whether zero-extending is required

git-svn-id: branches/jvmbackend@18917 -
2011-08-30 23:34:02 +00:00