| |
|
| Cell npriminfos=0; |
Cell npriminfos=0; |
| |
|
| |
Label goto_start; |
| |
Cell goto_len; |
| |
|
| int compare_labels(const void *pa, const void *pb) |
int compare_labels(const void *pa, const void *pb) |
| { |
{ |
| Label a = *(Label *)pa; |
Label a = *(Label *)pa; |
| { |
{ |
| int i; |
int i; |
| #ifndef NO_DYNAMIC |
#ifndef NO_DYNAMIC |
| Label *symbols2, *symbols3, *ends1, *ends1j, *ends1jsorted; |
Label *symbols2, *symbols3, *ends1, *ends1j, *ends1jsorted, *goto_p; |
| int nends1j; |
int nends1j; |
| #endif |
#endif |
| |
|
| #endif |
#endif |
| ends1 = symbols1+i+1; |
ends1 = symbols1+i+1; |
| ends1j = ends1+i; |
ends1j = ends1+i; |
| |
goto_p = ends1j+i+1; /* goto_p[0]==before; ...[1]==after;*/ |
| nends1j = i+1; |
nends1j = i+1; |
| ends1jsorted = (Label *)alloca(nends1j*sizeof(Label)); |
ends1jsorted = (Label *)alloca(nends1j*sizeof(Label)); |
| memcpy(ends1jsorted,ends1j,nends1j*sizeof(Label)); |
memcpy(ends1jsorted,ends1j,nends1j*sizeof(Label)); |
| qsort(ends1jsorted, nends1j, sizeof(Label), compare_labels); |
qsort(ends1jsorted, nends1j, sizeof(Label), compare_labels); |
| |
|
| |
/* check whether the "goto *" is relocatable */ |
| |
goto_len = goto_p[1]-goto_p[0]; |
| |
debugp(stderr, "goto * %p %p len=%ld\n", |
| |
goto_p[0],symbols2[goto_p-symbols1],goto_len); |
| |
if (memcmp(goto_p[0],symbols2[goto_p-symbols1],goto_len)!=0) { /* unequal */ |
| |
no_dynamic=1; |
| |
debugp(stderr," not relocatable, disabling dynamic code generation\n"); |
| |
return; |
| |
} |
| |
goto_start = goto_p[0]; |
| |
|
| priminfos = calloc(i,sizeof(PrimInfo)); |
priminfos = calloc(i,sizeof(PrimInfo)); |
| for (i=0; symbols1[i]!=0; i++) { |
for (i=0; symbols1[i]!=0; i++) { |
| int prim_len = ends1[i]-symbols1[i]; |
int prim_len = ends1[i]-symbols1[i]; |