Skip to content

Commit

Permalink
language-server: support avm2 intrinsics when using AIR SDK (closes #727
Browse files Browse the repository at this point in the history
)
  • Loading branch information
joshtynjala committed Jul 11, 2024
1 parent 4317ee2 commit d7bcdcd
Show file tree
Hide file tree
Showing 16 changed files with 660 additions and 187 deletions.
376 changes: 191 additions & 185 deletions LICENSE

Large diffs are not rendered by default.

1 change: 1 addition & 0 deletions distribution/src/assembly/bin.xml
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@
<include>jsfl/*</include>
<include>frameworks/*</include>
<include>playerglobal_docs/*</include>
<include>intrinsics/**/*</include>
</includes>
</fileSet>
<fileSet>
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
/* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
package avm2.intrinsics.memory
{
/**
* Load 32 bit <code>float</code>.
*
* <p>
* Load a 32 bit (IEEE 754), little-endian, float from global memory
* and promote to 64 bit (IEEE 754) double/Number.
* </p>
*
* <p>
* The MOPS opcodes all access the backing store of the ByteArray represented
* by the current app domain's <code>ApplicationDomain.domainMemory</code> property.
* </p>
*
* <p>
* Address ranges for accesses will be range checked using standard comparisons.
* No address alignment is necessary.
* </p>
*
* <p>
* opcode <b>lf32</b> = <code>56</code> (<code>0x38</code>).
* </p>
*
* @langversion 3.0
* @playerversion Flash 11.6
* @playerversion AIR 11.6
*
* @throws RangeError Range check failures will result in an <code>InvalidRangeError</code> exception.
*/
public native function lf32(addr:int):Number;
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
/* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
package avm2.intrinsics.memory
{
/**
* Load 64 bit <code>float</code>.
*
* <p>
* Load a 64 bit (IEEE 754), little-endian, float from global memory
* and promote to 64 bit (IEEE 754) double/Number.
* </p>
*
* <p>
* The MOPS opcodes all access the backing store of the ByteArray represented
* by the current app domain's <code>ApplicationDomain.domainMemory</code> property.
* </p>
*
* <p>
* Address ranges for accesses will be range checked using standard comparisons.
* No address alignment is necessary.
* </p>
*
* <p>
* opcode <b>lf64</b> = <code>57</code> (<code>0x39</code>).
* </p>
*
* @langversion 3.0
* @playerversion Flash 11.6
* @playerversion AIR 11.6
*
* @throws RangeError Range check failures will result in an <code>InvalidRangeError</code> exception.
*/
public native function lf64(addr:int):Number;
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
/* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
package avm2.intrinsics.memory
{
/**
* Load 16 bit <code>integer</code>.
*
* <p>
* Load a 16 bit, little-endian, unsigned integer from global memory.
* </p>
*
* <p>
* The MOPS opcodes all access the backing store of the ByteArray represented
* by the current app domain's <code>ApplicationDomain.domainMemory</code> property.
* </p>
*
* <p>
* Address ranges for accesses will be range checked using standard comparisons.
* No address alignment is necessary.
* </p>
*
* <p>
* opcode <b>li16</b> = <code>54</code> (<code>0x36</code>).
* </p>
*
* @langversion 3.0
* @playerversion Flash 11.6
* @playerversion AIR 11.6
*
* @throws RangeError Range check failures will result in an <code>InvalidRangeError</code> exception.
*/
public native function li16( addr:int ):int;
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
/* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
package avm2.intrinsics.memory
{
/**
* Load 32 bit <code>integer</code>.
*
* <p>
* Load a 32 bit, little-endian, signed integer from global memory.
* </p>
*
* <p>
* The MOPS opcodes all access the backing store of the ByteArray represented
* by the current app domain's <code>ApplicationDomain.domainMemory</code> property.
* </p>
*
* <p>
* Address ranges for accesses will be range checked using standard comparisons.
* No address alignment is necessary.
* </p>
*
* <p>
* opcode <b>li32</b> = <code>55</code> (<code>0x37</code>).
* </p>
*
* @langversion 3.0
* @playerversion Flash 11.6
* @playerversion AIR 11.6
*
* @throws RangeError Range check failures will result in an <code>InvalidRangeError</code> exception.
*/
public native function li32(addr:int):int;
}
34 changes: 34 additions & 0 deletions distribution/src/assembly/intrinsics/avm2/intrinsics/memory/li8.as
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
/* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
package avm2.intrinsics.memory
{
/**
* Load 8 bit <code>integer</code>.
*
* <p>
* Load a 8 bit, little-endian, unsigned integer from global memory.
* </p>
*
* <p>
* The MOPS opcodes all access the backing store of the ByteArray represented
* by the current app domain's <code>ApplicationDomain.domainMemory</code> property.
* </p>
*
* <p>
* Address ranges for accesses will be range checked using standard comparisons.
* No address alignment is necessary.
* </p>
*
* <p>
* opcode <b>li8</b> = <code>53</code> (<code>0x35</code>).
* </p>
*
* @langversion 3.0
* @playerversion Flash 11.6
* @playerversion AIR 11.6
*
* @throws RangeError Range check failures will result in an <code>InvalidRangeError</code> exception.
*/
public native function li8(addr:int):int;
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
/* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
package avm2.intrinsics.memory
{
/**
* Store 32 bit <code>float</code>.
*
* <p>
* Store a 32 bit (IEEE 754) float to global memory.
* </p>
*
* <p>
* The input value is converted to Number using the equivalent of <code>convert_d</code>,
* truncated to 32-bit float, then stored as four bytes in little-endian order.
* </p>
*
* <p>
* The MOPS opcodes all access the backing store of the ByteArray represented
* by the current app domain's <code>ApplicationDomain.domainMemory</code> property.
* </p>
*
* <p>
* Address ranges for accesses will be range checked using standard comparisons.
* </p>
*
* <p>
* opcode <b>sf32</b> = <code>61</code> (<code>0x3D</code>).
* </p>
*
* @langversion 3.0
* @playerversion Flash 11.6
* @playerversion AIR 11.6
*
* @throws RangeError Range check failures will result in an <code>InvalidRangeError</code> exception.
*/
public native function sf32(value:Number, addr:int):void;
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
/* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
package avm2.intrinsics.memory
{
/**
* Store 64 bit <code>float</code>.
*
* <p>
* Store a 64 bit (IEEE 754) float to global memory.
* </p>
*
* <p>
* The input value is converted to Number using the equivalent of <code>convert_d</code>,
* then stored as eight bytes in little endian order.
* </p>
*
* <p>
* The MOPS opcodes all access the backing store of the ByteArray represented
* by the current app domain's <code>ApplicationDomain.domainMemory</code> property.
* </p>
*
* <p>
* Address ranges for accesses will be range checked using standard comparisons.
* </p>
*
* <p>
* opcode <b>sf64</b> = <code>62</code> (<code>0x3E</code>).
* </p>
*
* @langversion 3.0
* @playerversion Flash 11.6
* @playerversion AIR 11.6
*
* @throws RangeError Range check failures will result in an <code>InvalidRangeError</code> exception.
*/
public native function sf64(value:Number, addr:int):void;
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
/* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
package avm2.intrinsics.memory
{
/**
* Store 16 bit <code>integer</code>.
*
* <p>
* Store a 16 bit integer to global memory.
* </p>
*
* <p>
* The value is converted to integer using the equivalent of <code>convert_i</code>,
* then the least significant 16 bits are stored as two bytes in little-endian order.
* </p>
*
* <p>
* The MOPS opcodes all access the backing store of the ByteArray represented
* by the current app domain's <code>ApplicationDomain.domainMemory</code> property.
* </p>
*
* <p>
* Address ranges for accesses will be range checked using standard comparisons.
* </p>
*
* <p>
* opcode <b>si16</b> = <code>59</code> (<code>0x3B</code>).
* </p>
*
* @langversion 3.0
* @playerversion Flash 11.6
* @playerversion AIR 11.6
*
* @throws RangeError Range check failures will result in an <code>InvalidRangeError</code> exception.
*/
public native function si16(value:int, addr:int):void;
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
/* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
package avm2.intrinsics.memory
{
/**
* Store 32 bit <code>integer</code>.
*
* <p>
* Store a 32 bit integer to global memory.
* </p>
*
* <p>
* The value is converted to integer using the equivalent of <code>convert_i</code>,
* then the 32 bits are stored as four bytes in little-endian order.
* </p>
*
* <p>
* The MOPS opcodes all access the backing store of the ByteArray represented
* by the current app domain's <code>ApplicationDomain.domainMemory</code> property.
* </p>
*
* <p>
* Address ranges for accesses will be range checked using standard comparisons.
* </p>
*
* <p>
* opcode <b>si32</b> = <code>60</code> (<code>0x3C</code>).
* </p>
*
* @langversion 3.0
* @playerversion Flash 11.6
* @playerversion AIR 11.6
*
* @throws RangeError Range check failures will result in an <code>InvalidRangeError</code> exception.
*/
public native function si32(value:int, addr:int):void;
}
38 changes: 38 additions & 0 deletions distribution/src/assembly/intrinsics/avm2/intrinsics/memory/si8.as
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
/* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
package avm2.intrinsics.memory
{
/**
* Store 8 bit <code>integer</code>.
*
* <p>
* Store a 8 bit integer to global memory.
* </p>
*
* <p>
* The value is converted to integer using the equivalent of <code>convert_i</code>,
* then the least significant 8 bits are stored.
* </p>
*
* <p>
* The MOPS opcodes all access the backing store of the ByteArray represented
* by the current app domain's <code>ApplicationDomain.domainMemory</code> property.
* </p>
*
* <p>
* Address ranges for accesses will be range checked using standard comparisons.
* </p>
*
* <p>
* opcode <b>si8</b> = <code>58</code> (<code>0x3A</code>).
* </p>
*
* @langversion 3.0
* @playerversion Flash 11.6
* @playerversion AIR 11.6
*
* @throws RangeError Range check failures will result in an <code>InvalidRangeError</code> exception.
*/
public native function si8(value:int, addr:int):void;
}
Loading

0 comments on commit d7bcdcd

Please sign in to comment.