* 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:
Jonas Maebe 2011-08-20 08:02:43 +00:00
parent d248b5992e
commit fa841f8011
3 changed files with 1396 additions and 1272 deletions

File diff suppressed because it is too large Load Diff

View File

@ -60,15 +60,20 @@ implementation
{ generate data for typed const }
storefilepos:=current_filepos;
current_filepos:=sym.fileinfo;
if not(target_info.system in systems_typed_constants_node_init) then
begin
if sym.varspez=vs_const then
cursectype:=sec_rodata
else
cursectype:=sec_data;
maybe_new_object_file(list);
tcbuilder:=ttypedconstbuilder.create(sym);
reslist:=tcbuilder.parse_into_asmlist;
tcbuilder:=tasmlisttypedconstbuilder.create(sym);
reslist:=tasmlisttypedconstbuilder(tcbuilder).parse_into_asmlist;
tcbuilder.free;
end
else
internalerror(2011040203);
{ Parse hints }
try_consume_hintdirective(sym.symoptions,sym.deprecatedmsg);
@ -93,6 +98,7 @@ implementation
) then
read_public_and_external(sym);
{ try to parse a section directive }
if not in_structure and (target_info.system in systems_allow_section) and
(symtablestack.top.symtabletype in [staticsymtable,globalsymtable]) and
@ -110,6 +116,8 @@ implementation
end;
end;
if not(target_info.system in systems_typed_constants_node_init) then
begin
{ only now add items based on the symbolname, because it may }
{ have been modified by the directives parsed above }
if vo_has_section in sym.varoptions then
@ -129,6 +137,10 @@ implementation
list.concatlist(reslist);
reslist.free;
list.concat(tai_symbol_end.Createname(sym.mangledname));
end
else
internalerror(2011040204);
current_filepos:=storefilepos;
end;

View File

@ -317,6 +317,12 @@ interface
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] =
('','i386','m68k','alpha','powerpc','sparc','vm','ia64','x86_64',
'mips','arm', 'powerpc64', 'avr', 'mipsel','jvm');