mirror of
https://github.com/cc65/cc65.git
synced 2025-01-16 13:31:16 +00:00
Fixed Issue #1028 by outputing local literals when exiting the function scope.
This commit is contained in:
parent
68f53e69f1
commit
07a5324a81
@ -453,7 +453,7 @@ void FinishCompile (void)
|
|||||||
}
|
}
|
||||||
|
|
||||||
/* Output the literal pool */
|
/* Output the literal pool */
|
||||||
OutputLiteralPool ();
|
OutputGlobalLiteralPool ();
|
||||||
|
|
||||||
/* Emit debug infos if enabled */
|
/* Emit debug infos if enabled */
|
||||||
EmitDebugInfo ();
|
EmitDebugInfo ();
|
||||||
|
@ -582,6 +582,11 @@ void NewFunc (SymEntry* Func)
|
|||||||
/* Restore the old literal pool, remembering the one for the function */
|
/* Restore the old literal pool, remembering the one for the function */
|
||||||
Func->V.F.LitPool = PopLiteralPool ();
|
Func->V.F.LitPool = PopLiteralPool ();
|
||||||
|
|
||||||
|
/* If --local-strings was given, output the literals now */
|
||||||
|
if (IS_Get (&LocalStrings)) {
|
||||||
|
OutputLocalLiteralPool (Func->V.F.LitPool);
|
||||||
|
}
|
||||||
|
|
||||||
/* Switch back to the old segments */
|
/* Switch back to the old segments */
|
||||||
PopSegments ();
|
PopSegments ();
|
||||||
|
|
||||||
|
@ -147,18 +147,6 @@ Literal* UseLiteral (Literal* L)
|
|||||||
/* Increase the reference count */
|
/* Increase the reference count */
|
||||||
++L->RefCount;
|
++L->RefCount;
|
||||||
|
|
||||||
/* If --local-strings was given, immediately output the literal */
|
|
||||||
if (IS_Get (&LocalStrings)) {
|
|
||||||
/* Switch to the proper data segment */
|
|
||||||
if (IS_Get (&WritableStrings)) {
|
|
||||||
g_usedata ();
|
|
||||||
} else {
|
|
||||||
g_userodata ();
|
|
||||||
}
|
|
||||||
/* Output the literal */
|
|
||||||
OutputLiteral (L);
|
|
||||||
}
|
|
||||||
|
|
||||||
/* Return the literal */
|
/* Return the literal */
|
||||||
return L;
|
return L;
|
||||||
}
|
}
|
||||||
@ -454,12 +442,20 @@ static void OutputReadOnlyLiterals (Collection* Literals)
|
|||||||
|
|
||||||
|
|
||||||
|
|
||||||
void OutputLiteralPool (void)
|
void OutputLocalLiteralPool (LiteralPool* Pool)
|
||||||
/* Output the global literal pool */
|
/* Output the local literal pool */
|
||||||
{
|
{
|
||||||
/* Output both sorts of literals */
|
/* Output both sorts of literals */
|
||||||
OutputWritableLiterals (&GlobalPool->WritableLiterals);
|
OutputWritableLiterals (&Pool->WritableLiterals);
|
||||||
OutputReadOnlyLiterals (&GlobalPool->ReadOnlyLiterals);
|
OutputReadOnlyLiterals (&Pool->ReadOnlyLiterals);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
void OutputGlobalLiteralPool (void)
|
||||||
|
/* Output the global literal pool */
|
||||||
|
{
|
||||||
|
OutputLocalLiteralPool (GlobalPool);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -113,8 +113,11 @@ void MoveLiteralPool (LiteralPool* LocalPool);
|
|||||||
** function will free LocalPool after moving the used string literals.
|
** function will free LocalPool after moving the used string literals.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
void OutputLiteralPool (void);
|
void OutputLocalLiteralPool (LiteralPool* Pool);
|
||||||
/* Output the literal pool */
|
/* Output the local literal pool */
|
||||||
|
|
||||||
|
void OutputGlobalLiteralPool (void);
|
||||||
|
/* Output the global literal pool */
|
||||||
|
|
||||||
Literal* AddLiteral (const char* S);
|
Literal* AddLiteral (const char* S);
|
||||||
/* Add a literal string to the literal pool. Return the literal. */
|
/* Add a literal string to the literal pool. Return the literal. */
|
||||||
|
Loading…
x
Reference in New Issue
Block a user