Commit Graph

34685 Commits

Author SHA1 Message Date
Jonas Maebe
d8191d48ab * also delete ppcjvm in the execlean target
git-svn-id: branches/jvmbackend@18385 -
2011-08-20 07:55:08 +00:00
Jonas Maebe
be4a27657b + support for nested Java classes
o tobjectdef.jvm_full_typename() now gets an extra parameter to determine
     whether or not the package name should be prepended, so it can be easily
     used to generate the name of the .j file and of the class name inside it

git-svn-id: branches/jvmbackend@18384 -
2011-08-20 07:55:03 +00:00
Jonas Maebe
fde622e050 * generate a loadvmtaddrnode wrapper around Java objectdef typenode arguments
to tasnode (like for regular Object Pascal classes)
  * don't collect WPO information for Java classes in tloadvmtaddrnode.pass_1()
    (devirtualization can't work for Java, since classes can always be loaded
     at run time, except for final/sealed classes -- but that's not yet
     implemented)
  + JVM is-node support, unified JVM type checking codegen for is- and as-nodes

git-svn-id: branches/jvmbackend@18383 -
2011-08-20 07:54:57 +00:00
Jonas Maebe
c1abc4a275 * call cgmessage() instead of message() for errors in
tloadvmtaddrnode.pass_typecheck(), because tas/isnode().pass_typecheck()
    checks codegenerror afterwards to determine whether an error occurred

git-svn-id: branches/jvmbackend@18382 -
2011-08-20 07:54:49 +00:00
Jonas Maebe
608572c63a * removed unused local variables
* fixed some "uninitialised function result" warnings for dummy routines

git-svn-id: branches/jvmbackend@18381 -
2011-08-20 07:54:37 +00:00
Jonas Maebe
678e6dceef * write floating point numbers using hex notation to prevent data loss
(requires patched Jasmin)

git-svn-id: branches/jvmbackend@18380 -
2011-08-20 07:54:29 +00:00
Jonas Maebe
e5ce390565 + support for indexing (dynamic) arrays on the JVM
git-svn-id: branches/jvmbackend@18379 -
2011-08-20 07:54:24 +00:00
Jonas Maebe
ee8b662fa1 + dynamic array support for the JVM target: setlength(), length(), high():
o since the JVM does not support call-by-reference, setlength() works
     by taking an argument pointing to the old array and one to the new
     array (the latter is always created in advance on the caller side,
     even if not strictly required, because we cannot easily create it
     on the callee side in an efficient way). Then we copy parts of the
     old array to the new array as necessary
   o to represent creating a new dynamic array, the JVM target uses
     an in_new_x tinlinenode
  + tasnode support for the JVM. Special: it can also be used to convert
    java.lang.Object to dynamic arrays, and dynamic arrays of java.lang.Object
    to dynamic arrays with more dimensions (arrays are special JVM objects,
    and such support is required for the setlength support)
  + check whether explicit type conversions are valid, and if so, add the
    necessary conversion code since we cannot simply reinterpret bit patterns
    in most cases in the JVM:
   o in case of class and/or dynamic array types, convert to an as-node
   o in case of int-to-float or float-to-int, use java.lang.Float/Double
     helpers (+ added the definitions of these helpers to the system unit)

git-svn-id: branches/jvmbackend@18378 -
2011-08-20 07:54:17 +00:00
Jonas Maebe
a2a6b2fd1d + "reference" temps that sort of implement pointer-style functionality for
platforms that don't support pointers (by make a copy of all registers
    part of a reference)

git-svn-id: branches/jvmbackend@18377 -
2011-08-20 07:54:10 +00:00
Jonas Maebe
0e87627218 + gethltemp() to allocate a temp specifying full type information even
for regular temps. This is required for targets that need special
    handling of the temps depending on the type
  * converted most gettemp() calls to gethltemp() calls

git-svn-id: branches/jvmbackend@18376 -
2011-08-20 07:54:04 +00:00
Jonas Maebe
8643ab7905 + hooks for target-specific handling of explicit type conversions and
as-nodes (required for JVM target: bit pattern reinterpretations
    have to be handled via conversion because of type safety reasons,
    and as-nodes will also have to be able to handled class<->dynarray
    checks/conversions)

git-svn-id: branches/jvmbackend@18375 -
2011-08-20 07:53:56 +00:00
Jonas Maebe
f47689a5fe * enable intercepting passes on tinlinenode(in_new_x); these cannot be
generated from Pascal source code, but they will be generated by the
    JVM backend to construct new array instances

git-svn-id: branches/jvmbackend@18374 -
2011-08-20 07:53:51 +00:00
Jonas Maebe
e56ad62f09 * second_real_to_real() converted to hlcg (in so far possible, no MM support)
git-svn-id: branches/jvmbackend@18373 -
2011-08-20 07:53:38 +00:00
Jonas Maebe
00c095fa70 * moved setlength() handling from pinline to ninl so it can be overridden
git-svn-id: branches/jvmbackend@18372 -
2011-08-20 07:53:28 +00:00
Jonas Maebe
34674eee5e * pred(length(dynarr)) -> high(dynarr)
git-svn-id: branches/jvmbackend@18371 -
2011-08-20 07:53:14 +00:00
Jonas Maebe
b5ea6ab7d8 + thlcgobj.location_force_fpureg() implementation
git-svn-id: branches/jvmbackend@18370 -
2011-08-20 07:53:03 +00:00
Jonas Maebe
c9dbd60b92 * allow "static" for external methods (for Java classes)
git-svn-id: branches/jvmbackend@18369 -
2011-08-20 07:52:51 +00:00
Jonas Maebe
0ae4bbb0cf + JVM-specific versions of initialize_data_node()/finalize_data_node():
do nothing for finalization, assign nil pointer for dynamic arrays
    and refcounted strings (not required for JVM per se, but required
    because programmer's may use them without initialising them first
    and then they should be empty rather than invalid)

git-svn-id: branches/jvmbackend@18368 -
2011-08-20 07:52:39 +00:00
Jonas Maebe
09207563d5 + hlcg implementation of gen_load_para_value(); no support yet for copying
value parameters when necessary, nor for -gt variable trashing

git-svn-id: branches/jvmbackend@18367 -
2011-08-20 07:52:31 +00:00
Jonas Maebe
2a6caa539c + support for constant array indices in treference for the JVM target
(art_indexconst)

git-svn-id: branches/jvmbackend@18366 -
2011-08-20 07:52:27 +00:00
Jonas Maebe
5fd205c130 * fixed indentation of thlcgjvm.a_load_loc_stack() implementation
git-svn-id: branches/jvmbackend@18365 -
2011-08-20 07:52:22 +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
Jonas Maebe
15aaf36b82 + pred/succ, inc/dec and assigned converted to hlcg
git-svn-id: branches/jvmbackend@18363 -
2011-08-20 07:51:50 +00:00
Jonas Maebe
df2d83f110 * fixed calculating the number of stack slots removed by a call
(pushedparasize is already expressed in number of stackslots rather
    than in bytes)
   o when determining the number of stack slots to pop after calling a function
     and not using its function result, round up the function result size to
     the nearest multiple of 4 before determining the number os tack slots (to
     correctly handle byte/word-sized results)

git-svn-id: branches/jvmbackend@18362 -
2011-08-20 07:51:42 +00:00
Jonas Maebe
13a459c2d7 * replaced all calls to cg.g_incr/decrrefcount/g_initialize/g_finalize with
calls to hlcg.*

git-svn-id: branches/jvmbackend@18361 -
2011-08-20 07:51:37 +00:00
Jonas Maebe
25f565751a + g_incrrefcount/g_decrrefcount/g_initialize/g_finalize() implementations for
the JVM (only g_initialize does something: set variable to nil)

git-svn-id: branches/jvmbackend@18360 -
2011-08-20 07:51:33 +00:00
Jonas Maebe
6c9256ee32 * made internalerror unique
git-svn-id: branches/jvmbackend@18359 -
2011-08-20 07:51:28 +00:00
Jonas Maebe
e326f46da5 * don't force the constant of a_cmp_const* to be an integer constant,
it can also be null

git-svn-id: branches/jvmbackend@18358 -
2011-08-20 07:51:24 +00:00
Jonas Maebe
ca98c329b3 + (dynamic) array helper routines
git-svn-id: branches/jvmbackend@18357 -
2011-08-20 07:51:19 +00:00
Jonas Maebe
9bd753ba7a * don't decrease the evaluation stack counter twice for a_load_*_ref
git-svn-id: branches/jvmbackend@18356 -
2011-08-20 07:51:07 +00:00
Jonas Maebe
e20919f065 + support for writing JVM line number information
* moved emitting line information from agjasmin to dbgjasm (+ it now
    also works if -al is not used)

git-svn-id: branches/jvmbackend@18355 -
2011-08-20 07:50:46 +00:00
Jonas Maebe
d456ec2ffe + support for JVM local variable and parameter debug information
o self is encoded as "this" for javac compatibility
  + ait_jvar (for the above) and ait_jcatch (similar, for future try/catch
    support) classes
  + support for smallset JVM type encoding (as int)

git-svn-id: branches/jvmbackend@18354 -
2011-08-20 07:50:41 +00:00
Jonas Maebe
b5e7989a06 * separate Jasmin operands by space instead of by ","
git-svn-id: branches/jvmbackend@18353 -
2011-08-20 07:50:35 +00:00
Jonas Maebe
730f75ed96 * use current_module.realmodulename^ (= unit name as declared in its main
source) instead of the filename of a unit's source as its Java class name

git-svn-id: branches/jvmbackend@18352 -
2011-08-20 07:50:29 +00:00
Jonas Maebe
0dc5baa681 * regenerated so it doesn't set an -XP parameter by default
git-svn-id: branches/jvmbackend@18351 -
2011-08-20 07:50:24 +00:00
Jonas Maebe
2e9e005647 * don't add a utils prefix when the target cpu is the JVM, because the
Jasmin assembler we use is a Java program, so the "assembler binary" is
    java itself (which is a native program for the current host in any case)

git-svn-id: branches/jvmbackend@18350 -
2011-08-20 07:50:08 +00:00
Jonas Maebe
002455ab5c + support for instance and class fields, and unit-level global variables
o hlcgobj support in tcgsubscriptnode.pass_2 for JVM-required functionality
   o slightly different handling for class fields for the JVM than for other
     platforms: instead of adding a unit-level staticvarsym with a hidden name,
     rename the original (unused) field and add the staticvarsym with the original
     name to the object symtable. This is required because the JVM code generator
     has to know the class the field belongs to, as well as its real name
   o moved tprocdef.makejvmmangledcallname() functionality mostly to
     jvmdef.jvmaddtypeownerprefix() because it's also required for mangling
     field symbol names
  * changed the interface of jvmdef from ansistring to shortstring because
    all of its results are also used in shortstring contexts (and they're
    unlikely to overflow the shortstring limit)
  * "protected", "private" (without strict) and implementation-only symbols
    now get "package" visibility instead of "public" visibility

git-svn-id: branches/jvmbackend@18349 -
2011-08-20 07:49:46 +00:00
Jonas Maebe
afceec23b2 - removed unused local variables
git-svn-id: branches/jvmbackend@18348 -
2011-08-20 07:49:41 +00:00
Jonas Maebe
532f16336a * force -dNOOPT when compiling a JVM compiler
git-svn-id: branches/jvmbackend@18347 -
2011-08-20 07:49:37 +00:00
Jonas Maebe
28740dce2d - removed extra "fordefinition" parameter again from tprocdef.mangledname(),
since the definition-specific adorning of JVM mangled names is Jasmin-
    specific, and such code has no place in symdef
  * moved code to adorn JVM mangled names for Jasmin definitions to agjasmin

git-svn-id: branches/jvmbackend@18346 -
2011-08-20 07:49:31 +00:00
Jonas Maebe
e269f68359 * require that class methods are "static" for Java classes
git-svn-id: branches/jvmbackend@18345 -
2011-08-20 07:49:24 +00:00
Jonas Maebe
83dc297346 + Java interface support, mostly the same as Objective-C protocols
(generalised some error messages that were specific to protocols
     so they can also be used for Java interfaces)
  o note, Java interface support requires a fix to Jasmin 2.4:
    http://sourceforge.net/tracker/?func=detail&aid=2897170&group_id=100746&atid=628212

git-svn-id: branches/jvmbackend@18344 -
2011-08-20 07:49:19 +00:00
Jonas Maebe
b0d050a490 * pass all .j files related to one unit in one go to Jasmin instead of
invoking Jasmin once for every generated .j file

git-svn-id: branches/jvmbackend@18343 -
2011-08-20 07:49:07 +00:00
Jonas Maebe
505660262d + sqr(float) and trunc() support
git-svn-id: branches/jvmbackend@18342 -
2011-08-20 07:48:47 +00:00
Jonas Maebe
d3a4866cf5 * reorder processing of left/right for add nodes somewhat to make
it easier for the register allocator/optimizer to reduce the
    number of intermediate stores to the stack

git-svn-id: branches/jvmbackend@18341 -
2011-08-20 07:48:42 +00:00
Jonas Maebe
fda72aaed6 * made the remove_dummy_load_stores() implementation more extensible
and skip comments (so it works again when -ar is used, because
    tlhcgjvm.inc/decstack() insert comments in that case)

git-svn-id: branches/jvmbackend@18340 -
2011-08-20 07:48:38 +00:00
Jonas Maebe
b023627f6a * converted tcgcasenode.pass_generate_code() to hlcgobj
o changed type of opsize field of tcgcasenode from tcgsize into tdef,
     and fixed compilation of other code generator units after this change

git-svn-id: branches/jvmbackend@18339 -
2011-08-20 07:48:33 +00:00
Jonas Maebe
71b348757b * reversed expected operand order of tjvmhlcg.a_cmp_*(), because
that's how these operations also work on other architectures
  * fixed tjvmaddnode.second_generic_compare() for this new order

git-svn-id: branches/jvmbackend@18338 -
2011-08-20 07:48:27 +00:00
Jonas Maebe
87925db8fb * fixed 64 bit shl/shr/sar operations: the second argument of the
operation is 32 bit, not 64 bit (both in the compiler and in the
    JVM)
  * request a 64 rather than a 32 bit shift operation from tjvmshlshrnode
    if the result is 64 bit (rather than in case shift value is 64 bit,
    since as described above that never happens)

git-svn-id: branches/jvmbackend@18337 -
2011-08-20 07:48:23 +00:00
Jonas Maebe
8f727557c0 + JVM support for int_to_int, int_to_real, bool_to_int and
int_to_bool type conversions (includes bool_to_bool)

git-svn-id: branches/jvmbackend@18336 -
2011-08-20 07:48:18 +00:00