* foreign procedures are now represented as bytevectors instead of

strings.
This commit is contained in:
Abdulaziz Ghuloum 2007-05-18 18:55:20 -04:00
parent dfe8e0e1c1
commit 10f5e53338
4 changed files with 14 additions and 4 deletions

Binary file not shown.

View File

@ -149,7 +149,13 @@ ik_relocate_code(ikp code){
else if(tag == 1){
/* foreign object */
ikp str = ref(p, wordsize);
char* name = string_data(str);
char* name;
if(tagof(str) == bytevector_tag){
name = (char*) str + off_bytevector_data;
} else {
fprintf(stderr, "foreign name is not a bytevector\n");
exit(-1);
}
void* sym = dlsym(RTLD_DEFAULT, name);
char* err = dlerror();
if(err){

Binary file not shown.

View File

@ -868,9 +868,13 @@
(vector-set! vec (fx+ reloc-idx 1) v)
(set! reloc-idx (fx+ reloc-idx 2))]
[(foreign-label)
(vector-set! vec reloc-idx (fxlogor 1 (fxsll idx 2)))
(vector-set! vec (fx+ reloc-idx 1) v)
(set! reloc-idx (fx+ reloc-idx 2))]
(let ([name
(if (string? v)
(string->utf8-bytevector v)
(error 'whack-reloc "not a string ~s" v))])
(vector-set! vec reloc-idx (fxlogor 1 (fxsll idx 2)))
(vector-set! vec (fx+ reloc-idx 1) name)
(set! reloc-idx (fx+ reloc-idx 2)))]
[(reloc-word+)
(let ([obj (car v)] [disp (cdr v)])
(vector-set! vec reloc-idx (fxlogor 2 (fxsll idx 2)))