1105 return true; |
1105 return true; |
1106 } |
1106 } |
1107 |
1107 |
1108 @Override |
1108 @Override |
1109 public boolean apply(GraphBuilderContext b, ResolvedJavaMethod targetMethod, Receiver unsafe, ValueNode object, ValueNode offset) { |
1109 public boolean apply(GraphBuilderContext b, ResolvedJavaMethod targetMethod, Receiver unsafe, ValueNode object, ValueNode offset) { |
|
1110 // Opaque mode does not directly impose any ordering constraints with respect to other |
|
1111 // variables beyond Plain mode. |
|
1112 if (accessKind == AccessKind.OPAQUE && StampTool.isPointerAlwaysNull(object)) { |
|
1113 // OFF_HEAP_LOCATION accesses are not floatable => no membars needed for opaque. |
|
1114 return apply(b, targetMethod, unsafe, offset); |
|
1115 } |
1110 // Emits a null-check for the otherwise unused receiver |
1116 // Emits a null-check for the otherwise unused receiver |
1111 unsafe.get(); |
1117 unsafe.get(); |
1112 if (accessKind.emitBarriers) { |
1118 if (accessKind.emitBarriers) { |
1113 b.add(new MembarNode(accessKind.preReadBarriers)); |
1119 b.add(new MembarNode(accessKind.preReadBarriers)); |
1114 } |
1120 } |
|
1121 // Raw accesses can be turned into floatable field accesses, the membars preserve the |
|
1122 // access mode. In the case of opaque access, and only for opaque, the location of the |
|
1123 // wrapping membars can be refined to the field location. |
1115 createUnsafeAccess(object, b, (obj, loc) -> new RawLoadNode(obj, offset, unsafeAccessKind, loc)); |
1124 createUnsafeAccess(object, b, (obj, loc) -> new RawLoadNode(obj, offset, unsafeAccessKind, loc)); |
1116 if (accessKind.emitBarriers) { |
1125 if (accessKind.emitBarriers) { |
1117 b.add(new MembarNode(accessKind.postReadBarriers)); |
1126 b.add(new MembarNode(accessKind.postReadBarriers)); |
1118 } |
1127 } |
1119 return true; |
1128 return true; |
1142 return true; |
1151 return true; |
1143 } |
1152 } |
1144 |
1153 |
1145 @Override |
1154 @Override |
1146 public boolean apply(GraphBuilderContext b, ResolvedJavaMethod targetMethod, Receiver unsafe, ValueNode object, ValueNode offset, ValueNode value) { |
1155 public boolean apply(GraphBuilderContext b, ResolvedJavaMethod targetMethod, Receiver unsafe, ValueNode object, ValueNode offset, ValueNode value) { |
|
1156 // Opaque mode does not directly impose any ordering constraints with respect to other |
|
1157 // variables beyond Plain mode. |
|
1158 if (accessKind == AccessKind.OPAQUE && StampTool.isPointerAlwaysNull(object)) { |
|
1159 // OFF_HEAP_LOCATION accesses are not floatable => no membars needed for opaque. |
|
1160 return apply(b, targetMethod, unsafe, offset, value); |
|
1161 } |
1147 // Emits a null-check for the otherwise unused receiver |
1162 // Emits a null-check for the otherwise unused receiver |
1148 unsafe.get(); |
1163 unsafe.get(); |
1149 if (accessKind.emitBarriers) { |
1164 if (accessKind.emitBarriers) { |
1150 b.add(new MembarNode(accessKind.preWriteBarriers)); |
1165 b.add(new MembarNode(accessKind.preWriteBarriers)); |
1151 } |
1166 } |
1152 ValueNode maskedValue = b.maskSubWordValue(value, unsafeAccessKind); |
1167 ValueNode maskedValue = b.maskSubWordValue(value, unsafeAccessKind); |
|
1168 // Raw accesses can be turned into floatable field accesses, the membars preserve the |
|
1169 // access mode. In the case of opaque access, and only for opaque, the location of the |
|
1170 // wrapping membars can be refined to the field location. |
1153 createUnsafeAccess(object, b, (obj, loc) -> new RawStoreNode(obj, offset, maskedValue, unsafeAccessKind, loc)); |
1171 createUnsafeAccess(object, b, (obj, loc) -> new RawStoreNode(obj, offset, maskedValue, unsafeAccessKind, loc)); |
1154 if (accessKind.emitBarriers) { |
1172 if (accessKind.emitBarriers) { |
1155 b.add(new MembarNode(accessKind.postWriteBarriers)); |
1173 b.add(new MembarNode(accessKind.postWriteBarriers)); |
1156 } |
1174 } |
1157 return true; |
1175 return true; |