Mercurial > hg > graal-jvmci-8
comparison src/share/vm/gc_implementation/concurrentMarkSweep/compactibleFreeListSpace.cpp @ 14443:3205e78d8193
8029396: PPC64 (part 212): Several memory ordering fixes in C-code.
Summary: memory ordering fixes in GC and other runtime code showing on PPC64.
Reviewed-by: kvn, coleenp
author | goetz |
---|---|
date | Mon, 02 Dec 2013 10:26:14 +0100 |
parents | 71180a6e5080 |
children | 8a9bb7821e28 bbfbe9b06038 |
comparison
equal
deleted
inserted
replaced
14442:1174c8abbdb6 | 14443:3205e78d8193 |
---|---|
995 while (true) { | 995 while (true) { |
996 // We must do this until we get a consistent view of the object. | 996 // We must do this until we get a consistent view of the object. |
997 if (FreeChunk::indicatesFreeChunk(p)) { | 997 if (FreeChunk::indicatesFreeChunk(p)) { |
998 volatile FreeChunk* fc = (volatile FreeChunk*)p; | 998 volatile FreeChunk* fc = (volatile FreeChunk*)p; |
999 size_t res = fc->size(); | 999 size_t res = fc->size(); |
1000 | |
1001 // Bugfix for systems with weak memory model (PPC64/IA64). The | |
1002 // block's free bit was set and we have read the size of the | |
1003 // block. Acquire and check the free bit again. If the block is | |
1004 // still free, the read size is correct. | |
1005 OrderAccess::acquire(); | |
1006 | |
1000 // If the object is still a free chunk, return the size, else it | 1007 // If the object is still a free chunk, return the size, else it |
1001 // has been allocated so try again. | 1008 // has been allocated so try again. |
1002 if (FreeChunk::indicatesFreeChunk(p)) { | 1009 if (FreeChunk::indicatesFreeChunk(p)) { |
1003 assert(res != 0, "Block size should not be 0"); | 1010 assert(res != 0, "Block size should not be 0"); |
1004 return res; | 1011 return res; |
1008 Klass* k = ((volatile oopDesc*)p)->klass_or_null(); | 1015 Klass* k = ((volatile oopDesc*)p)->klass_or_null(); |
1009 if (k != NULL) { | 1016 if (k != NULL) { |
1010 assert(k->is_klass(), "Should really be klass oop."); | 1017 assert(k->is_klass(), "Should really be klass oop."); |
1011 oop o = (oop)p; | 1018 oop o = (oop)p; |
1012 assert(o->is_oop(true /* ignore mark word */), "Should be an oop."); | 1019 assert(o->is_oop(true /* ignore mark word */), "Should be an oop."); |
1020 | |
1021 // Bugfix for systems with weak memory model (PPC64/IA64). | |
1022 // The object o may be an array. Acquire to make sure that the array | |
1023 // size (third word) is consistent. | |
1024 OrderAccess::acquire(); | |
1025 | |
1013 size_t res = o->size_given_klass(k); | 1026 size_t res = o->size_given_klass(k); |
1014 res = adjustObjectSize(res); | 1027 res = adjustObjectSize(res); |
1015 assert(res != 0, "Block size should not be 0"); | 1028 assert(res != 0, "Block size should not be 0"); |
1016 return res; | 1029 return res; |
1017 } | 1030 } |
1038 while (true) { | 1051 while (true) { |
1039 // We must do this until we get a consistent view of the object. | 1052 // We must do this until we get a consistent view of the object. |
1040 if (FreeChunk::indicatesFreeChunk(p)) { | 1053 if (FreeChunk::indicatesFreeChunk(p)) { |
1041 volatile FreeChunk* fc = (volatile FreeChunk*)p; | 1054 volatile FreeChunk* fc = (volatile FreeChunk*)p; |
1042 size_t res = fc->size(); | 1055 size_t res = fc->size(); |
1056 | |
1057 // Bugfix for systems with weak memory model (PPC64/IA64). The | |
1058 // free bit of the block was set and we have read the size of | |
1059 // the block. Acquire and check the free bit again. If the | |
1060 // block is still free, the read size is correct. | |
1061 OrderAccess::acquire(); | |
1062 | |
1043 if (FreeChunk::indicatesFreeChunk(p)) { | 1063 if (FreeChunk::indicatesFreeChunk(p)) { |
1044 assert(res != 0, "Block size should not be 0"); | 1064 assert(res != 0, "Block size should not be 0"); |
1045 assert(loops == 0, "Should be 0"); | 1065 assert(loops == 0, "Should be 0"); |
1046 return res; | 1066 return res; |
1047 } | 1067 } |
1053 // -- irrespective of its conc_safe-ty. | 1073 // -- irrespective of its conc_safe-ty. |
1054 if (k != NULL) { | 1074 if (k != NULL) { |
1055 assert(k->is_klass(), "Should really be klass oop."); | 1075 assert(k->is_klass(), "Should really be klass oop."); |
1056 oop o = (oop)p; | 1076 oop o = (oop)p; |
1057 assert(o->is_oop(), "Should be an oop"); | 1077 assert(o->is_oop(), "Should be an oop"); |
1078 | |
1079 // Bugfix for systems with weak memory model (PPC64/IA64). | |
1080 // The object o may be an array. Acquire to make sure that the array | |
1081 // size (third word) is consistent. | |
1082 OrderAccess::acquire(); | |
1083 | |
1058 size_t res = o->size_given_klass(k); | 1084 size_t res = o->size_given_klass(k); |
1059 res = adjustObjectSize(res); | 1085 res = adjustObjectSize(res); |
1060 assert(res != 0, "Block size should not be 0"); | 1086 assert(res != 0, "Block size should not be 0"); |
1061 return res; | 1087 return res; |
1062 } else { | 1088 } else { |