提交 f2e56e68 编写于 作者: T twisti

7170145: C1 doesn't respect the JMM with volatile field loads

Reviewed-by: kvn, roland
上级 725e8092
...@@ -141,8 +141,11 @@ class ValueNumberingVisitor: public InstructionVisitor { ...@@ -141,8 +141,11 @@ class ValueNumberingVisitor: public InstructionVisitor {
// visitor functions // visitor functions
void do_StoreField (StoreField* x) { void do_StoreField (StoreField* x) {
if (x->is_init_point()) { if (x->is_init_point() || // putstatic is an initialization point so treat it as a wide kill
// putstatic is an initialization point so treat it as a wide kill // This is actually too strict and the JMM doesn't require
// this in all cases (e.g. load a; volatile store b; load a)
// but possible future optimizations might require this.
x->field()->is_volatile()) {
kill_memory(); kill_memory();
} else { } else {
kill_field(x->field()); kill_field(x->field());
...@@ -160,8 +163,8 @@ class ValueNumberingVisitor: public InstructionVisitor { ...@@ -160,8 +163,8 @@ class ValueNumberingVisitor: public InstructionVisitor {
void do_Local (Local* x) { /* nothing to do */ } void do_Local (Local* x) { /* nothing to do */ }
void do_Constant (Constant* x) { /* nothing to do */ } void do_Constant (Constant* x) { /* nothing to do */ }
void do_LoadField (LoadField* x) { void do_LoadField (LoadField* x) {
if (x->is_init_point()) { if (x->is_init_point() || // getstatic is an initialization point so treat it as a wide kill
// getstatic is an initialization point so treat it as a wide kill x->field()->is_volatile()) { // the JMM requires this
kill_memory(); kill_memory();
} }
} }
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册