Get rid of execute-unsafe now that (execute) is more versatile
parent
27c84e89fe
commit
356537593e
|
@ -229,7 +229,6 @@ M: object infer-call*
|
||||||
! More words not to compile
|
! More words not to compile
|
||||||
\ call t "no-compile" set-word-prop
|
\ call t "no-compile" set-word-prop
|
||||||
\ execute t "no-compile" set-word-prop
|
\ execute t "no-compile" set-word-prop
|
||||||
\ execute-unsafe t "no-compile" set-word-prop
|
|
||||||
\ clear t "no-compile" set-word-prop
|
\ clear t "no-compile" set-word-prop
|
||||||
|
|
||||||
: non-inline-word ( word -- )
|
: non-inline-word ( word -- )
|
||||||
|
|
|
@ -242,8 +242,6 @@ M: f compile-engine ;
|
||||||
]
|
]
|
||||||
} cleave ;
|
} cleave ;
|
||||||
|
|
||||||
: execute-unsafe ( word -- ) (execute) ;
|
|
||||||
|
|
||||||
: make-empty-cache ( -- array )
|
: make-empty-cache ( -- array )
|
||||||
generic-word get "methods" word-prop
|
generic-word get "methods" word-prop
|
||||||
assoc-size 2 * next-power-of-2 f <array> ;
|
assoc-size 2 * next-power-of-2 f <array> ;
|
||||||
|
@ -257,7 +255,7 @@ M: single-combination perform-combination
|
||||||
picker %
|
picker %
|
||||||
,
|
,
|
||||||
make-empty-cache ,
|
make-empty-cache ,
|
||||||
[ lookup-method execute-unsafe ] %
|
[ lookup-method (execute) ] %
|
||||||
] [ ] make define
|
] [ ] make define
|
||||||
] 2bi
|
] 2bi
|
||||||
] with-combination ;
|
] with-combination ;
|
|
@ -122,6 +122,12 @@ F_REL rel_to_emit(CELL code, CELL code_format, CELL code_length, bool *rel_p)
|
||||||
GROWABLE_ARRAY_APPEND(code,code_to_emit(name)); \
|
GROWABLE_ARRAY_APPEND(code,code_to_emit(name)); \
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#define EMIT_TAIL_CALL(name) { \
|
||||||
|
if(stack_frame) EMIT(userenv[JIT_EPILOG]); \
|
||||||
|
tail_call = true; \
|
||||||
|
EMIT(name); \
|
||||||
|
}
|
||||||
|
|
||||||
bool jit_stack_frame_p(F_ARRAY *array)
|
bool jit_stack_frame_p(F_ARRAY *array)
|
||||||
{
|
{
|
||||||
F_FIXNUM length = array_capacity(array);
|
F_FIXNUM length = array_capacity(array);
|
||||||
|
@ -213,21 +219,21 @@ void jit_compile(CELL quot, bool relocate)
|
||||||
|
|
||||||
EMIT(word->subprimitive);
|
EMIT(word->subprimitive);
|
||||||
}
|
}
|
||||||
|
else if(obj == userenv[JIT_EXECUTE_WORD])
|
||||||
|
{
|
||||||
|
if(i == length - 1)
|
||||||
|
EMIT_TAIL_CALL(userenv[JIT_EXECUTE_JUMP])
|
||||||
|
else
|
||||||
|
EMIT(userenv[JIT_EXECUTE_CALL])
|
||||||
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
GROWABLE_ARRAY_ADD(literals,obj);
|
GROWABLE_ARRAY_ADD(literals,obj);
|
||||||
|
|
||||||
if(i == length - 1)
|
if(i == length - 1)
|
||||||
{
|
EMIT_TAIL_CALL(userenv[JIT_WORD_JUMP])
|
||||||
if(stack_frame)
|
|
||||||
EMIT(userenv[JIT_EPILOG]);
|
|
||||||
|
|
||||||
EMIT(userenv[JIT_WORD_JUMP]);
|
|
||||||
|
|
||||||
tail_call = true;
|
|
||||||
}
|
|
||||||
else
|
else
|
||||||
EMIT(userenv[JIT_WORD_CALL]);
|
EMIT(userenv[JIT_WORD_CALL])
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case WRAPPER_TYPE:
|
case WRAPPER_TYPE:
|
||||||
|
@ -253,6 +259,8 @@ void jit_compile(CELL quot, bool relocate)
|
||||||
if(stack_frame)
|
if(stack_frame)
|
||||||
EMIT(userenv[JIT_EPILOG]);
|
EMIT(userenv[JIT_EPILOG]);
|
||||||
|
|
||||||
|
tail_call = true;
|
||||||
|
|
||||||
jit_compile(array_nth(untag_object(array),i),relocate);
|
jit_compile(array_nth(untag_object(array),i),relocate);
|
||||||
jit_compile(array_nth(untag_object(array),i + 1),relocate);
|
jit_compile(array_nth(untag_object(array),i + 1),relocate);
|
||||||
|
|
||||||
|
@ -263,7 +271,6 @@ void jit_compile(CELL quot, bool relocate)
|
||||||
|
|
||||||
i += 2;
|
i += 2;
|
||||||
|
|
||||||
tail_call = true;
|
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
else if(jit_fast_dip_p(untag_object(array),i))
|
else if(jit_fast_dip_p(untag_object(array),i))
|
||||||
|
@ -299,15 +306,10 @@ void jit_compile(CELL quot, bool relocate)
|
||||||
case ARRAY_TYPE:
|
case ARRAY_TYPE:
|
||||||
if(jit_fast_dispatch_p(untag_object(array),i))
|
if(jit_fast_dispatch_p(untag_object(array),i))
|
||||||
{
|
{
|
||||||
if(stack_frame)
|
|
||||||
EMIT(userenv[JIT_EPILOG]);
|
|
||||||
|
|
||||||
GROWABLE_ARRAY_ADD(literals,array_nth(untag_object(array),i));
|
GROWABLE_ARRAY_ADD(literals,array_nth(untag_object(array),i));
|
||||||
EMIT(userenv[JIT_DISPATCH]);
|
EMIT_TAIL_CALL(userenv[JIT_DISPATCH]);
|
||||||
|
|
||||||
i++;
|
i++;
|
||||||
|
|
||||||
tail_call = true;
|
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
else if(jit_ignore_declare_p(untag_object(array),i))
|
else if(jit_ignore_declare_p(untag_object(array),i))
|
||||||
|
@ -366,6 +368,12 @@ struct.) */
|
||||||
offset -= size; \
|
offset -= size; \
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#define COUNT_TAIL_CALL(name,scan) { \
|
||||||
|
if(stack_frame) COUNT(JIT_EPILOG,scan) \
|
||||||
|
tail_call = true; \
|
||||||
|
COUNT(name,scan); \
|
||||||
|
}
|
||||||
|
|
||||||
F_FIXNUM quot_code_offset_to_scan(CELL quot, F_FIXNUM offset)
|
F_FIXNUM quot_code_offset_to_scan(CELL quot, F_FIXNUM offset)
|
||||||
{
|
{
|
||||||
CELL code_format = compiled_code_format();
|
CELL code_format = compiled_code_format();
|
||||||
|
@ -393,15 +401,15 @@ F_FIXNUM quot_code_offset_to_scan(CELL quot, F_FIXNUM offset)
|
||||||
word = untag_object(obj);
|
word = untag_object(obj);
|
||||||
if(word->subprimitive != F)
|
if(word->subprimitive != F)
|
||||||
COUNT(word->subprimitive,i)
|
COUNT(word->subprimitive,i)
|
||||||
else if(i == length - 1)
|
else if(obj == userenv[JIT_EXECUTE_WORD])
|
||||||
{
|
{
|
||||||
if(stack_frame)
|
if(i == length - 1)
|
||||||
COUNT(userenv[JIT_EPILOG],i);
|
COUNT_TAIL_CALL(userenv[JIT_EXECUTE_JUMP],i)
|
||||||
|
else
|
||||||
COUNT(userenv[JIT_WORD_JUMP],i)
|
COUNT(userenv[JIT_EXECUTE_CALL],i)
|
||||||
|
|
||||||
tail_call = true;
|
|
||||||
}
|
}
|
||||||
|
else if(i == length - 1)
|
||||||
|
COUNT_TAIL_CALL(userenv[JIT_WORD_JUMP],i)
|
||||||
else
|
else
|
||||||
COUNT(userenv[JIT_WORD_CALL],i)
|
COUNT(userenv[JIT_WORD_CALL],i)
|
||||||
break;
|
break;
|
||||||
|
@ -424,12 +432,12 @@ F_FIXNUM quot_code_offset_to_scan(CELL quot, F_FIXNUM offset)
|
||||||
{
|
{
|
||||||
if(stack_frame)
|
if(stack_frame)
|
||||||
COUNT(userenv[JIT_EPILOG],i)
|
COUNT(userenv[JIT_EPILOG],i)
|
||||||
|
tail_call = true;
|
||||||
|
|
||||||
COUNT(userenv[JIT_IF_1],i)
|
COUNT(userenv[JIT_IF_1],i)
|
||||||
COUNT(userenv[JIT_IF_2],i)
|
COUNT(userenv[JIT_IF_2],i)
|
||||||
i += 2;
|
i += 2;
|
||||||
|
|
||||||
tail_call = true;
|
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
else if(jit_fast_dip_p(untag_object(array),i))
|
else if(jit_fast_dip_p(untag_object(array),i))
|
||||||
|
@ -453,22 +461,14 @@ F_FIXNUM quot_code_offset_to_scan(CELL quot, F_FIXNUM offset)
|
||||||
case ARRAY_TYPE:
|
case ARRAY_TYPE:
|
||||||
if(jit_fast_dispatch_p(untag_object(array),i))
|
if(jit_fast_dispatch_p(untag_object(array),i))
|
||||||
{
|
{
|
||||||
if(stack_frame)
|
|
||||||
COUNT(userenv[JIT_EPILOG],i)
|
|
||||||
|
|
||||||
i++;
|
i++;
|
||||||
|
COUNT_TAIL_CALL(userenv[JIT_DISPATCH],i)
|
||||||
COUNT(userenv[JIT_DISPATCH],i)
|
|
||||||
|
|
||||||
tail_call = true;
|
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
if(jit_ignore_declare_p(untag_object(array),i))
|
if(jit_ignore_declare_p(untag_object(array),i))
|
||||||
{
|
{
|
||||||
if(offset == 0) return i;
|
if(offset == 0) return i;
|
||||||
|
|
||||||
i++;
|
i++;
|
||||||
|
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
default:
|
default:
|
||||||
|
|
Loading…
Reference in New Issue