aboutsummaryrefslogtreecommitdiff
path: root/lib/Bytecode/Reader
diff options
context:
space:
mode:
Diffstat (limited to 'lib/Bytecode/Reader')
-rw-r--r--lib/Bytecode/Reader/ConstantReader.cpp3
-rw-r--r--lib/Bytecode/Reader/Reader.cpp13
-rw-r--r--lib/Bytecode/Reader/ReaderInternals.h2
3 files changed, 12 insertions, 6 deletions
diff --git a/lib/Bytecode/Reader/ConstantReader.cpp b/lib/Bytecode/Reader/ConstantReader.cpp
index ec39a9f64c..405745d14a 100644
--- a/lib/Bytecode/Reader/ConstantReader.cpp
+++ b/lib/Bytecode/Reader/ConstantReader.cpp
@@ -306,7 +306,8 @@ bool BytecodeParser::parseConstPoolValue(const uchar *&Buf,
BCR_TRACE(5, "Creating new forward ref variable!\n");
// Create a placeholder for the global variable reference...
- GlobalVariable *GVar = new GlobalVariable(PT->getValueType(), false);
+ GlobalVariable *GVar =
+ new GlobalVariable(PT->getValueType(), false, true);
// Keep track of the fact that we have a forward ref to recycle it
GlobalRefs.insert(make_pair(make_pair(PT, Slot), GVar));
diff --git a/lib/Bytecode/Reader/Reader.cpp b/lib/Bytecode/Reader/Reader.cpp
index a076bffb3a..7f02b9339f 100644
--- a/lib/Bytecode/Reader/Reader.cpp
+++ b/lib/Bytecode/Reader/Reader.cpp
@@ -265,9 +265,12 @@ bool BytecodeParser::ParseMethod(const uchar *&Buf, const uchar *EndBuf,
const MethodType *MTy = dyn_cast<const MethodType>(PMTy->getValueType());
if (MTy == 0) return failure(true); // Not ptr to method!
+ unsigned isInternal;
+ if (read_vbr(Buf, EndBuf, isInternal)) return failure(true);
+
unsigned MethSlot = MethodSignatureList.front().second;
MethodSignatureList.pop_front();
- Method *M = new Method(MTy);
+ Method *M = new Method(MTy, isInternal != 0);
BCR_TRACE(2, "METHOD TYPE: " << MTy << endl);
@@ -380,8 +383,9 @@ bool BytecodeParser::ParseModuleGlobalInfo(const uchar *&Buf, const uchar *End,
unsigned VarType;
if (read_vbr(Buf, End, VarType)) return failure(true);
while (VarType != Type::VoidTyID) { // List is terminated by Void
- // VarType Fields: bit0 = isConstant, bit1 = hasInitializer, bit2+ = slot#
- const Type *Ty = getType(VarType >> 2);
+ // VarType Fields: bit0 = isConstant, bit1 = hasInitializer,
+ // bit2 = isInternal, bit3+ = slot#
+ const Type *Ty = getType(VarType >> 3);
if (!Ty || !Ty->isPointerType()) {
Error = "Global not pointer type! Ty = " + Ty->getDescription();
return failure(true);
@@ -404,7 +408,8 @@ bool BytecodeParser::ParseModuleGlobalInfo(const uchar *&Buf, const uchar *End,
}
// Create the global variable...
- GlobalVariable *GV = new GlobalVariable(ElTy, VarType & 1, Initializer);
+ GlobalVariable *GV = new GlobalVariable(ElTy, VarType & 1, VarType & 4,
+ Initializer);
int DestSlot = insertValue(GV, ModuleValues);
if (DestSlot == -1) return failure(true);
diff --git a/lib/Bytecode/Reader/ReaderInternals.h b/lib/Bytecode/Reader/ReaderInternals.h
index 50eed19393..fb34169d79 100644
--- a/lib/Bytecode/Reader/ReaderInternals.h
+++ b/lib/Bytecode/Reader/ReaderInternals.h
@@ -149,7 +149,7 @@ struct BBPlaceHolderHelper : public BasicBlock {
struct MethPlaceHolderHelper : public Method {
MethPlaceHolderHelper(const Type *Ty)
- : Method(cast<const MethodType>(Ty)) {
+ : Method(cast<const MethodType>(Ty), true) {
}
};