[vmkit-commits] [vmkit] r149837 - in /vmkit/trunk/lib: j3/Compiler/JavaAOTCompiler.cpp vmkit/StaticGCPrinter/VmkitGCPrinter.cpp
Will Dietz
wdietz2 at illinois.edu
Sun Feb 5 08:58:39 PST 2012
Author: wdietz2
Date: Sun Feb 5 10:58:39 2012
New Revision: 149837
URL: http://llvm.org/viewvc/llvm-project?rev=149837&view=rev
Log:
Fix VmkitGCPrinter to expect UTF8 as CDA's, create UTF8 as CDA's explicitly.
ConstantArray::get was creating a CDA for us behind the scenes, now making the
construction explicit since it's tied directly to how we interpret the
results back into a UTF8.
Modified:
vmkit/trunk/lib/j3/Compiler/JavaAOTCompiler.cpp
vmkit/trunk/lib/vmkit/StaticGCPrinter/VmkitGCPrinter.cpp
Modified: vmkit/trunk/lib/j3/Compiler/JavaAOTCompiler.cpp
URL: http://llvm.org/viewvc/llvm-project/vmkit/trunk/lib/j3/Compiler/JavaAOTCompiler.cpp?rev=149837&r1=149836&r2=149837&view=diff
==============================================================================
--- vmkit/trunk/lib/j3/Compiler/JavaAOTCompiler.cpp (original)
+++ vmkit/trunk/lib/j3/Compiler/JavaAOTCompiler.cpp Sun Feb 5 10:58:39 2012
@@ -1483,17 +1483,13 @@
StructType* STy = StructType::get(getLLVMModule()->getContext(),
Elemts);
-
+
std::vector<Constant*> Cts;
Cts.push_back(ConstantInt::get(JavaIntrinsics.pointerSizeType, val->size));
-
- std::vector<Constant*> Vals;
- for (sint32 i = 0; i < val->size; ++i) {
- Vals.push_back(ConstantInt::get(Type::getInt16Ty(getLLVMContext()), val->elements[i]));
- }
- Cts.push_back(ConstantArray::get(ATy, Vals));
-
+ ArrayRef<uint16_t> Vals(val->elements, val->size);
+ Cts.push_back(ConstantDataArray::get(getLLVMContext(), Vals));
+
return ConstantStruct::get(STy, Cts);
}
Modified: vmkit/trunk/lib/vmkit/StaticGCPrinter/VmkitGCPrinter.cpp
URL: http://llvm.org/viewvc/llvm-project/vmkit/trunk/lib/vmkit/StaticGCPrinter/VmkitGCPrinter.cpp?rev=149837&r1=149836&r2=149837&view=diff
==============================================================================
--- vmkit/trunk/lib/vmkit/StaticGCPrinter/VmkitGCPrinter.cpp (original)
+++ vmkit/trunk/lib/vmkit/StaticGCPrinter/VmkitGCPrinter.cpp Sun Feb 5 10:58:39 2012
@@ -153,13 +153,14 @@
}
static bool methodNameMatches(StringRef compiledName,
- Constant* name,
- Constant* type) {
+ ConstantDataArray* name,
+ ConstantDataArray* type) {
uint32_t size = compiledName.size();
std::string str;
- for (uint32_t i = 0; i < name->getNumOperands(); ++i) {
- int16_t cur = cast<ConstantInt>(name->getOperand(i))->getZExtValue();
+ for (uint32_t i = 0; i < name->getNumElements(); ++i) {
+ ConstantInt* charInt = cast<ConstantInt>(name->getElementAsConstant(i));
+ int16_t cur = charInt->getZExtValue();
if (cur == '/') {
str += '_';
} else if (cur == '_') {
@@ -173,8 +174,9 @@
}
}
- for (uint32_t i = 0; i < type->getNumOperands(); ++i) {
- int16_t cur = cast<ConstantInt>(type->getOperand(i))->getZExtValue();
+ for (uint32_t i = 0; i < type->getNumElements(); ++i) {
+ ConstantInt* charInt = cast<ConstantInt>(type->getElementAsConstant(i));
+ int16_t cur = charInt->getZExtValue();
if (cur == '(') {
str += "__";
} else if (cur == '/') {
@@ -247,15 +249,15 @@
for (uint32_t index = 0; index < MethodsArray->getNumOperands(); index++) {
Constant* method = cast<Constant>(MethodsArray->getOperand(index));
- Constant* name = cast<ConstantExpr>(method->getOperand(5));
- name = cast<Constant>(name->getOperand(0));
- name = cast<Constant>(name->getOperand(0));
- name = cast<Constant>(name->getOperand(1));
-
- Constant* type = cast<ConstantExpr>(method->getOperand(6));
- type = cast<Constant>(type->getOperand(0));
- type = cast<Constant>(type->getOperand(0));
- type = cast<Constant>(type->getOperand(1));
+ Constant* namePtr = cast<ConstantExpr>(method->getOperand(5));
+ namePtr = cast<Constant>(namePtr->getOperand(0));
+ namePtr = cast<Constant>(namePtr->getOperand(0));
+ ConstantDataArray* name = cast<ConstantDataArray>(namePtr->getOperand(1));
+
+ Constant* typePtr = cast<ConstantExpr>(method->getOperand(6));
+ typePtr = cast<Constant>(typePtr->getOperand(0));
+ typePtr = cast<Constant>(typePtr->getOperand(0));
+ ConstantDataArray* type = cast<ConstantDataArray>(typePtr->getOperand(1));
if (methodNameMatches(methodName, name, type)) {
Constant* GEPs[2] = { ConstantInt::get(Type::getInt32Ty(context), 0),
More information about the vmkit-commits
mailing list