IP Library Granted Patent US 10,452,363
Granted Patent B2
US 10,452,363 · App. 14/807,781 · Granted Oct 22, 2019

Methods and systems for evaluating bytecode in an on-demand service environment including translation of apex to bytecode

Inventors: Gregory D. Fee (Seattle, WA); William J. Gallagher (Easton, PA)
Assignee: salesforce.com, inc.
G06F8/41G06F9/5027G06F12/0811G06F12/0875G06F16/172G06F16/245G06F12/0866G06F2209/549G06F2212/45G06F2212/465
View Patent ↗
Loading inventors, assignments & file history…
Monitor This Case
Get email alerts when status or documents change.
Order Certified Copies
Most orders are placed with the USPTO same day — all within 24 business hours.
Order via The Patent Place →
Pre-filled with this patent's details
Quick Facts
Patent No.
US 10,452,363
App. No.
14/807,781
Granted
Oct 22, 2019
Kind
B2
Abstract

Techniques and mechanisms for conversion of code of a first type to bytecode. Apex provides various unique characteristics. When converting to bytecode, these characteristics are handled to provide bytecode functionality. Some of the unique characteristics of Apex include Autoboxing, SOQL, Properties, Comparisons, Modifiers, Code coverage mechanisms and Sharing mechanisms.

Claims (77)

1. A method comprising:

receiving, with one or more processors, code conforming to a first programming language wherein the code conforming to the first programming language comprises on demand platform code capable of running without client-side servers or software where all values are reference types, the first programming language to be implemented as an abstract syntax tree (AST)-based language supporting an in-line version of a database query language, wherein the code conforming to the first programming language comprises at least a database query;

generating code conforming to a second programming language, wherein the code is a compiled AST bytecode of the code conforming to the first programming language, wherein the generating comprises:

generating a plurality of constructs for each property;

tracking each property with a tuple;

generating a closure method with the property;

for the database query in the first programming language, wherein the database query includes one or more expressions, performing the steps of:

unboxing the expression;

evaluating the one or more expressions to generate a results; and

storing results of the evolution in one or more temporary variables;

rewriting the form of the database query to refer to the one or more temporary variables; and

compiling the rewritten database query;

emitting the rewritten database query as a method invocation with a stringized form of the query;

storing a rewritten database query in a distributed caching system; and

executing the rewritten database query within an execution environment to provide functionality corresponding to the code conforming to the first programming language.

2. The method of claim 1 further comprising:

identifying intermediate values; and

eliminating boxing and unboxing for the intermediate values.

3. A method comprising:

receiving, with one or more processors, code conforming to a first programming language wherein the code conforming to the first programming language comprises on demand platform code capable of running without client-side servers or software where all values are reference types, the first programming language to be implemented as an abstract syntax tree (AST)-based language supporting an in-line version of a database query language, wherein the code conforming to the first programming language comprises at least a database query;

generating code conforming to a second programming language, wherein the code is a compiled AST bytecode of the code conforming to the first programming language, wherein the generating comprises:

generating a plurality of constructs for each property;

tracking each property with a tuple;

generating a closure method with the property;

invoking the closure method;

revoking the closure method;

for the database query in the first programming language, wherein the database query includes one or more expressions, performing the steps of:

unboxing the expression;

evaluating the one or more expressions to generate a results; and

storing results of the evolution in one or more temporary variables;

rewriting the form of the database query to refer to the one or more temporary variables; and

compiling the rewritten database query;

emitting the rewritten database query as a method invocation with a stringized form of the query;

storing a rewritten database query in a distributed caching system; and

executing the rewritten database query within an execution environment to provide functionality corresponding to the code conforming to the first programming language.

4. The method of claim 3 wherein the plurality of constructs comprise:

a field of a same type as the property on a type that defines the property;

a setter method that includes code to set the field; and

a getter method to get the field.

5. An article comprising a non-transitory computer-readable medium having stored thereon instructions that, when executed, cause one or more processors in a multitenant environment to:

receiving, with one or more processors, code conforming to a first programming language wherein the code conforming to the first programming language comprises on demand platform code capable of running without client-side servers or software where all values are reference types, the first programming language to be implemented as an abstract syntax tree (AST)-based language supporting an in-line version of a database query language, wherein the code conforming to the first programming language comprises at least a database query;

generating code conforming to a second programming language, wherein the code is a compiled AST bytecode of the code conforming to the first programming language, wherein the generating comprises:

generating a plurality of constructs for each property;

tracking each property with a tuple;

generating a closure method with the property;

for the database query in the first programming language, wherein the database query includes one or more expressions, performing the steps of:

unboxing the expression;

evaluating the one or more expressions to generate a results; and

storing results of the evolution in one or more temporary variables;

rewriting the form of the database query to refer to the one or more temporary variables; and

compiling the rewritten database query;

emitting the rewritten database query as a method invocation with a stringized form of the query;

storing a rewritten database query in a distributed caching system; and executing the rewritten database query within an execution environment to provide functionality corresponding to the code conforming to the first programming language.

6. The article of claim 5 further comprising instructions that, when executed, cause the one or more processors to:

identify intermediate values; and

eliminate boxing and unboxing for the intermediate values.

7. An article comprising a non-transitory computer-readable medium having stored thereon instructions that, when executed, cause one or more processors in a multitenant environment to:

receiving code conforming to a first programming language wherein the code conforming to the first programming language comprises on demand platform code capable of running without client-side servers or software where all values are reference types, the first programming language to be implemented as an abstract syntax tree (AST)-based language supporting an in-line version of a database query language, wherein the code conforming to the first programming language comprises at least a database query;

generating code conforming to a second programming language, wherein the code is a compiled AST bytecode of the code conforming to the first programming language, wherein the generating comprises:

generating a plurality of constructs for each property;

tracking each property with a tuple;

generating a closure method with the property;

invoking the closure method;

revoking the closure method;

for the database query in the first programming language, wherein the database query includes one or more expressions, performing the steps of:

unboxing the expression;

evaluating the one or more expressions to generate a results; and

storing results of the evolution in one or more temporary variables;

rewriting the form of the database query to refer to the one or more temporary variables; and

compiling the rewritten database query;

emitting the rewritten database query as a method invocation with a stringized form of the query;

storing a rewritten database query in a distributed caching system; and

executing the rewritten database query within an execution environment to provide functionality corresponding to the code conforming to the first programming language.

8. The article of claim 7 wherein the plurality of constructs comprise:

a field of a same type as the property on a type that defines the property;

a setter method that includes code to set the field; and

a getter method to get the field.

Assignments (2)
CHANGE OF NAME Recorded Nov 21, 2024
From: SALESFORCE.COM, INC.
To: SALESFORCE, INC.
Reel/Frame 069430/0939 →
ASSIGNMENT OF ASSIGNOR'S INTEREST Recorded Jul 23, 2015
From: FEE, GREGORY D.; GALLAGHER, WILLIAM J.
To: SALESFORCE.COM, INC.
Reel/Frame 036168/0627 →