Compiler Cache for Indirect Call Redundancy
Find Innovative SolutionsGenerate Solutions
Solution Overview
Problem
Existing programming environments face performance and security challenges due to the high number of indirect calls, which can lead to redundant security checks and increased processor load, especially in languages that support function pointers like JavaScript and C++.
Innovation Solution
The implementation of a compiler-managed cache system that assigns ordinals to indirect call sites and uses hardcoded offsets to compare target addresses against cache entries, reducing redundant security checks and optimizing execution by avoiding unnecessary checks.
Engineering Contradictions & Design Principles
Engineering Contradiction Analysis
1Reliability
If security checks are performed on every indirect call target, then system security is maintained, but execution time and processor load increase
Solution Approach 1:
The compiler performs preliminary security validation of indirect call targets during the compilation phase. Validated targets are cached with their security verification results, allowing the runtime system to skip redundant security checks for cached targets while maintaining security for non-cached targets.
Solution Approach 2:
The system applies different security check strategies based on the specific call site context. Cached indirect call sites with validated targets use optimized paths that skip security checks, while non-cached sites undergo full security verification. This creates locally optimized security checks tailored to each call site's validation status.
2Reliability
If security checks are performed on every indirect call target, then system security is maintained, but processor load increases
Solution Approach 1:
Security validation is performed in advance during compilation rather than at runtime for every call. The compiler validates targets and caches the results, shifting the computational burden from runtime processor execution to compile-time processing, thereby reducing runtime processor load.
Solution Approach 2:
The system creates cached copies of validated target information including security verification results. Instead of re-executing security checks, the system retrieves and uses cached copies of validation data, reducing processor load during runtime execution.
3Productivity
If redundant security checks are eliminated through caching, then execution performance improves, but cache management complexity increases
Solution Approach 1:
The compiler-managed cache serves multiple functions: it stores indirect call target addresses, tracks validation status, and manages optimization opportunities. This multi-functional approach consolidates cache management responsibilities within the compiler, reducing runtime complexity while maintaining execution performance benefits.
Solution Approach 2:
The compiler automatically manages the cache of validated indirect call targets without requiring explicit runtime intervention. The system self-services by identifying optimization opportunities, validating targets, and maintaining the cache structure, thereby simplifying the overall system complexity while improving execution performance.
Data Source
AI summary
A compiler-created cache contains target addresses of multiple indirect routine call sites. Ordinals assigned to indirect routine call sites are used with hardcoded offsets into the cache. Ordinals may be computed using a routine counter and an indirect call site counter. At runtime a target address of an indirect routine call site is compared to an entry in the cache using the hardcoded offset for efficiency. If the target address matches the cache entry, then a redundant call is avoided; otherwise, the call is not redundant, and the cache is updated. The call tested for redundancy may be a security check for malware, or a computationally expensive routine which calculates a return value without any side effects. Stack pointer validity may be checked. The cache may be guarded with code for trustworthy computing. Tail merging may be performed.

