summaryrefslogtreecommitdiff
path: root/compiler/jvm/njvmld.pas
diff options
context:
space:
mode:
authorjonas <jonas@3ad0048d-3df7-0310-abae-a5850022a9f2>2011-08-20 08:24:58 +0000
committerjonas <jonas@3ad0048d-3df7-0310-abae-a5850022a9f2>2011-08-20 08:24:58 +0000
commitdf18e8491232c6d20d293113bf3f04396b9e7d50 (patch)
tree95ca81e7f206d09a17e7618ddbda064a82430a8e /compiler/jvm/njvmld.pas
parent281c4808b1be8c92e47e50519d43e660e9f94c9f (diff)
downloadfpc-df18e8491232c6d20d293113bf3f04396b9e7d50.tar.gz
+ support for procedural variables for the JVM target
o every porocedural variable type is represented by a class with one public "invoke" method whose signature matches the signature of the procvar o internally, dispatching happens via java.lang.reflect.Method.invoke(). WARNING: while this allows calling private/protected or other methods that are normally not accessible from another context, a security manger can override this. If such a security manager is installed, most procvars will cause security exceptions o such dispatching also requires that all arguments are wrapped, but that's done in the compiler-generated body of the invoke method, so that procvars can also be called conveniently from Java code o typecasting between a procedure of object and tmethod is supported, as well as Delphi-style replacing of only the method pointer via @procvar1=@procvar2. o nested procvars are not yet supported, but most of the basic infrastructure for them is already present * all units/programs now get an internal __FPC_JVM_Module_Class_Alias$ type when compiled for the JVM target, which is an "external" class that maps to the unit name. This is required to look up the JLRMethod instances for regular functions/procedures + new tabstractprocdef.copyas() method that allows to create a procvar from a procdef and vice versa git-svn-id: http://svn.freepascal.org/svn/fpc/branches/jvmbackend@18690 3ad0048d-3df7-0310-abae-a5850022a9f2
Diffstat (limited to 'compiler/jvm/njvmld.pas')
-rw-r--r--compiler/jvm/njvmld.pas5
1 files changed, 4 insertions, 1 deletions
diff --git a/compiler/jvm/njvmld.pas b/compiler/jvm/njvmld.pas
index 06654bc2b7..3ff74ce05b 100644
--- a/compiler/jvm/njvmld.pas
+++ b/compiler/jvm/njvmld.pas
@@ -55,7 +55,7 @@ implementation
uses
verbose,
aasmdata,
- nbas,nld,ncal,ninl,nmem,ncnv,
+ nbas,nld,ncal,ncon,ninl,nmem,ncnv,
symconst,symsym,symdef,symtable,defutil,jvmdef,
paramgr,
pass_1,
@@ -187,6 +187,9 @@ procedure tjvmloadnode.pass_generate_code;
else
hlcg.a_load_loc_reg(current_asmdata.CurrAsmList,java_jlobject,java_jlobject,tparavarsym(symtableentry).localloc,location.reference.base);
end
+ else if symtableentry.typ=procsym then
+ { handled in tjvmcnvnode.first_proc_to_procvar }
+ internalerror(2011072408)
else
inherited pass_generate_code;
end;