Guest User

Untitled

a guest
Jul 18th, 2018
78
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.02 KB | None | 0 0
  1. Index: dispatcher.cpp
  2. ===================================================================
  3. --- dispatcher.cpp (revision 3033)
  4. +++ dispatcher.cpp (working copy)
  5. @@ -1604,19 +1604,22 @@
  6. std::map<void *, rb_vm_block_t *>::iterator iter = blocks.find(key);
  7.  
  8. rb_vm_block_t *b;
  9. + int alloc_mask = VM_BLOCK_ACTIVE | VM_BLOCK_PROC | VM_BLOCK_IFUNC;
  10.  
  11. - if ((iter == blocks.end())
  12. - || (iter->second->flags & (VM_BLOCK_ACTIVE | VM_BLOCK_PROC))) {
  13. + if ((iter == blocks.end()) || (iter->second->flags & alloc_mask)) {
  14. + bool is_ifunc = (iter != blocks.end())
  15. + && ((iter->second->flags & VM_BLOCK_IFUNC) == VM_BLOCK_IFUNC);
  16.  
  17. - if (iter != blocks.end()) {
  18. + if (is_ifunc == false && iter != blocks.end()) {
  19. rb_objc_release(iter->second);
  20. }
  21. -
  22. b = (rb_vm_block_t *)xmalloc(sizeof(rb_vm_block_t)
  23. + (sizeof(VALUE *) * dvars_size));
  24. - rb_objc_retain(b);
  25. + if (is_ifunc == false) {
  26. + rb_objc_retain(b);
  27. + blocks[key] = b;
  28. + }
  29.  
  30. - blocks[key] = b;
  31. *cached = false;
  32. }
  33. else {
Add Comment
Please, Sign In to add comment