mirror of
https://gitlab.com/freepascal.org/fpc/source.git
synced 2025-08-20 11:09:23 +02:00
* migrated most typed constant parsing code to separate methods so
that the actual generation of the data can be overridden git-svn-id: branches/jvmbackend@18472 -
This commit is contained in:
parent
d248b5992e
commit
fa841f8011
2596
compiler/ngtcon.pp
2596
compiler/ngtcon.pp
File diff suppressed because it is too large
Load Diff
@ -60,15 +60,20 @@ implementation
|
|||||||
{ generate data for typed const }
|
{ generate data for typed const }
|
||||||
storefilepos:=current_filepos;
|
storefilepos:=current_filepos;
|
||||||
current_filepos:=sym.fileinfo;
|
current_filepos:=sym.fileinfo;
|
||||||
if sym.varspez=vs_const then
|
|
||||||
cursectype:=sec_rodata
|
|
||||||
else
|
|
||||||
cursectype:=sec_data;
|
|
||||||
maybe_new_object_file(list);
|
|
||||||
|
|
||||||
tcbuilder:=ttypedconstbuilder.create(sym);
|
if not(target_info.system in systems_typed_constants_node_init) then
|
||||||
reslist:=tcbuilder.parse_into_asmlist;
|
begin
|
||||||
tcbuilder.free;
|
if sym.varspez=vs_const then
|
||||||
|
cursectype:=sec_rodata
|
||||||
|
else
|
||||||
|
cursectype:=sec_data;
|
||||||
|
maybe_new_object_file(list);
|
||||||
|
tcbuilder:=tasmlisttypedconstbuilder.create(sym);
|
||||||
|
reslist:=tasmlisttypedconstbuilder(tcbuilder).parse_into_asmlist;
|
||||||
|
tcbuilder.free;
|
||||||
|
end
|
||||||
|
else
|
||||||
|
internalerror(2011040203);
|
||||||
|
|
||||||
{ Parse hints }
|
{ Parse hints }
|
||||||
try_consume_hintdirective(sym.symoptions,sym.deprecatedmsg);
|
try_consume_hintdirective(sym.symoptions,sym.deprecatedmsg);
|
||||||
@ -93,7 +98,8 @@ implementation
|
|||||||
) then
|
) then
|
||||||
read_public_and_external(sym);
|
read_public_and_external(sym);
|
||||||
|
|
||||||
{ try to parse a section directive }
|
|
||||||
|
{ try to parse a section directive }
|
||||||
if not in_structure and (target_info.system in systems_allow_section) and
|
if not in_structure and (target_info.system in systems_allow_section) and
|
||||||
(symtablestack.top.symtabletype in [staticsymtable,globalsymtable]) and
|
(symtablestack.top.symtabletype in [staticsymtable,globalsymtable]) and
|
||||||
(idtoken=_SECTION) then
|
(idtoken=_SECTION) then
|
||||||
@ -110,25 +116,31 @@ implementation
|
|||||||
end;
|
end;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
{ only now add items based on the symbolname, because it may }
|
if not(target_info.system in systems_typed_constants_node_init) then
|
||||||
{ have been modified by the directives parsed above }
|
begin
|
||||||
if vo_has_section in sym.varoptions then
|
{ only now add items based on the symbolname, because it may }
|
||||||
new_section(list,sec_user,sym.section,const_align(sym.vardef.alignment))
|
{ have been modified by the directives parsed above }
|
||||||
else
|
if vo_has_section in sym.varoptions then
|
||||||
new_section(list,cursectype,lower(sym.mangledname),const_align(sym.vardef.alignment));
|
new_section(list,sec_user,sym.section,const_align(sym.vardef.alignment))
|
||||||
if (sym.owner.symtabletype=globalsymtable) or
|
else
|
||||||
create_smartlink or
|
new_section(list,cursectype,lower(sym.mangledname),const_align(sym.vardef.alignment));
|
||||||
(assigned(current_procinfo) and
|
if (sym.owner.symtabletype=globalsymtable) or
|
||||||
(po_inline in current_procinfo.procdef.procoptions)) or
|
create_smartlink or
|
||||||
DLLSource then
|
(assigned(current_procinfo) and
|
||||||
list.concat(Tai_symbol.Createname_global(sym.mangledname,AT_DATA,0))
|
(po_inline in current_procinfo.procdef.procoptions)) or
|
||||||
else
|
DLLSource then
|
||||||
list.concat(Tai_symbol.Createname(sym.mangledname,AT_DATA,0));
|
list.concat(Tai_symbol.Createname_global(sym.mangledname,AT_DATA,0))
|
||||||
|
else
|
||||||
|
list.concat(Tai_symbol.Createname(sym.mangledname,AT_DATA,0));
|
||||||
|
|
||||||
|
{ add the parsed value }
|
||||||
|
list.concatlist(reslist);
|
||||||
|
reslist.free;
|
||||||
|
list.concat(tai_symbol_end.Createname(sym.mangledname));
|
||||||
|
end
|
||||||
|
else
|
||||||
|
internalerror(2011040204);
|
||||||
|
|
||||||
{ add the parsed value }
|
|
||||||
list.concatlist(reslist);
|
|
||||||
reslist.free;
|
|
||||||
list.concat(tai_symbol_end.Createname(sym.mangledname));
|
|
||||||
current_filepos:=storefilepos;
|
current_filepos:=storefilepos;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
|
@ -317,6 +317,12 @@ interface
|
|||||||
system_jvm_java32
|
system_jvm_java32
|
||||||
];
|
];
|
||||||
|
|
||||||
|
{ all systems where typed constants have to be translated into node
|
||||||
|
trees that initialise the data instead of into data sections }
|
||||||
|
systems_typed_constants_node_init = [
|
||||||
|
system_jvm_java32
|
||||||
|
];
|
||||||
|
|
||||||
cpu2str : array[TSystemCpu] of string[10] =
|
cpu2str : array[TSystemCpu] of string[10] =
|
||||||
('','i386','m68k','alpha','powerpc','sparc','vm','ia64','x86_64',
|
('','i386','m68k','alpha','powerpc','sparc','vm','ia64','x86_64',
|
||||||
'mips','arm', 'powerpc64', 'avr', 'mipsel','jvm');
|
'mips','arm', 'powerpc64', 'avr', 'mipsel','jvm');
|
||||||
|
Loading…
Reference in New Issue
Block a user