Browse files

Don't mark functions that allocate and could result in GC as read only

These can have side effects if they cause an actual GC because of memory
pressure. In that case it can also for example modify stack addresses
because objects are forwarded. LLVM shouldn't remove those cases.

The proper way to handle this would be to first do escape analysis and
if it doesn't escape, we could switch to stack allocation. That stack
allocation can then properly be seen as having no side effects.
  • Loading branch information...
1 parent 136425d commit e8b793d43e7b9e766cad33d5f385f8202ba6f9f3 @dbussink dbussink committed Jan 5, 2013
Showing with 0 additions and 3 deletions.
  1. +0 −2 vm/llvm/inline_primitive.cpp
  2. +0 −1 vm/llvm/jit_operations.hpp
@@ -950,7 +950,6 @@ namespace rubinius {
Value* call_args[] = { ops.state() };
CallInst* res ="rbx_float_allocate", call_args, 1, "result", ops.b());
- res->setOnlyReadsMemory();
@@ -1157,7 +1156,6 @@ namespace rubinius {
// not have the semantics that it does. Allocation of this object
// can be removed if this value is never used afterwards and the
// allocation can be elided in that case.
- out->setOnlyReadsMemory();
@@ -1018,7 +1018,6 @@ namespace rubinius {
CallInst* result = b().CreateCall(func, call_args, "big_value");
- result->setOnlyReadsMemory();
return result;

0 comments on commit e8b793d

Please sign in to comment.