new text conversion and string code (big changes, take care please)
This commit is contained in:
61
C/amasm.c
61
C/amasm.c
@@ -1144,6 +1144,22 @@ a_ublob(CELL rnd1, op_numbers opcode, op_numbers opcode_w, int *clause_has_blobs
|
||||
return code_p;
|
||||
}
|
||||
|
||||
// strings are blobs
|
||||
inline static yamop *
|
||||
a_ustring(CELL rnd1, op_numbers opcode, op_numbers opcode_w, int *clause_has_blobsp, yamop *code_p, int pass_no, struct intermediates *cip)
|
||||
{
|
||||
if (pass_no) {
|
||||
code_p->opc = emit_op(opcode);
|
||||
code_p->u.ou.opcw = emit_op(opcode_w);
|
||||
code_p->u.ou.u =
|
||||
AbsAppl((CELL *)(Unsigned(cip->code_addr) + cip->label_offset[rnd1]));
|
||||
|
||||
}
|
||||
*clause_has_blobsp = TRUE;
|
||||
GONEXT(ou);
|
||||
return code_p;
|
||||
}
|
||||
|
||||
inline static yamop *
|
||||
a_udbt(CELL rnd1, op_numbers opcode, op_numbers opcode_w, int *clause_has_dbtermp, yamop *code_p, int pass_no, struct intermediates *cip)
|
||||
{
|
||||
@@ -1384,6 +1400,19 @@ a_rb(op_numbers opcode, int *clause_has_blobsp, yamop *code_p, int pass_no, stru
|
||||
return code_p;
|
||||
}
|
||||
|
||||
inline static yamop *
|
||||
a_rstring(op_numbers opcode, int *clause_has_blobsp, yamop *code_p, int pass_no, struct intermediates *cip)
|
||||
{
|
||||
if (pass_no) {
|
||||
code_p->opc = emit_op(opcode);
|
||||
code_p->u.xu.x = emit_x(cip->cpc->rnd2);
|
||||
code_p->u.xu.u = AbsAppl((CELL *)(Unsigned(cip->code_addr) + cip->label_offset[cip->cpc->rnd1]));
|
||||
}
|
||||
*clause_has_blobsp = TRUE;
|
||||
GONEXT(xu);
|
||||
return code_p;
|
||||
}
|
||||
|
||||
inline static yamop *
|
||||
a_dbt(op_numbers opcode, int *clause_has_dbtermp, yamop *code_p, int pass_no, struct intermediates *cip)
|
||||
{
|
||||
@@ -2421,6 +2450,16 @@ copy_blob(yamop *code_p, int pass_no, struct PSEUDO *cpc)
|
||||
return code_p;
|
||||
}
|
||||
|
||||
static yamop *
|
||||
copy_string(yamop *code_p, int pass_no, struct PSEUDO *cpc)
|
||||
{
|
||||
/* copy the blob to code space, making no effort to align if a double */
|
||||
int max = cpc->rnd1, i;
|
||||
for (i = 0; i < max; i++)
|
||||
code_p = fill_a(cpc->arnds[i], code_p, pass_no);
|
||||
return code_p;
|
||||
}
|
||||
|
||||
|
||||
static void
|
||||
a_fetch_vv(cmp_op_info *cmp_info, int pass_no, struct intermediates *cip)
|
||||
@@ -3240,6 +3279,9 @@ do_pass(int pass_no, yamop **entry_codep, int assembling, int *clause_has_blobsp
|
||||
case get_bigint_op:
|
||||
code_p = a_rb(_get_bigint, clause_has_blobsp, code_p, pass_no, cip);
|
||||
break;
|
||||
case get_string_op:
|
||||
code_p = a_rb(_get_string, clause_has_blobsp, code_p, pass_no, cip);
|
||||
break;
|
||||
case get_dbterm_op:
|
||||
code_p = a_dbt(_get_dbterm, clause_has_dbtermp, code_p, pass_no, cip);
|
||||
break;
|
||||
@@ -3258,6 +3300,9 @@ do_pass(int pass_no, yamop **entry_codep, int assembling, int *clause_has_blobsp
|
||||
case put_bigint_op:
|
||||
code_p = a_rb(_put_bigint, clause_has_blobsp, code_p, pass_no, cip);
|
||||
break;
|
||||
case put_string_op:
|
||||
code_p = a_rstring(_put_bigint, clause_has_blobsp, code_p, pass_no, cip);
|
||||
break;
|
||||
case put_dbterm_op:
|
||||
code_p = a_dbt(_put_dbterm, clause_has_dbtermp, code_p, pass_no, cip);
|
||||
break;
|
||||
@@ -3318,6 +3363,9 @@ do_pass(int pass_no, yamop **entry_codep, int assembling, int *clause_has_blobsp
|
||||
case unify_bigint_op:
|
||||
code_p = a_ublob(cip->cpc->rnd1, _unify_bigint, _unify_atom_write, clause_has_blobsp, code_p, pass_no, cip);
|
||||
break;
|
||||
case unify_string_op:
|
||||
code_p = a_ublob(cip->cpc->rnd1, _unify_string, _unify_atom_write, clause_has_blobsp, code_p, pass_no, cip);
|
||||
break;
|
||||
case unify_dbterm_op:
|
||||
code_p = a_udbt(cip->cpc->rnd1, _unify_dbterm, _unify_atom_write, clause_has_dbtermp, code_p, pass_no, cip);
|
||||
break;
|
||||
@@ -3336,6 +3384,9 @@ do_pass(int pass_no, yamop **entry_codep, int assembling, int *clause_has_blobsp
|
||||
case unify_last_bigint_op:
|
||||
code_p = a_ublob(cip->cpc->rnd1, _unify_l_bigint, _unify_l_atom_write, clause_has_blobsp, code_p, pass_no, cip);
|
||||
break;
|
||||
case unify_last_string_op:
|
||||
code_p = a_ublob(cip->cpc->rnd1, _unify_l_bigint, _unify_l_atom_write, clause_has_blobsp, code_p, pass_no, cip);
|
||||
break;
|
||||
case unify_last_dbterm_op:
|
||||
code_p = a_udbt(cip->cpc->rnd1, _unify_l_dbterm, _unify_l_atom_write, clause_has_dbtermp, code_p, pass_no, cip);
|
||||
break;
|
||||
@@ -3354,6 +3405,9 @@ do_pass(int pass_no, yamop **entry_codep, int assembling, int *clause_has_blobsp
|
||||
case write_bigint_op:
|
||||
code_p = a_wblob(cip->cpc->rnd1, _write_bigint, clause_has_blobsp, code_p, pass_no, cip);
|
||||
break;
|
||||
case write_string_op:
|
||||
code_p = a_wblob(cip->cpc->rnd1, _write_bigint, clause_has_blobsp, code_p, pass_no, cip);
|
||||
break;
|
||||
case write_dbterm_op:
|
||||
code_p = a_wdbt(cip->cpc->rnd1, _write_dbterm, clause_has_dbtermp, code_p, pass_no, cip);
|
||||
break;
|
||||
@@ -3540,7 +3594,8 @@ do_pass(int pass_no, yamop **entry_codep, int assembling, int *clause_has_blobsp
|
||||
cip->cpc->nextInst != NULL &&
|
||||
(cip->cpc->nextInst->op == mark_initialised_pvars_op ||
|
||||
cip->cpc->nextInst->op == mark_live_regs_op ||
|
||||
cip->cpc->nextInst->op == blob_op)) {
|
||||
cip->cpc->nextInst->op == blob_op ||
|
||||
cip->cpc->nextInst->op == string_op)) {
|
||||
ystop_found = TRUE;
|
||||
code_p = a_il((CELL)*entry_codep, _Ystop, code_p, pass_no, cip);
|
||||
}
|
||||
@@ -3746,6 +3801,10 @@ do_pass(int pass_no, yamop **entry_codep, int assembling, int *clause_has_blobsp
|
||||
/* install a blob */
|
||||
code_p = copy_blob(code_p, pass_no, cip->cpc);
|
||||
break;
|
||||
case string_op:
|
||||
/* install a blob */
|
||||
code_p = copy_string(code_p, pass_no, cip->cpc);
|
||||
break;
|
||||
case empty_call_op:
|
||||
/* create an empty call */
|
||||
code_p = a_empty_call(&clinfo, code_p, pass_no, cip);
|
||||
|
Reference in New Issue
Block a user