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
8383 static unsigned long func_bound_offset;
8484 static int func_ret_sub;
8585
86+/* XXX: make it faster ? */
8687 void g(int c)
8788 {
89+ int ind1;
90+ ind1 = ind + 1;
91+ if (ind1 > cur_text_section->data_allocated)
92+ section_realloc(cur_text_section, ind1);
8893 cur_text_section->data[ind] = c;
89− ind++;
94+ ind = ind1;
9095 }
9196
9297 void o(int c)
@@ -129,10 +134,15 @@ void gsym(int t) · 36 unmodified lines
129134 /* instruction + 4 bytes data. Return the address of the data */
130135 int oad(int c, int s)
131136 {
137+ int ind1;
138+
132139 o(c);
140+ ind1 = ind + 4;
141+ if (ind1 > cur_text_section->data_allocated)
142+ section_realloc(cur_text_section, ind1);
133143 *(int *)(cur_text_section->data + ind) = s;
134144 s = ind;
135− ind = ind + 4;
145+ ind = ind1;
136146 return s;
137147 }
138148

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