diff options
author | Cyrille Bagard <nocbos@gmail.com> | 2020-02-04 21:51:50 (GMT) |
---|---|---|
committer | Cyrille Bagard <nocbos@gmail.com> | 2020-02-04 21:51:50 (GMT) |
commit | a1d7bc97071a4d22bb633359c749e3de84682024 (patch) | |
tree | 841744c30ac6010a4fc827fa09970e45f991c9ef /src/arch/operands/register.c | |
parent | 6d290a69f0b76fce34e8a2fc2c5fbec15c95d1a5 (diff) |
Reduced the size required for register operands.
Diffstat (limited to 'src/arch/operands/register.c')
-rw-r--r-- | src/arch/operands/register.c | 26 |
1 files changed, 23 insertions, 3 deletions
diff --git a/src/arch/operands/register.c b/src/arch/operands/register.c index d755dbb..81608a3 100644 --- a/src/arch/operands/register.c +++ b/src/arch/operands/register.c @@ -121,7 +121,8 @@ static void g_register_operand_class_init(GRegisterOperandClass *klass) static void g_register_operand_init(GRegisterOperand *operand) { operand->reg = NULL; - operand->is_written = false; + + INIT_REG_OP_EXTRA(operand); } @@ -250,7 +251,15 @@ GArchRegister *g_register_operand_get_register(const GRegisterOperand *operand) void g_register_operand_mark_as_written(GRegisterOperand *operand) { - operand->is_written = true; + regop_obj_extra *extra; /* Données insérées à modifier */ + + extra = GET_REG_OP_EXTRA(operand); + + g_bit_lock(&extra->lock, HOLE_LOCK_BIT); + + extra->is_written = true; + + g_bit_unlock(&extra->lock, HOLE_LOCK_BIT); } @@ -269,7 +278,18 @@ void g_register_operand_mark_as_written(GRegisterOperand *operand) bool g_register_operand_is_written(const GRegisterOperand *operand) { - return operand->is_written; + bool result; /* Statut à retourner */ + regop_obj_extra *extra; /* Données insérées à modifier */ + + extra = GET_REG_OP_EXTRA(operand); + + g_bit_lock(&extra->lock, HOLE_LOCK_BIT); + + result = extra->is_written; + + g_bit_unlock(&extra->lock, HOLE_LOCK_BIT); + + return result; } |