[truetype] Relocate the interpreter pointer.

This reduces dereferencing when calling the interpreter.

* include/freetype/internal/tttypes.h (TT_Face): Move it from here...
* src/truetype/ttinterp.h (TT_ExecContext): ... to here.
* src/truetype/ttobjs.c (tt_size_init_bytecode):  Move its initialization
* src/truetype/ttinterp.c (TT_New_Context): ... to here.
(TT_Run_Context): Updated.
This commit is contained in:
Alexei Podtelezhnikov 2025-06-07 22:15:18 -04:00
parent ecfefd8ccd
commit 68c62e193f
4 changed files with 13 additions and 21 deletions

View file

@ -1276,10 +1276,6 @@ FT_BEGIN_HEADER
*
* If varied by the `CVAR' table, non-integer values are possible.
*
* interpreter ::
* A pointer to the TrueType bytecode interpreters field is also used
* to hook the debugger in 'ttdebug'.
*
* extra ::
* Reserved for third-party font drivers.
*
@ -1521,10 +1517,6 @@ FT_BEGIN_HEADER
FT_ULong cvt_size;
FT_Int32* cvt;
/* A pointer to the bytecode interpreter to use. This is also */
/* used to hook the debugger for the `ttdebug' utility. */
TT_Interpreter interpreter;
/************************************************************************
*

View file

@ -409,7 +409,7 @@
exec->instruction_trap = FALSE;
return exec->face->interpreter( exec );
return exec->interpreter( exec );
}
@ -421,7 +421,8 @@
FT_Memory memory;
FT_Error error;
TT_ExecContext exec = NULL;
TT_ExecContext exec = NULL;
FT_DebugHook_Func interp;
if ( !driver )
@ -433,6 +434,15 @@
if ( FT_NEW( exec ) )
goto Fail;
/* set `exec->interpreter' according to the debug hook present, */
/* which is used by 'ttdebug'. */
interp = driver->root.root.library->debug_hooks[FT_DEBUG_HOOK_TRUETYPE];
if ( interp )
exec->interpreter = (TT_Interpreter)interp;
else
exec->interpreter = (TT_Interpreter)TT_RunIns;
/* create callStack here, other allocations delayed */
exec->memory = memory;
exec->callSize = 32;

View file

@ -111,6 +111,7 @@ FT_BEGIN_HEADER
TT_Face face; /* ! */
TT_Size size; /* ! */
FT_Memory memory;
TT_Interpreter interpreter;
/* instructions state */

View file

@ -1143,17 +1143,6 @@
size->GS = tt_default_graphics_state;
/* set `face->interpreter' according to the debug hook present */
{
FT_Library library = face->root.driver->root.library;
face->interpreter = (TT_Interpreter)
library->debug_hooks[FT_DEBUG_HOOK_TRUETYPE];
if ( !face->interpreter )
face->interpreter = (TT_Interpreter)TT_RunIns;
}
/* Fine, now run the font program! */
/* In case of an error while executing `fpgm', we intentionally don't */