[llvm-commits] CVS: llvm-java/lib/Compiler/Compiler.cpp

Alkis Evlogimenos alkis at cs.uiuc.edu
Sat Mar 19 05:22:43 PST 2005



Changes in directory llvm-java/lib/Compiler:

Compiler.cpp updated: 1.234 -> 1.235
---
Log message:

We need to cast to the array type before we store the length of the
array.


---
Diffs of the changes:  (+4 -1)

 Compiler.cpp |    5 ++++-
 1 files changed, 4 insertions(+), 1 deletion(-)


Index: llvm-java/lib/Compiler/Compiler.cpp
diff -u llvm-java/lib/Compiler/Compiler.cpp:1.234 llvm-java/lib/Compiler/Compiler.cpp:1.235
--- llvm-java/lib/Compiler/Compiler.cpp:1.234	Sat Mar 19 07:14:57 2005
+++ llvm-java/lib/Compiler/Compiler.cpp	Sat Mar 19 07:22:32 2005
@@ -2290,6 +2290,9 @@
       params[3] = ConstantUInt::get(Type::UIntTy, 0); // alignment
       new CallInst(memset_, params, "", ip);
 
+      // Cast back to array type.
+      objRef = new CastInst(objRef, PointerType::get(ci.getType()), TMP, ip);
+
       // Store the size.
       Value* lengthPtr = getArrayLengthPtr(objRef);
       new StoreInst(count, lengthPtr, ip);
@@ -2299,7 +2302,7 @@
       Value* vtable = new CastInst(vi.vtable, VTableBaseRefTy, TMP, ip);
       new CallInst(setVtable_, objBase, vtable, "", ip);
 
-      return new CastInst(objRef, PointerType::get(ci.getType()), TMP, ip);
+      return objRef;
     }
 
     void do_newarray(JType type) {






More information about the llvm-commits mailing list