Devices and methods for application streaming
By restructuring the bytecode module into a format with a header and incremental function entities, the method improves time-to-execution in bytecode streaming by enabling functions to be executed as their data is received, rather than waiting for the entire module to be transferred.
Patent Information
- Application Number
- PCT/SE2023/051287
- Authority / Receiving Office
- WO · WO
- Patent Type
- Applications
- Current Assignee / Owner
- Filing Date
- 2023-12-20
- Publication Date
- 2025-06-26
AI Technical Summary
Current bytecode streaming methods require the entire bytecode module to be transferred before any function can be executed, leading to inefficiencies in time-to-execution, especially as module size increases.
The method involves obtaining a first bytecode module and determining a second bytecode module with a header containing memory information and a list of exported functions, along with corresponding entities for each function's data and function body, allowing for incremental execution as each function's entity is received.
This approach reduces time-to-execution by allowing functions and their data to be packaged and executed incrementally, rather than requiring the entire module to be downloaded and processed first.
Smart Images

Figure SE2023051287_26062025_PF_FP_ABST
Abstract
Description
[0001] DEVICES AND METHODS FOR APPLICATION STREAMING
[0002] TECHNICAL FIELD
[0003] The invention relates to a method for application streaming performed by a first communications device, a method for application streaming performed by a second communications device, a first communications device for application streaming, a second communications device for application streaming, and corresponding computer programs, computer program products, and data carrier signals.
[0004] BACKGROUND
[0005] Bytecode or portable (byte)code is a form of instruction set designed for efficient execution by a software interpreter. Portable bytecode may be used to implement applications or functions deployed on a network. An application or function may be compiled once to bytecode format and deployed across a range of architectures and operating systems without recompilation. This makes it ideal for use in web browsers where a comprehensive compilation toolchain from source code is not available and it is impractical for a web host to provide an executable for every potential architecture. For the portable bytecode to run on a target machine (a virtual machine or a p-code machine, i.e., the interpreter), the bytecode portable must either be interpreted instruction by instruction, or first be converted into native executable code by a runtime process.
[0006] A portable bytecode is packaged as a binary module containing a number of entities, wherein each entity has a different purpose and is packaged in a specific order. Web Assembly (Wasm) is an example of light weight and high performance bytecode format. The entities in a Wasm bytecode format are called sections. Figure 1 shows the structure of a bytecode format for a Wasm bytecode: function definitions are included in section 3, the body of each function in section 10, and the data that the functions operate on in section 11. Further information on Wasm bytecode format may be found in https: / / webassembly.github.io / spec / core / binary / index.html [retrieved on 2023.12.19],
[0007] SUMMARY An object of the invention is to improve time-to-execution of streaming bytecode of an application. This and other objects of the invention are achieved by means of different aspects of the invention, as defined by the independent claims. Embodiments of the invention are characterized by the dependent claims.
[0008] According to a first aspect of the invention, a method for application streaming is provided. An application comprises one or more functions. One or more of the one or more functions are exported functions. The method is performed by a first communications device. The method comprises obtaining a first bytecode module comprising a first entity comprising information on the one or more functions, a second entity comprising information on memory associated with the one or more functions, a third entity comprising data associated with the one or more functions, a fourth entity comprising information on function body of the one or more functions. The method comprises determining a second bytecode module based on the first bytecode module. The second bytecode module comprises a header comprising information on the memory associated with the one or more functions and a list of the one or more exported functions; and for each of the one or more functions, a corresponding fifth entity comprising information on the data associated with the function and the function body of the function. The method comprises transmitting the second bytecode module to a second communications device for application streaming.
[0009] According to a second aspect of the invention, a method for application streaming is provided. An application comprises one or more functions. One or more of the one or more functions are exported functions. The method is performed by a second communications device. The method comprises receiving a header of a second bytecode module, wherein the header comprises information on memory associated with the one or more functions and a list of the one or more exported functions. The method comprises allocating a first memory associated with each of the one or more functions based on the information in the header. The method comprises allocating a second memory for a tag of each exported function in the list. The method comprises receiving one or more fifth entities of the second bytecode module, wherein each of the one or more fifth entities comprises information on the data associated with the corresponding function and function body of the corresponding function. The method comprises compiling each of the one or more fifth entities after receiving each fifth entity. The method comprises setting the tag of the corresponding exported function as executable after compiling the corresponding fifth entity. According to a third aspect, a first communications device for application streaming is provided. An application comprises one or more functions. One or more of the one or more functions are exported functions. The first communications device comprises a processor and a memory, the memory having stored thereon instructions executable by the processor, wherein the instructions, when executed by the processor, cause the first communications device to obtain a first bytecode module comprising a first entity comprising information on the one or more functions, a second entity comprising information on memory associated with the one or more functions, a third entity comprising data associated with the one or more functions operate on, a fourth entity comprising information on function body of the one or more functions. The instructions, when executed by the processor, cause the first communications device to determine a second bytecode module based on the first bytecode module, wherein the second bytecode module comprises a header comprising information on the memory associated with the one or more functions and a list of the one or more exported functions; and for each of the one or more functions, a corresponding fifth entity comprising information on the data associated with the function and the function body of the function. The instructions, when executed by the processor, cause the first communications device to transmit the second bytecode module to a second communications device for application streaming.
[0010] According to a fourth aspect, a second communications device for application streaming is provided. An application comprises one or more functions. One or more of the one or more functions are exported functions. The second communications device comprising a processor and a memory, the memory having stored thereon instructions executable by the processor, wherein the instructions, when executed by the processor, cause the second communications device to receive a header of a second bytecode module, wherein the header comprises information on memory associated with the one or more functions and a list of the one or more exported functions. The instructions, when executed by the processor, cause the second communications device to allocate a first memory associated with each of the one or more functions based on the information in the header. The instructions, when executed by the processor, cause the second communications device to allocate a second memory for a tag of each exported function in the list. The instructions, when executed by the processor, cause the second communications device to receive one or more fifth entities of the second bytecode module, wherein each of the one or more fifth entities comprises information on the data associated with the corresponding function, and function body of the corresponding function. The instructions, when executed by the processor, cause the second communications device to compile each of the one or more fifth entities after receiving each fifth entity. The instructions, when executed by the processor, cause the second communications device to set the tag of the corresponding exported function as executable after compiling the corresponding fifth entity.
[0011] According to a fifth aspect of the invention, there is provided a computer program. The computer program comprises instructions which, when run in a processing unit on a first communications device, cause the first communications device to perform the method according to the first aspect.
[0012] According to a sixth aspect of the invention, there is provided a computer program product. Th computer program product comprises a computer readable storage medium on which the computer program according to the fifth aspect is stored.
[0013] According to a seventh aspect of the invention, there is provided a data carrier signal. The data carrier signal carries the computer program according to the fifth aspect.
[0014] According to an eighth aspect of the invention, there is provided a computer program. The computer program comprises instructions which, when run in a processing unit on a second communications device, cause the second communications device to perform the method according to the second aspect.
[0015] According to a ninth aspect of the invention, there is provided a computer program product. The computer program product comprises a computer readable storage medium on which the computer program according to the eighth aspect is stored.
[0016] According to a tenth aspect of the invention, there is provided a data carrier signal. The data carrier signal carries the computer program according to the eighth aspect.
[0017] BRIEF DESCRIPTION OF THE DRAWINGS
[0018] For better understanding of the present disclosure, and to show more readily how the invention may be carried into effect, reference will now be made, by way of example, to the following drawings, in which: Figure la shows an example of Web Assembly (Wasm) bytecode module;
[0019] Figure lb shows an example of (first) bytecode module;
[0020] Figure 2 shows a flow chart illustrating a method for streaming applications performed by a first communications device;
[0021] Figure 3 shows a flow chart illustrating a method for streaming applications performed by a first communications device when a source code or a bytecode is obtained by the first communications device;
[0022] Figure 4 shows an example of second bytecode module;
[0023] Figure 5 shows a flow chart illustrating a method for streaming applications performed by a second communications device;
[0024] Figure 6 shows an example of memory allocation for exported function and internal functions based on information in a second bytecode module;
[0025] Figure 7 is a block diagram of a first communications device in accordance with some embodiments; and
[0026] Figure 8 is a block diagram of a second communications device in accordance with some embodiments.
[0027] DETAILED DESCRIPTION
[0028] Embodiments will be illustrated herein with reference to the accompanying drawings. These embodiments are provided by way of example so that this disclosure will be thorough and complete, and will fully convey the scope of the inventive concept to those skilled in the art. "First", "second", "third", etc. are used as a manner of distinguishing between different instances of a term, they are not intended to confer a cumulative or chronological meaning to the terms. A bytecode streaming compiler requires that an entire bytecode module comprising one or more functions is transferred from streaming source to streaming destination before execution of any of the one or more functions in the bytecode module may begin. Although the compilation stage of the streaming process may begin as soon as the one or more functions have been received at the streaming destination, execution may not begin until all the relevant data associated with the corresponding function has also been received, since all the relevant data associated with the corresponding function needs to be allocated in the memory to be executed. Considering for example the structure of a bytecode module as shown in Figure lb, the bytecode module 100 comprises a first entity 102 comprising information on the one or more functions, a second entity 104 comprising information on memory associated with the one or more functions, a third entity 106 comprising data associated with the one or more functions, and a fourth entity 108 comprising information on function body of the one or more functions. In case of a WebAssembly (Wasm) bytecode module, the first entity 102 corresponds to section 3 or function section, the second entity 104 corresponds to section 5 or memory section, the third entity 106 corresponds to section 10 or code section, and the fourth entity 108 corresponds to section 11 or data section.
[0029] Since all the data for all the functions is packaged together in the third entity, a function that has been compiled to native binary format will still have to wait until the third entity has been entirely downloaded and integrated before it may be run. Therefore, the current structure of the bytecode module is suboptimal for the purposes of streaming compilation, and does not scale efficiently with increasing module size (e.g., number of functions and / or size of the entities).
[0030] The invention disclosed herein makes it possible to improve time-to-execution of application streaming by a method comprising obtaining a first bytecode module comprising a first entity comprising information on one or more functions comprised in an application, and wherein one or more of the functions are exported functions, a second entity comprising information on memory associated with the one or more functions, a third entity comprising data associated with the one or more functions, and a fourth entity comprising information on function body of the one or more functions. The method further comprises determining a second bytecode module based on the first bytecode module, wherein the second bytecode module comprises a header comprising information on the memory associated with the one or more functions and a list of the one or more exported functions; and, for each of the one or more functions, a corresponding fifth entity comprising information on the data associated with the function and the function body of the function. The method further comprises transmitting the second bytecode module to a second communications device for application streaming.
[0031] The invention disclosed herein enables improving the time-to-execution of streaming bytecode since a function and its associated data are packaged adjacent to each other. The bytecode module according to embodiments of the invention allows data of a function to populate (heap) memory when the data is received, rather than waiting until the entire module has been streamed.
[0032] Figures 2 and 3 show a method 200 for application streaming. The method 200 is performed by a first communications device 700. An application comprises one or more functions. One or more of the one or more functions are exported functions. One or more of the remaining functions may be non-exported (or internal) functions. Exported functions are functions that may be called / executed by external applications. Non-exported functions are functions that may only be called / executed by one or more of the remaining functions. Examples of (exported and / or internal) functions are a sum function taking as inputs two or more elements and returning the sum, and machine learning (ML) image recognition function taking a picture as input, using a ML library to identify objects in the picture, and returning information on the identified objects, such as coordinates or an attempt to categorize the object.
[0033] The method 200 comprises obtaining 201 a first bytecode module 100, 307. The first bytecode module 100, 307 comprises a first entity 102 comprising information on the one or more functions, a second entity 104 comprising information on memory associated with the one or more functions, a third entity 106 comprising data associated with the one or more functions, a fourth entity 108 comprising information on function body of the one or more functions. The first bytecode module 100, 307 may comprise further entities. An example of first bytecode module is shown in Figure lb. An entity may comprise multiple bytecode components placed contiguously in a bytecode module. The information on the memory associated with the one or more functions indicates the linear or heap memory, i.e., a continuous buffer of unsigned bytes, that needs to be allocated and then populated to execute a function after the entire first bytecode module has been received by a streaming destination, e.g., a second communications device. The information on the data associated with the one or more functions comprises code of each function. The information on the function body of the one or more functions comprises byte sequences that will be used to initialize the linear memory. The first bytecode module 100, 307 may be obtained by compiling 213, 305a a source code 301a to bytecode. The first bytecode module 100, 307 may be obtained from a database or a marketplace. The method 200 may further comprise obtaining 207 a dependency tree of the functions of the application if the application comprises two or more functions. The dependency tree may be obtained by inspecting 303a the source code before compiling the source code to (first) bytecode. Inspecting the source code would require language-dependent tools, e.g., Frama-C and Visual Studio. The dependency tree may alternatively be obtained by inspecting 303b the (first) bytecode 301b. Inspecting 303b the (first) bytecode is more complex than inspecting 301a the source code, but it is not language dependent.
[0034] The method 200 may further comprise obtaining 209 information on location of the data associated with each of the two or more functions. The location of the data associated with a function may be obtained based on information on an offset in the first bytecode module, wherein the offset indicates where the data starts and its length.
[0035] The method 200 further comprises determining 203 a second bytecode module based on the first bytecode module 100, 307. The second bytecode module has a different internal structure compared to the first bytecode module. An example of the structure of the second bytecode module 400 comprising three functions, fl, 403a, f2, 403b, and f3, 403c, is shown in Figure 4. The second bytecode module 400 comprises a header 401 and one or more fifth entities 402a- c. The header 401 comprises information on the memory associated with the one or more functions. The header 401 further comprises a list of the one or more exported functions. The list allows a streaming compiler at the second communications device receiving the second bytecode module 400 to create a tag for each exported function as soon as it receives the header 401. The tags allow a streaming destination, e.g., a second communications device, to know when a function is ready for execution / calling. Without the tag there is no way to understand if a function may be called, until the entire module is received.
[0036] For each of the one or more functions, the second bytecode module 400 comprises a corresponding fifth entity 402a-c. Each fifth entity comprises information on the data 405a-c associated with the corresponding function, and the function body 407a-c of the corresponding function. In other words, while the third entity 106 of the first bytecode module 100 comprises information on the data associated with all the functions, the fifth entity 402a-c of a function, e.g., called fl, comprises only the information on the data associated with the function fl; and while the fourth entity 108 of the first bytecode module 100 comprises information on the function body associated with all the functions, the fifth entity 402a-c of the function fl, comprises only the function body associated with the function fl. In the second bytecode module 400 of Figure 4, the fifth section 502a associated with the function fl 403a comprises information on the data 407a associated with the function fl 403a, and the function body 405a of the function fl 403a; the fifth section 402b associated with the function f2 403b comprises information on the data 407b associated with the function f2 403b, and the function body 405b of the function f2403b; the fifth section 402c associated with the function f3 403c comprises information on the data 407c associated with the function f3 403c, and the function body 405c of the function f3 403 c.
[0037] The second bytecode module 400 may be determined by collecting 309, 311 information on memory, code, and data for each function based on the first bytecode module 200 and the dependency tree, packaging 309, 313 the collected information for each function in a corresponding fifth section of the second bytecode module 400, and constructing 317 the header 401.
[0038] The method 200 further comprises transmitting 205, 317 the second bytecode module to a second communications device for application streaming.
[0039] The advantage provided by the header 401 of the second bytecode module 400 is that the second communications device may reserve and allocate the memory for all the functions as soon as the header 401 has been received, and therefore the memory is ready to be populated as soon as a fifth entity associated with a function starts to be received. The structure of the second bytecode module 400 based on the fifth entities 402a-c allows to package all the necessary components of a function together so that when the second communications device starts receiving the second bytecode module 400, it does not need to receive the entire bytecode module to execute the functions, but each function is ready to be executed after the corresponding fifth entity is received, whilst the rest of the module is still being received.
[0040] The method 200 may further comprise ordering 211 the fifth entities 402a-c in the second bytecode module 400 based on the dependency tree. The fifth entities may be ordered based on their call order. This allows a reduction of time-to-execution of the application since the functions that are called earliest by an (e.g., external) application that makes use of them are located earlier in the second bytecode module so that they arrive at the streaming destination, e.g., the second communications device, first. The first bytecode module may be a Wasm bytecode module. In case of Wasm bytecode module, an entity may correspond to a section of the Wasm bytecode module. Specifically, the first entity may correspond to the function section (or section 3) 102, the second entity may correspond to the memory section (or section 5) 104, the third entity may correspond to the code section (or section 10) 106, the fourth entity may correspond to data section (or section 11) 108. The fifth entities 402a-c and the header 401 may be custom sections.
[0041] It will be appreciated that the method 200 may comprise additional, alternative, or modified steps in accordance with what is described throughout this disclosure.
[0042] Figure 5 shows a method 500 for application streaming. The method 500 is performed by a second communications device. The application comprises one or more functions. One or more of the one or more functions are exported functions. One or more of the remaining functions may be non-exported (or internal) functions. Exported functions are functions that may be called / executed by external applications. Non-exported functions are functions that may only be called / executed by one or more of the remaining functions.
[0043] The method 500 comprises receiving 501 a header 401 of a second bytecode module from the first communications device. The header 401 comprises information on memory associated with the one or more functions. The information on the memory associated with the one or more functions indicates the linear or heap memory, i.e., a continuous buffer of unsigned bytes, that needs to be allocated and then populated to execute a function in the second bytecode module. The method further comprises allocating 503 a first memory associated with each of the one or more (exported and internal) functions based on the information in the header. The advantage provided by the header is that the second communications device may reserve and allocate the (first) memory for the one or more functions as soon as the header has been received.
[0044] The header 401 further comprises a list of the one or more exported functions. The method 500 further comprises allocating 504 a second memory for a tag for each exported function in the list. The second memory may contain status metadata for each exported function in the list.
[0045] In other words, the tag for each exported function may be created as soon as the streaming compiler at the second communications device receives the second bytecode module. A tag indicates whether the corresponding exported function is ready for execution / calling. Without the tag, it is not possible to know whether a function may be called until the entire module is loaded. A tag may be a Boolean value of a certain number of bits.
[0046] The method 500 further comprises receiving 505 one or more fifth entities 402a-c of the second bytecode module 400. Each of the one or more fifth entities comprises information on the data associated with the corresponding function, and function body of the corresponding function. The information on the data associated with the function comprises code of the function. The information on the function body of the function comprises byte sequences that will be used to initialize the linear memory for the function. In other words, the third entity of the first bytecode module comprises information on the data associated with all the functions, instead the fifth entity of a function, e.g., called fl, comprises only the information on the data associated with the function fl; and the fourth entity of the first bytecode module comprises information on the function body associated with all the functions, instead the fifth entity of the function fl, comprises only the function body associated with the function fl . The second bytecode module may be a Wasm bytecode module. In case of Wasm bytecode module, the fifth sections and the header may be custom sections of the Wasm bytecode module.
[0047] The method 500 further comprises compiling 507 each of the one or more fifth entities after receiving each fifth entity. The compilation is possible because the (first) memory for the functions has already been allocated when the header has been received. The method 500 further comprises setting 509 the tag of the corresponding exported function as executable after compiling the corresponding fifth entity. The method 500 further comprises executing 511 each fifth entity if the tag of the corresponding function is set as executable.
[0048] It will be appreciated that the method 500 may comprise additional, alternative, or modified, steps in accordance with what is described throughout this disclosure.
[0049] Figure 6 shows an example of first memory space, called A, 601a, for three exported functions xfl, xf4, xf5 603 a-c, and of a second memory space, called B, 601b for internal and external functions comprising the exported functions xfl, xf4, xf5, 405a-c, and the internal functions f2, f3, f6, 405d-f. The memory space A 601a comprises a tag for each exported function xfl, xf4, xf5 603a-c indicating the status of the function. The tag in the example is a Boolean variable, wherein True indicates that the exported function is ready to be called / executed and False indicates that the exported function is not ready to be called / executed. Exported function status is made available for external query from calling applications. The memory space B comprises a memory address for each function 603a-e that is populated when the corresponding function is ready to be called.
[0050] An example scenario wherein the invention disclosed herein may be implemented is an unmanned aerial vehicle (UAV) scenario. A UAV for delivery operations may for example navigate its surroundings and avoid obstacles by running a ML image recognition function for identification and tracking of objects within captured images of the environment. The UAV, i.e., the first communications device, may have battery and resource-constraints, therefore the ML image recognition function may be compiled to a bytecode module and offloaded to another host (e.g., a compute node in an edge datacenter) with more resources, i.e., the second communications device. The UAV may need to run more than one function, and considering the low latency and speed requirements of the ML image recognition function, it may be located as first function in the second bytecode module, so that it will be executed as soon as the second communications device receives it.
[0051] Figure 7 shows a block diagram illustrating an embodiment of a first communications device 700 comprising processor circuitry 701, a computer-readable data carrier, such as the memory 702, and the network interface circuitry 703. The first communications device 700 may be a router, gateway, mobile devices, user equipment (UE), and / or constrained device, such as machine type communications (MTC) device, M2M device, loT device, sensor, and actuator, or any device with computing, storage, and network connectivity. The first communications device 700 may be implemented as a virtual network node, such as a virtual switch or a virtual proxy, that may be executed in a data center.
[0052] The processing circuitry 701 may comprise one or more processors, such as Central Processing Units (CPUs), microprocessors, application processors, application-specific processors, Graphics Processing Units (GPUs), and Digital Signal Processors (DSPs) including image processors, or a combination thereof, and the memory 702 comprises the computer program comprising instructions. When executed by the processor(s), the instructions cause the first communications device 700 to become operative in accordance with embodiments of the invention described herein, in particular with reference to Figure 2. More specifically, first communications device 700 becomes operative to obtain 201 a first bytecode module comprising a first entity comprising information on the one or more functions, a second entity comprising information on memory associated with the one or more functions, a third entity comprising data associated with the one or more functions, a fourth entity comprising information on function body of the one or more functions. The first communications device 700 is further operative to determine 203 a second bytecode module based on the first bytecode module, wherein the second bytecode module comprises
[0053] - a header comprising information on the memory associated with the one or more functions and a list of the one or more exported functions;
[0054] - for each of the one or more functions, a corresponding fifth entity comprising information on the data associated with the function and the function body of the function.
[0055] The first communications device 700 is further operative to transmit 205 the second bytecode module to a second communications device for application streaming. Each of the first bytecode module and the second bytecode module may be a Wasm module. The header and each of the fifth entities may be custom sections of the second bytecode module.
[0056] The first communications device 700 may be further operative to obtain 207 a dependency tree if the application comprises two or more functions. The first communications device 700 may be further operative to obtain 209 information on location of the data associated with each of the two or more functions.
[0057] The first communications device 700 may be further operative to determine a second bytecode module by ordering 211 the fifth entities corresponding to each of the one or more functions based on the dependency tree.
[0058] The first communications device 700 may be further operative to obtain 213 a first bytecode module by compiling a source code of the application.
[0059] The computer program 704 may be stored in a computer-readable data carrier, such as a memory 702. Alternatively, the computer program 704 may be carried by a data carrier signal, e.g., downloaded to the memory 702 via a network interface circuitry 703. The memory 702 may, e.g., be a Random-Access Memory (RAM), a Read-Only Memory (ROM), a Flash memory, or the like. The computer program 704 may be downloaded to the memory 702 by means of the network interface circuitry 703, as a data carrier signal carrying the computer program 704. The network interface circuitry 703 may comprise one or more of a cellular modem (e.g., GSM, UMTS, LTE, 5G, or higher generation), a WLAN / Wi-Fi modem, a Bluetooth modem, an Ethernet interface, an optical interface, or the like, for exchanging data between the first communications device 700 and the second communications device and other computing devices, communications devices, a radio-access network, and / or the Internet. The processing circuitry 701 may alternatively or additionally comprise one or more Application- Specific Integrated Circuits (ASICs), Field-Programmable Gate Arrays (FPGAs), or the like, which are operative to cause the first communications device 700 to become operative in accordance with embodiments of the invention described herein.
[0060] Figure 8 shows a block diagram illustrating an embodiment of a second communications device 800, comprising processor circuitry 801, a computer-readable data carrier, such as the memory 802, and the network interface circuitry 803. The second communications device 800 may be a router, gateway, mobile devices, UE, and / or constrained device, such as MTC device, M2M device, loT device, sensor, and actuator, or any device with computing, storage, and network connectivity. The second communications device 800 may be implemented as a virtual network node, such as a virtual switch or a virtual proxy, that may be executed in a data center. The first communications device 700 may communicate with the second communications device 800, through an application layer protocol such as HTTP, making use of an underlying transport layer protocol such as Transmission Control Protocol (TCP) or User Datagram Protocol (UDP).
[0061] The processing circuitry 801 may comprise one or more processors, such as CPUs, microprocessors, application processors, application-specific processors, GPUs, and DSPs including image processors, or a combination thereof, and the memory 802 comprising the computer program comprising instructions. When executed by the processor(s), the instructions cause the second communications device 800 to become operative in accordance with embodiments of the invention described herein, in particular with reference to Figure 3.
[0062] More specifically, the second communications device 800 becomes operative to receive 501 a header of a second bytecode module. The header comprises information on memory associated with the one or more functions and a list of the one or more exported functions. The second communications device 800 becomes operative to allocate 503 a first memory associated with each of the one or more functions based on the information in the header. The second communications device 800 becomes operative to allocate 504 a second memory for a tag of each exported function in the list. The second communications device 800 becomes operative to receive 505 one or more fifth entities of the second bytecode module, wherein each of the one or more fifth entities comprises information on the data associated with the corresponding function, and function body of the corresponding function. The second communications device 800 becomes operative to compile 507 each of the one or more fifth entities after receiving each fifth entity. The second communications device 800 becomes operative to set 509 the tag of the corresponding exported function as executable after compiling the corresponding fifth entity. The second communications device 800 may become further operative to execute 511 each fifth entity if the tag of the corresponding exported function is set as executable.
[0063] Each of the first bytecode module and the second bytecode module is a Wasm module. The header and each of the fifth entities are custom sections of the second bytecode module.
[0064] The computer program 804 may be stored in a computer-readable data carrier, such as a memory 802. Alternatively, the computer program 804 may be carried by a data carrier signal, e.g., downloaded to the memory 802 via a network interface circuitry 803. The memory 802 may, e.g., be a RAM, a ROM, a Flash memory, or the like. The computer program 804 may be downloaded to the memory 802 by means of the network interface circuitry 803, as a data carrier signal carrying the computer program 804. The network interface circuitry 803 may comprise one or more of a cellular modem (e.g., GSM, UMTS, LTE, 5G, or higher generation), a WLAN / Wi-Fi modem, a Bluetooth modem, an Ethernet interface, an optical interface, or the like, for exchanging data between the second communications device 800, the first communications device 700, and other computing devices, communications devices, a radioaccess network, and / or the Internet. The processing circuitry 801 may alternatively or additionally comprise one or more ASICs, FPGAs, or the like, which are operative to cause the second communications device 800 to become operative in accordance with embodiments of the invention described herein.
Claims
CLAIMS1. A method (200) for application streaming, wherein an application comprises one or more functions, wherein one or more of the one or more functions are exported functions, the method performed by a first communications device and comprising:- obtaining (201) a first bytecode module comprising a first entity comprising information on the one or more functions, a second entity comprising information on memory associated with the one or more functions, a third entity comprising data associated with the one or more functions, a fourth entity comprising information on function body of the one or more functions;- determining (203) a second bytecode module based on the first bytecode module, wherein the second bytecode module comprises- a header comprising information on the memory associated with the one or more functions and a list of the one or more exported functions;- for each of the one or more functions, a corresponding fifth entity comprising information on the data associated with the function and the function body of the function; and- transmitting (205) the second bytecode module to a second communications device for application streaming.
2. The method (200) according to claim 1, further comprising- obtaining (207) a dependency tree if the application comprises two or more functions and- obtaining (209) information on location of the data associated with each of the two or more functions.
3. The method (200) according to claim 2, wherein determining a second bytecode module further comprises:- ordering (211) the fifth entities corresponding to each of the one or more functions based on the dependency tree.
4. The method (200) according to any of claims 1 to 3, wherein obtaining a first bytecode module further comprises- compiling (213) a source code of the application.
5. The method (200) according to any of claims 1 to 4, wherein each of the first bytecode module and the second bytecode module is a Web Assembly (Wasm) module.
6. The method (200) according to claim 5, wherein the header and each of the fifth entities are custom sections of the second bytecode module.
7. A method (500) for application streaming, wherein the application comprises one or more functions, wherein one or more of the one or more functions are exported functions, the method performed by a second communications device, and comprising:- receiving (501) a header of a second bytecode module, wherein the header comprises information on memory associated with the one or more functions and a list of the one or more exported functions;- allocating (503) a first memory associated with each of the one or more functions based on the information in the header;- allocating (504) a second memory for a tag of each exported function in the list;- receiving (505) one or more fifth entities of the second bytecode module, wherein each of the one or more fifth entities comprises information on the data associated with the corresponding function and function body of the corresponding function;- compiling (507) each of the one or more fifth entities after receiving each fifth entity; and- setting (509) the tag of the corresponding exported function as executable after compiling the corresponding fifth entity.
8. The method (500) according to claim 7, further comprising:- executing each fifth entity if the tag of the corresponding exported function is set as executable.
9. The method (500) according to any of claims 7 or 8, wherein each of the first bytecode module and the second bytecode module is a Web Assembly (Wasm) module.
10. The method (500) according to claim 9, wherein the header and each of the fifth entities are custom sections of the second bytecode module.
11. A first communications device (700) for application streaming, wherein an application comprises one or more functions, wherein one or more of the one or more functions areexported functions, the first communications device comprising a processor and a memory, the memory having stored thereon instructions executable by the processor, wherein the instructions, when executed by the processor, cause the first communications device to:- obtain a first bytecode module comprising a first entity comprising information on the one or more functions, a second entity comprising information on memory associated with the one or more functions, a third entity comprising data associated with the one or more functions operate on, a fourth entity comprising information on function body of the one or more functions;- determine a second bytecode module based on the first bytecode module, wherein the second bytecode module comprises- a header comprising information on the memory associated with the one or more functions and a list of the one or more exported functions;- for each of the one or more functions, a corresponding fifth entity comprising information on the data associated with the function and the function body of the function; and- transmit the second bytecode module to a second communications device for application streaming.
12. The first communications device (700) according to claim 11, wherein the instructions cause the first communications device to:- obtain a dependency tree if the application comprises two or more functions and- obtain information on location of the data associated with each of the two or more functions.
13. The first communications device (700) according to claim 12, wherein the instructions, when executed by the processor, cause the first communications device to determine a second bytecode module:- by ordering the fifth entities corresponding to each of the one or more functions based on the dependency tree.
14. The first communications device (700) according to any of claims 11 to 13, wherein the instructions, when executed by the processor, cause the first device to obtain a first bytecode module comprising the one or more functions by- compiling a source code of the application.
15. The first communications device (700) according to any of claims 11 to 14, wherein each of the first bytecode module and the second bytecode module is a Web Assembly (Wasm) module.
16. The first communications device (700) according to claim 15, wherein the header and each of the fifth entities are custom sections of the second bytecode module.
17. A second communications device (800) for application streaming, wherein the application comprises one or more functions, wherein one or more of the one or more functions are exported functions, the second communications device comprising a processor and a memory, the memory having stored thereon instructions executable by the processor, wherein the instructions, when executed by the processor, cause the second communications device to:- receive a header of a second bytecode module, wherein the header comprises information on memory associated with the one or more functions and a list of the one or more exported functions;- allocate a first memory associated with each of the one or more functions based on the information in the header;- allocate a second memory for a tag of each exported function in the list;- receive one or more fifth entities of the second bytecode module, wherein each of the one or more fifth entities comprises information on the data associated with the corresponding function, and function body of the corresponding function;- compile each of the one or more fifth entities after receiving each fifth entity; and- set the tag of the corresponding exported function as executable after compiling the corresponding fifth entity.
18. The second communication device (800) according to claim 17, wherein the instructions, when executed by the processor, cause the second communications device to- execute each fifth entity if the tag of the corresponding exported function is set as executable.
19. The second communication device (800) according to any of claims 17 or 18, wherein each of the first bytecode module and the second bytecode module is a Web Assembly (Wasm) module.
20. The second communication device (800) according to claim 19, wherein the header and each of the fifth entities are custom sections of the second bytecode module.
21. A computer program (704) comprising instructions which, when run in a processing unit of a first communications device (700), cause the first communications device (700) to perform the method (200) according to any one of claims 1 to 6.
22. A computer-readable data carrier having stored thereon the computer program according to claim 21.
23. A data carrier signal carrying the computer program according to claim 21.
24. A computer program (804) comprising instructions which, when run in a processing unit of a second communications device (800), cause the second communications device (800) to perform the method (500) according to any one of claims 7 to 9.
25. A computer-readable data carrier having stored thereon the computer program according to claim 24.
26. A data carrier signal carrying the computer program according to claim 24.
Citation Information
Patent Citations
WASM smart contract vulnerability detection method based on symbolic execution
CN113672515A
Debugging method, debugging equipment and debugging system for smart contract
CN114327776A
Image-text material synthesis method and device, electronic equipment and storage medium
CN115131470A
Method and device for calling function by WebAssembly module
CN115982784A
Function calling method and device, electronic equipment and readable storage medium
CN116680015A