VM: emit_prolog/emit_epilog can be simplified because stack frame and
safe point is always emitted togetherdb4
parent
358fae93c9
commit
3f9fa7e39e
|
@ -115,20 +115,12 @@ bool quotation_jit::trivial_quotation_p(array* elements) {
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Allocates memory (emit) */
|
/* Allocates memory (emit) */
|
||||||
void quotation_jit::emit_prolog(bool safepoint, bool stack_frame) {
|
void quotation_jit::emit_epilog(bool needed) {
|
||||||
if (safepoint)
|
if (needed) {
|
||||||
emit(parent->special_objects[JIT_SAFEPOINT]);
|
emit(parent->special_objects[JIT_SAFEPOINT]);
|
||||||
if (stack_frame)
|
|
||||||
emit(parent->special_objects[JIT_PROLOG]);
|
|
||||||
}
|
|
||||||
|
|
||||||
/* Allocates memory (emit) */
|
|
||||||
void quotation_jit::emit_epilog(bool safepoint, bool stack_frame) {
|
|
||||||
if (safepoint)
|
|
||||||
emit(parent->special_objects[JIT_SAFEPOINT]);
|
|
||||||
if (stack_frame)
|
|
||||||
emit(parent->special_objects[JIT_EPILOG]);
|
emit(parent->special_objects[JIT_EPILOG]);
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
/* Allocates memory conditionally */
|
/* Allocates memory conditionally */
|
||||||
void quotation_jit::emit_quotation(cell quot_) {
|
void quotation_jit::emit_quotation(cell quot_) {
|
||||||
|
@ -147,13 +139,16 @@ void quotation_jit::emit_quotation(cell quot_) {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Allocates memory (parameter(), literal(), emit_prolog, emit_with_literal)*/
|
/* Allocates memory (parameter(), literal(), emit_epilog, emit_with_literal)*/
|
||||||
void quotation_jit::iterate_quotation() {
|
void quotation_jit::iterate_quotation() {
|
||||||
bool no_non_safepoint_words = no_non_safepoint_words_p();
|
bool no_non_safepoint_words = no_non_safepoint_words_p();
|
||||||
|
|
||||||
set_position(0);
|
set_position(0);
|
||||||
|
|
||||||
emit_prolog(no_non_safepoint_words, no_non_safepoint_words);
|
if (no_non_safepoint_words) {
|
||||||
|
emit(parent->special_objects[JIT_SAFEPOINT]);
|
||||||
|
emit(parent->special_objects[JIT_PROLOG]);
|
||||||
|
}
|
||||||
|
|
||||||
cell i;
|
cell i;
|
||||||
cell length = array_capacity(elements.untagged());
|
cell length = array_capacity(elements.untagged());
|
||||||
|
@ -173,7 +168,7 @@ void quotation_jit::iterate_quotation() {
|
||||||
no_non_safepoint_words); /* stack_frame_p */
|
no_non_safepoint_words); /* stack_frame_p */
|
||||||
} /* Everything else */
|
} /* Everything else */
|
||||||
else if (i == length - 1) {
|
else if (i == length - 1) {
|
||||||
emit_epilog(no_non_safepoint_words, no_non_safepoint_words);
|
emit_epilog(no_non_safepoint_words);
|
||||||
tail_call = true;
|
tail_call = true;
|
||||||
word_jump(obj.value());
|
word_jump(obj.value());
|
||||||
} else
|
} else
|
||||||
|
@ -207,7 +202,7 @@ void quotation_jit::iterate_quotation() {
|
||||||
/* 'if' preceded by two literal quotations (this is why if and ? are
|
/* 'if' preceded by two literal quotations (this is why if and ? are
|
||||||
mutually recursive in the library, but both still work) */
|
mutually recursive in the library, but both still work) */
|
||||||
if (fast_if_p(i, length)) {
|
if (fast_if_p(i, length)) {
|
||||||
emit_epilog(no_non_safepoint_words, no_non_safepoint_words);
|
emit_epilog(no_non_safepoint_words);
|
||||||
tail_call = true;
|
tail_call = true;
|
||||||
|
|
||||||
emit_quotation(array_nth(elements.untagged(), i));
|
emit_quotation(array_nth(elements.untagged(), i));
|
||||||
|
@ -240,7 +235,7 @@ void quotation_jit::iterate_quotation() {
|
||||||
/* Load the object from the datastack, then remove our stack frame. */
|
/* Load the object from the datastack, then remove our stack frame. */
|
||||||
emit_with_literal(parent->special_objects[PIC_LOAD],
|
emit_with_literal(parent->special_objects[PIC_LOAD],
|
||||||
tag_fixnum(-index * sizeof(cell)));
|
tag_fixnum(-index * sizeof(cell)));
|
||||||
emit_epilog(no_non_safepoint_words, no_non_safepoint_words);
|
emit_epilog(no_non_safepoint_words);
|
||||||
tail_call = true;
|
tail_call = true;
|
||||||
|
|
||||||
emit_mega_cache_lookup(array_nth(elements.untagged(), i), index,
|
emit_mega_cache_lookup(array_nth(elements.untagged(), i), index,
|
||||||
|
@ -260,8 +255,7 @@ void quotation_jit::iterate_quotation() {
|
||||||
|
|
||||||
if (!tail_call) {
|
if (!tail_call) {
|
||||||
set_position(length);
|
set_position(length);
|
||||||
|
emit_epilog(no_non_safepoint_words);
|
||||||
emit_epilog(no_non_safepoint_words, no_non_safepoint_words);
|
|
||||||
emit(parent->special_objects[JIT_RETURN]);
|
emit(parent->special_objects[JIT_RETURN]);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -16,8 +16,7 @@ struct quotation_jit : public jit {
|
||||||
bool primitive_call_p(cell i, cell length);
|
bool primitive_call_p(cell i, cell length);
|
||||||
bool trivial_quotation_p(array* elements);
|
bool trivial_quotation_p(array* elements);
|
||||||
void emit_quotation(cell quot);
|
void emit_quotation(cell quot);
|
||||||
void emit_prolog(bool safepoint, bool stack_frame);
|
void emit_epilog(bool needed);
|
||||||
void emit_epilog(bool safepoint, bool stack_frame);
|
|
||||||
bool fast_if_p(cell i, cell length);
|
bool fast_if_p(cell i, cell length);
|
||||||
bool fast_dip_p(cell i, cell length);
|
bool fast_dip_p(cell i, cell length);
|
||||||
bool fast_2dip_p(cell i, cell length);
|
bool fast_2dip_p(cell i, cell length);
|
||||||
|
|
Loading…
Reference in New Issue