Permalink
Browse files

Make sure to retry handle clearing

  • Loading branch information...
1 parent 1337a88 commit 330a3e7daae162ced7fc222bf8252c3ba8312d24 @dbussink dbussink committed May 24, 2012
Showing with 19 additions and 14 deletions.
  1. +18 −0 vm/oop.cpp
  2. +1 −14 vm/oop.hpp
View
18 vm/oop.cpp
@@ -175,6 +175,24 @@ namespace rubinius {
}
}
+ void ObjectHeader::clear_handle(STATE) {
+ for(;;) {
+ if(inflated_header_p()) {
+ inflated_header()->set_handle(state, NULL);
+ return;
+ } else {
+ HeaderWord orig = header;
+ orig.f.meaning = eAuxWordHandle;
+
+ HeaderWord new_val = orig;
+ new_val.f.meaning = eAuxWordEmpty;
+ new_val.f.aux_word = 0;
+
+ if(header.atomic_set(orig, new_val)) return;
+ }
+ }
+ }
+
capi::Handle* ObjectHeader::handle(STATE) {
HeaderWord tmp = header;
if(tmp.f.inflated) {
View
15 vm/oop.hpp
@@ -402,20 +402,7 @@ Object* const cUndef = reinterpret_cast<Object*>(0x22L);
}
}
- void clear_handle(STATE) {
- if(inflated_header_p()) {
- inflated_header()->set_handle(state, NULL);
- } else {
- HeaderWord orig = header;
- orig.f.meaning = eAuxWordHandle;
-
- HeaderWord new_val = orig;
- new_val.f.meaning = eAuxWordEmpty;
- new_val.f.aux_word = 0;
-
- if(header.atomic_set(orig, new_val)) return;
- }
- }
+ void clear_handle(STATE);
void set_handle_index(STATE, uintptr_t handle_index);

0 comments on commit 330a3e7

Please sign in to comment.