Commit Graph

35 Commits

Author SHA1 Message Date
Sven/Sarah Barth
7de854ef1e + add method register_implemented_interface to tobjectdef which registers an implemented interface and - if desired - also initializes the GUID related fields of the objectdef
* use that method in all locations outside symdef that add add an implemented interface

Based on work by Blaise.ru
2022-05-26 21:43:37 +02:00
Sven/Sarah Barth
7f3a5eb9ab * extend tabstractprocdef.getcopyas by a parameter to control whether the copy should be registered or not 2022-05-26 21:42:59 +02:00
Pierre Muller
5acd7a7b83 Rename tsymtable.insert and delete methods to insertsym ands deletesym 2022-05-03 23:00:28 +02: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
svenbarth
bf5d75e594 * move the common sequence to build a VMT for an objectdef into a separate procedure (based on a patch by Blaise.ru)
git-svn-id: trunk@43674 -
2019-12-11 22:42:53 +00:00
Jonas Maebe
a051b8d225 - remmoved doregister parameter from t*sym constructors, as the registration
is handled automatically nowadays

git-svn-id: trunk@42998 -
2019-09-14 17:30:45 +00:00
Jonas Maebe
e008785152 * insert the hidden parameters for objectdef methods after resolving
overrides but before generating the VMT, so that these hidden parameters
    are part of the procdefs stored in the VMT (fixes some LLVM type errors
    after r41716)

git-svn-id: trunk@41884 -
2019-04-16 16:11:50 +00:00
Jonas Maebe
ed2ae508d0 * only add hidden parameters for objectdef methods after generating the vmt,
so that they take into account inherited calling conventions (mantis #35233)
   o don't needlessly calculate the paraloc info when generating a JVM mangled
     name

git-svn-id: trunk@41716 -
2019-03-16 19:14:14 +00:00
Jonas Maebe
91d5457b38 * moved around/replaced the following procedures to stop nflw from depending
on pdecsub (node units should not depend on parser units):
   o maybe_add_public_default_java_constructor()
   o handle_calling_convention()
   o create_finalizer_procdef() (replaced with create_outline_procdef())
   o insert_record_hidden_paras()
   o handle_calling_convention()
   o proc_add_definition()
   o build_parentfpstruct()
   o maybe_guarantee_record_typesym()
   o get_first_proc_str()
  * factored out the creation of a procinfo for a nested procdef based on a
    subnodetree of the current procdef into tprocinfo.create_for_outlining()

git-svn-id: trunk@40773 -
2019-01-05 16:26:33 +00:00
Jonas Maebe
acf02ab64b * when creating wrappers, add a prefix to parameter names to prevent them
hiding the method name of the wrapped routine
   o also add a few more '&' prefixes to the generated wrapper code to
     prevent issues when keywords are used as identifiers

git-svn-id: trunk@40634 -
2018-12-24 22:10:06 +00:00
Jonas Maebe
c4b347c271 * support anonymous procvar definitions for jvm outside parameter lists (in a
parameter list they represent nested procvars, which aren't supported yet)

git-svn-id: trunk@32454 -
2015-11-22 10:52:20 +00:00
svenbarth
0ac12f0eaf Extend tstaticvarsym (and by extension tabstractnormalvarsym) with the capability to create it as unregistered if needed.
git-svn-id: trunk@32373 -
2015-11-20 11:15:30 +00:00
svenbarth
922646d106 Adjust tfieldvarsym (and by extension tabstractvarsym) so that it can be created as not registered if needed.
git-svn-id: trunk@32372 -
2015-11-20 10:43:25 +00:00
Jonas Maebe
2cea723a0d * only write the parts of the unit localsymtables that are actually needed:
the defs and syms (recursively) referred by inline routines and by the WPO
    info
   o defs and syms are no longer added immediately to the module's deflist/
     symlist, even if they are created as "registered". Instead,
     "doregister=true" simply means "add it to the symbol table at the
     top of the symtable stack"
   o normally only when a sym/def is deref'ed, it gets added to the module
     symlist/deflist and defid/symid gets a (unique) value
   o in cases where we use(d) the defid to construct unique names within the
     current module, you now have to call call the tdef.new unique_id_str()
     method. If the def was not yet registered, we will reserve room for it
     in the deflist (to get a unique id), but the defid gets set to a
     negative value computed from its position in the deflist. Should it
     have to be written to the ppu file later on, the defid will be
     modified to the actual position in the deflist. For both values,
     new unique_id_str() will return the same result so that references
     to this def before and after actual registrations are the same (needed
     for the JVM backend, but also a good principle in general)

   Overall: don't directly use symid/defid anymore to get unique identifiers,
     but use tdef.new unique_id_str() instead (if necessary, a similar routine
     for tsym can be added)

   The result is the ppu file size gets reduced significantly after its big
   increase as a result of the high level typed constant builder (which creates
   a lot of defs). The result is even more efficient than before, as other
   unneeded defs/syms from the localsymtables don't get saved/restored anymore
   either.

git-svn-id: trunk@32153 -
2015-10-25 19:22:00 +00:00
Jonas Maebe
0ea38852ac * fixed compilation of the jvm compiler after r31591 - r31593
git-svn-id: trunk@31665 -
2015-09-13 19:06:19 +00:00
Jonas Maebe
627c83e828 * when creating a bare procdef copy, don't copy the funcret parameter.
This is useful if you want to change the calling convention of the copy.
   o call insert_funcret_para() after creating a bare copy
  * don't copy aliasnames of copied procdefs either (can at best result
    in duplicate symbol errors)

git-svn-id: trunk@28227 -
2014-07-18 09:09:11 +00:00
Jonas Maebe
2bd39f62cb * factored out associating properties with their getters/setters/fiels
o moved JVM-specific code from pdecvar (and pjvm) to jvm/symcpu

git-svn-id: trunk@27938 -
2014-06-12 11:08:38 +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
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
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
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
1ce93f7430 * when automatically generating an overriding getter/setter method (because
a property in a child class has a higher visibility than the getter/
    setter), ensure that we call the inherited method and not the method
    itself (causing a stack overflow due to infinite recursion)

git-svn-id: trunk@25223 -
2013-08-06 21:50:56 +00:00
Jonas Maebe
185f71762f * fixed automatic setter generation if only a setter and no getter prefix
has been specified

git-svn-id: trunk@23561 -
2013-02-02 15:21:58 +00:00
Jonas Maebe
8f96ace589 * fixed -CTauto(g|s)etterprefix automatically generated helpers in case they
have to wrap an existing (g|s)etter that was marked as "abstract" (don't
    mark the helper also as abstract, sicnce it contains code)

git-svn-id: trunk@23545 -
2013-01-30 22:35:59 +00:00
Jonas Maebe
2ed4b295fe * only change the visibility of an existing getter/setter to that of
its property in case the visibility of the property is higher than
    that of the getter/setter (on the JVM target when automatically
    generating getters/setters)

git-svn-id: trunk@23523 -
2013-01-26 16:52:32 +00:00
Jonas Maebe
4aa05f5133 + support for automatically generating setters/getters for properties on the
JVM target, since Java bytecode itself has no support for properties and
    hence exposing properties to external Java code can only be done through
    getters/setters. Use the new parameters to do so:
      -CTautogetterprefix=XXX
      -CTautosetterprefix=YYY
    The getter/setter will get the same visibility as the property. If a
    getter/setter with the same naming convention was already specified for a
    property and this getter/setter is declared in the same class as the
    property, then the visibility of this existing getter/setter is
    modified and no new routine is generated.

    Newly generated getters/setters are virtual methods, because that is
    the only way in Java bytecode to allow redefining these getters/setters
    in child classes. However, that also means that using these switches can
    change the behvaviour of code, since normally the used property definition
    is only determined by the declared type of its associated class instance,
    and not by the actual instance type. The compiler will therefore warn when
    such an automatically generated getter/setter is overridden by another
    automatically generated getter/setter in a child class.

git-svn-id: trunk@22959 -
2012-11-08 20:18:08 +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
94b058fe19 * fixed version of r20547: can't check the number of abstract methods of a
class before its VMT has been built, because that's the process that looks
    for inherited abstract methods that are overridden -> instead use a new
    synthetic method kind (tsk_callthrough_nonabstract) that will call
    through to another method (in this case a constructor) if the owning
    class does not contain any abstract methods, and generates an
    empty routine otherwise

git-svn-id: branches/jvmbackend@20589 -
2012-03-23 11:26:30 +00:00
Jonas Maebe
94bffa65e9 * don't create an instance of abstract classes inside their virtual
constructors (simply do nothing), because creating an abstract class
    is not possible in the JVM (and while the JVM only triggers an
    exception when you actually execute code that tries to create an
    abstract class, the Android platform checks this using the bytecode
    verifier at class verification time and therefore stumbled over the
    old code)

git-svn-id: branches/jvmbackend@20547 -
2012-03-20 21:59:57 +00:00
Jonas Maebe
cfca607b9b * in case of an enum without a type name (e.g., "type xx = set of (ea,eb)"),
set the external name of the underlying class type to the internal name
    instead of to an (invalid) empty string

git-svn-id: branches/jvmbackend@19555 -
2011-10-28 21:19:12 +00:00
Jonas Maebe
cf47b8d422 * fixed all known memory leaks in the code added for the JVM port
git-svn-id: branches/jvmbackend@19248 -
2011-09-26 19:31:34 +00:00
Jonas Maebe
26b19274a3 + create an nested interface type called "Callback" inside the classes that
are used to implement procvar types, and add a constructor to the procvar
    types that accept an instance implementing this interface -> much easier
    and more natural to use procvar types from Java code

git-svn-id: branches/jvmbackend@19216 -
2011-09-24 20:32:01 +00:00
Jonas Maebe
125c0cf225 + support for generics on the JVM target:
o don't try to create .class files for generic types
   o still generate all JVM-specific wrappers for generic types even though they
     won't be written out, because when specializing all the defid's have to
     match exactly
   o add synthetic routine implementations after generating the specializations,
     so that the synthetic routines for those specializations are also generated
     (we don't specialize generic versions of the synthetic generic routines
      because it's not easy or even always possible to create valid generic
      versions of synthetic routines)
   o Note: these are Pascal-style generics, not Java-style generics. The generic
     types nor their specializations are usable from Java code (specializations
     may become usable in the future)

git-svn-id: branches/jvmbackend@19047 -
2011-09-11 11:54:37 +00:00
Jonas Maebe
3a5b3a0cce * don't crash after invalid JVM class definitions while trying to add
a default constructor

git-svn-id: branches/jvmbackend@18807 -
2011-08-23 15:25:11 +00:00
Jonas Maebe
5c832ecbd1 * moved jvm-specific compiler units to the jvm subdirectory
git-svn-id: branches/jvmbackend@18782 -
2011-08-20 08:35:58 +00:00