Add RT_INLINE_CACHE_MISS relocation type to avoid frequent dlsym lookups when compiling PICs. Fixes #123
parent
72d3c6e791
commit
f8e475485a
|
@ -99,6 +99,9 @@ MEMO: cached-string>symbol ( symbol -- obj ) string>symbol ;
|
||||||
: rel-exception-handler ( class -- )
|
: rel-exception-handler ( class -- )
|
||||||
rt-exception-handler add-relocation ;
|
rt-exception-handler add-relocation ;
|
||||||
|
|
||||||
|
: rel-inline-cache-miss ( class -- )
|
||||||
|
rt-inline-cache-miss add-relocation ;
|
||||||
|
|
||||||
: init-relocation ( -- )
|
: init-relocation ( -- )
|
||||||
V{ } clone parameter-table set
|
V{ } clone parameter-table set
|
||||||
V{ } clone literal-table set
|
V{ } clone literal-table set
|
||||||
|
|
|
@ -69,6 +69,7 @@ CONSTANT: rt-cards-offset 10
|
||||||
CONSTANT: rt-decks-offset 11
|
CONSTANT: rt-decks-offset 11
|
||||||
CONSTANT: rt-exception-handler 12
|
CONSTANT: rt-exception-handler 12
|
||||||
CONSTANT: rt-dlsym-toc 13
|
CONSTANT: rt-dlsym-toc 13
|
||||||
|
CONSTANT: rt-inline-cache-miss 14
|
||||||
|
|
||||||
: rc-absolute? ( n -- ? )
|
: rc-absolute? ( n -- ? )
|
||||||
${
|
${
|
||||||
|
|
|
@ -192,7 +192,7 @@ IN: bootstrap.x86
|
||||||
jit-save-context
|
jit-save-context
|
||||||
ESP 4 [+] vm-reg MOV
|
ESP 4 [+] vm-reg MOV
|
||||||
ESP [] pic-tail-reg MOV
|
ESP [] pic-tail-reg MOV
|
||||||
"inline_cache_miss" jit-call
|
0 CALL rc-relative rel-inline-cache-miss
|
||||||
jit-restore-context ;
|
jit-restore-context ;
|
||||||
|
|
||||||
[ jit-load-return-address jit-inline-cache-miss ]
|
[ jit-load-return-address jit-inline-cache-miss ]
|
||||||
|
|
|
@ -181,7 +181,8 @@ IN: bootstrap.x86
|
||||||
jit-save-context
|
jit-save-context
|
||||||
arg1 RBX MOV
|
arg1 RBX MOV
|
||||||
arg2 vm-reg MOV
|
arg2 vm-reg MOV
|
||||||
"inline_cache_miss" jit-call
|
RAX 0 MOV rc-absolute-cell rel-inline-cache-miss
|
||||||
|
RAX CALL
|
||||||
jit-load-context
|
jit-load-context
|
||||||
jit-restore-context ;
|
jit-restore-context ;
|
||||||
|
|
||||||
|
|
|
@ -269,6 +269,9 @@ void factor_vm::store_external_address(instruction_operand op)
|
||||||
op.store_value(compute_dlsym_toc_address(parameters,index));
|
op.store_value(compute_dlsym_toc_address(parameters,index));
|
||||||
break;
|
break;
|
||||||
#endif
|
#endif
|
||||||
|
case RT_INLINE_CACHE_MISS:
|
||||||
|
op.store_value((cell)&factor::inline_cache_miss);
|
||||||
|
break;
|
||||||
default:
|
default:
|
||||||
critical_error("Bad rel type in store_external_address()",op.rel_type());
|
critical_error("Bad rel type in store_external_address()",op.rel_type());
|
||||||
break;
|
break;
|
||||||
|
|
|
@ -32,6 +32,9 @@ enum relocation_type {
|
||||||
RT_EXCEPTION_HANDLER,
|
RT_EXCEPTION_HANDLER,
|
||||||
/* arg is a literal table index, holding a pair (symbol/dll) */
|
/* arg is a literal table index, holding a pair (symbol/dll) */
|
||||||
RT_DLSYM_TOC,
|
RT_DLSYM_TOC,
|
||||||
|
/* address of inline_cache_miss function. This is a separate
|
||||||
|
relocation to reduce compile time and size for PICs. */
|
||||||
|
RT_INLINE_CACHE_MISS
|
||||||
};
|
};
|
||||||
|
|
||||||
enum relocation_class {
|
enum relocation_class {
|
||||||
|
@ -117,6 +120,7 @@ struct relocation_entry {
|
||||||
case RT_CARDS_OFFSET:
|
case RT_CARDS_OFFSET:
|
||||||
case RT_DECKS_OFFSET:
|
case RT_DECKS_OFFSET:
|
||||||
case RT_EXCEPTION_HANDLER:
|
case RT_EXCEPTION_HANDLER:
|
||||||
|
case RT_INLINE_CACHE_MISS:
|
||||||
return 0;
|
return 0;
|
||||||
default:
|
default:
|
||||||
critical_error("Bad rel type in number_of_parameters()",rel_type());
|
critical_error("Bad rel type in number_of_parameters()",rel_type());
|
||||||
|
|
Loading…
Reference in New Issue