On-demand loading of dynamic scripting language code for reduced memory usage
Abstract
A computer-implemented method and system for reducing the amount of memory space required to store applications written in dynamic scripting languages loads a program module into memory and removes a category of program code, such as debug information or function definitions, from the program module. The method and system also receives a request for debug information, or a function call or query, and determines whether or not the corresponding program code is in memory. If not, then the location in storage is identified where the program module is stored, and another copy containing the corresponding program code is loaded into memory. The corresponding program code is located and copied into the program module in memory, and a response is provided to the request.
Claims
exact text as granted — not AI-modifiedWhat is claimed is:
1 . A method for on-demand loading of code, the method comprising:
storing, in a first memory, an initially compiled bytecode of a dynamic scripting language program and storing, in a second memory, a redacted source code placeholder in place of a function portion of a function of the dynamic scripting language program, the redacted source code placeholder identifying a location of the function portion in the second memory; creating, by at least one processor, a tree structure comprising a plurality of nodes, each node of the plurality of nodes including compiled bytecode for a corresponding function of the dynamic scripting language program; receiving, by the at least one processor, a call or query request for the function corresponding to the function portion, and in response to the call or query request:
determining the function portion is not in in the first memory;
searching the tree structure using the location to obtain the function portion compiled bytecode corresponding to the function portion; and
storing the obtained compiled function portion bytecode in the first memory.
2 . The method of claim 1 , wherein the compiled bytecode is executed within a virtual machine.
3 . The method of claim 1 , wherein the location comprises a source file name.
4 . The method of claim 1 , wherein the location comprises a beginning line number.
5 . The method of claim 1 , wherein the location comprises an ending line number.
6 . The method of claim 1 , wherein the location comprises a column number.
7 . The method of claim 1 , wherein the redacted source code placeholder points to the redacted function portion in the source code.
8 . The method of claim 1 , wherein the redacted source code placeholder points to the redacted function portion in the source code in the second memory.
9 . A device comprising:
a memory storing instructions; and at least one processor in communication with the memory, the at least one processor configured, upon execution of the instructions, to perform the following steps:
store, in a first memory, an initially compiled bytecode of a dynamic scripting language program and store, in a second memory, a redacted source code placeholder in place of a function portion of a function of the dynamic scripting language program, the redacted source code placeholder identifying a location of the function portion in the second memory;
create a tree structure comprising a plurality of nodes, each node of the plurality of nodes including compiled bytecode for a corresponding function of the dynamic scripting language program;
receive a call or query request for the function corresponding to the function portion, and in response to the call or query request:
determine the function portion is not in the first memory;
search the tree structure using the location to obtain the function portion compiled bytecode corresponding to the function portion; and
store the obtained compiled function portion bytecode in the first memory.
10 . The device of claim 9 , wherein the compiled bytecode is executed within a virtual machine.
11 . The device of claim 9 , wherein the location comprises a source file name.
12 . The device of claim 9 , wherein the location comprises a beginning line number.
13 . The device of claim 9 , wherein the location comprises an ending line number.
14 . The device of claim 9 , wherein the location comprises a column number.
15 . The device of claim 9 , wherein the device comprises an on-demand loader.
16 . The device of claim 9 , wherein the redacted source code placeholder points to the redacted function portion in the source code.
17 . The device of claim 9 , wherein the redacted source code placeholder points to the redacted function portion in the source code in the second memory.
18 . A non-transitory computer-readable media storing computer instructions for on-demand loading of code that configure at least one processor, upon execution of the instructions, to perform the following steps:
storing, in a first memory, an initially compiled bytecode of a dynamic scripting language program and storing, in a second memory, a redacted source code placeholder in place of a function portion of a function of the dynamic scripting language program, the redacted source code placeholder identifying a location of the function portion in the second memory; creating a tree structure comprising a plurality of nodes, each node of the plurality of nodes including compiled bytecode for a corresponding function of the dynamic scripting language program; receiving a call or query request for the function corresponding to the function portion, and in response to the call or query request:
determining the function portion is not in the first memory;
searching the tree structure using the location to obtain the function portion compiled bytecode corresponding to the function portion; and
storing the obtained compiled function portion bytecode in the first memory.
19 . The computer-readable media of claim 18 , wherein the redacted source code placeholder points to the redacted function portion in the source code.
20 . The computer-readable media of claim 18 , wherein the redacted source code placeholder points to the redacted function portion in the source code in the second memory.Join the waitlist — get patent alerts
Track US2023117105A1 — get alerts on status changes and closely related new filings.
We store only your email — no account needed. See our privacy policy.