Add opcodes for volatile field accesses
This adds instructions for {i,s}{get,put}{,-object}-volatile, for a
total of eight new instructions.
On SMP systems, these instructions will be substituted in for existing
field access instructions, either by dexopt or during just-in-time
verification. Unlike the wide-volatile instructions, these will not be
used at all when the VM is not built for SMP.
(Ideally we'd omit the volatile instruction implementations entirely on
non-SMP builds, but that requires a little work in gen-mterp.py.)
The change defines and implements the opcodes and support methods, but
does not cause them to be used.
Also, changed dvmQuasiAtomicRead64's argument to be const.
Change-Id: I9e44fe881e87f27aa41f6c6e898ec4402cb5493e
diff --git a/libdex/InstrUtils.c b/libdex/InstrUtils.c
index 79095ae..a3ee859 100644
--- a/libdex/InstrUtils.c
+++ b/libdex/InstrUtils.c
@@ -297,6 +297,14 @@
case OP_IPUT_QUICK:
case OP_IPUT_WIDE_QUICK:
case OP_IPUT_OBJECT_QUICK:
+ case OP_IGET_VOLATILE:
+ case OP_IPUT_VOLATILE:
+ case OP_SGET_VOLATILE:
+ case OP_SPUT_VOLATILE:
+ case OP_IGET_OBJECT_VOLATILE:
+ case OP_IPUT_OBJECT_VOLATILE:
+ case OP_SGET_OBJECT_VOLATILE:
+ case OP_SPUT_OBJECT_VOLATILE:
case OP_IGET_WIDE_VOLATILE:
case OP_IPUT_WIDE_VOLATILE:
case OP_SGET_WIDE_VOLATILE:
@@ -324,16 +332,8 @@
case OP_UNUSED_73:
case OP_UNUSED_79:
case OP_UNUSED_7A:
- case OP_UNUSED_E3:
- case OP_UNUSED_E4:
- case OP_UNUSED_E5:
- case OP_UNUSED_E6:
- case OP_UNUSED_E7:
case OP_BREAKPOINT:
case OP_UNUSED_F1:
- case OP_UNUSED_FC:
- case OP_UNUSED_FD:
- case OP_UNUSED_FE:
case OP_UNUSED_FF:
assert(width == 0);
break;
@@ -628,6 +628,14 @@
case OP_IPUT_QUICK:
case OP_IPUT_WIDE_QUICK:
case OP_IPUT_OBJECT_QUICK:
+ case OP_IGET_VOLATILE:
+ case OP_IPUT_VOLATILE:
+ case OP_SGET_VOLATILE:
+ case OP_SPUT_VOLATILE:
+ case OP_IGET_OBJECT_VOLATILE:
+ case OP_IPUT_OBJECT_VOLATILE:
+ case OP_SGET_OBJECT_VOLATILE:
+ case OP_SPUT_OBJECT_VOLATILE:
case OP_IGET_WIDE_VOLATILE:
case OP_IPUT_WIDE_VOLATILE:
case OP_SGET_WIDE_VOLATILE:
@@ -653,16 +661,8 @@
case OP_UNUSED_73:
case OP_UNUSED_79:
case OP_UNUSED_7A:
- case OP_UNUSED_E3:
- case OP_UNUSED_E4:
- case OP_UNUSED_E5:
- case OP_UNUSED_E6:
- case OP_UNUSED_E7:
case OP_BREAKPOINT:
case OP_UNUSED_F1:
- case OP_UNUSED_FC:
- case OP_UNUSED_FD:
- case OP_UNUSED_FE:
case OP_UNUSED_FF:
break;
@@ -973,6 +973,14 @@
case OP_IPUT_WIDE_VOLATILE:
case OP_SGET_WIDE_VOLATILE:
case OP_SPUT_WIDE_VOLATILE:
+ case OP_IGET_VOLATILE:
+ case OP_IPUT_VOLATILE:
+ case OP_SGET_VOLATILE:
+ case OP_SPUT_VOLATILE:
+ case OP_IGET_OBJECT_VOLATILE:
+ case OP_IPUT_OBJECT_VOLATILE:
+ case OP_SGET_OBJECT_VOLATILE:
+ case OP_SPUT_OBJECT_VOLATILE:
fmt = kFmt22c;
break;
case OP_IGET_QUICK:
@@ -1011,16 +1019,8 @@
case OP_UNUSED_73:
case OP_UNUSED_79:
case OP_UNUSED_7A:
- case OP_UNUSED_E3:
- case OP_UNUSED_E4:
- case OP_UNUSED_E5:
- case OP_UNUSED_E6:
- case OP_UNUSED_E7:
case OP_BREAKPOINT:
case OP_UNUSED_F1:
- case OP_UNUSED_FC:
- case OP_UNUSED_FD:
- case OP_UNUSED_FE:
case OP_UNUSED_FF:
fmt = kFmtUnknown;
break;