To protect your data, the CISO officer has suggested users to enable GitLab 2FA as soon as possible.

Commit 1d03dfae authored by Kunshan Wang's avatar Kunshan Wang
Browse files

Fixed association between functions and expFuncs.

parent 7ba974c9
...@@ -73,7 +73,19 @@ class Bundle { ...@@ -73,7 +73,19 @@ class Bundle {
val id = cand.id val id = cand.id
oldNs.get(id) match { oldNs.get(id) match {
case None => oldNs.add(cand) case None => oldNs.add(cand)
case Some(oldObj) => oldObj.versions = cand.versions.head :: oldObj.versions case Some(oldObj) =>
oldObj.versions = cand.versions.head :: oldObj.versions
cand.versions.head.func = oldObj
}
}
}
private def fixExpFuncs(oldNs: Namespace[Function], newNs: Namespace[ExposedFunc]) {
for (expFunc <- newNs.all) {
val funcID = expFunc.func.id
oldNs.get(funcID) match {
case None =>
case Some(oldFunc) => expFunc.func = oldFunc
} }
} }
} }
...@@ -88,5 +100,7 @@ class Bundle { ...@@ -88,5 +100,7 @@ class Bundle {
simpleMerge(constantNs, newBundle.constantNs) simpleMerge(constantNs, newBundle.constantNs)
simpleMerge(globalCellNs, newBundle.globalCellNs) simpleMerge(globalCellNs, newBundle.globalCellNs)
mergeFunc(funcNs, newBundle.funcNs) mergeFunc(funcNs, newBundle.funcNs)
simpleMerge(expFuncNs, newBundle.expFuncNs)
fixExpFuncs(funcNs, newBundle.expFuncNs)
} }
} }
...@@ -80,6 +80,12 @@ case class BoxTagRef64(var raw: Long) extends HasObjRef { ...@@ -80,6 +80,12 @@ case class BoxTagRef64(var raw: Long) extends HasObjRef {
raw = OpHelper.refToTr64(newObjRef, oldTag) raw = OpHelper.refToTr64(newObjRef, oldTag)
} }
} }
case class BoxPointer(var addr: Word) extends ValueBox {
def copyFrom(other: ValueBox): Unit = {
val that = other.asInstanceOf[BoxPointer]
this.addr = that.addr
}
}
object ValueBox { object ValueBox {
...@@ -99,6 +105,8 @@ object ValueBox { ...@@ -99,6 +105,8 @@ object ValueBox {
case _: TypeStack => BoxStack(None) case _: TypeStack => BoxStack(None)
case _: TypeThread => BoxThread(None) case _: TypeThread => BoxThread(None)
case _: TypeTagRef64 => BoxTagRef64(0L) case _: TypeTagRef64 => BoxTagRef64(0L)
case _: TypePtr => BoxPointer(0L)
case _: TypeFuncPtr => BoxPointer(0L)
} }
} }
\ No newline at end of file
...@@ -1183,9 +1183,26 @@ trait TestingBundlesValidators extends Matchers with ExtraMatchers { ...@@ -1183,9 +1183,26 @@ trait TestingBundlesValidators extends Matchers with ExtraMatchers {
(ourGlobal func "@foxsay").versions.head shouldBe (ourNew funcVer "@foxsay_v1") (ourGlobal func "@foxsay").versions.head shouldBe (ourNew funcVer "@foxsay_v1")
(ourGlobal func "@meaning_of_life").versions.head shouldBe (ourNew funcVer "@meaning_of_life_v2") (ourGlobal func "@meaning_of_life").versions.head shouldBe (ourNew funcVer "@meaning_of_life_v2")
(ourGlobal funcVer "@meaning_of_life_v1").func shouldBe (ourGlobal func "@meaning_of_life")
(ourGlobal funcVer "@meaning_of_life_v2").func shouldBe (ourGlobal func "@meaning_of_life")
val foxSay = ourGlobal func "@foxsay" val foxSay = ourGlobal func "@foxsay"
ourGlobal value "@foxsay" shouldBe foxSay ourGlobal value "@foxsay" shouldBe foxSay
ourGlobal globalValue "@foxsay" shouldBe foxSay ourGlobal globalValue "@foxsay" shouldBe foxSay
{
val its = ourGlobal expFunc "@meaning_external1"
its.func shouldBe (ourGlobal func "@meaning_of_life")
its.callConv shouldBe Flag("#DEFAULT")
its.cookie shouldBe (ourGlobal const "@I64_42")
}
{
val its = ourGlobal expFunc "@meaning_external2"
its.func shouldBe (ourGlobal func "@meaning_of_life")
its.callConv shouldBe Flag("#DEFAULT")
its.cookie shouldBe (ourGlobal const "@I64_43")
}
} }
} }
\ No newline at end of file
...@@ -9,3 +9,5 @@ ...@@ -9,3 +9,5 @@
} }
.funcdecl @foxsay <@IntReturner> .funcdecl @foxsay <@IntReturner>
.expose @meaning_external1 = @meaning_of_life #DEFAULT @I64_42
...@@ -9,3 +9,5 @@ ...@@ -9,3 +9,5 @@
%entry: %entry:
%ret = RET <@i64> @I64_43 %ret = RET <@i64> @I64_43
} }
.expose @meaning_external2 = @meaning_of_life #DEFAULT @I64_43
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment