Commit Graph

233 Commits

Author SHA1 Message Date
florian
b1dff29cbf * removed unused units
git-svn-id: trunk@36165 -
2017-05-09 19:53:14 +00:00
svenbarth
0e7a9ad375 * partial fix for Mantis #30831 (partial, because no exception has been encountered yet): when checking whether the left node of a vmtaddrnode is a generic, don't rely on df_generic, but instead use is_generic which checks for a true generic (the other will also be true if it's merely a structured type declared (or specialized) inside another generic)
+ added test

git-svn-id: trunk@34915 -
2016-11-18 14:43:45 +00:00
nickysn
657685a8b6 * use sizesinttype instead of ptrsinttype for the index and high parameter of
open arrays/dynarrays/string-like char arrays, etc.

git-svn-id: trunk@34665 -
2016-10-08 13:56:24 +00:00
Jonas Maebe
18639304e1 * convert the index for open arrays to ptr(u/s)inttype instead of to
(s/u)inttype (as in r32745)

git-svn-id: trunk@34057 -
2016-07-03 21:18:19 +00:00
Jonas Maebe
996e325175 * converted range checking for open arrays/array of const from the code
generator to the typecheck pass, so that it also works for platforms
    that use the parentfpstruct way to handle accesses to nested frames
    in case the array has been migrated to such a parentfpstruct
   o additionally, the number of comparisons for such range checks
     has been reduced from 3 (for signed indices) or 2 (for unsigned
     indices) to 1 in all cases
   o the range checking code is disabled for the JVM target, as the
     JVM automatically range checks all array accesses itself anyway

git-svn-id: trunk@34034 -
2016-06-30 15:33:47 +00:00
Jonas Maebe
5af40f22e8 * handle enums with a packenum setting that is larger than necessary to store
all of their values, when kept in a bitpacked array, properly via
    pass_typecheck rather than hacking location.size in pass_generate_code:
   o the old fix was incomplete (it didn't handle non-constant indices)
   o the old fix didn't work for llvm (since it uses defs rather than
     location.size)

git-svn-id: trunk@33943 -
2016-06-09 22:00:14 +00:00
Jonas Maebe
7005dec9b4 * equivalent of r32602 for subscriptnodes; couldn't find a test that fails
without this patch, but just like with arrays, writing part of a record
    should mark the record itself as modified

git-svn-id: trunk@33195 -
2016-03-06 15:10:31 +00:00
Jonas Maebe
356a5aff05 * apparently, Darwin/x86-64 also uses an opaque ISA pointer on OS X 10.11
-> assume it is always the case for non-fragile ABI platforms
    (mantis #29667)

git-svn-id: trunk@33112 -
2016-02-22 08:44:00 +00:00
florian
cad29a4e19 * set nf_write flag correctly for subscript nodes, resolves issue #28713
git-svn-id: trunk@32602 -
2015-12-06 19:17:50 +00:00
Jonas Maebe
2778bf55c7 * add "doregister" parameter to torddef.create, and don't register temporary
defs created in the scanner for evaluating compile time expressions, or in
    the code generator for range checking

git-svn-id: trunk@32046 -
2015-10-13 15:59:06 +00:00
svenbarth
529677cc79 ncal.pas:
* extend tcallnode with the ability to pass a tspecializationcontext so that tcallcandidates can do a final specialization
  * the final procdef is registered at the end of tcallnode.pass_typecheck

git-svn-id: trunk@31763 -
2015-09-18 14:48:54 +00:00
florian
049491a573 + fold the constructs @<record type>(nil^).<field >) and @<record point>(nil)^.<field> used to get the offset of a field into a constant
git-svn-id: trunk@31470 -
2015-08-31 20:03:49 +00:00
Jonas Maebe
f402b0d7df * changed getpointerdef() into a tpointerdef.getreusable() class method
o allows removing the ugly x86 hacks

git-svn-id: trunk@31144 -
2015-06-22 08:17:49 +00:00
Jonas Maebe
3f736f6114 * handle the loading of VMT entries at the node level, so it's done in a
type-safe way (for LLVM, and also internal consistency checking between
    the VMT as generated in nobj.pas and ncgvmt.pas)
   o also converted the VMT validity checking to the node level

git-svn-id: trunk@30950 -
2015-05-31 16:50:47 +00:00
Jonas Maebe
703e31512d * moved JVM-specific code of tloadvmtaddrnode.pass_1 to njvmmem
* create separate nodes for Objective-C in tloadvmtaddrnode.pass_1
    instead of implicitly relying on the fact that the Objective-C
    ISA field is at the same offset as the VMT of Object-Pascal
    classes
   o translate the resulting loads of ISA field into direct pointer
     accesses, so that even on non-fragile ABI platforms we don't
     go via an indirection (like clang/gcc)

git-svn-id: trunk@30947 -
2015-05-31 16:50:39 +00:00
Jonas Maebe
37c2d0e60d * use Object_getClass(obj) instead of obj._class to get the class of an
Objective-C instance on AArch64, as the latter helper from the runtime
    is a plain function call rather than an expensive message dispatch,
    and moreover it also works for protocols (the "class" method is part
    of NSObject, and protocols do not support it since there is no single
    root class and hence they may represent an instance of a class that
    does not derive from NSObject)
   o also call it to get the "self" pointer when calling class methods for
     protocols on AArch64 (fixes tobjc22a and tobjc22b on Darwin/AArch64)
   o also call it to get the metaclass of a class on Darwin/AArch64 (fixes
     tobjc25)
  - removed special handling of getting the Objective-C (meta)class for
    non-type nodes on other Darwin platforms, as this is also correctly
    handled by the generic pass_generate_code

git-svn-id: trunk@30018 -
2015-02-26 21:49:08 +00:00
Jonas Maebe
2c6e16e49e * accesses to the ISA pointer are guaranteed to be aligned -> ensure the
code generator knows this

git-svn-id: trunk@29944 -
2015-02-23 22:54:21 +00:00
Jonas Maebe
2340da410c * we cannot directly load the ISA pointer on AArch64, we have to call the
class instance method
   (http://www.sealiesoftware.com/blog/archive/2013/09/24/objc_explain_Non-pointer_isa.html )

git-svn-id: trunk@29943 -
2015-02-23 22:54:18 +00:00
Jonas Maebe
5bb89cc2f0 * keep track of the reason why a loadparentfpnode has been created: to
load a value from a nested context, or to pass a context to a nested
    routine. In case a target uses both the stack and frame pointer, this
    difference can matter.

git-svn-id: trunk@29937 -
2015-02-23 22:53:59 +00:00
Jeppe Johansen
7c34dc51a1 Removed vecn nodes from constant pointer address calculations to absolute variables, since only subscripts were being handled leading to problems like those described in issue #17118.
After the removal of vecn these values seem to be handled easily by subsequent optimizations anyway.

git-svn-id: trunk@28978 -
2014-11-03 20:12:19 +00:00
nickysn
235a37fad4 * moved the pass_1 handling of vecnodes for arraydefs to a new virtual method
tvecnode.first_arraydef. This will allow overriding it in the i8086 code
  generator in order to handle huge arrays.

git-svn-id: trunk@28271 -
2014-07-26 16:18:57 +00:00
nickysn
4b1e5f1c9a * in the vecnode, when indexing a pointer[], convert right to
tpointerdef.pointer_arithmetic_int_type instead of sinttype

git-svn-id: trunk@28269 -
2014-07-26 12:24:50 +00:00
nickysn
e6c5c35d65 * tarraydef.create_from_pointer changed to require the actual pointerdef as a
parameter, instead of the element def. This will allow e.g. creating huge
  arrays from huge pointers on i8086.

git-svn-id: trunk@28268 -
2014-07-26 10:39:18 +00:00
nickysn
02dff17ae0 * taddrnode: fixed getting the address of nested procs in tp mode in i8086 far
data memory models

git-svn-id: trunk@27816 -
2014-05-23 22:38:07 +00:00
nickysn
9f4dd78701 * the ifdef i8086 in taddrnode.pass_typecheck removed via using tabstractprocdef.address_type
git-svn-id: trunk@27547 -
2014-04-12 14:49:54 +00:00
florian
701cdf8ea2 * fix for #25956: left is not necessarily the array load node when accessing an open array/array of const element
git-svn-id: trunk@27487 -
2014-04-06 15:15:16 +00:00
Jonas Maebe
4a79481c51 * isolated segment-related functionality of tabsolutevarsym into i386/i8086-
specific descendent classes and moved the code that deals with this in the
    code generator also to target-specific classes -> only ifdefs left in
    pdecvar

git-svn-id: trunk@27379 -
2014-03-30 15:42:53 +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
nickysn
2908fa9123 + added type parentfpvoidpointertype, which is a void pointer with the same size
as the hidden parentfp parameter, passed to nested procs. On i8086 it is
  always a near pointer, unlike voidpointer (which changes according to the
  memory model). This fixes nested procs in i8086 far data memory models.

git-svn-id: trunk@26934 -
2014-03-02 22:55:52 +00:00
sergei
07ce8f46a4 * loadvmtaddrnode accesses global data only when left.nodetype=typen.
git-svn-id: trunk@26742 -
2014-02-09 17:44:14 +00:00
florian
cd6f4d4469 * fix tsubscriptnode to handle left.location being an fpu or mm register as well.
git-svn-id: trunk@26642 -
2014-02-01 13:08:21 +00:00
Károly Balogh
5e15e4b07d add basic constant handling to subscript nodes, avoid ie20060521 when building rgobj.pas with -O3/-O4
git-svn-id: trunk@26532 -
2014-01-20 12:00:48 +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
florian
9fdd64e94c * indention and new line fixes
git-svn-id: trunk@25963 -
2013-11-06 21:10:28 +00:00
nickysn
f2763b98fa + implemented absolute seg:ofs vars on i8086
git-svn-id: trunk@25666 -
2013-10-05 22:16:33 +00:00
nickysn
6aae88578c + getting the address of a label now returns a far pointer in i8086 far code memory models; this fixes the call to fpc_raiseexception in the raise node
git-svn-id: trunk@25517 -
2013-09-17 22:45:13 +00:00
nickysn
c9096ef806 * far pointer fix in taddrnode.pass_typecheck
git-svn-id: trunk@24857 -
2013-06-09 23:07:30 +00:00
florian
b734c17c4f * formatting
git-svn-id: trunk@24580 -
2013-05-24 18:08:05 +00:00
nickysn
b0f7786782 + added support for special versions of near data pointers associated with a x86 segment register. They are supported on all x86 platforms: i8086, i386 and x86_64
git-svn-id: trunk@24453 -
2013-05-05 17:22:37 +00:00
paul
fe338013a5 compiler: calculate offset of record fields in taddrnode also for bitpacked structures (Jonas comment in bug #0019357)
git-svn-id: trunk@23437 -
2013-01-18 01:56:55 +00:00
Jonas Maebe
583eb3f9a4 * re-enabled loadvmtaddrnode for records on JVM targets, fixes
tests/test/jvm/tpvar.pp after r23417

git-svn-id: trunk@23430 -
2013-01-17 19:45:09 +00:00
paul
65cbb4e9ba compiler: calculate offset of record fields in taddrnode (based on patch of Jeppe Johansen, fixes bug #0019357)
git-svn-id: trunk@23428 -
2013-01-17 14:30:55 +00:00
paul
4d79a44e4c compiler: don't create loadvmtaddrnode for record references, they have no VMT (fixes bug #23130)
git-svn-id: trunk@23417 -
2013-01-17 07:30:00 +00:00
florian
761fcca4ec + is_dynamicstring
+ implement low/high for dynamic strings, resolves #15244 and #22936
+ basic support for $zerobasedstrings directive

git-svn-id: trunk@22933 -
2012-11-04 21:48:53 +00:00
pierre
bc04e83b25 Add pi_needs_got to current_procinfo.flags in pass_1 method if a label reference is used
git-svn-id: trunk@22448 -
2012-09-24 15:39:26 +00:00
Jonas Maebe
11e9f95580 * fixed (not harmless) class cast error when indexing an array[orddef] using
a non-orddef (e.g., a variant)

git-svn-id: trunk@21261 -
2012-05-08 20:02:26 +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
284210ad48 * hardcode offset of the ISA field in Objective-C (meta)classes to be
0, just like gcc/clang. This results in more efficient code on
    non-fragile ABI platforms and removes a dependency of the name
    of the isa field in header translations

git-svn-id: trunk@20623 -
2012-03-25 12:55:18 +00:00
Jonas Maebe
ab9b52a003 * truncate indices into arrays from 64 to 32 bit on 32 bit
platforms so that their code generators don't get 64 bit
    operands (fixes internalerrors on at least ppc32  after r20108)

git-svn-id: trunk@20132 -
2012-01-20 22:43:55 +00:00
Jonas Maebe
ceee186f2f * typecheck all array indices, not just integer and boolean types
o allows converting indices to the proper type if required (such as
     variant, mantis #20873)
   o do not create temporary defs for this type checking anymore if not
     necessary
   o makes sure that errors are thrown in case of conversions considered
     as invalid by the compiler rather than that wrong code is silently
     generated (such as in mantis #20873 before this change)

git-svn-id: trunk@20108 -
2012-01-18 21:29:44 +00:00