History

realloc text section in code generation

bellard committed 24 years ago

Commit 48917611 parent acba7d11 file · +12 −2Browse files

Unified · Split

i386-gen.c+12−2
@@ -83,10 +83,15 @@ static unsigned long func_sub_sp_offset; · 82 unmodified lines
83static unsigned long func_bound_offset;83static unsigned long func_bound_offset;
84static int func_ret_sub;84static int func_ret_sub;
85 85
86/* XXX: make it faster ? */
86void g(int c)87void g(int c)
87{88{
89 int ind1;
90 ind1 = ind + 1;
91 if (ind1 > cur_text_section->data_allocated)
92 section_realloc(cur_text_section, ind1);
88 cur_text_section->data[ind] = c;93 cur_text_section->data[ind] = c;
89 ind++;94 ind = ind1;
90}95}
91 96
92void o(int c)97void o(int c)
@@ -129,10 +134,15 @@ void gsym(int t) · 36 unmodified lines
129/* instruction + 4 bytes data. Return the address of the data */134/* instruction + 4 bytes data. Return the address of the data */
130int oad(int c, int s)135int oad(int c, int s)
131{136{
137 int ind1;
138
132 o(c);139 o(c);
140 ind1 = ind + 4;
141 if (ind1 > cur_text_section->data_allocated)
142 section_realloc(cur_text_section, ind1);
133 *(int *)(cur_text_section->data + ind) = s;143 *(int *)(cur_text_section->data + ind) = s;
134 s = ind;144 s = ind;
135 ind = ind + 4;145 ind = ind1;
136 return s;146 return s;
137}147}
138 148

Keyboard shortcuts

General

Show keyboard shortcuts
?
Focus the current search
/

Issues and pull requests

Open filters
f

Issues, pull requests and Inbox

Select next item
j↓
Select previous item
k↑
Open selected item
Enter
Dismiss filters or clear selection
Esc

Repository code

Go to file
t