* 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 } { generate data for typed const }
storefilepos:=current_filepos; storefilepos:=current_filepos;
current_filepos:=sym.fileinfo; current_filepos:=sym.fileinfo;
if not(target_info.system in systems_typed_constants_node_init) then
begin
if sym.varspez=vs_const then if sym.varspez=vs_const then
cursectype:=sec_rodata cursectype:=sec_rodata
else else
cursectype:=sec_data; cursectype:=sec_data;
maybe_new_object_file(list); maybe_new_object_file(list);
tcbuilder:=tasmlisttypedconstbuilder.create(sym);
tcbuilder:=ttypedconstbuilder.create(sym); reslist:=tasmlisttypedconstbuilder(tcbuilder).parse_into_asmlist;
reslist:=tcbuilder.parse_into_asmlist;
tcbuilder.free; 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,6 +98,7 @@ 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
@ -110,6 +116,8 @@ implementation
end; end;
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 } { only now add items based on the symbolname, because it may }
{ have been modified by the directives parsed above } { have been modified by the directives parsed above }
if vo_has_section in sym.varoptions then if vo_has_section in sym.varoptions then
@ -129,6 +137,10 @@ implementation
list.concatlist(reslist); list.concatlist(reslist);
reslist.free; reslist.free;
list.concat(tai_symbol_end.Createname(sym.mangledname)); list.concat(tai_symbol_end.Createname(sym.mangledname));
end
else
internalerror(2011040204);
current_filepos:=storefilepos; current_filepos:=storefilepos;
end; end;

View File

@ -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');