System and method for compiling rules set into bytecode using switch and class hierarchies
AssigneeAdobe Inc.
InventorSandeep Nawathe
Life of this patent
Estimating the term…
Abstract
Embodiments of the present disclosure are directed to a system, methods, and computer-readable media for compiling source code into bytecode using a compiler. Using a rules set as input, a compiler de-duplicates action codes in the rules and assigns a unique identifier to each action code. The compiler generates a cascading hierarchy of switches that process discrete portions of the unique identifiers in order to invoke methods. The methods are assigned to classes using a method-per-class limit, and bytecode is generated from the class-assigned methods.
Claims20
One or more computer storage media storing computer-useable instructions that, when used by a computing device, cause the computing device to perform operations for compiling rules into bytecode, the operations comprising:
- receiving a plurality of rules encoding a plurality of conditions and a plurality of action codes;
- assigning a plurality of unique identifiers to the plurality of action codes,
- wherein each of the plurality of unique identifiers is represented using bits;
- generating a hierarchy of switches that comprises a first switch and a second switch nested under the first switch;
- processing the plurality of rules using the hierarchy of switches;
- and
- generating bytecode based on the processing of the plurality of rules using the hierarchy of switches.
One or more computer storage media storing computer-useable instructions that, when used by a computing device, cause the computing device to perform operations for compiling rules into bytecode, the operations comprising:
- receiving a plurality of rules encoding a plurality of conditions and a plurality of action codes;
- de-duplicating the plurality of action codes for the plurality of rules;
- assigning a plurality of unique identifiers to the plurality of action codes subsequent to de-duplication, wherein each of the plurality of unique identifiers is assigned to one of the plurality of action codes, and wherein each of the plurality of unique identifiers is represented using a quantity of bits;
- generating a hierarchy of switches having a switch for each n quantity of bits representing one or more of the plurality of unique identifiers, wherein the hierarchy of switches comprises a first switch and a second switch nested under the first switch, and wherein each of the first switch and the second switch are configured to process n or fewer bits;
- processing the plurality of rules using the hierarchy of switches, wherein processing comprises, for each of the plurality of unique identifiers:
- processing, by the first switch, a first sequential portion of n or fewer bits of the unique identifier;
- processing, by the second switch, a second sequential portion of n or fewer bits of the unique identifier;
- when all of the quantity of bits of the unique identifier are processed by the hierarchy of switches, invoking a method for the action code that corresponds to the unique identifier;
- and
- assigning the method invoked to a hierarchy of classes, wherein an additional class is generated when a predefined method per class limit is met;
- and
- generating bytecode based on the processing of the plurality of rules using the hierarchy of switches.
A method for compiling rules into bytecode, the method comprising:
- receiving a plurality of rules encoding a plurality of conditions and a plurality of action codes;
- assigning a plurality of unique identifiers to the plurality of action codes, wherein each of the plurality of unique identifiers is represented using bits;
- generating a hierarchy of switches that comprises a first switch and a second switch nested under the first switch;
- processing the plurality of rules using the hierarchy of switches;
- and
- generating bytecode based on the processing of the plurality of rules using the hierarchy of switches.
Dependencies are inferred from the claim text.