We planned to upgrade GitLab and Mattermost to the latest version this Friday morning (early). You may experience some downtime!

Verified Commit 7edf38be authored by Camil Staps's avatar Camil Staps 🚀

Remove catAC and cmpAC from jesr everywhere; centralise generation of this...

Remove catAC and cmpAC from jesr everywhere; centralise generation of this instruction (cf. cefc36dc)
parent cbfbaa7d
Pipeline #17066 passed with stages
in 18 minutes and 4 seconds
......@@ -820,6 +820,16 @@ void add_instruction_w_internal_label_label(int16_t i,int32_t n1,struct label *l
store_code_label_value(label_name,0);
}
void add_jesr_instruction(int lib_function_n) {
switch (lib_function_n) {
case 0: add_instruction(CeqAC); break;
case 1: add_instruction(CcatAC); break;
case 11: add_instruction(CcmpAC); break;
default:
add_instruction_w(Cjesr,lib_function_n);
}
}
void add_label(char *label_name) {
if (list_code)
printf("%d\t.label %s\n",pgrm.code_size,label_name);
......@@ -2259,14 +2269,7 @@ void code_jsr(char label_name[]) {
lib_function_n = get_lib_function_n(label_name);
if (lib_function_n>=0) {
switch (lib_function_n) {
case 0: add_instruction(CeqAC); break;
case 1: add_instruction(CcatAC); break;
case 11: add_instruction(CcmpAC); break;
default:
add_instruction_w(Cjesr,lib_function_n);
}
add_jesr_instruction(lib_function_n);
last_jsr_with_d=0;
return;
}
......@@ -3397,12 +3400,7 @@ void code_buildh0_put_a_jsr(char descriptor_name[],int a_offset,char label_name[
if (lib_function_n>=0) {
code_buildh0_put_a(descriptor_name,a_offset);
if (lib_function_n==0)
add_instruction(CeqAC);
else
add_instruction_w(Cjesr,lib_function_n);
add_jesr_instruction(lib_function_n);
last_jsr_with_d=0;
return;
}
......@@ -3604,12 +3602,7 @@ void code_pop_a_jsr(int n,char label_name[]) {
if (lib_function_n>=0) {
code_pop_a(n);
if (lib_function_n==0)
add_instruction(CeqAC);
else
add_instruction_w(Cjesr,lib_function_n);
add_jesr_instruction(lib_function_n);
last_jsr_with_d=0;
return;
}
......@@ -3652,12 +3645,7 @@ void code_pop_b_jsr(int n,char label_name[]) {
if (lib_function_n>=0) {
code_pop_b(n);
if (lib_function_n==0)
add_instruction(CeqAC);
else
add_instruction_w(Cjesr,lib_function_n);
add_jesr_instruction(lib_function_n);
last_jsr_with_d=0;
return;
}
......@@ -3695,12 +3683,7 @@ void code_push_a_jsr(int a_offset,char label_name[]) {
if (lib_function_n>=0) {
code_push_a(a_offset);
if (lib_function_n==0)
add_instruction(CeqAC);
else
add_instruction_w(Cjesr,lib_function_n);
add_jesr_instruction(lib_function_n);
last_jsr_with_d=0;
return;
}
......@@ -3741,12 +3724,7 @@ void code_push_b_jsr(int b_offset,char label_name[]) {
if (lib_function_n>=0) {
code_push_b(b_offset);
if (lib_function_n==0)
add_instruction(CeqAC);
else
add_instruction_w(Cjesr,lib_function_n);
add_jesr_instruction(lib_function_n);
last_jsr_with_d=0;
return;
}
......
......@@ -303,13 +303,12 @@ void *get_interpretation_environment_finalizer(void) {
void interpreter_finalizer(BC_WORD interpret_node) {
}
int interpret_ie(struct interpretation_environment *ie, BC_WORD *pc) {
int result = interpret(ie,
static inline int interpret_ie(struct interpretation_environment *ie, BC_WORD *pc) {
return interpret(ie,
ie->stack, ie->stack_size,
ie->heap, ie->heap_size,
ie->asp, ie->bsp, ie->csp, ie->hp,
pc);
return result;
}
static BC_WORD *copy_to_host(struct InterpretationEnvironment *clean_ie,
......
......@@ -8938,6 +8938,9 @@ INSTRUCTION_BLOCK(jesr):
case 14:
clean_writeFC();
break;
default:
EPRINTF("internal error: unknown trap %d\n",(int)pc[1]);
interpreter_exit(-1);
}
asp=g_asp;
bsp=g_bsp;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment