mirror of
https://github.com/c64scene-ar/llvm-6502.git
synced 2024-10-16 12:24:44 +00:00
Encode the Caml frametable by following what the comment says: the number of descriptors
is first emitted, and StackOffsets are emitted in 16 bits. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@104488 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
parent
4139630212
commit
3816c25fdc
@ -104,6 +104,21 @@ void OcamlGCMetadataPrinter::finishAssembly(AsmPrinter &AP) {
|
|||||||
AP.OutStreamer.SwitchSection(AP.getObjFileLowering().getDataSection());
|
AP.OutStreamer.SwitchSection(AP.getObjFileLowering().getDataSection());
|
||||||
EmitCamlGlobal(getModule(), AP, "frametable");
|
EmitCamlGlobal(getModule(), AP, "frametable");
|
||||||
|
|
||||||
|
int NumDescriptors = 0;
|
||||||
|
for (iterator I = begin(), IE = end(); I != IE; ++I) {
|
||||||
|
GCFunctionInfo &FI = **I;
|
||||||
|
for (GCFunctionInfo::iterator J = FI.begin(), JE = FI.end(); J != JE; ++J) {
|
||||||
|
NumDescriptors++;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (NumDescriptors >= 1<<16) {
|
||||||
|
// Very rude!
|
||||||
|
report_fatal_error(" Too much descriptor for ocaml GC");
|
||||||
|
}
|
||||||
|
AP.EmitInt16(NumDescriptors);
|
||||||
|
AP.EmitAlignment(IntPtrSize == 4 ? 2 : 3);
|
||||||
|
|
||||||
for (iterator I = begin(), IE = end(); I != IE; ++I) {
|
for (iterator I = begin(), IE = end(); I != IE; ++I) {
|
||||||
GCFunctionInfo &FI = **I;
|
GCFunctionInfo &FI = **I;
|
||||||
|
|
||||||
@ -135,11 +150,13 @@ void OcamlGCMetadataPrinter::finishAssembly(AsmPrinter &AP) {
|
|||||||
|
|
||||||
for (GCFunctionInfo::live_iterator K = FI.live_begin(J),
|
for (GCFunctionInfo::live_iterator K = FI.live_begin(J),
|
||||||
KE = FI.live_end(J); K != KE; ++K) {
|
KE = FI.live_end(J); K != KE; ++K) {
|
||||||
assert(K->StackOffset < 1<<16 &&
|
if (K->StackOffset >= 1<<16) {
|
||||||
"GC root stack offset is outside of fixed stack frame and out "
|
// Very rude!
|
||||||
"of range for ocaml GC!");
|
report_fatal_error(
|
||||||
|
"GC root stack offset is outside of fixed stack frame and out "
|
||||||
AP.EmitInt32(K->StackOffset);
|
"of range for ocaml GC!");
|
||||||
|
}
|
||||||
|
AP.EmitInt16(K->StackOffset);
|
||||||
}
|
}
|
||||||
|
|
||||||
AP.EmitAlignment(IntPtrSize == 4 ? 2 : 3);
|
AP.EmitAlignment(IntPtrSize == 4 ? 2 : 3);
|
||||||
|
Loading…
Reference in New Issue
Block a user