and getters for the ttemp*node classes instead
o this will allow descendants to prevent certain flags from being added
or removed. E.g. for LLVM, certain temps must never be put in registers
because it cannot typecast a value in a register from a non-record/array
type to an array type without forcing it to memory (so if that is done
on an lvalue, the result will be written to the memory temp instead of
to the register)
git-svn-id: trunk@34358 -
release the source location in case it was also a temp. Reason: we
don't increase reference counts when assigning to a ti_const (they are
like const parameters), so the original value must stay alive until
the ti_const temp is freed
o free the original data in the ttempdelete node for the ti_const temp
o don't increase reference counts when assigning composite types to
ti_const temps either
git-svn-id: trunk@34287 -
it was AT_NONE, which is invalid and should never be used
* explicitly pass the correct value for all calls to those methods elsewhere
in the compiler
git-svn-id: trunk@34250 -
tasmdata.DefineAsmSymbol() and all routines that call it
o will be used to automatically generate AB_INDIRECT sybols when
necessary
git-svn-id: trunk@34164 -
Merged revision(s) 28239-28289 from branches/svenbarth/packages:
Provide the possiblity to switch between the direct and indirect RTTI symbols.
ncgrtti.pas, TRTTIWriter:
+ get_rtti_label, get_rtti_label_ord2str & get_rtti_label_str2ord: add new "indirect" parameter and pass that along to rtti_mangledname
hlcgobj.pas, thlcgobj:
* g_incrrefcount, g_initialize, g_finalize, g_array_rtti_helper: for now pass along False to get_rtti_label()
ncgvmt.pas, TVMTWriter:
* writevmt: for now pass along False to get_rtti_label()
ncgld.pas, tcgrttinode:
* pass_generate_code: for now pass along False to the get_rtti_label*() methods
........
Provide possibility to select between using a direct and an indirect RTTI reference. This way the references can be changed for selected cases.
ncgrtti, TRTTIWriter:
* ref_rtti: new "indirect" parameter that's relayed to rtti_mangledname()
* write_rtti_reference: new "indirect" paramater that's relayed to ref_rtti()
........
Switch properties to use the indirect type information without breaking backwards compatiblity. :)
compiler/ncgrtti.pas, TRTTIWriter:
* published_properties_write_rtti_data: use the indirect reference, not the direct one
rtl/objpas/typinfo.pp:
* to allow compilation with both 2.6.x and 2.7.1 and too avoid too many ifdefs at least in the declarations we define a macro TypeInfoPtr which is either PTypeInfo (2.6.x) or PPTypeInfo (2.7.1 and newer)
* TPropInfo: rename PropType to PropTypeRef and change type to TypeInfoPtr
+ TPropInfo: add a new property PropType which returns a PTypeInfo out of the PropTypeRef depending on the compiler version
........
Switch further simple types (sets, enums, class references, pointers) to indirect type information (again without breaking backwards compatibility).
compiler/ncgrtti.pas, TRTTIWriter.write_rtti_data:
* enumdef_rtti, setdef_rtti, classrefdef_rtti & pointerdef_rtti: write an indirect RTTI reference
rtl/objpas/typinfo.pp, TTypeData:
* rename BaseType to BaseTypeRef, CompType to CompTypeRef, InstanceType to InstanceTypeRef and RefType to RefTypeRef and change their type to TypeInfoPtr
+ add properties BaseType, CompType, InstanceType & RefType which return a PTypeInfo out of the corresponding *Ref field depending on the compiler version
........
Switch class and interface parent as well as extended type to indirect type information
compiler/ncgrtti.pas, TRTTIWriter:
* write_rtti_data.objectdef_rtti.objectdef_rtti_class_full: use indirect reference for class parent and extended type
* write_rtti_data.objectdef_rtti.objectdef_rtti_interface_full: use indirect reference for interface parent
rtl/objpas/typinfo.pp, TTypeData:
+ add new method DerefTypeInfoPtr which returns Nil if the indirect reference is Nil and otherwise returns the dereferences indirect reference (for 2.6.x the direct reference is returned as is)
* rename ParentInfo to ParentInfoRef, HelperParent to HelperParentRef, ExtendedInfo to ExtendedInfoRef, IntfParent ot IntfParentRef and RawIntfParent to RawIntfParentRef and change their type to TypeInfoPtr
+ introduce ParentInfo, HelperParent, ExtendedInfo, IntfParent and RawIntfParent properties that return a PTypeInfo and use the new DerefTypeInfoPtr to return the correct type info value
* change the other newly introduced properties of TTypeData to use DerefTypeInfoPtr as well to be on the safe side
........
Switch record/object fields to indirect type information references.
compiler/ncgrtti.pas, TRTTIWriter.fields_write_rtti_data:
* use the indirect reference for the object parent type
* use the indirect reference for the field type
rtl/inc/rtti.inc:
* TRecordElement: change TypeInfo to PPointer for 2.7.1 and newer
* RecordRTTI: correctly dereference the element type for 2.7.1 and newer
* fpc_copy: correctly reference the element type for 2.7.1 and newer
........
Switch static arrays to indirect RTTI reference.
compiler/ncgrtti.pas, TRTTIWriter.write_rtti_data:
* arraydef_rtti: write the dimension types and the final field type as indirect references
rtl/inc/rtti.inc:
* TArrayInfo: switch ElInfo to PPointer for 2.7.1+
* ArrayRTTI & fpc_copy: correctly dereference ElInfo for 2.7.1+
rtl/objpas/typinfo.pp, TArrayTypeData:
* switch ElType and Dims to PPTypeInfo; no backwards compatibility needed here as TArrayTypeData was added in 2.7.1 only
tests/test/trtti8.pp: fix test
........
Switch dynamic arrays to indirect RTTI references.
compiler/ncgrtti.pas, TRTTIWriter.write_rtti_data.arraydef_rtti:
* write indirect references for the two element entries
rtl/inc/dynarr.inc:
* tdynarraytypedata: change elType2 to PPointer for 2.7.1+
* fpc_dynarray_clear, fpc_dynarray_setlength & fpc_dynarray_copy: correctly dereference elType2 for 2.7.1+
rtl/objpas/typinfo.pp, TTypeData:
* rename elType and elType2 to elTypeRef and elType2Ref respectively and change type to TypeInfoPtr
* add properties elType and elType2 which return PTypeInfo by dereferencing elTypeRef and elType2Ref respecively correctly
* remove a few stray "inline" directives in the implementation
........
Switch procedure parameters and result type to indirect RTTI references.
compiler/ncgrtti.pas, TRTTIWriter.write_rtti_data.procvardef_rtti:
* write_procedure_param: use indirect RTTI reference
* write result info for both methods and procvars as indirect RTTI reference
* write parameters for procvars as indirect RTTI reference
rtl/objpas/typinfo.pp:
* TProcedureParam: change type of ParamType to PPTypeInfo (no backwards compatiblity needed here; was added for 2.7.1)
* TProcedureSignature: change type of RseultType to PPTypeInfo (no backwards compatibility needed here; was added for 2.7.1)
* TTypeData: remark in the comments of tkMethod that ResultTypeRef and ParamTypeRefs are of type PPTypeInfo and not PTypeInfo
tests/test/trtti9.pp:
* fix test
........
Remove no longer needed "indirect" parameter for TRTTIWriter methods.
ncgrtti.pas, TRTTIWriter:
- ref_rtti & write_rtti_reference: remove "indirect" parameter
* ref_rtti: call rtti_mangledname with "indirect" always set to "true"
- remove "true" parameter on callsites of write_rtti_reference & ref_rtti
........
git-svn-id: trunk@33944 -
ncgld.pas, tcgloadnode:
+ new method use_indirect_symbol to determine whether using an indirect reference is necessary at all
* generate_threadvar_access & pass_generate_code: pass result of use_indirect_code() to RefAsmSymbol() for using an indirect access if needed
git-svn-id: trunk@33282 -
a pointer to a vmt, but a pointer to a pointer to vmt (mantis #29086)
o also adjusted the llvm type for interfaces accordingly
git-svn-id: trunk@32530 -
thlcgobj.g_set_addr_nonbitpacked_field_ref() and adjusted it so that
it also works for objects/classes (if the incoming reference points
to the start of the class contents)
o factored out the related code from tllvmsubscriptnode
git-svn-id: trunk@32411 -
labels of LOC_JUMP in the node's location. This generates some extra jumps
for short circuit boolean and/or-expressions if optimizations are off, but
with optimisations enabled the generated code is the same (except for JVM
because the jump threading optimisation isn't enabled there yet).
git-svn-id: trunk@31431 -
Please note that Delphi has the exact same bug as we have and thus code working in FPC will not work in Delphi.
Additionally taking the method address of a local variable or a local/global constant for a method pointer is dangerous as the variable (in case of constants is a temporary local variable) will go out of scope once the containing procedure/function/method exits!
ncgld.pas, tcgloadnode.pass_generate_code:
* only use the value of Self if it is an implicit pointer object (class instance) or a class reference, but not for everything else (objects, records, primitive types)
+added test
git-svn-id: trunk@28160 -
6-byte method pointers and other i8086 types that use loc.registerhi
* changed the i8086 specific code in tcgassignmentnode.pass_generate_code to
use hlcg.a_load_loc_ref
git-svn-id: trunk@27555 -
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 -