diff options
author | jonas <jonas@3ad0048d-3df7-0310-abae-a5850022a9f2> | 2019-03-17 15:25:31 +0000 |
---|---|---|
committer | jonas <jonas@3ad0048d-3df7-0310-abae-a5850022a9f2> | 2019-03-17 15:25:31 +0000 |
commit | 9ce6005d3d83b63e453e453c46c82677e14f6fcb (patch) | |
tree | 1b675731f23cf8d1d4ed5b1ba79163edf5d8692d /compiler/jvm | |
parent | 4fd867d9c3e24b0c9b25c812535f2be4ee581db4 (diff) | |
parent | 35df64e0f87e1e342b68af730043b551dabc7ea9 (diff) | |
download | fpc-9ce6005d3d83b63e453e453c46c82677e14f6fcb.tar.gz |
* synchronised with trunk till r41725
git-svn-id: https://svn.freepascal.org/svn/fpc/branches/debug_eh@41726 3ad0048d-3df7-0310-abae-a5850022a9f2
Diffstat (limited to 'compiler/jvm')
-rw-r--r-- | compiler/jvm/jvmdef.pas | 9 | ||||
-rw-r--r-- | compiler/jvm/pjvm.pas | 17 | ||||
-rw-r--r-- | compiler/jvm/symcpu.pas | 12 |
3 files changed, 14 insertions, 24 deletions
diff --git a/compiler/jvm/jvmdef.pas b/compiler/jvm/jvmdef.pas index 8e6d0a1636..c5c18eefc4 100644 --- a/compiler/jvm/jvmdef.pas +++ b/compiler/jvm/jvmdef.pas @@ -1121,10 +1121,11 @@ implementation pd.visibility:=vis_public; { result type } pd.returndef:=obj; - { calling convention, self, ... (not for advanced records, for those - this is handled later) } - if obj.typ=recorddef then - handle_calling_convention(pd,[hcc_declaration,hcc_check]) + { calling convention } + if assigned(current_structdef) or + (assigned(pd.owner.defowner) and + (pd.owner.defowner.typ=recorddef)) then + handle_calling_convention(pd,hcc_default_actions_intf_struct) else handle_calling_convention(pd,hcc_default_actions_intf); { register forward declaration with procsym } diff --git a/compiler/jvm/pjvm.pas b/compiler/jvm/pjvm.pas index 744789fb04..f9dc2a712a 100644 --- a/compiler/jvm/pjvm.pas +++ b/compiler/jvm/pjvm.pas @@ -322,6 +322,7 @@ implementation vmtbuilder:=TVMTBuilder.Create(enumclass); vmtbuilder.generate_vmt; vmtbuilder.free; + insert_struct_hidden_paras(enumclass); restore_after_new_class(sstate,islocal,oldsymtablestack); current_structdef:=old_current_structdef; @@ -376,8 +377,6 @@ implementation then wraps them and calls through to JLRMethod.invoke } methoddef:=tprocdef(tprocvardef(def).getcopyas(procdef,pc_bareproc,'')); finish_copied_procdef(methoddef,'invoke',pvclass.symtable,pvclass); - insert_self_and_vmt_para(methoddef); - insert_funcret_para(methoddef); methoddef.synthetickind:=tsk_jvm_procvar_invoke; methoddef.calcparas; @@ -411,8 +410,6 @@ implementation symtablestack.push(pvintf.symtable); methoddef:=tprocdef(tprocvardef(def).getcopyas(procdef,pc_bareproc,'')); finish_copied_procdef(methoddef,name+'Callback',pvintf.symtable,pvintf); - insert_self_and_vmt_para(methoddef); - insert_funcret_para(methoddef); { can't be final/static/private/protected, and must be virtual since it's an interface method } methoddef.procoptions:=methoddef.procoptions-[po_staticmethod,po_finalmethod]; @@ -436,6 +433,7 @@ implementation vmtbuilder:=TVMTBuilder.Create(pvclass); vmtbuilder.generate_vmt; vmtbuilder.free; + insert_struct_hidden_paras(pvclass); restore_after_new_class(sstate,islocal,oldsymtablestack); end; @@ -477,7 +475,7 @@ implementation { wrapper is part of the same symtable as the original procdef } symtablestack.push(pd.owner); { get a copy of the virtual class method } - wrapperpd:=tprocdef(pd.getcopy); + wrapperpd:=tprocdef(pd.getcopyas(procdef,pc_normal_no_hidden,'')); { this one is not virtual nor override } exclude(wrapperpd.procoptions,po_virtualmethod); exclude(wrapperpd.procoptions,po_overridingmethod); @@ -508,8 +506,8 @@ implementation wrapperpd.synthetickind:=tsk_jvm_virtual_clmethod; wrapperpd.skpara:=pd; { also create procvar type that we can use in the implementation } - wrapperpv:=tcpuprocvardef(pd.getcopyas(procvardef,pc_normal,'')); - wrapperpv.calcparas; + wrapperpv:=tcpuprocvardef(pd.getcopyas(procvardef,pc_normal_no_hidden,'')); + handle_calling_convention(wrapperpv,hcc_default_actions_intf); { no use in creating a callback wrapper here, this procvar type isn't for public consumption } jvm_create_procvar_class_intern('__fpc_virtualclassmethod_pv_t'+wrapperpd.unique_id_str,wrapperpv,true); @@ -551,11 +549,6 @@ implementation in callnodes, we will have to replace the calls to virtual constructors with calls to the wrappers) } finish_copied_procdef(wrapperpd,pd.procsym.realname+'__fpcvirtconstrwrapper__',pd.owner,tabstractrecorddef(pd.owner.defowner)); - { since it was a bare copy, insert the self parameter (we can't just - copy the vmt parameter from the constructor, that's different) } - insert_self_and_vmt_para(wrapperpd); - insert_funcret_para(wrapperpd); - wrapperpd.calcparas; { implementation: call through to the constructor Exception: if the current class is abstract, do not call the constructor, since abstract class cannot be constructed (and the diff --git a/compiler/jvm/symcpu.pas b/compiler/jvm/symcpu.pas index 05df1e756d..cbe06c8ae2 100644 --- a/compiler/jvm/symcpu.pas +++ b/compiler/jvm/symcpu.pas @@ -334,7 +334,7 @@ implementation proc_add_definition will give an error } end; { add method with the correct visibility } - pd:=tprocdef(parentpd.getcopy); + pd:=tprocdef(parentpd.getcopyas(procdef,pc_normal_no_hidden,'')); { get rid of the import accessorname for inherited virtual class methods, it has to be regenerated rather than amended } if [po_classmethod,po_virtualmethod]<=pd.procoptions then @@ -394,7 +394,7 @@ implementation begin { getter/setter could have parameters in case of indexed access -> copy original procdef } - pd:=tprocdef(orgaccesspd.getcopy); + pd:=tprocdef(orgaccesspd.getcopyas(procdef,pc_normal_no_hidden,'')); exclude(pd.procoptions,po_abstractmethod); exclude(pd.procoptions,po_overridingmethod); { can only construct the artificial accessorname now, because it requires @@ -488,11 +488,8 @@ implementation done already } if not assigned(orgaccesspd) then begin - { calling convention, self, ... } - if obj.typ=recorddef then - handle_calling_convention(pd,[hcc_declaration,hcc_check]) - else - handle_calling_convention(pd,hcc_default_actions_intf); + { calling convention } + handle_calling_convention(pd,hcc_default_actions_intf_struct); { register forward declaration with procsym } proc_add_definition(pd); end; @@ -692,7 +689,6 @@ implementation the JVM, this only sets the importname, however) } if assigned(paras) then begin - init_paraloc_info(callerside); for i:=0 to paras.count-1 do begin vs:=tparavarsym(paras[i]); |