text
stringlengths 2
1.04M
| meta
dict |
---|---|
package me.rhespanhol.rxtraktjava.entities;
import org.joda.time.DateTime;
public class CalendarShowEntry {
public DateTime first_aired;
public Episode episode;
public Show show;
}
| {
"content_hash": "f7aef8227900eadc7fa3ad2dec14dcc3",
"timestamp": "",
"source": "github",
"line_count": 11,
"max_line_length": 43,
"avg_line_length": 17.90909090909091,
"alnum_prop": 0.7563451776649747,
"repo_name": "rhespanhol/RxTraktJava",
"id": "4149e1afae0b87aab840545b2af043ebdd26ca17",
"size": "197",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "app/src/main/java/me/rhespanhol/rxtraktjava/entities/CalendarShowEntry.java",
"mode": "33188",
"license": "apache-2.0",
"language": [
{
"name": "Java",
"bytes": "110911"
}
],
"symlink_target": ""
} |
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
<modelVersion>4.0.0</modelVersion>
<parent>
<groupId>org.sonatype.oss</groupId>
<artifactId>oss-parent</artifactId>
<version>4</version>
</parent>
<groupId>com.payneteasy.superfly</groupId>
<artifactId>superfly-parent</artifactId>
<packaging>pom</packaging>
<name>Superfly parent project</name>
<version>1.7-26-SNAPSHOT</version>
<description>Parent POM of the Superfly project</description>
<modules>
<module>superfly-remote-api</module>
<module>superfly-spi</module>
<module>superfly-service</module>
<module>superfly-web</module>
<module>superfly-httpclient-ssl</module>
<module>superfly-common</module>
<module>superfly-client</module>
<module>superfly-client-web-security</module>
<module>superfly-client-opt</module>
<module>superfly-spring-security</module>
<module>superfly-spi-support</module>
<module>superfly-crypto</module>
<module>superfly-wicket</module>
<module>superfly-integration-test</module>
</modules>
<url>https://github.com/rpuch/superfly</url>
<scm>
<connection>scm:git:[email protected]:payneteasy/superfly.git</connection>
<developerConnection>scm:git:[email protected]:payneteasy/superfly.git</developerConnection>
<url>https://github.com/paynetesy/superfly</url>
<tag>superfly-parent-1.7-12</tag>
</scm>
<licenses>
<license>
<name>The Apache Software License, Version 2.0</name>
<url>http://www.apache.org/licenses/LICENSE-2.0.txt</url>
<distribution>repo</distribution>
</license>
</licenses>
<developers>
<developer>
<id>roman.puchkovskiy</id>
<email>[email protected]</email>
<name>Roman Puchkovskiy</name>
</developer>
<developer>
<id>esinev</id>
<email>[email protected]</email>
</developer>
<developer>
<id>mgoryachkin</id>
<email>[email protected]</email>
</developer>
<developer>
<id>pasha.zarubin</id>
<email>[email protected]</email>
</developer>
<developer>
<id>izinchenko</id>
<email>[email protected]</email>
</developer>
<developer>
<email>[email protected]</email>
</developer>
<developer>
<email>[email protected]</email>
</developer>
<developer>
<email>[email protected]</email>
</developer>
</developers>
<!--
- Distributions
-->
<distributionManagement>
<repository>
<id>sonatype-nexus-staging</id>
<name>sonatype oss RELEASE repository</name>
<url>https://oss.sonatype.org/service/local/staging/deploy/maven2</url>
</repository>
<snapshotRepository>
<id>sonatype-nexus-snapshots</id>
<name>sonatype oss SNAPSHOT repository</name>
<url>https://oss.sonatype.org/content/repositories/snapshots</url>
<uniqueVersion>false</uniqueVersion>
</snapshotRepository>
</distributionManagement>
<repositories>
<!-- Atlassian repositories -->
<repository>
<id>atlassian-public</id>
<url>https://maven.atlassian.com/repository/public</url>
<snapshots>
<enabled>true</enabled>
</snapshots>
<releases>
<enabled>true</enabled>
</releases>
</repository>
<repository>
<id>atlassian-m2-repository</id>
<url>https://maven.atlassian.com/content/groups/public/</url>
</repository>
<!-- ibiblio mirror for some artifacts -->
<!--
<repository>
<id>ibiblio-mirrors</id>
<name>ibiblio mirrors</name>
<url>http://mirrors.ibiblio.org/pub/mirrors/maven2/</url>
</repository>
-->
</repositories>
<dependencyManagement>
<dependencies>
<dependency>
<groupId>com.payneteasy.superfly</groupId>
<artifactId>superfly-remote-api</artifactId>
<version>${project.version}</version>
</dependency>
<dependency>
<groupId>com.payneteasy.superfly</groupId>
<artifactId>superfly-service</artifactId>
<version>${project.version}</version>
</dependency>
<dependency>
<groupId>com.payneteasy.superfly</groupId>
<artifactId>superfly-httpclient-ssl</artifactId>
<version>${project.version}</version>
</dependency>
<dependency>
<groupId>com.payneteasy.superfly</groupId>
<artifactId>superfly-common</artifactId>
<version>${project.version}</version>
</dependency>
<dependency>
<groupId>com.payneteasy.superfly</groupId>
<artifactId>superfly-client</artifactId>
<version>${project.version}</version>
</dependency>
<dependency>
<groupId>com.payneteasy.superfly</groupId>
<artifactId>superfly-client-opt</artifactId>
<version>${project.version}</version>
</dependency>
<dependency>
<groupId>com.payneteasy.superfly</groupId>
<artifactId>superfly-spring-security</artifactId>
<version>${project.version}</version>
</dependency>
<dependency>
<groupId>com.payneteasy.superfly</groupId>
<artifactId>superfly-spi</artifactId>
<version>${project.version}</version>
</dependency>
<dependency>
<groupId>com.payneteasy.superfly</groupId>
<artifactId>superfly-spi-support</artifactId>
<version>${project.version}</version>
</dependency>
<dependency>
<groupId>com.payneteasy.superfly</groupId>
<artifactId>superfly-crypto</artifactId>
<version>${project.version}</version>
</dependency>
<dependency>
<groupId>com.payneteasy.superfly</groupId>
<artifactId>superfly-wicket</artifactId>
<version>${project.version}</version>
</dependency>
<dependency>
<groupId>org.springframework</groupId>
<artifactId>spring-core</artifactId>
<version>${spring.version}</version>
<exclusions>
<exclusion>
<groupId>org.springframework</groupId>
<artifactId>spring-jcl</artifactId>
</exclusion>
</exclusions>
</dependency>
<dependency>
<groupId>org.springframework</groupId>
<artifactId>spring-beans</artifactId>
<version>${spring.version}</version>
</dependency>
<dependency>
<groupId>org.springframework</groupId>
<artifactId>spring-aop</artifactId>
<version>${spring.version}</version>
</dependency>
<dependency>
<groupId>org.springframework</groupId>
<artifactId>spring-context</artifactId>
<version>${spring.version}</version>
</dependency>
<dependency>
<groupId>org.springframework</groupId>
<artifactId>spring-context-support</artifactId>
<version>${spring.version}</version>
</dependency>
<dependency>
<groupId>org.springframework</groupId>
<artifactId>spring-jdbc</artifactId>
<version>${spring.version}</version>
</dependency>
<dependency>
<groupId>org.springframework</groupId>
<artifactId>spring-tx</artifactId>
<version>${spring.version}</version>
</dependency>
<dependency>
<groupId>org.springframework</groupId>
<artifactId>spring-web</artifactId>
<version>${spring.version}</version>
</dependency>
<dependency>
<groupId>org.springframework</groupId>
<artifactId>spring-webmvc</artifactId>
<version>${spring.version}</version>
<exclusions>
<exclusion>
<groupId>org.springframework</groupId>
<artifactId>spring-beans</artifactId>
</exclusion>
<exclusion>
<groupId>org.springframework</groupId>
<artifactId>spring-core</artifactId>
</exclusion>
<exclusion>
<groupId>org.springframework</groupId>
<artifactId>spring-context</artifactId>
</exclusion>
<exclusion>
<groupId>org.springframework</groupId>
<artifactId>spring-context-support</artifactId>
</exclusion>
<exclusion>
<groupId>org.springframework</groupId>
<artifactId>spring-web</artifactId>
</exclusion>
</exclusions>
</dependency>
<dependency>
<artifactId>jdbc-proc-daofactory</artifactId>
<groupId>com.googlecode.jdbc-proc.jdbc-proc</groupId>
<version>${jdbcproc.version}</version>
<exclusions>
<exclusion>
<artifactId>spring-jdbc</artifactId>
<groupId>org.springframework</groupId>
</exclusion>
</exclusions>
</dependency>
<dependency>
<groupId>org.slf4j</groupId>
<artifactId>slf4j-api</artifactId>
<version>${slf4j.version}</version>
</dependency>
<dependency>
<groupId>ch.qos.logback</groupId>
<artifactId>logback-classic</artifactId>
<version>1.2.10</version>
</dependency>
<dependency>
<groupId>org.logback-extensions</groupId>
<artifactId>logback-ext-spring</artifactId>
<version>0.1.5</version>
</dependency>
<dependency>
<groupId>org.slf4j</groupId>
<artifactId>jcl-over-slf4j</artifactId>
<version>${slf4j.version}</version>
</dependency>
<dependency>
<groupId>javax.servlet</groupId>
<artifactId>javax.servlet-api</artifactId>
<version>3.1.0</version>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>org.springframework.security</groupId>
<artifactId>spring-security-core</artifactId>
<version>${spring.security.version}</version>
<exclusions>
<exclusion>
<groupId>org.springframework</groupId>
<artifactId>spring-core</artifactId>
</exclusion>
<exclusion>
<groupId>org.springframework</groupId>
<artifactId>spring-beans</artifactId>
</exclusion>
<exclusion>
<groupId>org.springframework</groupId>
<artifactId>spring-context</artifactId>
</exclusion>
<exclusion>
<groupId>org.springframework</groupId>
<artifactId>spring-aop</artifactId>
</exclusion>
<exclusion>
<groupId>org.springframework</groupId>
<artifactId>spring-support</artifactId>
</exclusion>
<exclusion>
<groupId>org.springframework</groupId>
<artifactId>spring-tx</artifactId>
</exclusion>
<exclusion>
<groupId>org.springframework</groupId>
<artifactId>spring-expression</artifactId>
</exclusion>
<exclusion>
<groupId>commons-logging</groupId>
<artifactId>commons-logging</artifactId>
</exclusion>
<exclusion>
<groupId>aopalliance</groupId>
<artifactId>aopalliance</artifactId>
</exclusion>
</exclusions>
</dependency>
<dependency>
<groupId>org.springframework.security</groupId>
<artifactId>spring-security-web</artifactId>
<version>${spring.security.version}</version>
<exclusions>
<exclusion>
<artifactId>commons-logging</artifactId>
<groupId>commons-logging</groupId>
</exclusion>
<exclusion>
<groupId>org.springframework</groupId>
<artifactId>spring-aop</artifactId>
</exclusion>
<exclusion>
<groupId>org.springframework</groupId>
<artifactId>spring-expression</artifactId>
</exclusion>
<exclusion>
<groupId>aopalliance</groupId>
<artifactId>aopalliance</artifactId>
</exclusion>
</exclusions>
</dependency>
<dependency>
<groupId>org.springframework.security</groupId>
<artifactId>spring-security-config</artifactId>
<version>${spring.security.version}</version>
<exclusions>
<exclusion>
<artifactId>commons-logging</artifactId>
<groupId>commons-logging</groupId>
</exclusion>
<exclusion>
<groupId>org.springframework</groupId>
<artifactId>spring-aop</artifactId>
</exclusion>
<exclusion>
<groupId>aopalliance</groupId>
<artifactId>aopalliance</artifactId>
</exclusion>
</exclusions>
</dependency>
<!--
<dependency>
<groupId>org.springframework.security</groupId>
<artifactId>spring-security-core-tiger</artifactId>
<version>${spring.security.version}</version>
<exclusions>
<exclusion>
<groupId>org.springframework</groupId>
<artifactId>spring-core</artifactId>
</exclusion>
<exclusion>
<groupId>org.springframework</groupId>
<artifactId>spring-beans</artifactId>
</exclusion>
<exclusion>
<groupId>org.springframework</groupId>
<artifactId>spring-context</artifactId>
</exclusion>
<exclusion>
<groupId>org.springframework</groupId>
<artifactId>spring-aop</artifactId>
</exclusion>
<exclusion>
<groupId>org.springframework</groupId>
<artifactId>spring-support</artifactId>
</exclusion>
<exclusion>
<groupId>commons-logging</groupId>
<artifactId>commons-logging</artifactId>
</exclusion>
</exclusions>
</dependency>
-->
<dependency>
<groupId>org.aspectj</groupId>
<artifactId>aspectjweaver</artifactId>
<version>${aspectj.version}</version>
</dependency>
<dependency>
<groupId>org.quartz-scheduler</groupId>
<artifactId>quartz</artifactId>
<version>2.3.2</version>
</dependency>
<dependency>
<groupId>commons-digester</groupId>
<artifactId>commons-digester</artifactId>
<version>2.0</version>
<exclusions>
<exclusion>
<groupId>commons-logging</groupId>
<artifactId>commons-logging</artifactId>
</exclusion>
</exclusions>
</dependency>
<dependency>
<groupId>commons-httpclient</groupId>
<artifactId>commons-httpclient</artifactId>
<version>3.1</version>
<exclusions>
<exclusion>
<groupId>commons-logging</groupId>
<artifactId>commons-logging</artifactId>
</exclusion>
</exclusions>
</dependency>
<dependency>
<groupId>commons-codec</groupId>
<artifactId>commons-codec</artifactId>
<version>1.14</version>
</dependency>
<dependency>
<groupId>commons-beanutils</groupId>
<artifactId>commons-beanutils</artifactId>
<version>1.9.4</version>
</dependency>
<dependency>
<groupId>commons-io</groupId>
<artifactId>commons-io</artifactId>
<version>2.7</version>
</dependency>
<dependency>
<groupId>com.warrenstrange</groupId>
<artifactId>googleauth</artifactId>
<version>1.5.0</version>
<exclusions>
<exclusion>
<groupId>commons-logging</groupId>
<artifactId>commons-logging</artifactId>
</exclusion>
<exclusion>
<groupId>org.slf4j</groupId>
<artifactId>jcl-over-slf4j</artifactId>
</exclusion>
</exclusions>
</dependency>
<dependency>
<!--override googleauth's httpclient version-->
<groupId>org.apache.httpcomponents</groupId>
<artifactId>httpclient</artifactId>
<version>4.5.13</version>
<exclusions>
<exclusion>
<groupId>commons-logging</groupId>
<artifactId>commons-logging</artifactId>
</exclusion>
</exclusions>
</dependency>
<dependency>
<groupId>com.googlecode.xremoting</groupId>
<artifactId>xremoting-core</artifactId>
<version>1.0-10</version>
</dependency>
<dependency>
<groupId>com.thoughtworks.xstream</groupId>
<artifactId>xstream</artifactId>
<version>1.4.19</version>
</dependency>
<dependency>
<groupId>com.caucho</groupId>
<artifactId>hessian</artifactId>
<version>4.0.7</version>
</dependency>
<dependency>
<groupId>com.github.spullara.mustache.java</groupId>
<artifactId>compiler</artifactId>
<version>0.9.6</version>
</dependency>
<dependency>
<groupId>org.apache.velocity</groupId>
<artifactId>velocity-engine-core</artifactId>
<version>2.3</version>
</dependency>
<dependency>
<groupId>javax.mail</groupId>
<artifactId>mail</artifactId>
<version>1.4</version>
</dependency>
<!-- WICKET DEPENDENCIES -->
<dependency>
<groupId>org.apache.wicket</groupId>
<artifactId>wicket</artifactId>
<version>${wicket.version}</version>
<type>pom</type>
</dependency>
<dependency>
<groupId>org.apache.wicket</groupId>
<artifactId>wicket-spring</artifactId>
<version>${wicket.version}</version>
</dependency>
<dependency>
<groupId>org.apache.wicket</groupId>
<artifactId>wicket-extensions</artifactId>
<version>${wicket.version}</version>
</dependency>
<dependency>
<groupId>org.apache.wicket</groupId>
<artifactId>wicket-datetime</artifactId>
<version>${wicket.version}</version>
</dependency>
<dependency>
<groupId>commons-fileupload</groupId>
<artifactId>commons-fileupload</artifactId>
<version>1.3.3</version>
</dependency>
<dependency>
<groupId>cglib</groupId>
<artifactId>cglib</artifactId>
<version>3.2.5</version>
<exclusions>
<exclusion>
<!--
https://github.com/cglib/cglib/issues/144
https://github.com/cglib/cglib/pull/87
-->
<groupId>org.apache.ant</groupId>
<artifactId>ant</artifactId>
</exclusion>
</exclusions>
</dependency>
<dependency>
<groupId>org.ow2.asm</groupId>
<artifactId>asm</artifactId>
<version>5.2</version>
</dependency>
<dependency>
<groupId>commons-dbcp</groupId>
<artifactId>commons-dbcp</artifactId>
<version>1.2.2</version>
</dependency>
<dependency>
<groupId>commons-pool</groupId>
<artifactId>commons-pool</artifactId>
<version>1.5.3</version>
</dependency>
<dependency>
<groupId>mysql</groupId>
<artifactId>mysql-connector-java</artifactId>
<version>8.0.28</version>
</dependency>
<dependency>
<groupId>org.springframework</groupId>
<artifactId>spring-test</artifactId>
<version>${spring.version}</version>
<scope>test</scope>
</dependency>
<!-- JETTY DEPENDENCIES FOR TESTING -->
<dependency>
<groupId>org.eclipse.jetty</groupId>
<artifactId>jetty-server</artifactId>
<version>${jetty.version}</version>
<scope>provided</scope>
<exclusions>
<exclusion>
<groupId>org.eclipse.jetty.orbit</groupId>
<artifactId>javax.servlet</artifactId>
</exclusion>
</exclusions>
</dependency>
<dependency>
<groupId>org.eclipse.jetty</groupId>
<artifactId>jetty-util</artifactId>
<version>${jetty.version}</version>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>org.eclipse.jetty</groupId>
<artifactId>jetty-plus</artifactId>
<version>${jetty.version}</version>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>org.bouncycastle</groupId>
<artifactId>bcpg-jdk15on</artifactId>
<version>1.69</version>
</dependency>
<dependency>
<groupId>ca.juliusdavies</groupId>
<artifactId>not-yet-commons-ssl</artifactId>
<!-- This version contains a fix that implements the same thing
as a fix for CVE-2015-5262.
Also, there is a fix that allows us to run on Java 9+.
-->
<version>0.3.17-20180724</version>
<exclusions>
<exclusion>
<groupId>log4j</groupId>
<artifactId>log4j</artifactId>
</exclusion>
</exclusions>
</dependency>
<dependency>
<groupId>org.reflections</groupId>
<artifactId>reflections</artifactId>
<version>0.9.11</version>
</dependency>
<dependency>
<!--Override org.reflections:reflections guava-->
<groupId>com.google.guava</groupId>
<artifactId>guava</artifactId>
<version>31.0.1-jre</version>
</dependency>
<dependency>
<groupId>javax.annotation</groupId>
<artifactId>javax.annotation-api</artifactId>
<version>1.3.2</version>
</dependency>
<dependency>
<groupId>org.easymock</groupId>
<artifactId>easymock</artifactId>
<version>3.0</version>
<scope>test</scope>
<exclusions>
<exclusion>
<groupId>cglib</groupId>
<artifactId>cglib-nodep</artifactId>
</exclusion>
</exclusions>
</dependency>
<dependency>
<groupId>org.passay</groupId>
<artifactId>passay</artifactId>
<version>1.6.1</version>
</dependency>
</dependencies>
</dependencyManagement>
<dependencies>
<dependency>
<groupId>junit</groupId>
<artifactId>junit</artifactId>
<version>4.13.1</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.easymock</groupId>
<artifactId>easymock</artifactId>
<scope>test</scope>
</dependency>
<dependency>
<groupId>cglib</groupId>
<artifactId>cglib</artifactId>
<scope>test</scope>
</dependency>
</dependencies>
<build>
<pluginManagement>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-enforcer-plugin</artifactId>
<version>3.0.0-M3</version>
<dependencies>
<dependency>
<groupId>org.codehaus.mojo</groupId>
<artifactId>extra-enforcer-rules</artifactId>
<version>1.2</version>
</dependency>
</dependencies>
</plugin>
</plugins>
</pluginManagement>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-eclipse-plugin</artifactId>
<version>2.8</version>
<configuration>
<ajdtVersion>none</ajdtVersion>
</configuration>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-javadoc-plugin</artifactId>
<version>2.10.1</version>
<configuration>
<source>${java.version}</source>
<!-- this is to disable JDK-supplied doclint which is too strict
causes the build to fail -->
<additionalparam>-Xdoclint:none</additionalparam>
</configuration>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-enforcer-plugin</artifactId>
<version>3.0.0-M3</version>
<executions>
<execution>
<id>enforce-ban-duplicate-classes</id>
<goals>
<goal>enforce</goal>
</goals>
<configuration>
<rules>
<banDuplicateClasses>
<ignoreClasses>
<ignoreClass>org.bouncycastle.*</ignoreClass>
</ignoreClasses>
<findAllDuplicates>true</findAllDuplicates>
<dependencies />
</banDuplicateClasses>
</rules>
<fail>${fail.on.dup.dependency}</fail>
</configuration>
</execution>
<execution>
<id>enforce-banned-dependencies</id>
<goals>
<goal>enforce</goal>
</goals>
<configuration>
<rules>
<bannedDependencies>
<excludes>
<exclude>commons-logging</exclude>
<exclude>xml-apis:xml-apis</exclude>
</excludes>
</bannedDependencies>
</rules>
<fail>true</fail>
</configuration>
</execution>
</executions>
</plugin>
<plugin>
<groupId>org.gaul</groupId>
<artifactId>modernizer-maven-plugin</artifactId>
<version>1.3.0</version>
<configuration>
<javaVersion>${java.version}</javaVersion>
<ignorePackages />
<failOnViolations>${modernizer.failOnViolations}</failOnViolations>
</configuration>
<executions>
<execution>
<id>modernizer</id>
<phase>verify</phase>
<goals>
<goal>modernizer</goal>
</goals>
</execution>
</executions>
</plugin>
<plugin>
<artifactId>maven-release-plugin</artifactId>
<version>2.5.2</version>
<dependencies>
<dependency>
<groupId>org.apache.maven.scm</groupId>
<artifactId>maven-scm-provider-gitexe</artifactId>
<version>1.8.1</version>
</dependency>
</dependencies>
</plugin>
</plugins>
</build>
<profiles>
<profile>
<id>deploy</id>
<build>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-gpg-plugin</artifactId>
<version>1.6</version>
<executions>
<execution>
<id>sign-artifacts</id>
<phase>verify</phase>
<goals>
<goal>sign</goal>
</goals>
</execution>
</executions>
</plugin>
</plugins>
</build>
</profile>
<profile>
<id>owasp-dependency-check</id>
<build>
<plugins>
<plugin>
<groupId>org.owasp</groupId>
<artifactId>dependency-check-maven</artifactId>
<configuration>
<suppressionFile>src/main/dependency-check/suppressions.xml</suppressionFile>
<!--format>xml</format>
<prettyPrint>true</prettyPrint>
<ossindexAnalyzerEnabled>false</ossindexAnalyzerEnabled-->
<!--skipDependencyManagement>false</skipDependencyManagement-->
</configuration>
<executions>
<execution>
<goals>
<goal>aggregate</goal>
</goals>
</execution>
</executions>
</plugin>
</plugins>
</build>
<reporting>
<plugins>
<!-- OWASP dependency check -->
<plugin>
<groupId>org.owasp</groupId>
<artifactId>dependency-check-maven</artifactId>
<version>${owasp.dependencyCheck.version}</version>
<configuration>
<suppressionFile>src/main/dependency-check/suppressions.xml</suppressionFile>
</configuration>
<reportSets>
<reportSet>
<reports>
<report>aggregate</report>
</reports>
</reportSet>
</reportSets>
</plugin>
</plugins>
</reporting>
</profile>
</profiles>
<properties>
<jdbcproc.version>1.1-4</jdbcproc.version>
<slf4j.version>1.7.12</slf4j.version>
<spring.version>5.3.20</spring.version>
<spring.security.version>5.5.8</spring.security.version>
<aspectj.version>1.6.5</aspectj.version>
<wicket.version>7.18.0</wicket.version>
<jetty.version>9.4.44.v20210927</jetty.version>
<maven.compiler.source>${java.version}</maven.compiler.source>
<maven.compiler.target>${java.version}</maven.compiler.target>
<maven.compiler.showDeprecation>true</maven.compiler.showDeprecation>
<maven.compiler.showWarnings>true</maven.compiler.showWarnings>
<project.build.sourceEncoding>utf-8</project.build.sourceEncoding>
<java.version>1.8</java.version>
<modernizer.failOnViolations>true</modernizer.failOnViolations>
<fail.on.dup.dependency>true</fail.on.dup.dependency>
<owasp.dependencyCheck.version>5.0.0-M3</owasp.dependencyCheck.version>
</properties>
</project>
| {
"content_hash": "e66033caaa8d89a4f442a3c3bd454b95",
"timestamp": "",
"source": "github",
"line_count": 905,
"max_line_length": 201,
"avg_line_length": 40.665193370165746,
"alnum_prop": 0.46839845660561924,
"repo_name": "payneteasy/superfly",
"id": "3a606546138f01fb9767f27f317a20eea671bf43",
"size": "36802",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "pom.xml",
"mode": "33188",
"license": "apache-2.0",
"language": [
{
"name": "Batchfile",
"bytes": "5148"
},
{
"name": "CSS",
"bytes": "10114"
},
{
"name": "HTML",
"bytes": "91190"
},
{
"name": "Java",
"bytes": "1362088"
},
{
"name": "JavaScript",
"bytes": "2389"
},
{
"name": "PLSQL",
"bytes": "50740"
},
{
"name": "Shell",
"bytes": "7675"
}
],
"symlink_target": ""
} |
<?php
// Copyright 2006-2017 Faisal Thaheem
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
class SubscriptionsController extends AppController {
var $name = 'Subscriptions';
var $components = array(
'Email'
);
public function beforeFilter() {
parent::beforeFilter();
$this->Auth->allow(
'subscribe'
,'unsubscribe'
);
}
function subscribe(){
Configure::write('debug',0);
$subscription_result = 'error';
if(!empty($this->data)){
$this->Subscription->set($this->data);
if($this->Subscription->validates()){
$subscription_result =
$this->Subscription->subscribeUpdateLink(
$this->sitename,
$this->data['Subscription']['email']
);
// send out the welcome email
$this->Email->sendAs = 'both';
$this->Email->from = $this->siteInfo['emailnoreply'];
$this->Email->to = $this->data['Subscription']['email'];
$this->Email->subject = "You have been successfully subscribed to {$this->sitename}'s mailing list.";
$this->Email->template = 'email_subscribe';
$this->Email->delivery = Configure::read('Mail.method');
$this->set('emailaddress', $this->data['Subscription']['email']);
$url = str_replace('##site##', $this->siteInfo['fqdn'], Configure::read('URLs.unsubscribeURL'));
$url = str_replace('##emailaddress##', urlencode($this->data['Subscription']['email']), $url);
$this->set('unsubscribeurl', $url);
$this->Email->send();
}else{
$subscription_result = $this->Subscription->validationErrors;
}
}
$this->set('subscription_result',$subscription_result);
}
function unsubscribe($emailaddress = null)
{
$result = false;
if(null != $emailaddress){
$result = $this->Subscription->unsubscribe($this->sitename, urldecode($emailaddress));
}
$this->set('emailaddress', $emailaddress);
$this->set('result',$result);
}
function admin_index()
{
$this->loadModel('Site');
$sites = $this->Site->find('list'
// ,array(
// 'fields' => array(
// 'id',
// 'fqdn'
// )
// )
);
$this->set('sites',$sites);
}
function admin_download($siteid)
{
$this->layout = null;
$subscribers = $this->Subscription->query("select subscriptions.email from subscriptions where id in (Select subscription_id from sites_subscriptions where site_id = $siteid)");
$this->set('subscribers',$subscribers);
}
}
?> | {
"content_hash": "9bf744e8424e610add2112362e42db2b",
"timestamp": "",
"source": "github",
"line_count": 107,
"max_line_length": 179,
"avg_line_length": 27.61682242990654,
"alnum_prop": 0.6382402707275804,
"repo_name": "faisalthaheem/denovo-voucher-script",
"id": "96f559489d7da8641cab707ec43991121be8cdc4",
"size": "2955",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "site/app/controllers/subscriptions_controller.php",
"mode": "33188",
"license": "apache-2.0",
"language": [
{
"name": "Batchfile",
"bytes": "981"
},
{
"name": "CSS",
"bytes": "300526"
},
{
"name": "Dockerfile",
"bytes": "629"
},
{
"name": "HTML",
"bytes": "312"
},
{
"name": "JavaScript",
"bytes": "324775"
},
{
"name": "PHP",
"bytes": "3178287"
},
{
"name": "PLpgSQL",
"bytes": "309826"
},
{
"name": "Shell",
"bytes": "1077"
}
],
"symlink_target": ""
} |
require "test_helper"
describe Hbc::CLI::List do
it "lists the installed Casks in a pretty fashion" do
casks = %w[local-caffeine local-transmission].map { |c| Hbc.load(c) }
casks.each do |c|
TestHelper.install_with_caskfile(c)
end
lambda {
Hbc::CLI::List.run
}.must_output <<-OUTPUT.gsub(%r{^ *}, "")
local-caffeine
local-transmission
OUTPUT
end
it "lists the installed Casks and all their installed versions" do
casks = %w[local-caffeine local-transmission].map { |c| Hbc.load(c) }
casks.each do |c|
TestHelper.install_with_caskfile(c)
end
lambda {
Hbc::CLI::List.run("--versions")
}.must_output <<-OUTPUT.gsub(%r{^ *}, "")
local-caffeine 1.2.3
local-transmission 2.61
OUTPUT
end
describe "when Casks have been renamed" do
before do
@renamed_path = Hbc.caskroom.join("ive-been-renamed", "latest", "Renamed.app").tap(&:mkpath)
@renamed_path.join("Info.plist").open("w") { |f| f.puts "Oh plist" }
end
after do
@renamed_path.rmtree if @renamed_path.exist?
end
it "lists installed Casks without backing ruby files (due to renames or otherwise)" do
lambda {
Hbc::CLI::List.run
}.must_output <<-OUTPUT.gsub(%r{^ *}, "")
ive-been-renamed (!)
OUTPUT
end
end
it "given a set of installed Casks, lists the installed files for those Casks" do
casks = %w[local-caffeine local-transmission].map { |c| Hbc.load(c) }
casks.each do |c|
TestHelper.install_without_artifacts_with_caskfile(c)
end
caffeine, transmission = casks
shutup do
Hbc::Artifact::App.new(transmission).install_phase
end
lambda {
Hbc::CLI::List.run("local-transmission", "local-caffeine")
}.must_output <<-OUTPUT.gsub(%r{^ *}, "")
==> Apps managed by brew-cask:
'#{Hbc.appdir.join('Transmission.app')}'
==> Staged content:
#{transmission.staged_path} (0 files)
==> Apps managed by brew-cask:
Missing App: '#{Hbc.appdir.join('Caffeine.app')}'
==> Staged content:
#{caffeine.staged_path} (13 files)
OUTPUT
end
end
| {
"content_hash": "d891985280efe49593640ea96b193339",
"timestamp": "",
"source": "github",
"line_count": 79,
"max_line_length": 98,
"avg_line_length": 27.468354430379748,
"alnum_prop": 0.616589861751152,
"repo_name": "gilesdring/homebrew-cask",
"id": "1df5c7188a0f58a7b80db9dff8800b77e7f9b4c6",
"size": "2170",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "test/cask/cli/list_test.rb",
"mode": "33188",
"license": "bsd-2-clause",
"language": [
{
"name": "Ruby",
"bytes": "2174158"
},
{
"name": "Shell",
"bytes": "70807"
}
],
"symlink_target": ""
} |
This is forked version of jcjohnson's [torch-rnn](https://github.com/jcjohnson/torch-rnn). Following changes were introduced:
* Implemented Pyphen-based syllabic prediction (thanks to [dreavjr](https://github.com/dreavjr) for his PyHyphen syllabic prediction implementation, on which I've based mine).
* Included [maraoz's](https://github.com/maraoz) changes to support UTF-8 encoded -start_text.
* Included [ChrisCummins](https://github.com/ChrisCummins) and [maraoz's](https://github.com/maraoz) patch for sample streaming.
* Included [guillitte's](https://github.com/guillitte) GRU cells implementation.
# torch-rnn
torch-rnn provides high-performance, reusable RNN and LSTM modules for torch7, and uses these modules for character-level
language modeling similar to [char-rnn](https://github.com/karpathy/char-rnn).
You can find documentation for the RNN and LSTM modules [here](doc/modules.md); they have no dependencies other than `torch`
and `nn`, so they should be easy to integrate into existing projects.
Compared to char-rnn, torch-rnn is up to **1.9x faster** and uses up to **7x less memory**. For more details see
the [Benchmark](#benchmarks) section below.
# Installation
## Docker Images
Cristian Baldi has prepared Docker images for both CPU-only mode and GPU mode;
you can [find them here](https://github.com/crisbal/docker-torch-rnn).
## System setup
You'll need to install the header files for Python 2.7 and the HDF5 library. On Ubuntu you should be able to install
like this:
```bash
sudo apt-get -y install python2.7-dev
sudo apt-get install libhdf5-dev
```
## Python setup
The preprocessing script is written in Python 2.7; its dependencies are in the file `requirements.txt`.
You can install these dependencies in a virtual environment like this:
```bash
virtualenv .env # Create the virtual environment
source .env/bin/activate # Activate the virtual environment
pip install -r requirements.txt # Install Python dependencies
# Work for a while ...
deactivate # Exit the virtual environment
```
## Lua setup
The main modeling code is written in Lua using [torch](http://torch.ch); you can find installation instructions
[here](http://torch.ch/docs/getting-started.html#_). You'll need the following Lua packages:
- [torch/torch7](https://github.com/torch/torch7)
- [torch/nn](https://github.com/torch/nn)
- [torch/optim](https://github.com/torch/optim)
- [lua-cjson](https://luarocks.org/modules/luarocks/lua-cjson)
- [torch-hdf5](https://github.com/deepmind/torch-hdf5)
After installing torch, you can install / update these packages by running the following:
```bash
# Install most things using luarocks
luarocks install torch
luarocks install nn
luarocks install optim
luarocks install lua-cjson
# We need to install torch-hdf5 from GitHub
git clone https://github.com/deepmind/torch-hdf5
cd torch-hdf5
luarocks make hdf5-0-0.rockspec
```
### CUDA support (Optional)
To enable GPU acceleration with CUDA, you'll need to install CUDA 6.5 or higher and the following Lua packages:
- [torch/cutorch](https://github.com/torch/cutorch)
- [torch/cunn](https://github.com/torch/cunn)
You can install / update them by running:
```bash
luarocks install cutorch
luarocks install cunn
```
## OpenCL support (Optional)
To enable GPU acceleration with OpenCL, you'll need to install the following Lua packages:
- [cltorch](https://github.com/hughperkins/cltorch)
- [clnn](https://github.com/hughperkins/clnn)
You can install / update them by running:
```bash
luarocks install cltorch
luarocks install clnn
```
## OSX Installation
Jeff Thompson has written a very detailed installation guide for OSX that you [can find here](http://www.jeffreythompson.org/blog/2016/03/25/torch-rnn-mac-install/).
# Usage
To train a model and use it to generate new text, you'll need to follow three simple steps:
## Step 1: Preprocess the data
You can use any text file for training models. Before training, you'll need to preprocess the data using the script
`scripts/preprocess.py`; this will generate an HDF5 file and JSON file containing a preprocessed version of the data.
If you have training data stored in `my_data.txt`, you can run the script like this:
```bash
python scripts/preprocess.py \
--input_txt my_data.txt \
--output_h5 my_data.h5 \
--output_json my_data.json
```
This will produce files `my_data.h5` and `my_data.json` that will be passed to the training script.
There are a few more flags you can use to configure preprocessing; [read about them here](doc/flags.md#preprocessing)
## Step 2: Train the model
After preprocessing the data, you'll need to train the model using the `train.lua` script. This will be the slowest step.
You can run the training script like this:
```bash
th train.lua -input_h5 my_data.h5 -input_json my_data.json
```
This will read the data stored in `my_data.h5` and `my_data.json`, run for a while, and save checkpoints to files with
names like `cv/checkpoint_1000.t7`.
You can change the RNN model type, hidden state size, and number of RNN layers like this:
```bash
th train.lua -input_h5 my_data.h5 -input_json my_data.json -model_type rnn -num_layers 3 -rnn_size 256
```
By default this will run in GPU mode using CUDA; to run in CPU-only mode, add the flag `-gpu -1`.
To run with OpenCL, add the flag `-gpu_backend opencl`.
There are many more flags you can use to configure training; [read about them here](doc/flags.md#training).
## Step 3: Sample from the model
After training a model, you can generate new text by sampling from it using the script `sample.lua`. Run it like this:
```bash
th sample.lua -checkpoint cv/checkpoint_10000.t7 -length 2000
```
This will load the trained checkpoint `cv/checkpoint_10000.t7` from the previous step, sample 2000 characters from it,
and print the results to the console.
By default the sampling script will run in GPU mode using CUDA; to run in CPU-only mode add the flag `-gpu -1` and
to run in OpenCL mode add the flag `-gpu_backend opencl`.
There are more flags you can use to configure sampling; [read about them here](doc/flags.md#sampling).
# Benchmarks
To benchmark `torch-rnn` against `char-rnn`, we use each to train LSTM language models for the tiny-shakespeare dataset
with 1, 2 or 3 layers and with an RNN size of 64, 128, 256, or 512. For each we use a minibatch size of 50, a sequence
length of 50, and no dropout. For each model size and for both implementations, we record the forward/backward times and
GPU memory usage over the first 100 training iterations, and use these measurements to compute the mean time and memory
usage.
All benchmarks were run on a machine with an Intel i7-4790k CPU, 32 GB main memory, and a Titan X GPU.
Below we show the forward/backward times for both implementations, as well as the mean speedup of `torch-rnn` over
`char-rnn`. We see that `torch-rnn` is faster than `char-rnn` at all model sizes, with smaller models giving a larger
speedup; for a single-layer LSTM with 128 hidden units, we achieve a **1.9x speedup**; for larger models we achieve about
a 1.4x speedup.
<img src='imgs/lstm_time_benchmark.png' width="800px">
Below we show the GPU memory usage for both implementations, as well as the mean memory saving of `torch-rnn` over
`char-rnn`. Again `torch-rnn` outperforms `char-rnn` at all model sizes, but here the savings become more significant for
larger models: for models with 512 hidden units, we use **7x less memory** than `char-rnn`.
<img src='imgs/lstm_memory_benchmark.png' width="800px">
# TODOs
- Get rid of Python / JSON / HDF5 dependencies?
| {
"content_hash": "d72e707eb9947db7ad30e4bdfd8a4cb4",
"timestamp": "",
"source": "github",
"line_count": 180,
"max_line_length": 175,
"avg_line_length": 42.361111111111114,
"alnum_prop": 0.7537049180327868,
"repo_name": "tmp6154/torch-rnn",
"id": "6ff0a4aa023ce7c2b311feb5853f90d85015653d",
"size": "7625",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "README.md",
"mode": "33188",
"license": "mit",
"language": [
{
"name": "Lua",
"bytes": "95485"
},
{
"name": "Python",
"bytes": "7656"
}
],
"symlink_target": ""
} |
RSpec.describe RuboCop::Cop::Naming::HeredocDelimiterCase, :config do
let(:config) do
RuboCop::Config.new(described_class.badge.to_s => cop_config)
end
context 'when enforced style is uppercase' do
let(:cop_config) do
{
'SupportedStyles' => %w[uppercase lowercase],
'EnforcedStyle' => 'uppercase'
}
end
context 'with an interpolated heredoc' do
it 'registers an offense and corrects with a lowercase delimiter' do
expect_offense(<<~RUBY)
<<-sql
foo
sql
^^^ Use uppercase heredoc delimiters.
RUBY
expect_correction(<<~RUBY)
<<-SQL
foo
SQL
RUBY
end
it 'registers an offense with a camel case delimiter' do
expect_offense(<<~RUBY)
<<-Sql
foo
Sql
^^^ Use uppercase heredoc delimiters.
RUBY
end
it 'does not register an offense with an uppercase delimiter' do
expect_no_offenses(<<~RUBY)
<<-SQL
foo
SQL
RUBY
end
end
context 'with a non-interpolated heredoc' do
context 'when using single quoted delimiters' do
it 'registers an offense and corrects with a lowercase delimiter' do
expect_offense(<<~RUBY)
<<-'sql'
foo
sql
^^^ Use uppercase heredoc delimiters.
RUBY
expect_correction(<<~RUBY)
<<-'SQL'
foo
SQL
RUBY
end
it 'registers an offense and corrects with a camel case delimiter' do
expect_offense(<<~RUBY)
<<-'Sql'
foo
Sql
^^^ Use uppercase heredoc delimiters.
RUBY
expect_correction(<<~RUBY)
<<-'SQL'
foo
SQL
RUBY
end
it 'does not register an offense with an uppercase delimiter' do
expect_no_offenses(<<~RUBY)
<<-'SQL'
foo
SQL
RUBY
end
end
context 'when using double quoted delimiters' do
it 'registers an offense and corrects with a lowercase delimiter' do
expect_offense(<<~RUBY)
<<-"sql"
foo
sql
^^^ Use uppercase heredoc delimiters.
RUBY
expect_correction(<<~RUBY)
<<-"SQL"
foo
SQL
RUBY
end
it 'registers an offense and corrects with a camel case delimiter' do
expect_offense(<<~RUBY)
<<-"Sql"
foo
Sql
^^^ Use uppercase heredoc delimiters.
RUBY
expect_correction(<<~RUBY)
<<-"SQL"
foo
SQL
RUBY
end
it 'does not register an offense with an uppercase delimiter' do
expect_no_offenses(<<~RUBY)
<<-"SQL"
foo
SQL
RUBY
end
end
context 'when using back tick delimiters' do
it 'registers an offense and corrects with a lowercase delimiter' do
expect_offense(<<~RUBY)
<<-`sql`
foo
sql
^^^ Use uppercase heredoc delimiters.
RUBY
expect_correction(<<~RUBY)
<<-`SQL`
foo
SQL
RUBY
end
it 'registers an offense and corrects with a camel case delimiter' do
expect_offense(<<~RUBY)
<<-`Sql`
foo
Sql
^^^ Use uppercase heredoc delimiters.
RUBY
expect_correction(<<~RUBY)
<<-`SQL`
foo
SQL
RUBY
end
it 'does not register an offense with an uppercase delimiter' do
expect_no_offenses(<<~RUBY)
<<-`SQL`
foo
SQL
RUBY
end
end
context 'when using non-word delimiters' do
it 'does not register an offense' do
expect_no_offenses(<<~RUBY)
<<-'+'
foo
+
RUBY
end
end
end
context 'with a squiggly heredoc' do
it 'registers an offense and corrects with a lowercase delimiter' do
expect_offense(<<~RUBY)
<<~sql
foo
sql
^^^ Use uppercase heredoc delimiters.
RUBY
expect_correction(<<~RUBY)
<<~SQL
foo
SQL
RUBY
end
it 'registers an offense and corrects with a camel case delimiter' do
expect_offense(<<~RUBY)
<<~Sql
foo
Sql
^^^ Use uppercase heredoc delimiters.
RUBY
expect_correction(<<~RUBY)
<<~SQL
foo
SQL
RUBY
end
it 'does not register an offense with an uppercase delimiter' do
expect_no_offenses(<<~RUBY)
<<~SQL
foo
SQL
RUBY
end
end
end
context 'when enforced style is lowercase' do
let(:cop_config) do
{
'SupportedStyles' => %w[uppercase lowercase],
'EnforcedStyle' => 'lowercase'
}
end
context 'with an interpolated heredoc' do
it 'does not register an offense with a lowercase delimiter' do
expect_no_offenses(<<~RUBY)
<<-sql
foo
sql
RUBY
end
it 'registers an offense and corrects with a camel case delimiter' do
expect_offense(<<~RUBY)
<<-Sql
foo
Sql
^^^ Use lowercase heredoc delimiters.
RUBY
expect_correction(<<~RUBY)
<<-sql
foo
sql
RUBY
end
it 'registers an offense and corrects with an uppercase delimiter' do
expect_offense(<<~RUBY)
<<-SQL
foo
SQL
^^^ Use lowercase heredoc delimiters.
RUBY
expect_correction(<<~RUBY)
<<-sql
foo
sql
RUBY
end
end
context 'with a non-interpolated heredoc' do
it 'does not register an offense with a lowercase delimiter' do
expect_no_offenses(<<~RUBY)
<<-'sql'
foo
sql
RUBY
end
it 'registers an offense and corrects with a camel case delimiter' do
expect_offense(<<~RUBY)
<<-'Sql'
foo
Sql
^^^ Use lowercase heredoc delimiters.
RUBY
expect_correction(<<~RUBY)
<<-'sql'
foo
sql
RUBY
end
it 'registers an offense and corrects with an uppercase delimiter' do
expect_offense(<<~RUBY)
<<-'SQL'
foo
SQL
^^^ Use lowercase heredoc delimiters.
RUBY
expect_correction(<<~RUBY)
<<-'sql'
foo
sql
RUBY
end
end
context 'with a squiggly heredoc' do
it 'does not register an offense with a lowercase delimiter' do
expect_no_offenses(<<~RUBY)
<<~sql
foo
sql
RUBY
end
it 'registers an offense and corrects with a camel case delimiter' do
expect_offense(<<~RUBY)
<<~Sql
foo
Sql
^^^ Use lowercase heredoc delimiters.
RUBY
expect_correction(<<~RUBY)
<<~sql
foo
sql
RUBY
end
it 'registers an offense and corrects with an uppercase delimiter' do
expect_offense(<<~RUBY)
<<~SQL
foo
SQL
^^^ Use lowercase heredoc delimiters.
RUBY
expect_correction(<<~RUBY)
<<~sql
foo
sql
RUBY
end
end
end
end
| {
"content_hash": "5583c063fedc93416646f9ffed74f548",
"timestamp": "",
"source": "github",
"line_count": 349,
"max_line_length": 77,
"avg_line_length": 22.92836676217765,
"alnum_prop": 0.4823794051487128,
"repo_name": "tdeo/rubocop",
"id": "7a4ed9a80c1035cda128913c2d3ff3890ee1e7cd",
"size": "8033",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "spec/rubocop/cop/naming/heredoc_delimiter_case_spec.rb",
"mode": "33188",
"license": "mit",
"language": [
{
"name": "CSS",
"bytes": "355"
},
{
"name": "HTML",
"bytes": "7109"
},
{
"name": "Ruby",
"bytes": "4762048"
},
{
"name": "Shell",
"bytes": "75"
}
],
"symlink_target": ""
} |
'use strict';
const fs = require('fs');
const path = require('path');
const winston = require('../lib/winston');
const filename = path.join(__dirname, 'created-logfile.log');
//
// Remove the file, ignoring any errors
//
try { fs.unlinkSync(filename); }
catch (ex) { }
//
// Create a new winston logger instance with two tranports: Console, and File
//
//
const logger = winston.createLogger({
transports: [
new winston.transports.Console(),
new winston.transports.File({ filename })
]
});
logger.log('info', 'Hello created log files!', { 'foo': 'bar' });
setTimeout(function () {
//
// Remove the file, ignoring any errors
//
try { fs.unlinkSync(filename); }
catch (ex) { }
}, 1000);
| {
"content_hash": "9d3b870f6fdf9dfe5f8796d1f2c82605",
"timestamp": "",
"source": "github",
"line_count": 34,
"max_line_length": 77,
"avg_line_length": 20.970588235294116,
"alnum_prop": 0.6451612903225806,
"repo_name": "winstonjs/winston",
"id": "6fd0e18b35fe669561a1b76da4920f89b02a876c",
"size": "713",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "examples/create-file.js",
"mode": "33188",
"license": "mit",
"language": [
{
"name": "JavaScript",
"bytes": "205816"
},
{
"name": "TypeScript",
"bytes": "1749"
}
],
"symlink_target": ""
} |
from __future__ import print_function
import numpy as np
class Classifier:
def __init__(self,subjectNodes,userNodes):
self.subjectNodes = subjectNodes
self.userNodes = userNodes
self.alpha = 0.6
def __classify__(self,attributeList):
for att in attributeList:
for subject in self.subjectNodes:
subject.__shiftFocus__(att)
#what alpha value would this subject need to get correct positive?
def __alphaPlot__(self,attributeList):
p = []
for alpha in np.arange(0,1.01,0.02):
print(alpha)
correct = 0
total = 0.
for i,subject in enumerate(self.subjectNodes):
a1,a2 = subject.__getAlphas__(attributeList)
if (a1 <= alpha) and (alpha <= a2):
correct += 1
total += 1
if i == 200:
break
p.append(correct/total)
return p
def __rocAnalyze__(self,attributeList):
inAlpha = []
exAlpha = []
for i,subject in enumerate(self.subjectNodes):
a1,a2 = subject.__getAlphas__(attributeList)
inAlpha.append(a1)
exAlpha.append(a2)
inAlpha.sort(reverse=True)
exAlpha.sort(reverse=True)
pEnumerated = list(enumerate(inAlpha))
nEnumerated = list(enumerate(exAlpha))
lx = [1]
ly = [1]
for alpha in np.arange(0,1.01,0.01):
found = False
for pIndex,pAlpha in pEnumerated:
if pAlpha <= alpha:
found = True
break
assert(found)
pPercent = pIndex/float(len(inAlpha))
found = False
for nIndex,nAlpha in nEnumerated:
if nAlpha <= alpha:
found = True
break
assert(found)
nPercent = nIndex/float(len(exAlpha))
lx.append(pPercent)
ly.append(nPercent)
return lx,ly | {
"content_hash": "f2196055d5bd5e89b90958102c36be5f",
"timestamp": "",
"source": "github",
"line_count": 84,
"max_line_length": 82,
"avg_line_length": 24.833333333333332,
"alnum_prop": 0.5067114093959731,
"repo_name": "camallen/aggregation",
"id": "f472561f1bcf1ec494e6bbed50620239b6f3ce22",
"size": "2086",
"binary": false,
"copies": "2",
"ref": "refs/heads/master",
"path": "experimental/graphicalClassification/attributeBased/majorityVote/MajorityVote.py",
"mode": "33188",
"license": "apache-2.0",
"language": [
{
"name": "C",
"bytes": "723"
},
{
"name": "Python",
"bytes": "1676640"
},
{
"name": "Scala",
"bytes": "629"
},
{
"name": "Shell",
"bytes": "95"
}
],
"symlink_target": ""
} |
<!-- Title of Post Form Input -->
<div class="form-group @if ($errors->has('title')) has-error @endif">
{!! Form::label('title', 'Title') !!}
{!! Form::text('title', null, ['class' => 'form-control', 'placeholder' => 'Title of Post']) !!}
@if ($errors->has('title')) <p class="help-block">{{ $errors->first('title') }}</p> @endif
</div>
<!-- Text body Form Input -->
<div class="form-group @if ($errors->has('body')) has-error @endif">
{!! Form::label('body', 'Body') !!}
{!! Form::textarea('body', null, ['class' => 'form-control ckeditor', 'placeholder' => 'Body of Post...']) !!}
@if ($errors->has('body')) <p class="help-block">{{ $errors->first('body') }}</p> @endif
</div>
@push('scripts')
<script src="//cdn.ckeditor.com/4.6.2/standard/ckeditor.js"></script>
@endpush | {
"content_hash": "32b81227d40d9705eaf622b6855cf762",
"timestamp": "",
"source": "github",
"line_count": 17,
"max_line_length": 114,
"avg_line_length": 47.05882352941177,
"alnum_prop": 0.5775,
"repo_name": "adsofmelk/art",
"id": "9d58d53a11c08ea7d63f9181e9c7ba429c6ba0e5",
"size": "800",
"binary": false,
"copies": "3",
"ref": "refs/heads/master",
"path": "resources/views/post/_form.blade.php",
"mode": "33261",
"license": "mit",
"language": [
{
"name": "ApacheConf",
"bytes": "553"
},
{
"name": "HTML",
"bytes": "363079"
},
{
"name": "PHP",
"bytes": "245748"
},
{
"name": "Shell",
"bytes": "159"
},
{
"name": "Vue",
"bytes": "563"
}
],
"symlink_target": ""
} |
//
// This file is part of nuBASIC
// Copyright (c) Antonino Calderone ([email protected])
// All rights reserved.
// Licensed under the MIT License.
// See COPYING file in the project root for full license information.
//
/* -------------------------------------------------------------------------- */
#include "nu_stmt_on_goto.h"
#include "nu_error_codes.h"
#include "nu_rt_prog_ctx.h"
/* -------------------------------------------------------------------------- */
namespace nu {
/* -------------------------------------------------------------------------- */
void stmt_on_goto_t::run(rt_prog_ctx_t& ctx)
{
rt_error_code_t::get_instance().throw_if(_label_list.empty(),
ctx.runtime_pc.get_line(), rt_error_code_t::value_t::E_NO_LABEL, "On ... Goto");
auto lbl_idx = _condition->eval(ctx);
rt_error_code_t::get_instance().throw_if(
!variable_t::is_integral(lbl_idx.get_type()), ctx.runtime_pc.get_line(),
rt_error_code_t::value_t::E_TYPE_ILLEGAL, "On ... Goto");
size_t idx = static_cast<size_t>(lbl_idx.to_int());
rt_error_code_t::get_instance().throw_if(
int(idx) < 0 || idx >= _label_list.size(), ctx.runtime_pc.get_line(),
rt_error_code_t::value_t::E_VAL_OUT_OF_RANGE,
"On " + nu::to_string(idx) + " Goto ...");
auto label = _label_list[idx];
rt_error_code_t::get_instance().throw_if(!ctx.prog_label.is_defined(label),
ctx.runtime_pc.get_line(), rt_error_code_t::value_t::E_LABEL_NOT_DEF,
"On ... Goto '" + label + "'");
const auto line_number = ctx.prog_label[label];
ctx.go_to(prog_pointer_t(line_number, 0));
}
/* -------------------------------------------------------------------------- */
} // namespace nu
| {
"content_hash": "1697cab7781c9c061a2abf3d36c962cc",
"timestamp": "",
"source": "github",
"line_count": 56,
"max_line_length": 88,
"avg_line_length": 31.375,
"alnum_prop": 0.5025611838360843,
"repo_name": "eantcal/nubasic",
"id": "b508d77884e0c0fa889670537dffbd9b9c2f4bf3",
"size": "1757",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "lib/nu_stmt_on_goto.cc",
"mode": "33188",
"license": "mit",
"language": [
{
"name": "Batchfile",
"bytes": "902"
},
{
"name": "C",
"bytes": "373293"
},
{
"name": "C++",
"bytes": "5114503"
},
{
"name": "CMake",
"bytes": "6444"
},
{
"name": "Classic ASP",
"bytes": "242"
},
{
"name": "D",
"bytes": "1012"
},
{
"name": "HTML",
"bytes": "1045902"
},
{
"name": "Lua",
"bytes": "240"
},
{
"name": "Makefile",
"bytes": "215051"
},
{
"name": "Nim",
"bytes": "1540"
},
{
"name": "Objective-C",
"bytes": "21747"
},
{
"name": "Objective-C++",
"bytes": "253754"
},
{
"name": "PHP",
"bytes": "380"
},
{
"name": "Perl",
"bytes": "12048"
},
{
"name": "Python",
"bytes": "215112"
},
{
"name": "QMake",
"bytes": "9347"
},
{
"name": "Raku",
"bytes": "18776"
},
{
"name": "Ruby",
"bytes": "126"
},
{
"name": "Shell",
"bytes": "1785"
},
{
"name": "Tcl",
"bytes": "356"
},
{
"name": "Visual Basic .NET",
"bytes": "584"
}
],
"symlink_target": ""
} |
package org.apache.samza.storage;
import java.io.File;
import org.apache.samza.container.SamzaContainerContext;
import org.apache.samza.metrics.MetricsRegistry;
import org.apache.samza.serializers.Serde;
import org.apache.samza.system.SystemStreamPartition;
import org.apache.samza.task.MessageCollector;
public class MockStorageEngineFactory implements StorageEngineFactory<Object, Object> {
@Override
public StorageEngine getStorageEngine(String storeName, File storeDir, Serde<Object> keySerde, Serde<Object> msgSerde,
MessageCollector collector, MetricsRegistry registry, SystemStreamPartition changeLogSystemStreamPartition,
SamzaContainerContext containerContext) {
StoreProperties storeProperties = new StoreProperties.StorePropertiesBuilder().setLoggedStore(true).build();
return new MockStorageEngine(storeName, storeDir, changeLogSystemStreamPartition, storeProperties);
}
}
| {
"content_hash": "ce483feb0ffeb71b80c5fad3e16c0d54",
"timestamp": "",
"source": "github",
"line_count": 21,
"max_line_length": 120,
"avg_line_length": 43.61904761904762,
"alnum_prop": 0.8307860262008734,
"repo_name": "InnovaCo/samza",
"id": "d483ae69fe0aaacf5135ff16072a2d655254afaf",
"size": "1723",
"binary": false,
"copies": "4",
"ref": "refs/heads/master",
"path": "samza-core/src/test/java/org/apache/samza/storage/MockStorageEngineFactory.java",
"mode": "33188",
"license": "apache-2.0",
"language": [
{
"name": "CSS",
"bytes": "4148"
},
{
"name": "HTML",
"bytes": "10645"
},
{
"name": "Java",
"bytes": "1062726"
},
{
"name": "Python",
"bytes": "37524"
},
{
"name": "Scala",
"bytes": "1105212"
},
{
"name": "Shell",
"bytes": "31438"
},
{
"name": "XSLT",
"bytes": "7116"
}
],
"symlink_target": ""
} |
package com.thinkgem.jeesite.test.web;
/**
* Created by mk on 2017/9/18.
*/
public class teee {
}
| {
"content_hash": "817d7559b4910e3e05b45728576b8245",
"timestamp": "",
"source": "github",
"line_count": 7,
"max_line_length": 38,
"avg_line_length": 14.428571428571429,
"alnum_prop": 0.6633663366336634,
"repo_name": "QQ85979512/jeesite-master",
"id": "14ae09c7db70df7353b904701acb30eeb77fa8de",
"size": "101",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "src/main/java/com/thinkgem/jeesite/test/web/teee.java",
"mode": "33188",
"license": "apache-2.0",
"language": [
{
"name": "ASP",
"bytes": "3753"
},
{
"name": "ApacheConf",
"bytes": "768"
},
{
"name": "Batchfile",
"bytes": "6110"
},
{
"name": "CSS",
"bytes": "943463"
},
{
"name": "HTML",
"bytes": "2574074"
},
{
"name": "Java",
"bytes": "1628331"
},
{
"name": "JavaScript",
"bytes": "8809000"
},
{
"name": "PHP",
"bytes": "8060"
},
{
"name": "PLSQL",
"bytes": "73251"
},
{
"name": "PLpgSQL",
"bytes": "4867"
}
],
"symlink_target": ""
} |
#import "TiBase.h"
#import "KrollBridge.h"
#import "KrollCallback.h"
#import "KrollObject.h"
#import "TiHost.h"
#import "TopTiModule.h"
#import "TiUtils.h"
#import "TiApp.h"
#import "ApplicationMods.h"
#import <libkern/OSAtomic.h>
#import "KrollContext.h"
#import "TiConsole.h"
#import "TiExceptionHandler.h"
#import "APSAnalytics.h"
#ifdef KROLL_COVERAGE
# include "KrollCoverage.h"
#endif
#ifdef TI_DEBUGGER_PROFILER
#import "TiDebugger.h"
#endif
extern BOOL const TI_APPLICATION_ANALYTICS;
extern NSString * const TI_APPLICATION_DEPLOYTYPE;
extern NSString * const TI_APPLICATION_GUID;
extern NSString * const TI_APPLICATION_BUILD_TYPE;
NSString * TitaniumModuleRequireFormat = @"(function(exports){"
"var __OXP=exports;var module={'exports':exports};var __dirname=\"%@\";var __filename=\"%@\";%@;\n"
"if(module.exports !== __OXP){return module.exports;}"
"return exports;})({})";
//Defined private method inside TiBindingRunLoop.m (Perhaps to move to .c?)
void TiBindingRunLoopAnnounceStart(TiBindingRunLoop runLoop);
@implementation TitaniumObject
-(NSDictionary*)modules
{
return modules;
}
-(id)initWithContext:(KrollContext*)context_ host:(TiHost*)host_ context:(id<TiEvaluator>)pageContext_ baseURL:(NSURL*)baseURL_
{
TopTiModule *module = [[[TopTiModule alloc] _initWithPageContext:pageContext_] autorelease];
[module setHost:host_];
[module _setBaseURL:baseURL_];
if (self = [super initWithTarget:module context:context_])
{
pageContext = pageContext_;
modules = [[NSMutableDictionary alloc] init];
host = [host_ retain];
[(KrollBridge *)pageContext_ registerProxy:module krollObject:self];
// pre-cache a few modules we always use
TiModule *ui = [host moduleNamed:@"UI" context:pageContext_];
[self addModule:@"UI" module:ui];
TiModule *api = [host moduleNamed:@"API" context:pageContext_];
[self addModule:@"API" module:api];
if (TI_APPLICATION_ANALYTICS)
{
APSAnalytics *sharedAnalytics = [APSAnalytics sharedInstance];
if (TI_APPLICATION_BUILD_TYPE != nil || (TI_APPLICATION_BUILD_TYPE.length > 0)) {
[sharedAnalytics performSelector:@selector(setBuildType:) withObject:TI_APPLICATION_BUILD_TYPE];
}
[sharedAnalytics performSelector:@selector(setSDKVersion:) withObject:[NSString stringWithFormat:@"ti.%@",[module performSelector:@selector(version)]]];
[sharedAnalytics enableWithAppKey:TI_APPLICATION_GUID andDeployType:TI_APPLICATION_DEPLOYTYPE];
}
}
return self;
}
#if KROLLBRIDGE_MEMORY_DEBUG==1
-(id)retain
{
NSLog(@"[MEMRORY DEBUG] RETAIN: %@ (%d)",self,[self retainCount]+1);
return [super retain];
}
-(oneway void)release
{
NSLog(@"[MEMORY DEBUG] RELEASE: %@ (%d)",self,[self retainCount]-1);
[super release];
}
#endif
-(void)dealloc
{
RELEASE_TO_NIL(host);
RELEASE_TO_NIL(modules);
RELEASE_TO_NIL(dynprops);
[super dealloc];
}
-(void)gc
{
}
-(id)valueForKey:(NSString *)key
{
// allow dynprops to override built-in modules
// in case you want to re-define them
if (dynprops!=nil)
{
id result = [dynprops objectForKey:key];
if (result!=nil)
{
if (result == [NSNull null])
{
return nil;
}
return result;
}
}
id module = [modules objectForKey:key];
if (module!=nil)
{
return module;
}
module = [host moduleNamed:key context:pageContext];
if (module!=nil)
{
return [self addModule:key module:module];
}
//go against module
return [super valueForKey:key];
}
-(void)setValue:(id)value forKey:(NSString *)key
{
if (dynprops==nil)
{
dynprops = [[NSMutableDictionary dictionary] retain];
}
if (value == nil)
{
value = [NSNull null];
}
[dynprops setValue:value forKey:key];
}
- (id) valueForUndefinedKey: (NSString *) key
{
if ([key isEqualToString:@"toString"] || [key isEqualToString:@"valueOf"])
{
return [self description];
}
if (dynprops != nil)
{
return [dynprops objectForKey:key];
}
//NOTE: we need to return nil here since in JS you can ask for properties
//that don't exist and it should return undefined, not an exception
return nil;
}
-(id)addModule:(NSString*)name module:(TiModule*)module
{
// Have we received a JS Module?
if (![module respondsToSelector:@selector(unboundBridge:)])
{
[modules setObject:module forKey:name];
return module;
}
KrollObject *ko = [pageContext registerProxy:module];
if (ko == nil)
{
return nil;
}
[self noteKrollObject:ko forKey:name];
[modules setObject:ko forKey:name];
return ko;
}
-(TiModule*)moduleNamed:(NSString*)name context:(id<TiEvaluator>)context
{
return [modules objectForKey:name];
}
@end
OSSpinLock krollBridgeRegistryLock = OS_SPINLOCK_INIT;
CFMutableSetRef krollBridgeRegistry = nil;
@implementation KrollBridge
+(void)initialize
{
if (krollBridgeRegistry == nil)
{
CFSetCallBacks doNotRetain = kCFTypeSetCallBacks;
doNotRetain.retain = NULL;
doNotRetain.release = NULL;
krollBridgeRegistry = CFSetCreateMutable(NULL, 3, &doNotRetain);
}
}
@synthesize currentURL;
-(void)registerForMemoryWarning
{
WARN_IF_BACKGROUND_THREAD_OBJ; //NSNotificationCenter is not threadsafe!
[[NSNotificationCenter defaultCenter] addObserver:self
selector:@selector(didReceiveMemoryWarning:)
name:UIApplicationDidReceiveMemoryWarningNotification
object:nil];
}
-(void)unregisterForMemoryWarning
{
WARN_IF_BACKGROUND_THREAD_OBJ; //NSNotificationCenter is not threadsafe!
[[NSNotificationCenter defaultCenter] removeObserver:self name:UIApplicationDidReceiveMemoryWarningNotification object:nil];
}
-(id)init
{
if (self = [super init])
{
#if KROLLBRIDGE_MEMORY_DEBUG==1
NSLog(@"[DEBUG] INIT: %@",self);
#endif
modules = [[NSMutableDictionary alloc] init];
proxyLock = OS_SPINLOCK_INIT;
OSSpinLockLock(&krollBridgeRegistryLock);
CFSetAddValue(krollBridgeRegistry, self);
OSSpinLockUnlock(&krollBridgeRegistryLock);
TiThreadPerformOnMainThread(^{[self registerForMemoryWarning];}, NO);
}
return self;
}
-(void)didReceiveMemoryWarning:(NSNotification*)notification
{
OSSpinLockLock(&proxyLock);
if (registeredProxies == NULL) {
OSSpinLockUnlock(&proxyLock);
[self gc];
return;
}
BOOL keepWarning = YES;
signed long proxiesCount = CFDictionaryGetCount(registeredProxies);
OSSpinLockUnlock(&proxyLock);
//During a memory panic, we may not get the chance to copy proxies.
while (keepWarning)
{
keepWarning = NO;
for (id proxy in (NSDictionary *)registeredProxies)
{
[proxy didReceiveMemoryWarning:notification];
OSSpinLockLock(&proxyLock);
if (registeredProxies == NULL) {
OSSpinLockUnlock(&proxyLock);
break;
}
signed long newCount = CFDictionaryGetCount(registeredProxies);
OSSpinLockUnlock(&proxyLock);
if (newCount != proxiesCount)
{
proxiesCount = newCount;
keepWarning = YES;
break;
}
}
}
[self gc];
}
#if KROLLBRIDGE_MEMORY_DEBUG==1
-(id)retain
{
NSLog(@"[MEMORY DEBUG] RETAIN: %@ (%d)",self,[self retainCount]+1);
return [super retain];
}
-(oneway void)release
{
NSLog(@"[MEMORY DEBUG] RELEASE: %@ (%d)",self,[self retainCount]-1);
[super release];
}
#endif
-(void)removeProxies
{
OSSpinLockLock(&proxyLock);
CFDictionaryRef oldProxies = registeredProxies;
registeredProxies = NULL;
OSSpinLockUnlock(&proxyLock);
for (id thisProxy in (NSDictionary *)oldProxies)
{
KrollObject * thisKrollObject = (id)CFDictionaryGetValue(oldProxies, thisProxy);
[thisProxy contextShutdown:self];
[thisKrollObject unprotectJsobject];
}
if (oldProxies != NULL)
{
CFRelease(oldProxies);
}
for (NSString * thisModuleKey in modules) {
id thisModule = [modules objectForKey:thisModuleKey];
if ([thisModule respondsToSelector:@selector(unprotectJsobject)]) {
[thisModule unprotectJsobject];
}
}
RELEASE_TO_NIL(modules);
}
-(void)dealloc
{
#if KROLLBRIDGE_MEMORY_DEBUG==1
NSLog(@"[MEMORY DEBUG] DEALLOC: %@",self);
#endif
[self removeProxies];
RELEASE_TO_NIL(preload);
RELEASE_TO_NIL(context);
RELEASE_TO_NIL(titanium);
OSSpinLockLock(&krollBridgeRegistryLock);
CFSetRemoveValue(krollBridgeRegistry, self);
OSSpinLockUnlock(&krollBridgeRegistryLock);
[super dealloc];
}
- (TiHost*)host
{
return host;
}
- (KrollContext*) krollContext
{
return context;
}
- (id)preloadForKey:(id)key name:(id)name
{
if (preload!=nil)
{
NSDictionary* dict = [preload objectForKey:name];
if (dict!=nil)
{
return [dict objectForKey:key];
}
}
return nil;
}
- (void)boot:(id)callback url:(NSURL*)url_ preload:(NSDictionary*)preload_
{
preload = [preload_ retain];
[super boot:callback url:url_ preload:preload_];
context = [[KrollContext alloc] init];
context.delegate = self;
[context start];
}
- (void)evalJSWithoutResult:(NSString*)code
{
[context evalJS:code];
}
// NOTE: this must only be called on the JS thread or an exception will be raised
- (id)evalJSAndWait:(NSString*)code
{
return [context evalJSAndWait:code];
}
-(BOOL)evaluationError
{
return evaluationError;
}
- (void)evalFileOnThread:(NSString*)path context:(KrollContext*)context_
{
NSAutoreleasePool* pool = [[NSAutoreleasePool alloc] init];
NSError *error = nil;
TiValueRef exception = NULL;
TiContextRef jsContext = [context_ context];
NSURL *url_ = [path hasPrefix:@"file:"] ? [NSURL URLWithString:path] : [NSURL fileURLWithPath:path];
if (![path hasPrefix:@"/"] && ![path hasPrefix:@"file:"])
{
url_ = [NSURL URLWithString:path relativeToURL:url];
}
NSString *jcode = nil;
if ([url_ isFileURL])
{
NSData *data = [TiUtils loadAppResource:url_];
if (data==nil)
{
jcode = [NSString stringWithContentsOfFile:[url_ path] encoding:NSUTF8StringEncoding error:&error];
}
else
{
jcode = [[[NSString alloc] initWithData:data encoding:NSUTF8StringEncoding] autorelease];
}
}
else
{
jcode = [NSString stringWithContentsOfURL:url_ encoding:NSUTF8StringEncoding error:&error];
}
if (error!=nil)
{
NSLog(@"[ERROR] Error loading path: %@, %@",path,error);
evaluationError = YES;
TiScriptError *scriptError = nil;
// check for file not found a give a friendlier message
if ([error code]==260 && [error domain]==NSCocoaErrorDomain) {
scriptError = [[TiScriptError alloc] initWithMessage:[NSString stringWithFormat:@"Could not find the file %@",[path lastPathComponent]] sourceURL:nil lineNo:0];
} else {
scriptError = [[TiScriptError alloc] initWithMessage:[NSString stringWithFormat:@"Error loading script %@. %@",[path lastPathComponent],[error description]] sourceURL:nil lineNo:0];
}
[[TiExceptionHandler defaultExceptionHandler] reportScriptError:scriptError];
[scriptError release];
return;
}
const char *urlCString = [[url_ absoluteString] UTF8String];
TiStringRef jsCode = TiStringCreateWithCFString((CFStringRef) jcode);
TiStringRef jsURL = TiStringCreateWithUTF8CString(urlCString);
// validate script
if (![TI_APPLICATION_DEPLOYTYPE isEqualToString:@"production"]) {
TiCheckScriptSyntax(jsContext,jsCode,jsURL,1,&exception);
}
// only continue if we don't have any exceptions from above
if (exception == NULL) {
#ifdef TI_DEBUGGER_PROFILER
if ([[self host] debugMode]) {
TiDebuggerBeginScript(context_,urlCString);
}
#endif
TiEvalScript(jsContext, jsCode, NULL, jsURL, 1, &exception);
#ifdef TI_DEBUGGER_PROFILER
if ([[self host] debugMode]) {
TiDebuggerEndScript(context_);
}
#endif
if (exception == NULL) {
evaluationError = NO;
}
}
if (exception != NULL) {
id excm = [KrollObject toID:context value:exception];
evaluationError = YES;
[[TiExceptionHandler defaultExceptionHandler] reportScriptError:[TiUtils scriptErrorValue:excm]];
}
TiStringRelease(jsCode);
TiStringRelease(jsURL);
[pool release];
}
- (void)evalFile:(NSString*)path callback:(id)callback selector:(SEL)selector
{
[context invokeOnThread:self method:@selector(evalFileOnThread:context:) withObject:path callback:callback selector:selector];
}
- (void)evalFile:(NSString *)file
{
[context invokeOnThread:self method:@selector(evalFileOnThread:context:) withObject:file condition:nil];
}
- (void)fireEvent:(id)listener withObject:(id)obj remove:(BOOL)yn thisObject:(TiProxy*)thisObject_
{
if (![listener isKindOfClass:[KrollCallback class]])
{
DebugLog(@"[ERROR] Listener callback is of a non-supported type: %@",[listener class]);
return;
}
KrollEvent *event = [[KrollEvent alloc] initWithCallback:listener eventObject:obj thisObject:thisObject_];
[context enqueue:event];
[event release];
}
-(void)enqueueEvent:(NSString*)type forProxy:(TiProxy *)proxy withObject:(id)obj
{
KrollObject* eventKrollObject = [self krollObjectForProxy:proxy];
KrollEvent * newEvent = [[KrollEvent alloc]
initWithType:type
ForKrollObject:eventKrollObject
eventObject:obj
thisObject:eventKrollObject];
[context enqueue:newEvent];
[newEvent release];
}
-(void)shutdown:(NSCondition*)condition
{
#if KROLLBRIDGE_MEMORY_DEBUG==1
NSLog(@"[MEMORY DEBUG] DESTROY: %@",self);
#endif
if (shutdown==NO)
{
shutdownCondition = [condition retain];
shutdown = YES;
// fire a notification event to our listeners
WARN_IF_BACKGROUND_THREAD_OBJ; //NSNotificationCenter is not threadsafe!
NSNotification *notification = [NSNotification notificationWithName:kTiContextShutdownNotification object:self];
[[NSNotificationCenter defaultCenter] postNotification:notification];
[context stop];
}
else
{
[condition lock];
[condition signal];
[condition unlock];
}
}
-(void)gc
{
[context gc];
[titanium gc];
}
#pragma mark Delegate
-(void)willStartNewContext:(KrollContext*)kroll
{
[self retain]; // Hold onto ourselves as long as the context needs us
}
-(void)didStartNewContext:(KrollContext*)kroll
{
// create Titanium global object
NSAutoreleasePool* pool = [[NSAutoreleasePool alloc] init];
// Load the "Titanium" object into the global scope
NSString *basePath = (url==nil) ? [TiHost resourcePath] : [[[url path] stringByDeletingLastPathComponent] stringByAppendingPathComponent:@"."];
titanium = [[TitaniumObject alloc] initWithContext:kroll host:host context:self baseURL:[NSURL fileURLWithPath:basePath]];
TiContextRef jsContext = [kroll context];
TiValueRef tiRef = [KrollObject toValue:kroll value:titanium];
NSString *titaniumNS = [NSString stringWithFormat:@"T%sanium","it"];
TiStringRef prop = TiStringCreateWithCFString((CFStringRef) titaniumNS);
TiStringRef prop2 = TiStringCreateWithCFString((CFStringRef) [NSString stringWithFormat:@"%si","T"]);
TiObjectRef globalRef = TiContextGetGlobalObject(jsContext);
TiObjectSetProperty(jsContext, globalRef, prop, tiRef,
kTiPropertyAttributeDontDelete | kTiPropertyAttributeDontEnum,
NULL);
TiObjectSetProperty(jsContext, globalRef, prop2, tiRef,
kTiPropertyAttributeDontDelete | kTiPropertyAttributeDontEnum,
NULL);
TiStringRelease(prop);
TiStringRelease(prop2);
// Load the "console" object into the global scope
console = [[KrollObject alloc] initWithTarget:[[[TiConsole alloc] _initWithPageContext:self] autorelease] context:kroll];
prop = TiStringCreateWithCFString((CFStringRef)@"console");
TiObjectSetProperty(jsContext, globalRef, prop, [KrollObject toValue:kroll value:console], kTiPropertyAttributeNone, NULL);
//if we have a preload dictionary, register those static key/values into our namespace
if (preload!=nil)
{
for (NSString *name in preload)
{
KrollObject *ti = (KrollObject*)[titanium valueForKey:name];
NSDictionary *values = [preload valueForKey:name];
for (id key in values)
{
id target = [values objectForKey:key];
KrollObject *ko = [self krollObjectForProxy:target];
if (ko==nil)
{
ko = [self registerProxy:target];
}
[ti noteKrollObject:ko forKey:key];
[ti setStaticValue:ko forKey:key purgable:NO];
}
}
//We need to run this before the app.js, which means it has to be here.
TiBindingRunLoopAnnounceStart(kroll);
[self evalFile:[url path] callback:self selector:@selector(booted)];
}
else
{
// now load the app.js file and get started
NSURL *startURL = [host startURL];
//We need to run this before the app.js, which means it has to be here.
TiBindingRunLoopAnnounceStart(kroll);
[self evalFile:[startURL absoluteString] callback:self selector:@selector(booted)];
}
[pool release];
}
-(void)willStopNewContext:(KrollContext*)kroll
{
if (shutdown==NO)
{
shutdown = YES;
// fire a notification event to our listeners
WARN_IF_BACKGROUND_THREAD_OBJ; //NSNotificationCenter is not threadsafe!
NSNotification *notification = [NSNotification notificationWithName:kTiContextShutdownNotification object:self];
[[NSNotificationCenter defaultCenter] postNotification:notification];
}
[titanium gc];
if (shutdownCondition)
{
[shutdownCondition lock];
[shutdownCondition signal];
[shutdownCondition unlock];
RELEASE_TO_NIL(shutdownCondition);
}
}
-(void)didStopNewContext:(KrollContext*)kroll
{
TiThreadPerformOnMainThread(^{[self unregisterForMemoryWarning];}, NO);
[self removeProxies];
RELEASE_TO_NIL(titanium);
RELEASE_TO_NIL(console);
RELEASE_TO_NIL(context);
RELEASE_TO_NIL(preload);
[self autorelease]; // Safe to release now that the context is done
}
-(void)registerProxy:(id)proxy krollObject:(KrollObject *)ourKrollObject
{
OSSpinLockLock(&proxyLock);
if (registeredProxies==NULL)
{
registeredProxies = CFDictionaryCreateMutable(NULL, 10, &kCFTypeDictionaryKeyCallBacks, &kCFTypeDictionaryValueCallBacks);
}
//NOTE: Do NOT treat registeredProxies like a mutableDictionary; mutable dictionaries copy keys,
//CFMutableDictionaryRefs only retain keys, which lets them work with proxies properly.
CFDictionaryAddValue(registeredProxies, proxy, ourKrollObject);
OSSpinLockUnlock(&proxyLock);
[proxy boundBridge:self withKrollObject:ourKrollObject];
}
- (id)registerProxy:(id)proxy
{
KrollObject * ourKrollObject = [self krollObjectForProxy:proxy];
if (ourKrollObject != nil)
{
return ourKrollObject;
}
if (![context isKJSThread])
{
return nil;
}
#ifdef KROLL_COVERAGE
ourKrollObject = [[KrollCoverageObject alloc] initWithTarget:proxy context:context];
#else
ourKrollObject = [[KrollObject alloc] initWithTarget:proxy context:context];
#endif
[self registerProxy:proxy krollObject:ourKrollObject];
return [ourKrollObject autorelease];
}
- (void)unregisterProxy:(id)proxy
{
OSSpinLockLock(&proxyLock);
if (registeredProxies != NULL)
{
CFDictionaryRemoveValue(registeredProxies, proxy);
//Don't bother with removing the empty registry. It's small and leaves on dealloc anyways.
}
OSSpinLockUnlock(&proxyLock);
[proxy unboundBridge:self];
}
- (BOOL)usesProxy:(id)proxy
{
if (proxy == nil)
{
return NO;
}
BOOL result=NO;
OSSpinLockLock(&proxyLock);
if (registeredProxies != NULL)
{
result = (CFDictionaryGetCountOfKey(registeredProxies, proxy) != 0);
}
OSSpinLockUnlock(&proxyLock);
return result;
}
- (id)krollObjectForProxy:(id)proxy
{
id result=nil;
OSSpinLockLock(&proxyLock);
if (registeredProxies != NULL)
{
result = (id)CFDictionaryGetValue(registeredProxies, proxy);
}
OSSpinLockUnlock(&proxyLock);
return result;
}
-(id)loadCommonJSModule:(NSString*)code withSourceURL:(NSURL *)sourceURL
{
// This takes care of resolving paths like `../../foo.js`
sourceURL = [NSURL fileURLWithPath:[[sourceURL path] stringByStandardizingPath]];
// Get the relative path to the Resources directory
NSString *relativePath = [sourceURL path];
relativePath = [relativePath stringByReplacingOccurrencesOfString:[[[NSBundle mainBundle] resourceURL] path] withString:@""];
relativePath = [[relativePath substringFromIndex:1] stringByDeletingLastPathComponent];
NSString *dirname = [relativePath length] == 0 ? @"." : relativePath;
/*
* This is for parity with android, if the file is located in the Resources, then __dirname returns "."
* otherwise the __dirname returns the folder names separated by "/"
* for example:
* "/Resources/constants.js" __dirname = "."
* "/Resources/views/login/window.js" __dirname = "views/login"
*/
NSString *filename = [sourceURL lastPathComponent];
NSString *js = [[NSString alloc] initWithFormat:TitaniumModuleRequireFormat, dirname, filename,code];
/* This most likely should be integrated with normal code flow, but to
* minimize impact until a in-depth reconsideration of KrollContext can be
* done, we should have as little footprint
*/
KrollEval *eval = [[KrollEval alloc] initWithCode:js sourceURL:sourceURL startingLineNo:1];
TiValueRef exception = NULL;
TiValueRef resultRef = [eval jsInvokeInContext:context exception:&exception];
[js release];
[eval release];
if (exception != NULL) {
id excm = [KrollObject toID:context value:exception];
[[TiExceptionHandler defaultExceptionHandler] reportScriptError:[TiUtils scriptErrorValue:excm]];
return nil;
}
/*
* In order to work around the underlying issue of TIMOB-2392, we must
* use KrollWrapper as a JS wrapper instead of converting it to a proxy
*/
KrollWrapper * result = [[KrollWrapper alloc] init];
[result setBridge:self];
[result setJsobject:(TiObjectRef)resultRef];
[result protectJsobject];
return [result autorelease];
}
-(NSString*)pathToModuleClassName:(NSString*)path
{
//TODO: switch to use ApplicationMods
NSArray *tokens = [path componentsSeparatedByString:@"."];
NSMutableString *modulename = [NSMutableString string];
for (NSString *token in tokens)
{
[modulename appendFormat:@"%@%@",[[token substringToIndex:1] uppercaseString],[token substringFromIndex:1]];
}
[modulename appendString:@"Module"];
return modulename;
}
-(id)require:(KrollContext*)kroll path:(NSString*)path
{
TiModule* module = nil;
NSData *data = nil;
NSString *filepath = nil;
NSString* fullPath = nil;
NSURL* oldURL = [self currentURL];
// Check the position of the first '/', which will give some information
// about resource resolution and if the path is absolute.
//
// TODO: This violates commonjs 1.1 and there is some ongoing discussion about whether or not
// it should make a path absolute.
NSString* workingPath = [oldURL relativePath];
fullPath = [path hasPrefix:@"/"]?[path substringFromIndex:1]:path;
NSString* moduleID = nil;
NSString* leadingComponent = [[fullPath pathComponents] objectAtIndex:0];
BOOL isAbsolute = !([leadingComponent isEqualToString:@"."] || [leadingComponent isEqualToString:@".."]);
if (isAbsolute) {
moduleID = [[fullPath pathComponents] objectAtIndex:0];
}
else {
fullPath = (workingPath != nil) ?
[[workingPath stringByAppendingPathComponent:[fullPath stringByStandardizingPath]] stringByStandardizingPath] :
[fullPath stringByStandardizingPath];
moduleID = [[fullPath pathComponents] objectAtIndex:0];
}
// Now that we have the full path, we can check and see if the module was loaded,
// and return it if available.
if (modules!=nil)
{
module = [modules objectForKey:fullPath];
if (module!=nil)
{
return module;
}
}
NSRange separatorLocation = [fullPath rangeOfString:@"/"];
NSString* moduleClassName = [self pathToModuleClassName:moduleID];
Class moduleClass = NSClassFromString(moduleClassName);
if (moduleClass != nil) {
// We have a module to load resources from! Now we need to determine if
// it's a base module (which should be cached) or a pure JS resource
// stored on the module.
module = [modules objectForKey:moduleID];
if (module == nil) {
module = [[moduleClass alloc] _initWithPageContext:self];
[module setHost:host];
[module _setName:moduleClassName];
[modules setObject:module forKey:moduleID];
[module autorelease];
}
// TODO: Support package.json 'main' file identifier which will load instead
// of module JS. Currently neither iOS nor Android support package information.
if (separatorLocation.location == NSNotFound) { // Indicates toplevel module
loadNativeJS:
if ([module isJSModule]) {
data = [module moduleJS];
}
[self setCurrentURL:[NSURL URLWithString:fullPath relativeToURL:[[self host] baseURL]]];
}
else {
NSString* assetPath = [fullPath substringFromIndex:separatorLocation.location+1];
// Handle the degenerate case (supported by MW) where we're loading
// module.id/module.id, which should resolve to module.id and mixin.
// Rather than create a utility method for this (or C&P if native loading changes)
// we use a goto to jump into the if block above.
if ([assetPath isEqualToString:moduleID]) {
goto loadNativeJS;
}
NSString* filepath = [assetPath stringByAppendingString:@".js"];
data = [module loadModuleAsset:filepath];
// Have to reset module so that this code doesn't get mixed in and is loaded as pure JS
module = nil;
}
if (data == nil && isAbsolute) {
// We may have an absolute URL which tried to load from a module instead of a directory. Fix
// the fullpath back to the right value, so we can try again.
fullPath = [path hasPrefix:@"/"]?[path substringFromIndex:1]:path;
}
else if (data != nil) {
// Set the current URL; it should be the fullPath relative to the host's base URL.
[self setCurrentURL:[NSURL URLWithString:[fullPath stringByDeletingLastPathComponent] relativeToURL:[[self host] baseURL]]];
}
}
if (data==nil)
{
filepath = [fullPath stringByAppendingString:@".js"];
NSURL* url_ = [NSURL URLWithString:filepath relativeToURL:[[self host] baseURL]];
data = [TiUtils loadAppResource:url_];
if (data == nil) {
data = [NSData dataWithContentsOfURL:url_];
}
if (data != nil) {
[self setCurrentURL:[NSURL URLWithString:[fullPath stringByDeletingLastPathComponent] relativeToURL:[[self host] baseURL]]];
}
}
// we found data, now create the common js module proxy
if (data!=nil)
{
NSString* urlPath = (filepath != nil) ? filepath : fullPath;
NSURL *url_ = [TiHost resourceBasedURL:urlPath baseURL:NULL];
KrollWrapper* wrapper = nil;
#ifdef TI_DEBUGGER_PROFILER
const char *urlCString = [[url_ absoluteString] UTF8String];
if ([[self host] debugMode] && ![module isJSModule]) {
TiDebuggerBeginScript([self krollContext],urlCString);
}
#endif
NSString * dataContents = [[NSString alloc] initWithData:data encoding:NSUTF8StringEncoding];
wrapper = [self loadCommonJSModule:dataContents withSourceURL:url_];
[dataContents release];
#ifdef TI_DEBUGGER_PROFILER
if ([[self host] debugMode] && ![module isJSModule]) {
TiDebuggerEndScript([self krollContext]);
}
#endif
if (![wrapper respondsToSelector:@selector(replaceValue:forKey:notification:)]) {
[self setCurrentURL:oldURL];
@throw [NSException exceptionWithName:@"org.appcelerator.kroll"
reason:[NSString stringWithFormat:@"Module \"%@\" failed to leave a valid exports object",path]
userInfo:nil];
}
// register the module if it's pure JS
if (module == nil) {
module = (id)wrapper;
[modules setObject:module forKey:fullPath];
if (filepath!=nil && module!=nil)
{
// uri is optional but we point it to where we loaded it
[module replaceValue:[NSString stringWithFormat:@"app://%@",filepath] forKey:@"uri" notification:NO];
}
}
else {
// For right now, we need to mix any compiled JS on top of a compiled module, so that both components
// are accessible. We store the exports object and then put references to its properties on the toplevel
// object.
TiContextRef jsContext = [[self krollContext] context];
TiObjectRef jsObject = [wrapper jsobject];
KrollObject* moduleObject = [module krollObjectForContext:[self krollContext]];
[moduleObject noteObject:jsObject forTiString:kTiStringExportsKey context:jsContext];
TiPropertyNameArrayRef properties = TiObjectCopyPropertyNames(jsContext, jsObject);
size_t count = TiPropertyNameArrayGetCount(properties);
for (size_t i=0; i < count; i++) {
// Mixin the property onto the module JS object if it's not already there
TiStringRef propertyName = TiPropertyNameArrayGetNameAtIndex(properties, i);
if (!TiObjectHasProperty(jsContext, [moduleObject jsobject], propertyName)) {
TiValueRef property = TiObjectGetProperty(jsContext, jsObject, propertyName, NULL);
TiObjectSetProperty([[self krollContext] context], [moduleObject jsobject], propertyName, property, kTiPropertyAttributeReadOnly, NULL);
}
}
TiPropertyNameArrayRelease(properties);
}
}
[self setCurrentURL:oldURL];
if (module!=nil)
{
// spec says you must have a read-only id property - we don't
// currently support readonly in kroll so this is probably OK for now
[module replaceValue:path forKey:@"id" notification:NO];
return module;
}
@throw [NSException exceptionWithName:@"org.appcelerator.kroll" reason:[NSString stringWithFormat:@"Couldn't find module: %@",path] userInfo:nil];
}
+ (NSArray *)krollBridgesUsingProxy:(id)proxy
{
NSMutableArray * results = nil;
OSSpinLockLock(&krollBridgeRegistryLock);
signed long bridgeCount = CFSetGetCount(krollBridgeRegistry);
KrollBridge * registryObjects[bridgeCount];
CFSetGetValues(krollBridgeRegistry, (const void **)registryObjects);
for (int currentBridgeIndex = 0; currentBridgeIndex < bridgeCount; currentBridgeIndex++)
{
KrollBridge * currentBridge = registryObjects[currentBridgeIndex];
if (![currentBridge usesProxy:proxy])
{
continue;
}
if (results == nil)
{
results = [NSMutableArray arrayWithObject:currentBridge];
continue;
}
[results addObject:currentBridge];
}
//Why do we wait so long? In case someone tries to dealloc the krollBridge while we're looking at it.
//registryObjects nor the registry does a retain here!
OSSpinLockUnlock(&krollBridgeRegistryLock);
return results;
}
+ (NSArray *)krollContexts
{
OSSpinLockLock(&krollBridgeRegistryLock);
signed long bridgeCount = CFSetGetCount(krollBridgeRegistry);
KrollBridge * registryObjects[bridgeCount];
CFSetGetValues(krollBridgeRegistry, (const void **)registryObjects);
NSMutableArray *results = [[NSMutableArray alloc] initWithCapacity:0];
for (NSUInteger currentBridgeIndex = 0; currentBridgeIndex < bridgeCount; ++currentBridgeIndex) {
KrollBridge *bridge = registryObjects[currentBridgeIndex];
[results addObject:bridge.krollContext];
}
OSSpinLockUnlock(&krollBridgeRegistryLock);
return [results autorelease];
}
+ (BOOL)krollBridgeExists:(KrollBridge *)bridge
{
if(bridge == nil)
{
return NO;
}
bool result=NO;
OSSpinLockLock(&krollBridgeRegistryLock);
signed long bridgeCount = CFSetGetCount(krollBridgeRegistry);
KrollBridge * registryObjects[bridgeCount];
CFSetGetValues(krollBridgeRegistry, (const void **)registryObjects);
for (int currentBridgeIndex = 0; currentBridgeIndex < bridgeCount; currentBridgeIndex++)
{
KrollBridge * currentBridge = registryObjects[currentBridgeIndex];
if (currentBridge == bridge)
{
result = YES;
break;
}
}
//Why not CFSetContainsValue? Because bridge may not be a valid pointer, and SetContainsValue
//will ask it for a hash!
OSSpinLockUnlock(&krollBridgeRegistryLock);
return result;
}
+ (KrollBridge *)krollBridgeForThreadName:(NSString *)threadName;
{
if(threadName == nil)
{
return nil;
}
KrollBridge * result=nil;
OSSpinLockLock(&krollBridgeRegistryLock);
signed long bridgeCount = CFSetGetCount(krollBridgeRegistry);
KrollBridge * registryObjects[bridgeCount];
CFSetGetValues(krollBridgeRegistry, (const void **)registryObjects);
for (int currentBridgeIndex = 0; currentBridgeIndex < bridgeCount; currentBridgeIndex++)
{
KrollBridge * currentBridge = registryObjects[currentBridgeIndex];
if ([[[currentBridge krollContext] threadName] isEqualToString:threadName])
{
result = [[currentBridge retain] autorelease];
break;
}
}
OSSpinLockUnlock(&krollBridgeRegistryLock);
return result;
}
-(int)forceGarbageCollectNow;
{
[context gc];
//Actually forcing garbage collect now will cause a deadlock.
return 0;
}
-(BOOL)shouldDebugContext
{
return [[self host] debugMode];
}
- (BOOL)shouldProfileContext
{
return [[self host] profileMode];
}
@end | {
"content_hash": "5dc60cb0119f5313769d8ad22d4df0a3",
"timestamp": "",
"source": "github",
"line_count": 1098,
"max_line_length": 184,
"avg_line_length": 30.636612021857925,
"alnum_prop": 0.6967507952079431,
"repo_name": "pinnamur/titanium_mobile",
"id": "6d6008631136b087426f2bfd6ac032fd39aab124",
"size": "33876",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "iphone/Classes/KrollBridge.m",
"mode": "33188",
"license": "apache-2.0",
"language": [
{
"name": "C",
"bytes": "188070"
},
{
"name": "C#",
"bytes": "80533"
},
{
"name": "C++",
"bytes": "202887"
},
{
"name": "CSS",
"bytes": "19521"
},
{
"name": "Java",
"bytes": "2550087"
},
{
"name": "JavaScript",
"bytes": "4575134"
},
{
"name": "Makefile",
"bytes": "7605"
},
{
"name": "Objective-C",
"bytes": "3397775"
},
{
"name": "Objective-C++",
"bytes": "8560"
},
{
"name": "PHP",
"bytes": "17988"
},
{
"name": "Perl",
"bytes": "12759"
},
{
"name": "Python",
"bytes": "1844919"
},
{
"name": "Shell",
"bytes": "28070"
}
],
"symlink_target": ""
} |
"""
Written by Nathan Fritz and Lance Stout. Copyright 2011 by &yet, LLC.
Released under the terms of the MIT License
"""
import time
import uuid
try:
import queue
except ImportError:
import Queue as queue
from thoonk.exceptions import *
import redis.exceptions
class Feed(object):
"""
A Thoonk feed is a collection of items ordered by publication date.
The collection may either be bounded or unbounded in size. A bounded
feed is created by adding the field 'max_length' to the configuration
with a value greater than 0.
Attributes:
thoonk -- The main Thoonk object.
redis -- A Redis connection instance from the Thoonk object.
feed -- The name of the feed.
Redis Keys Used:
feed.ids:[feed] -- A sorted set of item IDs.
feed.items:[feed] -- A hash table of items keyed by ID.
feed.publish:[feed] -- A pubsub channel for publication notices.
feed.publishes:[feed] -- A counter for number of published items.
feed.retract:[feed] -- A pubsub channel for retraction notices.
feed.config:[feed] -- A JSON string of configuration data.
feed.edit:[feed] -- A pubsub channel for edit notices.
Thoonk.py Implementation API:
get_channels -- Return the standard pubsub channels for this feed.
event_publish -- Process publication events.
event_retract -- Process item retraction events.
delete_feed -- Delete the feed and its contents.
get_schemas -- Return the set of Redis keys used by this feed.
Thoonk Standard API:
get_ids -- Return the IDs of all items in the feed.
get_item -- Return a single item from the feed given its ID.
get_all -- Return all items in the feed.
publish -- Publish a new item to the feed, or edit an existing item.
retract -- Remove an item from the feed.
"""
def __init__(self, thoonk, feed):
"""
Create a new Feed object for a given Thoonk feed.
Note: More than one Feed objects may be create for the same
Thoonk feed, and creating a Feed object does not
automatically generate the Thoonk feed itself.
Arguments:
thoonk -- The main Thoonk object.
feed -- The name of the feed.
config -- Optional dictionary of configuration values.
"""
self.thoonk = thoonk
self.redis = thoonk.redis
self.feed = feed
self.feed_ids = 'feed.ids:%s' % feed
self.feed_items = 'feed.items:%s' % feed
self.feed_publish = 'feed.publish:%s' % feed
self.feed_publishes = 'feed.publishes:%s' % feed
self.feed_retract = 'feed.retract:%s' % feed
self.feed_config = 'feed.config:%s' % feed
self.feed_edit = 'feed.edit:%s' % feed
# Thoonk.py Implementation API
# =================================================================
def get_channels(self):
"""
Return the Redis key channels for publishing and retracting items.
"""
return (self.feed_publish, self.feed_retract, self.feed_edit)
def event_publish(self, id, value):
"""
Process an item published event.
Meant to be overridden.
Arguments:
id -- The ID of the published item.
value -- The content of the published item.
"""
pass
def event_retract(self, id):
"""
Process an item retracted event.
Meant to be overridden.
Arguments:
id -- The ID of the retracted item.
"""
pass
def delete_feed(self):
"""Delete the feed and its contents."""
self.thoonk.delete_feed(self.feed)
def get_schemas(self):
"""Return the set of Redis keys used exclusively by this feed."""
return set((self.feed_ids, self.feed_items, self.feed_publish,
self.feed_publishes, self.feed_retract, self.feed_config,
self.feed_edit))
# Thoonk Standard API
# =================================================================
def get_ids(self):
"""Return the set of IDs used by items in the feed."""
return self.redis.zrange(self.feed_ids, 0, -1)
def get_item(self, id=None):
"""
Retrieve a single item from the feed.
Arguments:
id -- The ID of the item to retrieve.
"""
if id is None:
self.redis.hget(self.feed_items,
self.redis.lindex(self.feed_ids, 0))
else:
return self.redis.hget(self.feed_items, id)
def get_all(self):
"""Return all items from the feed."""
return self.redis.hgetall(self.feed_items)
def publish(self, item, id=None):
"""
Publish an item to the feed, or replace an existing item.
Newly published items will be at the top of the feed, while
edited items will remain in their original order.
If the feed has a max length, then the oldest entries will
be removed to maintain the maximum length.
Arguments:
item -- The content of the item to add to the feed.
id -- Optional ID to use for the item, if the ID already
exists, the existing item will be replaced.
"""
publish_id = id
if publish_id is None:
publish_id = uuid.uuid4().hex
def _publish(pipe):
max = int(pipe.hget(self.feed_config, "max_length") or 0)
if max > 0:
delete_ids = pipe.zrange(self.feed_ids, 0, -max)
pipe.multi()
for id in delete_ids:
if id != publish_id:
pipe.zrem(self.feed_ids, id)
pipe.hdel(self.feed_items, id)
self.thoonk._publish(self.feed_retract, (id,), pipe)
else:
pipe.multi()
pipe.zadd(self.feed_ids, **{publish_id: time.time()})
pipe.incr(self.feed_publishes)
pipe.hset(self.feed_items, publish_id, item)
results = self.redis.transaction(_publish, self.feed_ids)
if results[-3]:
# If zadd was successful
self.thoonk._publish(self.feed_publish, (publish_id, item))
else:
self.thoonk._publish(self.feed_edit, (publish_id, item))
return publish_id
def retract(self, id):
"""
Remove an item from the feed.
Arguments:
id -- The ID value of the item to remove.
"""
def _retract(pipe):
if pipe.zrank(self.feed_ids, id) is not None:
pipe.multi()
pipe.zrem(self.feed_ids, id)
pipe.hdel(self.feed_items, id)
self.thoonk._publish(self.feed_retract, (id,), pipe)
self.redis.transaction(_retract, self.feed_ids)
| {
"content_hash": "d1b3e928823c5b8d87595859a2de09c2",
"timestamp": "",
"source": "github",
"line_count": 204,
"max_line_length": 77,
"avg_line_length": 34.53431372549019,
"alnum_prop": 0.5635202271114266,
"repo_name": "andyet/thoonk.py",
"id": "bf40de93bc7e5e1818d4f475108b50cc265800dc",
"size": "7045",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "thoonk/feeds/feed.py",
"mode": "33188",
"license": "mit",
"language": [
{
"name": "Python",
"bytes": "89130"
}
],
"symlink_target": ""
} |
package net.sf.jabref.logic.importer.fetcher;
import java.io.FileNotFoundException;
import java.io.IOException;
import java.net.MalformedURLException;
import java.net.URL;
import java.nio.charset.StandardCharsets;
import java.util.Optional;
import net.sf.jabref.logic.formatter.bibtexfields.UnitsToLatexFormatter;
import net.sf.jabref.logic.formatter.casechanger.ProtectTermsFormatter;
import net.sf.jabref.logic.importer.ImportFormatPreferences;
import net.sf.jabref.logic.importer.ParserResult;
import net.sf.jabref.logic.importer.fileformat.BibtexParser;
import net.sf.jabref.logic.l10n.Localization;
import net.sf.jabref.logic.net.URLDownload;
import net.sf.jabref.logic.util.DOI;
import net.sf.jabref.model.entry.BibEntry;
import net.sf.jabref.model.entry.FieldName;
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
public class DOItoBibTeX {
private static final Log LOGGER = LogFactory.getLog(DOItoBibTeX.class);
private static final ProtectTermsFormatter protectTermsFormatter = new ProtectTermsFormatter();
private static final UnitsToLatexFormatter unitsToLatexFormatter = new UnitsToLatexFormatter();
public static Optional<BibEntry> getEntryFromDOI(String doiStr, ImportFormatPreferences importFormatPreferences) {
return getEntryFromDOI(doiStr, null, importFormatPreferences);
}
public static Optional<BibEntry> getEntryFromDOI(String doiStr, ParserResult parserResult,
ImportFormatPreferences importFormatPreferences) {
Optional<DOI> doi = DOI.build(doiStr);
if (!doi.isPresent()) {
if (parserResult != null) {
parserResult.addWarning(Localization.lang("Invalid DOI: '%0'.", doiStr));
}
return Optional.empty();
}
try {
URL doiURL = new URL(doi.get().getURIAsASCIIString());
// BibTeX data
URLDownload download = new URLDownload(doiURL);
download.addParameters("Accept", "application/x-bibtex");
String bibtexString = download.downloadToString(StandardCharsets.UTF_8);
bibtexString = cleanupEncoding(bibtexString);
// BibTeX entry
BibEntry entry = BibtexParser.singleFromString(bibtexString, importFormatPreferences);
if (entry == null) {
return Optional.empty();
}
// Optionally re-format BibTeX entry
formatTitleField(entry, importFormatPreferences);
return Optional.of(entry);
} catch (MalformedURLException e) {
LOGGER.warn("Bad DOI URL", e);
return Optional.empty();
} catch (FileNotFoundException e) {
if (parserResult != null) {
parserResult.addWarning(Localization.lang("Unknown DOI: '%0'.", doi.get().getDOI()));
}
LOGGER.debug("Unknown DOI", e);
return Optional.empty();
} catch (IOException e) {
LOGGER.warn("Communication problems", e);
return Optional.empty();
}
}
private static void formatTitleField(BibEntry entry, ImportFormatPreferences importFormatPreferences) {
// Optionally add curly brackets around key words to keep the case
entry.getFieldOptional(FieldName.TITLE).ifPresent(title -> {
// Unit formatting
if (importFormatPreferences.isConvertUnitsOnSearch()) {
title = unitsToLatexFormatter.format(title);
}
// Case keeping
if (importFormatPreferences.isUseCaseKeeperOnSearch()) {
title = protectTermsFormatter.format(title);
}
entry.setField(FieldName.TITLE, title);
});
}
private static String cleanupEncoding(String bibtex) {
// Usually includes an en-dash in the page range. Char is in cp1252 but not
// ISO 8859-1 (which is what latex expects). For convenience replace here.
return bibtex.replaceAll("(pages=\\{[0-9]+)\u2013([0-9]+\\})", "$1--$2");
}
}
| {
"content_hash": "05d27cad3dd2c13bfc8e6c3ee63bc613",
"timestamp": "",
"source": "github",
"line_count": 103,
"max_line_length": 118,
"avg_line_length": 39.601941747572816,
"alnum_prop": 0.6695268448149057,
"repo_name": "motokito/jabref",
"id": "45ade5bda400f1efb66c6ceb1a65bc38f0e62db3",
"size": "4079",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "src/main/java/net/sf/jabref/logic/importer/fetcher/DOItoBibTeX.java",
"mode": "33188",
"license": "mit",
"language": [
{
"name": "ANTLR",
"bytes": "1625"
},
{
"name": "GAP",
"bytes": "1492"
},
{
"name": "Java",
"bytes": "5872387"
},
{
"name": "Perl",
"bytes": "9622"
},
{
"name": "Python",
"bytes": "6952"
},
{
"name": "Ruby",
"bytes": "1115"
},
{
"name": "Shell",
"bytes": "3120"
},
{
"name": "TeX",
"bytes": "142898"
}
],
"symlink_target": ""
} |
"use strict";
var drinkreviews,
DrinkReview = require("../../models/drinkReview");
// Reused by all routes
function respond(res, result) {
var code = result.success ? 200 : 500;
res.status(code).json(result);
}
function findById(req, res) {
DrinkReview.findById(req.params, respond.bind(null, res));
}
function add(req, res) {
DrinkReview.add(req.body, respond.bind(null, res));
}
function remove(req, res) {
var info = req.body;
info.drid = req.param("drid");
DrinkReview.remove(info, respond.bind(null, res));
}
function update(req, res) {
var info = req.body;
info.drid = req.param("drid");
DrinkReview.update(info, respond.bind(null, res));
}
function findAll(req, res) {
DrinkReview.findAll({}, respond.bind(null, res));
}
drinkreviews = {
findById: findById,
findAll: findAll,
add: add,
update: update,
remove: remove
};
module.exports = drinkreviews;
| {
"content_hash": "e81ea7ec4db9a9b01d4c5d4891f077c0",
"timestamp": "",
"source": "github",
"line_count": 44,
"max_line_length": 62,
"avg_line_length": 21.25,
"alnum_prop": 0.6556149732620321,
"repo_name": "rcruz/whiskey-app",
"id": "4e0bc2809706cf1b76c517f9cc9ab852023592ab",
"size": "935",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "api/routes/1/drinkreviews.js",
"mode": "33188",
"license": "mit",
"language": [
{
"name": "JavaScript",
"bytes": "49556"
},
{
"name": "Shell",
"bytes": "386"
}
],
"symlink_target": ""
} |
var lang = require('cssauron-falafel')
, falafel = require('falafel')
, through = require('through')
var test_file_rex = /\.test\.js$/
, is_require_pass
is_require_pass = lang(
'call > id[name=suite]:first-child + literal ' +
'~ function > id[name=require]'
)
module.exports = transform
function transform(file) {
if(!test_file_rex.test(file)) {
return through()
}
var tr = through(write, end)
, data = ''
return tr
function write(buf) {
data += buf
}
function end() {
this.queue('module.exports = function () {\n')
this.queue('' + falafel(data, process_function))
this.queue('\n}')
this.queue(null)
}
function process_function(node) {
if(is_require_pass(node)) {
node.update('')
}
}
}
| {
"content_hash": "98974b8598e0faff97e1f3a6e86c96a1",
"timestamp": "",
"source": "github",
"line_count": 41,
"max_line_length": 52,
"avg_line_length": 18.804878048780488,
"alnum_prop": 0.5992217898832685,
"repo_name": "urbanairship/drive.js",
"id": "5ee1842fb63dfe9fded6012aa3ee584abc9f210c",
"size": "771",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "lib/test_transform.js",
"mode": "33188",
"license": "mit",
"language": [
{
"name": "CSS",
"bytes": "1070"
},
{
"name": "HTML",
"bytes": "1087"
},
{
"name": "JavaScript",
"bytes": "71097"
}
],
"symlink_target": ""
} |
<?php
declare(strict_types=1);
namespace Edde\Service\Validator;
use Edde\Validator\IValidatorManager;
trait ValidatorManager {
/** @var IValidatorManager */
protected $validatorManager;
/**
* @param IValidatorManager $validatorManager
*/
public function injectValidatorManager(IValidatorManager $validatorManager): void {
$this->validatorManager = $validatorManager;
}
}
| {
"content_hash": "b48ca16ee29334873b2ccc4f86ea23c5",
"timestamp": "",
"source": "github",
"line_count": 18,
"max_line_length": 87,
"avg_line_length": 23,
"alnum_prop": 0.717391304347826,
"repo_name": "edde-framework/edde",
"id": "726c005054c7f51671c593f280ecb09410014227",
"size": "414",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "src/Edde/Service/Validator/ValidatorManager.php",
"mode": "33188",
"license": "apache-2.0",
"language": [
{
"name": "Dockerfile",
"bytes": "255"
},
{
"name": "PHP",
"bytes": "407159"
},
{
"name": "Shell",
"bytes": "421"
}
],
"symlink_target": ""
} |
#ifndef itkLabelShapeKeepNObjectsImageFilter_h
#define itkLabelShapeKeepNObjectsImageFilter_h
#include "itkShapeLabelObject.h"
#include "itkLabelImageToLabelMapFilter.h"
#include "itkShapeLabelMapFilter.h"
#include "itkShapeKeepNObjectsLabelMapFilter.h"
#include "itkLabelMapToLabelImageFilter.h"
namespace itk
{
/** \class LabelShapeKeepNObjectsImageFilter
* \brief keep N objects according to their shape attributes
*
* LabelShapeKeepNObjectsImageFilter keep the N objects in a labeled image
* with the highest (or lowest) attribute value. The attributes are the ones
* of the ShapeLabelObject.
*
* \author Gaetan Lehmann. Biologie du Developpement et de la Reproduction, INRA de Jouy-en-Josas, France.
*
* This implementation was taken from the Insight Journal paper:
* https://hdl.handle.net/1926/584 or
* http://www.insight-journal.org/browse/publication/176
*
* \sa ShapeLabelObject, BinaryShapeKeepNObjectsImageFilter, LabelStatisticsKeepNObjectsImageFilter
* \ingroup ImageEnhancement MathematicalMorphologyImageFilters
* \ingroup ITKLabelMap
*
* \wiki
* \wikiexample{ImageProcessing/LabelShapeKeepNObjectsImageFilter,Keep only regions that rank above a certain level of a particular property}
* \endwiki
*/
template< typename TInputImage >
class ITK_TEMPLATE_EXPORT LabelShapeKeepNObjectsImageFilter:
public ImageToImageFilter< TInputImage, TInputImage >
{
public:
/** Standard class typedefs. */
typedef LabelShapeKeepNObjectsImageFilter Self;
typedef ImageToImageFilter< TInputImage, TInputImage > Superclass;
typedef SmartPointer< Self > Pointer;
typedef SmartPointer< const Self > ConstPointer;
/** Some convenient typedefs. */
typedef TInputImage InputImageType;
typedef TInputImage OutputImageType;
typedef typename InputImageType::Pointer InputImagePointer;
typedef typename InputImageType::ConstPointer InputImageConstPointer;
typedef typename InputImageType::RegionType InputImageRegionType;
typedef typename InputImageType::PixelType InputImagePixelType;
typedef typename OutputImageType::Pointer OutputImagePointer;
typedef typename OutputImageType::ConstPointer OutputImageConstPointer;
typedef typename OutputImageType::RegionType OutputImageRegionType;
typedef typename OutputImageType::PixelType OutputImagePixelType;
/** ImageDimension constants */
itkStaticConstMacro(InputImageDimension, unsigned int,
TInputImage::ImageDimension);
itkStaticConstMacro(OutputImageDimension, unsigned int,
TInputImage::ImageDimension);
itkStaticConstMacro(ImageDimension, unsigned int,
TInputImage::ImageDimension);
typedef ShapeLabelObject< InputImagePixelType, itkGetStaticConstMacro(ImageDimension) > LabelObjectType;
typedef LabelMap< LabelObjectType > LabelMapType;
typedef LabelImageToLabelMapFilter< InputImageType, LabelMapType > LabelizerType;
typedef Image< typename OutputImageType::PixelType,
itkGetStaticConstMacro(OutputImageDimension) > ShapeLabelFilterOutput;
typedef ShapeLabelMapFilter< LabelMapType,
ShapeLabelFilterOutput > LabelObjectValuatorType;
typedef typename LabelObjectType::AttributeType AttributeType;
typedef ShapeKeepNObjectsLabelMapFilter< LabelMapType > KeepNObjectsType;
typedef LabelMapToLabelImageFilter< LabelMapType, OutputImageType > BinarizerType;
/** Standard New method. */
itkNewMacro(Self);
/** Runtime information support. */
itkTypeMacro(LabelShapeKeepNObjectsImageFilter,
ImageToImageFilter);
#ifdef ITK_USE_CONCEPT_CHECKING
// Begin concept checking
itkConceptMacro( InputEqualityComparableCheck,
( Concept::EqualityComparable< InputImagePixelType > ) );
itkConceptMacro( IntConvertibleToInputCheck,
( Concept::Convertible< int, InputImagePixelType > ) );
itkConceptMacro( InputOStreamWritableCheck,
( Concept::OStreamWritable< InputImagePixelType > ) );
// End concept checking
#endif
/**
* Set/Get the value used as "background" in the output image.
* Defaults to NumericTraits<PixelType>::NonpositiveMin().
*/
itkSetMacro(BackgroundValue, OutputImagePixelType);
itkGetConstMacro(BackgroundValue, OutputImagePixelType);
/**
* Set/Get the number of objects to keep
*/
itkGetConstMacro(NumberOfObjects, SizeValueType);
itkSetMacro(NumberOfObjects, SizeValueType);
/**
* Set/Get the ordering of the objects. By default, the ones with the
* highest value are kept. Turming ReverseOrdering to true make this filter
* keep the objects with the smallest values
*/
itkGetConstMacro(ReverseOrdering, bool);
itkSetMacro(ReverseOrdering, bool);
itkBooleanMacro(ReverseOrdering);
/**
* Set/Get the attribute to use to select the object to keep. The default
* is "Size".
*/
itkGetConstMacro(Attribute, AttributeType);
itkSetMacro(Attribute, AttributeType);
void SetAttribute(const std::string & s)
{
this->SetAttribute( LabelObjectType::GetAttributeFromName(s) );
}
protected:
LabelShapeKeepNObjectsImageFilter();
~LabelShapeKeepNObjectsImageFilter() {}
void PrintSelf(std::ostream & os, Indent indent) const ITK_OVERRIDE;
/** LabelShapeKeepNObjectsImageFilter needs the entire input be
* available. Thus, it needs to provide an implementation of
* GenerateInputRequestedRegion(). */
void GenerateInputRequestedRegion() ITK_OVERRIDE;
/** LabelShapeKeepNObjectsImageFilter will produce the entire output. */
void EnlargeOutputRequestedRegion( DataObject *itkNotUsed(output) ) ITK_OVERRIDE;
/** Single-threaded version of GenerateData. This filter delegates
* to GrayscaleGeodesicErodeImageFilter. */
void GenerateData() ITK_OVERRIDE;
private:
ITK_DISALLOW_COPY_AND_ASSIGN(LabelShapeKeepNObjectsImageFilter);
OutputImagePixelType m_BackgroundValue;
SizeValueType m_NumberOfObjects;
bool m_ReverseOrdering;
AttributeType m_Attribute;
}; // end of class
} // end namespace itk
#ifndef ITK_MANUAL_INSTANTIATION
#include "itkLabelShapeKeepNObjectsImageFilter.hxx"
#endif
#endif
| {
"content_hash": "b4464d42c113d2d80f3734b462c4e161",
"timestamp": "",
"source": "github",
"line_count": 158,
"max_line_length": 141,
"avg_line_length": 40.74050632911393,
"alnum_prop": 0.7371446325928227,
"repo_name": "PlutoniumHeart/ITK",
"id": "b53630749ef786ce8564096dd027c4eb65e2731f",
"size": "7212",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "Modules/Filtering/LabelMap/include/itkLabelShapeKeepNObjectsImageFilter.h",
"mode": "33188",
"license": "apache-2.0",
"language": [
{
"name": "Batchfile",
"bytes": "306"
},
{
"name": "C",
"bytes": "30635310"
},
{
"name": "C++",
"bytes": "47011599"
},
{
"name": "CMake",
"bytes": "2183114"
},
{
"name": "CSS",
"bytes": "24960"
},
{
"name": "DIGITAL Command Language",
"bytes": "709"
},
{
"name": "Fortran",
"bytes": "2260380"
},
{
"name": "HTML",
"bytes": "208777"
},
{
"name": "Io",
"bytes": "1833"
},
{
"name": "Java",
"bytes": "28598"
},
{
"name": "Lex",
"bytes": "6948"
},
{
"name": "Makefile",
"bytes": "267990"
},
{
"name": "Objective-C",
"bytes": "43946"
},
{
"name": "Objective-C++",
"bytes": "6591"
},
{
"name": "OpenEdge ABL",
"bytes": "85244"
},
{
"name": "Perl",
"bytes": "18085"
},
{
"name": "Python",
"bytes": "939926"
},
{
"name": "Ruby",
"bytes": "296"
},
{
"name": "Shell",
"bytes": "131549"
},
{
"name": "Tcl",
"bytes": "74786"
},
{
"name": "XSLT",
"bytes": "195448"
},
{
"name": "Yacc",
"bytes": "20591"
}
],
"symlink_target": ""
} |
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<!-- NewPage -->
<html lang="en">
<head>
<meta http-equiv="Content-Type" content="text/html" charset="UTF-8">
<title>Uses of Class org.apache.commons.collections4.bidimap.AbstractOrderedBidiMapDecorator (Apache Commons Collections 4.1 API)</title>
<link rel="stylesheet" type="text/css" href="../../../../../../stylesheet.css" title="Style">
</head>
<body>
<script type="text/javascript"><!--
if (location.href.indexOf('is-external=true') == -1) {
parent.document.title="Uses of Class org.apache.commons.collections4.bidimap.AbstractOrderedBidiMapDecorator (Apache Commons Collections 4.1 API)";
}
//-->
</script>
<noscript>
<div>JavaScript is disabled on your browser.</div>
</noscript>
<!-- ========= START OF TOP NAVBAR ======= -->
<div class="topNav"><a name="navbar_top">
<!-- -->
</a><a href="#skip-navbar_top" title="Skip navigation links"></a><a name="navbar_top_firstrow">
<!-- -->
</a>
<ul class="navList" title="Navigation">
<li><a href="../../../../../../overview-summary.html">Overview</a></li>
<li><a href="../package-summary.html">Package</a></li>
<li><a href="../../../../../../org/apache/commons/collections4/bidimap/AbstractOrderedBidiMapDecorator.html" title="class in org.apache.commons.collections4.bidimap">Class</a></li>
<li class="navBarCell1Rev">Use</li>
<li><a href="../package-tree.html">Tree</a></li>
<li><a href="../../../../../../deprecated-list.html">Deprecated</a></li>
<li><a href="../../../../../../index-all.html">Index</a></li>
<li><a href="../../../../../../help-doc.html">Help</a></li>
</ul>
</div>
<div class="subNav">
<ul class="navList">
<li>Prev</li>
<li>Next</li>
</ul>
<ul class="navList">
<li><a href="../../../../../../index.html?org/apache/commons/collections4/bidimap/class-use/AbstractOrderedBidiMapDecorator.html" target="_top">Frames</a></li>
<li><a href="AbstractOrderedBidiMapDecorator.html" target="_top">No Frames</a></li>
</ul>
<ul class="navList" id="allclasses_navbar_top">
<li><a href="../../../../../../allclasses-noframe.html">All Classes</a></li>
</ul>
<div>
<script type="text/javascript"><!--
allClassesLink = document.getElementById("allclasses_navbar_top");
if(window==top) {
allClassesLink.style.display = "block";
}
else {
allClassesLink.style.display = "none";
}
//-->
</script>
</div>
<a name="skip-navbar_top">
<!-- -->
</a></div>
<!-- ========= END OF TOP NAVBAR ========= -->
<div class="header">
<h2 title="Uses of Class org.apache.commons.collections4.bidimap.AbstractOrderedBidiMapDecorator" class="title">Uses of Class<br>org.apache.commons.collections4.bidimap.AbstractOrderedBidiMapDecorator</h2>
</div>
<div class="classUseContainer">
<ul class="blockList">
<li class="blockList">
<table border="0" cellpadding="3" cellspacing="0" summary="Use table, listing packages, and an explanation">
<caption><span>Packages that use <a href="../../../../../../org/apache/commons/collections4/bidimap/AbstractOrderedBidiMapDecorator.html" title="class in org.apache.commons.collections4.bidimap">AbstractOrderedBidiMapDecorator</a></span><span class="tabEnd"> </span></caption>
<tr>
<th class="colFirst" scope="col">Package</th>
<th class="colLast" scope="col">Description</th>
</tr>
<tbody>
<tr class="altColor">
<td class="colFirst"><a href="#org.apache.commons.collections4.bidimap">org.apache.commons.collections4.bidimap</a></td>
<td class="colLast">
<div class="block">This package contains implementations of the
<a href="../../../../../../org/apache/commons/collections4/BidiMap.html" title="interface in org.apache.commons.collections4"><code>BidiMap</code></a>,
<a href="../../../../../../org/apache/commons/collections4/OrderedBidiMap.html" title="interface in org.apache.commons.collections4"><code>OrderedBidiMap</code></a> and
<a href="../../../../../../org/apache/commons/collections4/SortedBidiMap.html" title="interface in org.apache.commons.collections4"><code>SortedBidiMap</code></a> interfaces.</div>
</td>
</tr>
</tbody>
</table>
</li>
<li class="blockList">
<ul class="blockList">
<li class="blockList"><a name="org.apache.commons.collections4.bidimap">
<!-- -->
</a>
<h3>Uses of <a href="../../../../../../org/apache/commons/collections4/bidimap/AbstractOrderedBidiMapDecorator.html" title="class in org.apache.commons.collections4.bidimap">AbstractOrderedBidiMapDecorator</a> in <a href="../../../../../../org/apache/commons/collections4/bidimap/package-summary.html">org.apache.commons.collections4.bidimap</a></h3>
<table border="0" cellpadding="3" cellspacing="0" summary="Use table, listing subclasses, and an explanation">
<caption><span>Subclasses of <a href="../../../../../../org/apache/commons/collections4/bidimap/AbstractOrderedBidiMapDecorator.html" title="class in org.apache.commons.collections4.bidimap">AbstractOrderedBidiMapDecorator</a> in <a href="../../../../../../org/apache/commons/collections4/bidimap/package-summary.html">org.apache.commons.collections4.bidimap</a></span><span class="tabEnd"> </span></caption>
<tr>
<th class="colFirst" scope="col">Modifier and Type</th>
<th class="colLast" scope="col">Class and Description</th>
</tr>
<tbody>
<tr class="altColor">
<td class="colFirst"><code>class </code></td>
<td class="colLast"><code><strong><a href="../../../../../../org/apache/commons/collections4/bidimap/AbstractSortedBidiMapDecorator.html" title="class in org.apache.commons.collections4.bidimap">AbstractSortedBidiMapDecorator</a><K,V></strong></code>
<div class="block">Provides a base decorator that enables additional functionality to be added
to a SortedBidiMap via decoration.</div>
</td>
</tr>
<tr class="rowColor">
<td class="colFirst"><code>class </code></td>
<td class="colLast"><code><strong><a href="../../../../../../org/apache/commons/collections4/bidimap/UnmodifiableOrderedBidiMap.html" title="class in org.apache.commons.collections4.bidimap">UnmodifiableOrderedBidiMap</a><K,V></strong></code>
<div class="block">Decorates another <a href="../../../../../../org/apache/commons/collections4/OrderedBidiMap.html" title="interface in org.apache.commons.collections4"><code>OrderedBidiMap</code></a> to ensure it can't be altered.</div>
</td>
</tr>
<tr class="altColor">
<td class="colFirst"><code>class </code></td>
<td class="colLast"><code><strong><a href="../../../../../../org/apache/commons/collections4/bidimap/UnmodifiableSortedBidiMap.html" title="class in org.apache.commons.collections4.bidimap">UnmodifiableSortedBidiMap</a><K,V></strong></code>
<div class="block">Decorates another <a href="../../../../../../org/apache/commons/collections4/SortedBidiMap.html" title="interface in org.apache.commons.collections4"><code>SortedBidiMap</code></a> to ensure it can't be altered.</div>
</td>
</tr>
</tbody>
</table>
</li>
</ul>
</li>
</ul>
</div>
<!-- ======= START OF BOTTOM NAVBAR ====== -->
<div class="bottomNav"><a name="navbar_bottom">
<!-- -->
</a><a href="#skip-navbar_bottom" title="Skip navigation links"></a><a name="navbar_bottom_firstrow">
<!-- -->
</a>
<ul class="navList" title="Navigation">
<li><a href="../../../../../../overview-summary.html">Overview</a></li>
<li><a href="../package-summary.html">Package</a></li>
<li><a href="../../../../../../org/apache/commons/collections4/bidimap/AbstractOrderedBidiMapDecorator.html" title="class in org.apache.commons.collections4.bidimap">Class</a></li>
<li class="navBarCell1Rev">Use</li>
<li><a href="../package-tree.html">Tree</a></li>
<li><a href="../../../../../../deprecated-list.html">Deprecated</a></li>
<li><a href="../../../../../../index-all.html">Index</a></li>
<li><a href="../../../../../../help-doc.html">Help</a></li>
</ul>
</div>
<div class="subNav">
<ul class="navList">
<li>Prev</li>
<li>Next</li>
</ul>
<ul class="navList">
<li><a href="../../../../../../index.html?org/apache/commons/collections4/bidimap/class-use/AbstractOrderedBidiMapDecorator.html" target="_top">Frames</a></li>
<li><a href="AbstractOrderedBidiMapDecorator.html" target="_top">No Frames</a></li>
</ul>
<ul class="navList" id="allclasses_navbar_bottom">
<li><a href="../../../../../../allclasses-noframe.html">All Classes</a></li>
</ul>
<div>
<script type="text/javascript"><!--
allClassesLink = document.getElementById("allclasses_navbar_bottom");
if(window==top) {
allClassesLink.style.display = "block";
}
else {
allClassesLink.style.display = "none";
}
//-->
</script>
</div>
<a name="skip-navbar_bottom">
<!-- -->
</a></div>
<!-- ======== END OF BOTTOM NAVBAR ======= -->
<p class="legalCopy"><small>Copyright © 2001–2015 <a href="http://www.apache.org/">The Apache Software Foundation</a>. All rights reserved.</small></p>
</body>
</html>
| {
"content_hash": "3b77be0e247bd618e8c3e61e23667e85",
"timestamp": "",
"source": "github",
"line_count": 175,
"max_line_length": 413,
"avg_line_length": 50.18857142857143,
"alnum_prop": 0.6751679380621656,
"repo_name": "LDAforVisProject/VKPSA",
"id": "7530403ae6acf91009e00d2319bfd25fa23d91ef",
"size": "8783",
"binary": false,
"copies": "4",
"ref": "refs/heads/master",
"path": "bin/dependencies/commons-collections4-4.1/apidocs/org/apache/commons/collections4/bidimap/class-use/AbstractOrderedBidiMapDecorator.html",
"mode": "33188",
"license": "mit",
"language": [
{
"name": "CSS",
"bytes": "27346"
},
{
"name": "HTML",
"bytes": "37868060"
},
{
"name": "Java",
"bytes": "710042"
},
{
"name": "JavaScript",
"bytes": "121142"
},
{
"name": "PLpgSQL",
"bytes": "2821"
}
],
"symlink_target": ""
} |
package pl.java.scalatech.design_pattern.aroundMethod;
import java.util.function.Consumer;
import lombok.extern.slf4j.Slf4j;
@Slf4j
public class Resource {
private Resource(){
log.info("create resource");
}
public Resource operationOne(){
log.info("operation one");
return this;
}
public Resource operationTwo(){
log.info("operation one");
return this;
}
private void close(){
log.info("close resource...");
}
public static void use(Consumer<Resource> cons){
Resource resource = new Resource();
try{
cons.accept(resource );
}finally{
resource.close();
}
}
}
| {
"content_hash": "0c326b103aee667a9a960223843c7271",
"timestamp": "",
"source": "github",
"line_count": 34,
"max_line_length": 54,
"avg_line_length": 19.705882352941178,
"alnum_prop": 0.6238805970149254,
"repo_name": "przodownikR1/java8features",
"id": "781bf1f7aa368707adb2163051c2fc7c2b22a755",
"size": "670",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "src/test/java/pl/java/scalatech/design_pattern/aroundMethod/Resource.java",
"mode": "33188",
"license": "mit",
"language": [
{
"name": "Java",
"bytes": "184691"
}
],
"symlink_target": ""
} |
<?php
namespace SharePoint\PHP\Client\WebParts;
use SharePoint\PHP\Client\ClientObject;
class WebPart extends ClientObject
{
} | {
"content_hash": "a715962a064de28fa6217fb692bcaca8",
"timestamp": "",
"source": "github",
"line_count": 9,
"max_line_length": 41,
"avg_line_length": 14.333333333333334,
"alnum_prop": 0.8062015503875969,
"repo_name": "ctcudd/phpSPO",
"id": "d191363ccce38b1eda8118033789162e12276d2f",
"size": "129",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "src/webparts/WebPart.php",
"mode": "33188",
"license": "mit",
"language": [
{
"name": "PHP",
"bytes": "101270"
}
],
"symlink_target": ""
} |
// No for loop here. Instead, a global variable.
var y = 0;
function setup(){
createCanvas(200,200);
background(255);
// Slowing down the frame rate so we can easily see the effect.
setFrameRate(5);
};
function draw(){
// Draw a line
stroke(0);
// Only one line is drawn each time through draw().
line(0,y,width,y);
// Increment y
y += 10;
// Reset y back to 0 when it gets to the bottom of window
if (y > height) {
y = 0;
}
}; | {
"content_hash": "b441e4e50347b208280e1f997c2b1b83",
"timestamp": "",
"source": "github",
"line_count": 23,
"max_line_length": 65,
"avg_line_length": 20.217391304347824,
"alnum_prop": 0.6193548387096774,
"repo_name": "hcvazquez/UFFOptimizer",
"id": "c729cc3da53b62b3eb38105f0969fbd669df283f",
"size": "612",
"binary": false,
"copies": "56",
"ref": "refs/heads/master",
"path": "benchmark/p5.js/test/manual-test-examples/learningprocessing/chp6/example_6_8.js",
"mode": "33188",
"license": "apache-2.0",
"language": [
{
"name": "CSS",
"bytes": "218069"
},
{
"name": "GLSL",
"bytes": "15194"
},
{
"name": "HTML",
"bytes": "299105"
},
{
"name": "JavaScript",
"bytes": "14028879"
},
{
"name": "Shell",
"bytes": "510"
},
{
"name": "mupad",
"bytes": "8618"
}
],
"symlink_target": ""
} |
package com.example.cl.notepad.DataAdapter;
import android.content.Context;
import android.database.Cursor;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.CursorAdapter;
import android.widget.TextView;
import com.example.cl.notepad.ConstantValue;
import com.example.cl.notepad.ConvertDate;
import com.example.cl.notepad.NoteVO;
import com.example.cl.notepad.PrefVO;
import com.example.cl.notepad.R;
import com.example.cl.notepad.dbhandle.DBAccess;
import com.example.cl.notepad.dbhandle.DBUtil;
import java.util.ArrayList;
import java.util.List;
/**
* Created by cl on 2017/4/9.
*/
public class NoteCursorAdapter extends CursorAdapter {
private Context context;
private Cursor c;
private LayoutInflater layoutInflater;
private View view;
private DBUtil dbUtil;
private List<NoteVO> list=new ArrayList<NoteVO>();
public NoteCursorAdapter(Context context, Cursor c, boolean autoRequery) {
super(context, c, autoRequery);
this.context = context;
this.c = c;
layoutInflater=LayoutInflater.from(context);
}
@Override
public View newView(Context context, Cursor cursor, ViewGroup viewGroup) {
view=layoutInflater.inflate(R.layout.item,null);
return view;
}
@Override
public void bindView(View view, Context context, Cursor cursor) {
TextView imNoteIcon= (TextView) view.findViewById(R.id.itemimage);
TextView tvNoteTitle= (TextView) view.findViewById(R.id.itemtitle);
TextView tvNoteDate= (TextView) view.findViewById(R.id.itemdate);
imNoteIcon.setText(cursor.getPosition()+1+"");
imNoteIcon.setBackgroundColor(PrefVO.themeColorValue);
tvNoteTitle.setText(cursor.getString(cursor.getColumnIndex("notetitle")));
tvNoteDate.setText(cursor.getString(cursor.getColumnIndex("notedate")));
NoteVO noteVO=new NoteVO();
noteVO.setNoteID(c.getInt(c.getColumnIndex(ConstantValue.DB_MetaData.NOTEID_COL)));
noteVO.setNoteTitle(c.getString(c.getColumnIndex(ConstantValue.DB_MetaData.NOTETITLE_COL)));
noteVO.setNoteContent(c.getString(c.getColumnIndex(ConstantValue.DB_MetaData.NOTECONTENT_COL)));
noteVO.setNoteDate(ConvertDate.Stringtodate(c.getString(c.getColumnIndex(ConstantValue.DB_MetaData.NOTEDATE_COL))));
list.add(noteVO);
}
public List<NoteVO> getList() {
return list;
}
@Override
public CharSequence convertToString(Cursor cursor) {
String name=cursor.getString(cursor.getColumnIndex("notetitle"));
return name;
}
@Override
public Cursor runQueryOnBackgroundThread(CharSequence constraint) {
c.moveToFirst();
if(null==dbUtil){
dbUtil=new DBUtil(context);
}
list.clear();
if(null!=constraint){
String []selectionArgs=new String[]{"%"+constraint.toString()+"%","%"+constraint.toString()+"%"};
String selection="notetitle like ? or notecontent like ?";
c=new DBAccess(context).selectAllNoteCursor(selection,selectionArgs);
}
else{
c=new DBAccess(context).selectAllNoteCursor(null,null);
}
return c;
}
}
| {
"content_hash": "6092e56cad8f51c9c43a108bba54c33d",
"timestamp": "",
"source": "github",
"line_count": 91,
"max_line_length": 124,
"avg_line_length": 35.94505494505494,
"alnum_prop": 0.7013145826964231,
"repo_name": "AllenChenAndroid/NotePad",
"id": "6f0d9155c5095d54afe2cd95d9ac192f9c5ed8bd",
"size": "3271",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "app/src/main/java/com/example/cl/notepad/DataAdapter/NoteCursorAdapter.java",
"mode": "33188",
"license": "apache-2.0",
"language": [
{
"name": "Java",
"bytes": "54262"
}
],
"symlink_target": ""
} |
Yet Another Entity-Component System. Fed up with the vast variety of ECS
available in Rust crates, I decided "me too" and dived in with this effort.
## Current state
At present, this is a deliberately simple and naive implementation, as my poor
little brain hurt when I looked at other awesome systems such as [ecs](https://github.com/HeroesGrave/ecs-rs)
and [specs](https://github.com/slide-rs/specs). Hopefully over time as my code
using this matures I'll spend some time optimizing what's going on in here and
trying to remove any bottlenecks, though this will likely only be done once I've
profiled the application.
| {
"content_hash": "f2c42a1fdec5e1bb1287947ad43464ee",
"timestamp": "",
"source": "github",
"line_count": 11,
"max_line_length": 109,
"avg_line_length": 56.54545454545455,
"alnum_prop": 0.7845659163987139,
"repo_name": "davidedmonds/yaecs",
"id": "ef44c35504bab7925060490e701cfcdf8b37e698",
"size": "631",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "README.md",
"mode": "33188",
"license": "mit",
"language": [
{
"name": "Rust",
"bytes": "12079"
}
],
"symlink_target": ""
} |
<?php
namespace Proyecto\TaskBundle\Form;
use Symfony\Component\Form\AbstractType;
use Symfony\Component\Form\FormBuilderInterface;
use Symfony\Component\OptionsResolver\OptionsResolverInterface;
class CountryType extends AbstractType
{
/**
* @param FormBuilderInterface $builder
* @param array $options
*/
public function buildForm(FormBuilderInterface $builder, array $options)
{
$builder
->add('name')
->add('code')
;
}
/**
* @param OptionsResolverInterface $resolver
*/
public function setDefaultOptions(OptionsResolverInterface $resolver)
{
$resolver->setDefaults(array(
'data_class' => 'Proyecto\TaskBundle\Entity\Country'
));
}
/**
* @return string
*/
public function getName()
{
return 'proyecto_taskbundle_country';
}
}
| {
"content_hash": "58c95279ed4da48d9a70ea720b6abcd5",
"timestamp": "",
"source": "github",
"line_count": 40,
"max_line_length": 76,
"avg_line_length": 22.525,
"alnum_prop": 0.6270810210876804,
"repo_name": "ilzayas/arbeitsplan",
"id": "5c771a72cdd6526e749d33bceee6aba13c13ba2b",
"size": "901",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "src/Proyecto/TaskBundle/Form/CountryType.php",
"mode": "33188",
"license": "mit",
"language": [
{
"name": "ApacheConf",
"bytes": "2647"
},
{
"name": "CSS",
"bytes": "22307"
},
{
"name": "HTML",
"bytes": "186634"
},
{
"name": "JavaScript",
"bytes": "10634"
},
{
"name": "PHP",
"bytes": "202553"
}
],
"symlink_target": ""
} |
declare module 'oada-error' {
export class OADAError {
constructor(
message: string,
code?: number,
userMessage?: string | null,
href?: string | null,
detail?: string | null
);
}
}
// Make TS understand assert better
declare module 'assert' {
function internal(value: any, message?: string | Error): asserts value;
}
| {
"content_hash": "4b69bb0c98a10c60b86c3167f777ab2e",
"timestamp": "",
"source": "github",
"line_count": 16,
"max_line_length": 73,
"avg_line_length": 22.625,
"alnum_prop": 0.6298342541436464,
"repo_name": "OADA/oada-srvc-docker",
"id": "af5f5fb61d7ab4ad4c88a48013f1ed747fe9774d",
"size": "362",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "oada/services/http-handler/src/types.d.ts",
"mode": "33188",
"license": "apache-2.0",
"language": [
{
"name": "Dockerfile",
"bytes": "6831"
},
{
"name": "HTML",
"bytes": "14145"
},
{
"name": "JavaScript",
"bytes": "857880"
},
{
"name": "Perl",
"bytes": "8564"
},
{
"name": "PowerShell",
"bytes": "2082"
},
{
"name": "Raku",
"bytes": "2812"
},
{
"name": "Shell",
"bytes": "67508"
},
{
"name": "Vim script",
"bytes": "2076"
}
],
"symlink_target": ""
} |
<?xml version="1.0" encoding="utf-8"?>
<appwidget-provider xmlns:android="http://schemas.android.com/apk/res/android"
android:minWidth="110dp"
android:minHeight="40dp"
android:updatePeriodMillis="86400000"
android:previewImage="@drawable/example_appwidget_preview"
android:initialLayout="@layout/demo_app_widget"
android:configure="com.jayway.com.remoteviews_demo.DemoAppWidgetConfigureActivity"
android:resizeMode="horizontal|vertical"
android:widgetCategory="home_screen"
android:initialKeyguardLayout="@layout/demo_app_widget">
</appwidget-provider> | {
"content_hash": "8dcee195217d2831114c8f24aa9fb659",
"timestamp": "",
"source": "github",
"line_count": 12,
"max_line_length": 86,
"avg_line_length": 49,
"alnum_prop": 0.7687074829931972,
"repo_name": "andreasnilsson/RemoteViewsDemo",
"id": "a904ba6907259df2c2b7eff4d35999b089aba36d",
"size": "588",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "RemoteViewsDemo/remoteviews_demo/src/main/res/xml/demo_app_widget_info.xml",
"mode": "33188",
"license": "apache-2.0",
"language": [
{
"name": "Groovy",
"bytes": "809"
},
{
"name": "Java",
"bytes": "7594"
},
{
"name": "Shell",
"bytes": "2314"
}
],
"symlink_target": ""
} |
/* global describe it */
var path = require('path')
var chai = require('chai')
var check = require(path.resolve(__dirname, '../index'))
chai.should()
chai.config.includeStack = true
describe('got', function () {
function Base () {
this.a = 1
}
function Sub () {
this.b = 2
}
Sub.prototype = new Base()
var obj = new Sub()
it('got', function () {
check(obj, 'obj').got('a').eq(1)
check(obj, 'obj').got('b').eq(2)
})
it('NOT got', function () {
(_ => check(obj, 'obj').got('c')).should.throw()
})
})
| {
"content_hash": "76096d0c324a4300560de8df8305709c",
"timestamp": "",
"source": "github",
"line_count": 31,
"max_line_length": 56,
"avg_line_length": 17.612903225806452,
"alnum_prop": 0.5531135531135531,
"repo_name": "yusangeng/param-check",
"id": "38c79706ae0dfba85fed9201c115318cca2b9974",
"size": "546",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "test/got.spec.js",
"mode": "33188",
"license": "mit",
"language": [
{
"name": "JavaScript",
"bytes": "54962"
}
],
"symlink_target": ""
} |
SYNONYM
#### According to
The Catalogue of Life, 3rd January 2011
#### Published in
null
#### Original name
null
### Remarks
null | {
"content_hash": "d05f632f1e9822adbc330311f5a4bd08",
"timestamp": "",
"source": "github",
"line_count": 13,
"max_line_length": 39,
"avg_line_length": 10.23076923076923,
"alnum_prop": 0.6917293233082706,
"repo_name": "mdoering/backbone",
"id": "5bf4980a8bf184b6ba03c4ad601730be3b33473f",
"size": "191",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "life/Fungi/Ascomycota/Dothideomycetes/Capnodiales/Mycosphaerellaceae/Mycosphaerella/Mycosphaerella clematitidis/ Syn. Sphaerella clematidis/README.md",
"mode": "33188",
"license": "apache-2.0",
"language": [],
"symlink_target": ""
} |
from django.test.client import Client
from django.test import TestCase
from push.views import *
class UrlResolveTests(TestCase):
def test_url_index(self):
c = Client()
response = c.get('/')
self.assertEqual(response.status_code, 302)
def test_url_index_page(self):
c = Client()
response = c.get('/', {'page': 2})
self.assertEqual(response.status_code, 302)
self.assertEqual(response.content, '')
| {
"content_hash": "b9a014a62c67fcb293abfd70914279f9",
"timestamp": "",
"source": "github",
"line_count": 15,
"max_line_length": 51,
"avg_line_length": 30.8,
"alnum_prop": 0.6363636363636364,
"repo_name": "nnsnodnb/django-mbaas",
"id": "44cd2d2efbcfefe6063340f67ea3d63a330a483c",
"size": "478",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "push/tests/test_urls.py",
"mode": "33188",
"license": "apache-2.0",
"language": [
{
"name": "CSS",
"bytes": "32"
},
{
"name": "HTML",
"bytes": "52557"
},
{
"name": "JavaScript",
"bytes": "5938"
},
{
"name": "Python",
"bytes": "65164"
}
],
"symlink_target": ""
} |
ACCEPTED
#### According to
International Plant Names Index
#### Published in
null
#### Original name
null
### Remarks
null | {
"content_hash": "6b0caadbb25a776cf2f3af1cc2f43ea6",
"timestamp": "",
"source": "github",
"line_count": 13,
"max_line_length": 31,
"avg_line_length": 9.692307692307692,
"alnum_prop": 0.7063492063492064,
"repo_name": "mdoering/backbone",
"id": "f0982949755b262cbce9b4699f982caec308527f",
"size": "186",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "life/Plantae/Magnoliophyta/Magnoliopsida/Malpighiales/Salicaceae/Salix/Salix ionica/README.md",
"mode": "33188",
"license": "apache-2.0",
"language": [],
"symlink_target": ""
} |
export { default } from 'shared/components/star-rating/component'; | {
"content_hash": "b4c50ad5c435de46df912dda3cd3bd44",
"timestamp": "",
"source": "github",
"line_count": 1,
"max_line_length": 66,
"avg_line_length": 66,
"alnum_prop": 0.7878787878787878,
"repo_name": "pengjiang80/ui",
"id": "e79a50017a472079063777f849437baa2a89fa87",
"size": "66",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "lib/shared/app/components/star-rating/component.js",
"mode": "33188",
"license": "apache-2.0",
"language": [
{
"name": "CSS",
"bytes": "157884"
},
{
"name": "HTML",
"bytes": "739881"
},
{
"name": "JavaScript",
"bytes": "1407771"
},
{
"name": "Shell",
"bytes": "11290"
},
{
"name": "Standard ML",
"bytes": "1205"
}
],
"symlink_target": ""
} |
package org.deviceconnect.android.event.cache;
import org.deviceconnect.android.event.Event;
import org.deviceconnect.android.event.EventError;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import java.util.Map.Entry;
import java.util.concurrent.CopyOnWriteArrayList;
/**
* イベントデータをメモリにキャッシュし、キャッシュの操作機能を提供する.
*
*
* @author NTT DOCOMO, INC.
*/
public class MemoryCacheController extends BaseCacheController {
/**
* イベントマップ. serviceId毎にイベントの種類をキーにイベント情報を管理する。
*
*/
private Map<String, Map<String, List<Event>>> mEventMap;
/**
* 空のサービスID用キー.
*/
private static final String NULL_SERVICE_ID = "__null";
/**
* 空のレシーバー用キー.
*/
private static final String NULL_RECEIVER_NAME = "";
/**
* メモリキャッシュコントローラーを生成する.
*/
public MemoryCacheController() {
mEventMap = new HashMap<>();
}
/**
* イベント情報からサービスIDを取得する.
* サービスIDが無い場合はnullを示す特殊な文字列を返す。
*
* @param event イベントデータ
* @return サービスID
*/
private String getServiceId(final Event event) {
String serviceId = event.getServiceId();
if (serviceId == null) {
serviceId = NULL_SERVICE_ID;
}
return serviceId;
}
/**
* イベント情報からレシーバー名を取得する.
* レシーバーが無い場合は空文字を返す。
*
* @param event イベント情報
* @return レシーバー名
*/
private String getReceiverName(final Event event) {
String receiver = event.getReceiverName();
if (receiver == null) {
receiver = NULL_RECEIVER_NAME;
}
return receiver;
}
@Override
public synchronized EventError addEvent(final Event event) {
if (!checkParameter(event)) {
return EventError.INVALID_PARAMETER;
}
String serviceId = getServiceId(event);
Map<String, List<Event>> events = mEventMap.get(serviceId);
if (events == null) {
events = new HashMap<>();
mEventMap.put(serviceId, events);
}
String path = event.getProfile();
if (event.getInterface() != null) {
path += event.getInterface();
}
if (event.getAttribute() != null) {
path += event.getAttribute();
}
List<Event> eventList = events.get(path);
if (eventList == null) {
eventList = new CopyOnWriteArrayList<>();
events.put(path, eventList);
}
String origin = event.getOrigin();
String receiver = getReceiverName(event);
for (Event e : eventList) {
if (compare(e.getOrigin(), origin) && compare(e.getReceiverName(), receiver)) {
// 登録済みの場合はアクセストークンを上書きする
e.setAccessToken(event.getAccessToken());
e.setUpdateDate(Utils.getCurreTimestamp());
return EventError.NONE;
}
}
event.setCreateDate(Utils.getCurreTimestamp());
event.setUpdateDate(Utils.getCurreTimestamp());
eventList.add(event);
return EventError.NONE;
}
@Override
public synchronized EventError removeEvent(final Event event) {
if (!checkParameter(event)) {
return EventError.INVALID_PARAMETER;
}
String serviceId = getServiceId(event);
Map<String, List<Event>> events = mEventMap.get(serviceId);
if (events == null) {
return EventError.NOT_FOUND;
}
String path = event.getProfile();
if (event.getInterface() != null) {
path += event.getInterface();
}
if (event.getAttribute() != null) {
path += event.getAttribute();
}
List<Event> eventList = events.get(path);
if (eventList == null) {
return EventError.NOT_FOUND;
}
String origin = event.getOrigin();
String receiver = getReceiverName(event);
for (Event e : eventList) {
if (compare(e.getOrigin(), origin) && compare(e.getReceiverName(), receiver)) {
eventList.remove(e);
if (eventList.size() == 0) {
events.remove(path);
}
return EventError.NONE;
}
}
return EventError.NOT_FOUND;
}
@Override
public synchronized Event getEvent(final String serviceId, final String profile, final String inter,
final String attribute, final String origin, final String receiver) {
Event event = null;
String tmpReceiver = receiver;
if (tmpReceiver == null) {
tmpReceiver = NULL_RECEIVER_NAME;
}
do {
List<Event> eventList = getEvents(serviceId, profile, inter, attribute);
if (eventList == null) {
break;
}
for (Event e : eventList) {
if (compare(e.getOrigin(), origin) && compare(e.getReceiverName(), tmpReceiver)) {
event = e;
break;
}
}
} while (false);
return event;
}
@Override
public synchronized List<Event> getEvents(final String serviceId, final String profile,
final String inter, final String attribute) {
String tmpServiceId = serviceId;
if (serviceId == null) {
tmpServiceId = NULL_SERVICE_ID;
}
Map<String, List<Event>> events = mEventMap.get(tmpServiceId);
if (events == null) {
return new ArrayList<>();
}
String path = profile;
if (inter != null) {
path += inter;
}
if (attribute != null) {
path += attribute;
}
List<Event> res = events.get(path);
if (res == null) {
return new ArrayList<>();
}
return res;
}
@Override
public synchronized List<Event> getEvents(final String origin) {
List<Event> result = new ArrayList<>();
for (Entry<String, Map<String, List<Event>>> entry : mEventMap.entrySet()) {
for (Entry<String, List<Event>> events : entry.getValue().entrySet()) {
for (Event event : events.getValue()) {
if (origin.equals(event.getOrigin())) {
result.add(event);
}
}
}
}
return result;
}
@Override
public void flush() {
// do nothing.
}
@Override
public synchronized boolean removeAll() {
mEventMap.clear();
return mEventMap.size() == 0;
}
private boolean compare(final String s1, final String s2) {
return (s1 == null && s2 == null) || s1!= null && s1.equals(s2);
}
/**
* イベントデータのキャッシュオブジェクトを取得する.
* Map<serviceId, Map<profile+interface+attribute, List<Event>>>。
*
* @return キャッシュ
*/
protected synchronized Map<String, Map<String, List<Event>>> getCache() {
return mEventMap;
}
/**
* キャッシュを設定する.
* nullの場合設定されない。
*
* @param cache キャッシュ
*/
protected synchronized void setCache(final Map<String, Map<String, List<Event>>> cache) {
if (cache != null) {
mEventMap = cache;
}
}
@Override
public synchronized boolean removeEvents(final String origin) {
if (origin == null) {
throw new IllegalArgumentException("origin is null.");
}
for (Entry<String, Map<String, List<Event>>> entry : mEventMap.entrySet()) {
for (Entry<String, List<Event>> events : entry.getValue().entrySet()) {
List<Event> removes = new ArrayList<>();
for (Event event : events.getValue()) {
if (origin.equals(event.getOrigin())) {
removes.add(event);
}
}
if (removes.size() != 0) {
events.getValue().removeAll(removes);
}
}
}
return true;
}
}
| {
"content_hash": "c150a6ae91009f355afa1993640690ab",
"timestamp": "",
"source": "github",
"line_count": 293,
"max_line_length": 105,
"avg_line_length": 28.392491467576793,
"alnum_prop": 0.531674480105782,
"repo_name": "TakayukiHoshi1984/DeviceConnect-Android",
"id": "b20b3a525905051a1aa7c9bbeb7d333b748fd727",
"size": "9033",
"binary": false,
"copies": "2",
"ref": "refs/heads/main",
"path": "dConnectDevicePlugin/dConnectDevicePluginSDK/dconnect-device-plugin-sdk/src/main/java/org/deviceconnect/android/event/cache/MemoryCacheController.java",
"mode": "33261",
"license": "mit",
"language": [
{
"name": "AIDL",
"bytes": "678"
},
{
"name": "C",
"bytes": "186682"
},
{
"name": "C++",
"bytes": "63628"
},
{
"name": "CMake",
"bytes": "3472"
},
{
"name": "CSS",
"bytes": "12886"
},
{
"name": "HTML",
"bytes": "59976"
},
{
"name": "Java",
"bytes": "7280246"
},
{
"name": "JavaScript",
"bytes": "357443"
},
{
"name": "Makefile",
"bytes": "1525"
}
],
"symlink_target": ""
} |
package jp.ne.smma.wheel;
import android.database.DataSetObserver;
import android.view.View;
import android.view.ViewGroup;
/**
* Wheel items adapter interface
*/
public interface WheelViewAdapter {
/**
* Gets items count
* @return the count of wheel items
*/
public int getItemsCount();
/**
* Get a View that displays the data at the specified position in the data set
*
* @param index the item index
* @param convertView the old view to reuse if possible
* @param parent the parent that this view will eventually be attached to
* @return the wheel item View
*/
public View getItem(int index, View convertView, ViewGroup parent);
/**
* Get a View that displays an empty wheel item placed before the first or after
* the last wheel item.
*
* @param convertView the old view to reuse if possible
* @param parent the parent that this view will eventually be attached to
* @return the empty item View
*/
public View getEmptyItem(View convertView, ViewGroup parent);
/**
* Register an observer that is called when changes happen to the data used by this adapter.
* @param observer the observer to be registered
*/
public void registerDataSetObserver(DataSetObserver observer);
/**
* Unregister an observer that has previously been registered
* @param observer the observer to be unregistered
*/
void unregisterDataSetObserver (DataSetObserver observer);
}
| {
"content_hash": "2f60be24038f39d76f5870fe581f097b",
"timestamp": "",
"source": "github",
"line_count": 49,
"max_line_length": 100,
"avg_line_length": 33.97959183673469,
"alnum_prop": 0.6288288288288288,
"repo_name": "NhamPhanDinh/smmatest",
"id": "3a899cdf4042e89a515aaa0a1745a4c288baae69",
"size": "1665",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "SMMA/src/jp/ne/smma/wheel/WheelViewAdapter.java",
"mode": "33188",
"license": "apache-2.0",
"language": [
{
"name": "Groovy",
"bytes": "560"
},
{
"name": "Java",
"bytes": "818327"
}
],
"symlink_target": ""
} |
class Browser;
namespace content {
class BrowserContext;
}
namespace aura {
class Window;
}
namespace chrome {
class MultiUserWindowManagerChromeOS;
// The MultiUserWindowManager manages windows from multiple users by presenting
// only user relevant windows to the current user. The manager is automatically
// determining the window ownership from browser and application windows and
// puts them onto the correct "desktop".
// Un-owned windows will be visible on all users desktop's and owned windows can
// only be presented on one desktop. If a window should get moved to another
// user's desktop |ShowWindowForUser| can be called.
// Windows which are neither a browser nor an app can be associated with a user
// through |SetWindowOwner|.
// This class will also switch the desktop upon user change.
// Note:
// - There is no need to "unregister" a window from an owner. The class will
// clean automatically all references of that window upon destruction.
// - User changes will be tracked via observer. No need to call.
// - All child windows will be owned by the same owner as its parent.
class MultiUserWindowManager {
public:
// Observer to notify of any window owner changes.
class Observer {
public:
// Invoked when the new window is created and the manager start to track its
// owner.
virtual void OnOwnerEntryAdded(aura::Window* window) {}
// Invoked when the owner of the window tracked by the manager is changed.
virtual void OnOwnerEntryChanged(aura::Window* window) {}
// Invoked when the window is destroyed and the manager stop to track its
// owner.
virtual void OnOwnerEntryRemoved(aura::Window* window) {}
protected:
virtual ~Observer() {}
};
// The multi profile mode in use.
enum MultiProfileMode {
MULTI_PROFILE_MODE_UNINITIALIZED, // Not initialized yet.
MULTI_PROFILE_MODE_OFF, // Single user mode.
MULTI_PROFILE_MODE_SEPARATED, // Each user has his own desktop.
MULTI_PROFILE_MODE_MIXED // All users mix windows freely.
};
// Creates an instance of the MultiUserWindowManager.
// Note: This function might fail if due to the desired mode the
// MultiUserWindowManager is not required.
static MultiUserWindowManager* CreateInstance();
// Gets the instance of the object. If the multi profile mode is not enabled
// this will return NULL.
static MultiUserWindowManager* GetInstance();
// Return the current multi profile mode operation. If CreateInstance was not
// yet called (or was already destroyed), MULTI_PROFILE_MODE_UNINITIALIZED
// will get returned.
static MultiProfileMode GetMultiProfileMode();
// Whether or not the window's title should show the avatar. On chromeos,
// this is true when the owner of the window is different from the owner of
// the desktop.
static bool ShouldShowAvatar(aura::Window* window);
// Removes the instance.
static void DeleteInstance();
// A function to set an |instance| of a created MultiUserWinwdowManager object
// with a given |mode| for test purposes.
static void SetInstanceForTest(MultiUserWindowManager* instance,
MultiProfileMode mode);
// Assigns an owner to a passed window. Note that this window's parent should
// be a direct child of the root window.
// A user switch will automatically change the visibility - and - if the
// current user is not the owner it will immediately hidden. If the window
// had already be registered this function will run into a DCHECK violation.
virtual void SetWindowOwner(
aura::Window* window, const std::string& user_id) = 0;
// See who owns this window. The return value is the user id or an empty
// string if not assigned yet.
virtual const std::string& GetWindowOwner(aura::Window* window) = 0;
// Allows to show an owned window for another users. If the window is not
// owned, this call will return immediately. (The FileManager for example
// might be available for every user and not belong explicitly to one).
// Note that a window can only be shown on one desktop at a time. Note that
// when the window gets minimized, it will automatically fall back to the
// owner's desktop.
virtual void ShowWindowForUser(
aura::Window* window, const std::string& user_id) = 0;
// Returns true when windows are shared among users.
virtual bool AreWindowsSharedAmongUsers() = 0;
// Get the owners for the visible windows and set them to |user_ids|.
virtual void GetOwnersOfVisibleWindows(std::set<std::string>* user_ids) = 0;
// A query call for a given window to see if it is on the given user's
// desktop.
virtual bool IsWindowOnDesktopOfUser(aura::Window* window,
const std::string& user_id) = 0;
// Get the user on which the window is currently shown. If an empty string is
// passed back the window will be presented for every user.
virtual const std::string& GetUserPresentingWindow(aura::Window* window) = 0;
// Adds user to monitor starting and running V1/V2 application windows.
// Returns immediately if the user (identified by a |profile|) is already
// known to the manager. Note: This function is not implemented as a
// SessionStateObserver to coordinate the timing of the addition with other
// modules.
virtual void AddUser(content::BrowserContext* profile) = 0;
// Manages observers.
virtual void AddObserver(Observer* observer) = 0;
virtual void RemoveObserver(Observer* observer) = 0;
protected:
virtual ~MultiUserWindowManager() {}
private:
// Caching the current multi profile mode since the detection is expensive.
static MultiProfileMode multi_user_mode_;
};
} // namespace chrome
#endif // CHROME_BROWSER_UI_ASH_MULTI_USER_MULTI_USER_WINDOW_MANAGER_H_
| {
"content_hash": "cb82cc421746fa05d95a95e9dbb69ed9",
"timestamp": "",
"source": "github",
"line_count": 140,
"max_line_length": 80,
"avg_line_length": 41.621428571428574,
"alnum_prop": 0.7271323150849494,
"repo_name": "patrickm/chromium.src",
"id": "af43f3ec414a68af8d34f944ba50e54b24805449",
"size": "6183",
"binary": false,
"copies": "1",
"ref": "refs/heads/nw",
"path": "chrome/browser/ui/ash/multi_user/multi_user_window_manager.h",
"mode": "33188",
"license": "bsd-3-clause",
"language": [
{
"name": "ASP",
"bytes": "853"
},
{
"name": "AppleScript",
"bytes": "6973"
},
{
"name": "Arduino",
"bytes": "464"
},
{
"name": "Assembly",
"bytes": "52960"
},
{
"name": "Awk",
"bytes": "8660"
},
{
"name": "C",
"bytes": "40737238"
},
{
"name": "C#",
"bytes": "1132"
},
{
"name": "C++",
"bytes": "207930633"
},
{
"name": "CSS",
"bytes": "939170"
},
{
"name": "Java",
"bytes": "5844934"
},
{
"name": "JavaScript",
"bytes": "17837835"
},
{
"name": "Mercury",
"bytes": "10533"
},
{
"name": "Objective-C",
"bytes": "886228"
},
{
"name": "Objective-C++",
"bytes": "6667789"
},
{
"name": "PHP",
"bytes": "97817"
},
{
"name": "Perl",
"bytes": "672770"
},
{
"name": "Python",
"bytes": "10857933"
},
{
"name": "Rebol",
"bytes": "262"
},
{
"name": "Shell",
"bytes": "1326032"
},
{
"name": "Tcl",
"bytes": "277091"
},
{
"name": "XSLT",
"bytes": "13493"
},
{
"name": "nesC",
"bytes": "15206"
}
],
"symlink_target": ""
} |
class leveldb_error : public std::runtime_error
{
public:
leveldb_error(const std::string &msg) : std::runtime_error(msg) {}
};
void HandleError(const leveldb::Status &status) throw(leveldb_error);
// Batch of changes queued to be written to a CLevelDB
class CLevelDBBatch
{
friend class CLevelDB;
private:
leveldb::WriteBatch batch;
public:
template<typename K, typename V> void Write(const K& key, const V& value) {
CDataStream ssKey(SER_DISK, CLIENT_VERSION);
ssKey.reserve(ssKey.GetSerializeSize(key));
ssKey << key;
leveldb::Slice slKey(&ssKey[0], ssKey.size());
CDataStream ssValue(SER_DISK, CLIENT_VERSION);
ssValue.reserve(ssValue.GetSerializeSize(value));
ssValue << value;
leveldb::Slice slValue(&ssValue[0], ssValue.size());
batch.Put(slKey, slValue);
}
template<typename K> void Erase(const K& key) {
CDataStream ssKey(SER_DISK, CLIENT_VERSION);
ssKey.reserve(ssKey.GetSerializeSize(key));
ssKey << key;
leveldb::Slice slKey(&ssKey[0], ssKey.size());
batch.Delete(slKey);
}
};
class CLevelDB
{
private:
// custom environment this database is using (may be NULL in case of default environment)
leveldb::Env *penv;
// database options used
leveldb::Options options;
// options used when reading from the database
leveldb::ReadOptions readoptions;
// options used when iterating over values of the database
leveldb::ReadOptions iteroptions;
// options used when writing to the database
leveldb::WriteOptions writeoptions;
// options used when sync writing to the database
leveldb::WriteOptions syncoptions;
// the database itself
leveldb::DB *pdb;
public:
CLevelDB(const boost::filesystem::path &path, size_t nCacheSize, bool fMemory = false, bool fWipe = false);
~CLevelDB();
template<typename K, typename V> bool Read(const K& key, V& value) throw(leveldb_error) {
CDataStream ssKey(SER_DISK, CLIENT_VERSION);
ssKey.reserve(ssKey.GetSerializeSize(key));
ssKey << key;
leveldb::Slice slKey(&ssKey[0], ssKey.size());
std::string strValue;
leveldb::Status status = pdb->Get(readoptions, slKey, &strValue);
if (!status.ok()) {
if (status.IsNotFound())
return false;
printf("LevelDB read failure: %s\n", status.ToString().c_str());
HandleError(status);
}
try {
CDataStream ssValue(strValue.data(), strValue.data() + strValue.size(), SER_DISK, CLIENT_VERSION);
ssValue >> value;
} catch(std::exception &e) {
return false;
}
return true;
}
template<typename K, typename V> bool Write(const K& key, const V& value, bool fSync = false) throw(leveldb_error) {
CLevelDBBatch batch;
batch.Write(key, value);
return WriteBatch(batch, fSync);
}
template<typename K> bool Exists(const K& key) throw(leveldb_error) {
CDataStream ssKey(SER_DISK, CLIENT_VERSION);
ssKey.reserve(ssKey.GetSerializeSize(key));
ssKey << key;
leveldb::Slice slKey(&ssKey[0], ssKey.size());
std::string strValue;
leveldb::Status status = pdb->Get(readoptions, slKey, &strValue);
if (!status.ok()) {
if (status.IsNotFound())
return false;
printf("LevelDB read failure: %s\n", status.ToString().c_str());
HandleError(status);
}
return true;
}
template<typename K> bool Erase(const K& key, bool fSync = false) throw(leveldb_error) {
CLevelDBBatch batch;
batch.Erase(key);
return WriteBatch(batch, fSync);
}
bool WriteBatch(CLevelDBBatch &batch, bool fSync = false) throw(leveldb_error);
// not available for LevelDB; provide for compatibility with BDB
bool Flush() {
return true;
}
bool Sync() throw(leveldb_error) {
CLevelDBBatch batch;
return WriteBatch(batch, true);
}
// not exactly clean encapsulation, but it's easiest for now
leveldb::Iterator *NewIterator() {
return pdb->NewIterator(iteroptions);
}
};
#endif // ROTOCOIN_LEVELDB_H
| {
"content_hash": "ce568e9f807edc38100fd8c8469f3d85",
"timestamp": "",
"source": "github",
"line_count": 140,
"max_line_length": 120,
"avg_line_length": 30.678571428571427,
"alnum_prop": 0.6281722933643772,
"repo_name": "rotocoin/rotocoin",
"id": "1faa644afa5becd3ebf823661307a2f49f409de3",
"size": "4658",
"binary": false,
"copies": "1",
"ref": "refs/heads/roto-thegreat-win",
"path": "src/leveldb.h",
"mode": "33188",
"license": "mit",
"language": [
{
"name": "C",
"bytes": "96106"
},
{
"name": "C++",
"bytes": "2556158"
},
{
"name": "CSS",
"bytes": "1127"
},
{
"name": "IDL",
"bytes": "16310"
},
{
"name": "Objective-C++",
"bytes": "5864"
},
{
"name": "Python",
"bytes": "37324"
},
{
"name": "Shell",
"bytes": "9761"
},
{
"name": "TypeScript",
"bytes": "5236515"
}
],
"symlink_target": ""
} |
require.config({
paths: {
bootstrap: "./vendor/bootstrap.min",
diffMatchPatch: "./vendor/diff_match_patch.min",
handlebars: "./vendor/handlebars.min",
handlebarsExtended: "./handlebars_helper",
locales: "./locales/locale",
lodash: "./vendor/lodash.min",
prettify: "./vendor/prettify/prettify"
},
shim: {
bootstrap: {
deps: ["jquery"],
},
diffMatchPatch: {
exports: "diff_match_patch"
},
handlebars: {
exports: "Handlebars"
},
handlebarsExtended: {
deps: ["handlebars"],
exports: "Handlebars"
},
prettify: {
exports: "prettyPrint"
}
},
urlArgs: "v=" + (new Date()).getTime()
});
require([
"jquery",
"lodash",
"locales",
"handlebarsExtended",
"./api_project.js",
"./api_data.js",
"prettify",
"bootstrap"
], function($, _, locale, Handlebars, apiProject, apiData, prettyPrint) {
var api = apiData.api;
/**
* Templates.
*/
var templateApidoc = Handlebars.compile( $("#template-apidoc").html() );
var templateArticle = Handlebars.compile( $("#template-article").html() );
var templateCompareArticle = Handlebars.compile( $("#template-compare-article").html() );
var templateGenerator = Handlebars.compile( $("#template-generator").html() );
var templateProject = Handlebars.compile( $("#template-project").html() );
var templateSections = Handlebars.compile( $("#template-sections").html() );
var templateSidenav = Handlebars.compile( $("#template-sidenav").html() );
/**
* Data transform.
*/
// Grouped by group
var apiByGroup = _.groupBy(api, function(entry) {
return entry.group;
});
// Grouped by group and name
var apiByGroupAndName = {};
$.each(apiByGroup, function(index, entries) {
apiByGroupAndName[index] = _.groupBy(entries, function(entry) {
return entry.name;
});
});
/**
* Sort api by group - name - title.
*/
var newList = [];
var umlauts = { "ä": "ae", "ü": "ue", "ö": "oe", "ß": "ss" };
$.each(apiByGroupAndName, function(index, groupEntries) {
// Titel der ersten Einträge von group[].name[] ermitteln (name hat Versionsliste)
var titles = {};
$.each(groupEntries, function(index, entries) {
var title = entries[0].title;
if(title)
{
title.toLowerCase().replace(/[äöüß]/g, function($0) { return umlauts[$0]; });
titles[title + " #~#" + index] = 1;
}
}); // each
// Sortieren
var values = Object.keys(titles);
values.sort();
// Einzelne Elemente der neuen Liste hinzufügen.
values.forEach(function(name) {
var values = name.split( "#~#");
groupEntries[values[1]].forEach(function(entry) {
newList.push(entry);
}); // forEach
}); // forEach
}); // each
// api überschreiben mit sortierter Liste.
api = newList;
/**
* Group- and Versionlists.
*/
var apiGroups = {};
var apiVersions = {};
apiVersions[apiProject.version] = 1;
$.each(api, function(index, entry) {
apiGroups[entry.group] = 1;
apiVersions[entry.version] = 1;
});
// Sort.
apiGroups = Object.keys(apiGroups);
apiGroups.sort();
apiVersions = Object.keys(apiVersions);
apiVersions.sort();
apiVersions.reverse();
/**
* Create Navigationlist.
*/
var nav = [];
apiGroups.forEach(function(group) {
// Mainmenu-Entry.
nav.push({
group: group,
isHeader: true,
title: group
});
// Add Submenu.
var oldName = "";
api.forEach(function(entry) {
if(entry.group === group)
{
if(oldName !== entry.name)
{
nav.push({
title: entry.title,
group: group,
name: entry.name,
type: entry.type,
version: entry.version
});
}
else
{
nav.push({
title: entry.title,
group: group,
hidden: true,
name: entry.name,
type: entry.type,
version: entry.version
});
}
oldName = entry.name;
}
}); // forEach
}); // forEach
// Mainmenu "General" Entry.
if(apiProject.apidoc)
{
nav.push({
group: "_",
isHeader: true,
title: locale.__("General"),
isFixed: true
});
}
/**
* Render Pagetitle.
*/
var title = apiProject.name + " - " + apiProject.version;
$(document).attr("title", "apiDoc: " + title);
/**
* Render Sidenav.
*/
var fields = {
nav: nav
};
$("#sidenav").append( templateSidenav(fields) );
/**
* Render Generator.
*/
$("#generator").append( templateGenerator(apiProject) );
/**
* Render Project.
*/
_.extend(apiProject, { versions: apiVersions});
$("#project").append( templateProject(apiProject) );
/**
* Render ApiDoc, general documentation.
*/
$("#apidoc").append( templateApidoc(apiProject) );
/**
* Render Sections and Articles
*/
var articleVersions = {};
apiGroups.forEach(function(groupEntry) {
var articles = [];
var oldName = "";
var fields = {};
articleVersions[groupEntry] = {};
// Render all Articls of a group.
api.forEach(function(entry) {
if(groupEntry === entry.group)
{
if(oldName !== entry.name)
{
// Artikelversionen ermitteln.
api.forEach(function(versionEntry) {
if(groupEntry === versionEntry.group && entry.name === versionEntry.name)
{
if( ! articleVersions[entry.group][entry.name]) articleVersions[entry.group][entry.name] = [];
articleVersions[entry.group][entry.name].push(versionEntry.version);
}
});
fields = {
article: entry,
versions: articleVersions[entry.group][entry.name]
};
}
else
{
fields = {
article: entry,
hidden: true,
versions: articleVersions[entry.group][entry.name]
};
}
if(entry.parameter && entry.parameter.fields) fields._hasTypeInParameterFields = _hasTypeInFields(entry.parameter.fields);
if(entry.error && entry.error.fields) fields._hasTypeInErrorFields = _hasTypeInFields(entry.error.fields);
if(entry.success && entry.success.fields) fields._hasTypeInSuccessFields = _hasTypeInFields(entry.success.fields);
if(entry.info && entry.info.fields) fields._hasTypeInInfoFields = _hasTypeInFields(entry.info.fields);
articles.push({
article: templateArticle(fields),
group: entry.group,
name: entry.name
});
oldName = entry.name;
}
}); // forEach
// Render Section with Articles.
var fields = {
group: groupEntry,
title: groupEntry,
articles: articles
};
$("#sections").append( templateSections(fields) );
}); // forEach
/**
* Bootstrap Scrollspy.
*/
$("body").scrollspy({ offset: 25 });
// Content-Scroll on Navigation click.
$(".sidenav").find("a").on("click", function(e) {
e.preventDefault();
var id = $(this).attr("href");
$('html,body').animate({ scrollTop: parseInt($(id).offset().top) - 18 }, 400);
window.location.hash = $(this).attr("href");
});
// Quickjump on Pageload to hash position.
if(window.location.hash)
{
var id = window.location.hash;
$('html,body').animate({ scrollTop: parseInt($(id).offset().top) - 18 }, 0);
}
/**
* Check if Parameter (sub) List has a type Field.
* Example: @apaSuccess varname1 No type.
* @apaSuccess {String} varname2 With type.
*
* @param {Object} fields
*/
function _hasTypeInFields(fields)
{
hasField = false;
$.each(fields, function(name) {
if(_.any(fields[name], function(item) { return item.type; }) )
{
hasField = true;
}
});
return hasField;
} // _hasTypeInFields
/**
* On Template changes, recall plugins.
*/
function initDynamic()
{
// Bootstrap Popover.
$("a[data-toggle=popover]")
.popover()
.click(function(e) {
e.preventDefault();
})
;
var version = $("#version strong").html();
$("#sidenav li").removeClass("is-new");
$("#sidenav li[data-version=\"" + version + "\"]").each(function(){
var group = $(this).data("group");
var name = $(this).data("name");
var length = $("#sidenav li[data-group=\"" + group + "\"][data-name=\"" + name + "\"]").length;
var index = $("#sidenav li[data-group=\"" + group + "\"][data-name=\"" + name + "\"]").index($(this));
if(length === 1 || index === (length - 1))
{
$(this).addClass("is-new");
}
});
} // initDynamic
initDynamic();
/**
* Pre- / Code-Format.
*/
prettyPrint();
/**
* HTML-Template specific jQuery-Functions
*/
// Change Main Version
$("#versions li.version a").on("click", function(e) {
e.preventDefault();
var selectedVersion = $(this).html();
$("#version strong").html(selectedVersion);
// Hide all
$("article").addClass("hide");
$("#sidenav li:not(.nav-fixed)").addClass("hide");
// Show 1st equal or lower Version of each entry
$("article[data-version]").each(function(index) {
var group = $(this).data("group");
var name = $(this).data("name");
var version = $(this).data("version");
if(version <= selectedVersion)
{
if($("article[data-group=\"" + group + "\"][data-name=\"" + name + "\"]:visible").length === 0)
{
// Enable Article
$("article[data-group=\"" + group + "\"][data-name=\"" + name + "\"][data-version=\"" + version + "\"]").removeClass("hide");
// Enable Navigation
$("#sidenav li[data-group=\"" + group + "\"][data-name=\"" + name + "\"][data-version=\"" + version + "\"]").removeClass("hide");
$("#sidenav li.nav-header[data-group=\"" + group + "\"]").removeClass("hide");
}
}
});
initDynamic();
return;
});
// On click compare all currently selected Versions with their predecessor.
$("#compareAllWithPredecessor").on("click", changeAllVersionCompareTo);
// On change the Version of an article.
$("article .versions li.version a").on("click", changeVersionCompareTo);
$.urlParam = function(name) {
var results = new RegExp('[\\?&]' + name + '=([^&#]*)').exec(window.location.href);
return (results && results[1]) ? results[1] : null;
};
if($.urlParam("compare"))
{
// URL Paramter ?compare=1 is set.
$("#compareAllWithPredecessor").trigger("click");
if(window.location.hash)
{
var id = window.location.hash;
$('html,body').animate({ scrollTop: parseInt($(id).offset().top) - 18 }, 0);
}
}
/**
*
*/
function changeVersionCompareTo(e)
{
e.preventDefault();
var $root = $(this).parents("article");
var selectedVersion = $(this).html();
var $button = $root.find(".version");
var currentVersion = $button.find("strong").html();
$button.find("strong").html(selectedVersion);
var group = $root.data("group");
var name = $root.data("name");
var version = $root.data("version");
var compareVersion = $root.data("compare-version");
if(compareVersion === selectedVersion) return;
if( ! compareVersion && version == selectedVersion) return;
if( compareVersion && articleVersions[group][name][0] === selectedVersion
|| version === selectedVersion
)
{
// Version des Eintrages wurde wieder auf höchste Version gesetzt (reset)
resetArticle(group, name, version);
}
else
{
var $compareToArticle = $("article[data-group=\"" + group + "\"][data-name=\"" + name + "\"][data-version=\"" + selectedVersion + "\"]");
var sourceEntry = {};
var compareEntry = {};
$.each(apiByGroupAndName[group][name], function(index, entry) {
if(entry.version === version) sourceEntry = entry;
if(entry.version === selectedVersion) compareEntry = entry;
});
var fields = {
article: sourceEntry,
compare: compareEntry,
versions: articleVersions[group][name]
};
var entry = sourceEntry;
if(entry.parameter && entry.parameter.fields) fields._hasTypeInParameterFields = _hasTypeInFields(entry.parameter.fields);
if(entry.error && entry.error.fields) fields._hasTypeInErrorFields = _hasTypeInFields(entry.error.fields);
if(entry.success && entry.success.fields) fields._hasTypeInSuccessFields = _hasTypeInFields(entry.success.fields);
if(entry.info && entry.info.fields) fields._hasTypeInInfoFields = _hasTypeInFields(entry.info.fields);
var entry = compareEntry;
if(fields._hasTypeInParameterFields !== true && entry.parameter && entry.parameter.fields) fields._hasTypeInParameterFields = _hasTypeInFields(entry.parameter.fields);
if(fields._hasTypeInErrorFields !== true && entry.error && entry.error.fields) fields._hasTypeInErrorFields = _hasTypeInFields(entry.error.fields);
if(fields._hasTypeInSuccessFields !== true && entry.success && entry.success.fields) fields._hasTypeInSuccessFields = _hasTypeInFields(entry.success.fields);
if(fields._hasTypeInInfoFields !== true && entry.info && entry.info.fields) fields._hasTypeInInfoFields = _hasTypeInFields(entry.info.fields);
var content = templateCompareArticle(fields);
$root.after(content);
var $content = $root.next();
// Event on.click muss neu zugewiesen werden (sollte eigentlich mit on automatisch funktionieren... sollte)
$content.find(".versions li.version a").on("click", changeVersionCompareTo);
// Navigation markieren
$("#sidenav li[data-group=\"" + group + "\"][data-name=\"" + name + "\"][data-version=\"" + currentVersion + "\"]").addClass("has-modifications");
$root.remove();
// todo: bei Hauptversionswechsel oder zurückstellen auf höchste Eintragsversion, den Eintrag neu rendern
}
initDynamic();
return;
} // changeVersionCompareTo
/**
*
*/
function changeAllVersionCompareTo(e)
{
e.preventDefault();
$("article:visible .versions").each(function(){
var $root = $(this).parents("article");
var currentVersion = $root.data("version");
var $foundElement = null;
$(this).find("li.version a").each(function() {
var selectVersion = $(this).html();
if(selectVersion < currentVersion && ! $foundElement)
{
$foundElement = $(this);
}
});
if($foundElement)
{
$foundElement.trigger("click");
}
});
initDynamic();
return;
} // changeAllVersionCompareTo
/**
* Render an Article.
*/
function renderArticle(group, name, version)
{
var entry = {};
$.each(apiByGroupAndName[group][name], function(index, currentEntry) {
if(currentEntry.version === version) entry = currentEntry;
});
var fields = {
article: entry,
versions: articleVersions[group][name]
};
if(entry.parameter && entry.parameter.fields) fields._hasTypeInParameterFields = _hasTypeInFields(entry.parameter.fields);
if(entry.error && entry.error.fields) fields._hasTypeInErrorFields = _hasTypeInFields(entry.error.fields);
if(entry.success && entry.success.fields) fields._hasTypeInSuccessFields = _hasTypeInFields(entry.success.fields);
if(entry.info && entry.info.fields) fields._hasTypeInInfoFields = _hasTypeInFields(entry.info.fields);
return templateArticle(fields);
} // renderArticle
/**
* Render the original Article and remove the current visible Article.
*/
function resetArticle(group, name, version)
{
var $root = $("article[data-group=\"" + group + "\"][data-name=\"" + name + "\"]:visible");
var content = renderArticle(group, name, version);
$root.after(content);
var $content = $root.next();
// Event on.click muss neu zugewiesen werden (sollte eigentlich mit on automatisch funktionieren... sollte)
$content.find(".versions li.version a").on("click", changeVersionCompareTo);
$("#sidenav li[data-group=\"" + group + "\"][data-name=\"" + name + "\"][data-version=\"" + version + "\"]").removeClass("has-modifications");
$root.remove();
return;
} // resetArticle
}); | {
"content_hash": "78cc511d0f2c36cc735b0b37b7184cd4",
"timestamp": "",
"source": "github",
"line_count": 544,
"max_line_length": 170,
"avg_line_length": 28.277573529411764,
"alnum_prop": 0.6341415848664109,
"repo_name": "sylvainw/brain-api",
"id": "d638e6ee85bd295ca307c291ea8a738cddf20935",
"size": "15397",
"binary": false,
"copies": "3",
"ref": "refs/heads/master",
"path": "doc/main.js",
"mode": "33188",
"license": "mit",
"language": [
{
"name": "CSS",
"bytes": "6480"
},
{
"name": "HTML",
"bytes": "12743"
},
{
"name": "JavaScript",
"bytes": "826"
}
],
"symlink_target": ""
} |
using PipServices.Commons.Data;
using PipServices.Commons.Log;
using System;
using System.Collections.Generic;
using Xunit;
namespace PipServices.Commons.Convert
{
//[TestClass]
public class TypeConverterTest
{
[Fact]
public void TestToTypeCode()
{
Assert.Equal(TypeCode.String, TypeConverter.ToTypeCode(typeof(string)));
Assert.Equal(TypeCode.Integer, TypeConverter.ToTypeCode(typeof(int)));
Assert.Equal(TypeCode.Long, TypeConverter.ToTypeCode(typeof(long)));
Assert.Equal(TypeCode.Float, TypeConverter.ToTypeCode(typeof(float)));
Assert.Equal(TypeCode.Double, TypeConverter.ToTypeCode(typeof(double)));
Assert.Equal(TypeCode.DateTime, TypeConverter.ToTypeCode(typeof(DateTime)));
Assert.Equal(TypeCode.Enum, TypeConverter.ToTypeCode(typeof(LogLevel)));
Assert.Equal(TypeCode.Array, TypeConverter.ToTypeCode(typeof(List<object>)));
Assert.Equal(TypeCode.Map, TypeConverter.ToTypeCode(typeof(Dictionary<string, object>)));
Assert.Equal(TypeCode.Object, TypeConverter.ToTypeCode(typeof(object)));
Assert.Equal(TypeCode.Unknown, TypeConverter.ToTypeCode(null));
Assert.Equal(TypeCode.String, TypeConverter.ToTypeCode("123"));
Assert.Equal(TypeCode.Integer, TypeConverter.ToTypeCode(123));
Assert.Equal(TypeCode.Long, TypeConverter.ToTypeCode(123L));
Assert.Equal(TypeCode.Float, TypeConverter.ToTypeCode(123.456f));
Assert.Equal(TypeCode.Double, TypeConverter.ToTypeCode(123.456));
Assert.Equal(TypeCode.DateTime, TypeConverter.ToTypeCode(DateTime.Now));
Assert.Equal(TypeCode.Enum, TypeConverter.ToTypeCode(LogLevel.None));
Assert.Equal(TypeCode.Array, TypeConverter.ToTypeCode(new List<int>()));
Assert.Equal(TypeCode.Array, TypeConverter.ToTypeCode(new int[0]));
Assert.Equal(TypeCode.Map, TypeConverter.ToTypeCode(new Dictionary<string, string>()));
Assert.Equal(TypeCode.Object, TypeConverter.ToTypeCode(new object()));
}
[Fact]
public void TestToNullableType()
{
Assert.Equal("123", TypeConverter.ToType<string>(123));
Assert.Equal(123, TypeConverter.ToNullableType<int>("123"));
Assert.Equal(123L, TypeConverter.ToNullableType<long>(123.456));
Assert.True(123 - TypeConverter.ToNullableType<float>(123) < 0.001);
Assert.True(123 - TypeConverter.ToNullableType<double>(123) < 0.001);
Assert.Equal(DateTimeConverter.ToDateTime("1975-04-08T17:30:00.00Z"),
TypeConverter.ToNullableType<DateTime>("1975-04-08T17:30:00.00Z"));
//Assert.Equal(1, TypeConverter.ToNullableType<List<object>>(123).Count);
//Assert.Equal(1, TypeConverter.ToNullableType<Dictionary<string, object>>(StringValueMap.FromString("abc=123")).Count);
}
[Fact]
public void TestToType()
{
Assert.Equal("123", TypeConverter.ToType<string>(123));
Assert.Equal(123, TypeConverter.ToType<int>("123"));
Assert.Equal(123L, TypeConverter.ToType<long>(123.456));
Assert.True(123 - TypeConverter.ToType<float>(123) < 0.001);
Assert.True(123 - TypeConverter.ToType<double>(123) < 0.001);
Assert.Equal(DateTimeConverter.ToDateTime("1975-04-08T17:30:00.00Z"),
TypeConverter.ToType<DateTime>("1975-04-08T17:30:00.00Z"));
//Assert.Equal(1, TypeConverter.ToType<List<object>>(123).Count);
//Assert.Equal(1, TypeConverter.ToType<Dictionary<string, object>>(StringValueMap.FromString("abc=123")).Count);
}
[Fact]
public void TestToTypeWithDefault()
{
Assert.Equal("123", TypeConverter.ToTypeWithDefault<string>(null, "123"));
Assert.Equal(123, TypeConverter.ToTypeWithDefault<int>(null, 123));
Assert.Equal(123L, TypeConverter.ToTypeWithDefault<long>(null, 123L));
Assert.True(123 - TypeConverter.ToTypeWithDefault<float>(null, (float)123) < 0.001);
Assert.True(123 - TypeConverter.ToTypeWithDefault<double>(null, 123.0) < 0.001);
Assert.Equal(DateTimeConverter.ToDateTime("1975-04-08T17:30:00.00Z"),
TypeConverter.ToTypeWithDefault<DateTime>("1975-04-08T17:30:00.00Z", default(DateTime)));
//Assert.Equal(1, TypeConverter.ToTypeWithDefault<List<object>>(123, null).Count);
//Assert.Equal(1, TypeConverter.ToTypeWithDefault<Dictionary<string, object>>(StringValueMap.FromString("abc=123"), null).Count);
}
}
}
| {
"content_hash": "879975a7f9fed1dd62b61a18970b9a0e",
"timestamp": "",
"source": "github",
"line_count": 83,
"max_line_length": 141,
"avg_line_length": 56.674698795180724,
"alnum_prop": 0.6639030612244898,
"repo_name": "pip-services/pip-services-commons-dotnet",
"id": "9271ef380564808066cd478141d9d43735a6de26",
"size": "4706",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "test/Convert/TypeConverterTest.cs",
"mode": "33188",
"license": "mit",
"language": [
{
"name": "C#",
"bytes": "559593"
},
{
"name": "PowerShell",
"bytes": "128"
},
{
"name": "Shell",
"bytes": "2456"
},
{
"name": "Smalltalk",
"bytes": "287"
}
],
"symlink_target": ""
} |
"""
-------------------------------------------------------
contains
holds a function contains
-------------------------------------------------------
Author: Dallas Fraser
ID: 110242560
Email: [email protected]
Version: 2014-09-17
-------------------------------------------------------
"""
import itertools
import networkx as nx
def induced_subgraph(G, H):
'''
induced_subgraph
a function that checks if G has an induced subgraph of H
Parameters:
G: the graph to check (networkx)
H: the induced subgraph (networkx)
Returns:
induced: the induced subgraph (networkx)
Method:
just create every permutation of the G graph with as many vertices
as H and use networkx to check if isomorphic
Note:
not solved in polynomial time (only use for small cases)
'''
n = len(G)
k = len(H)
if n < k:
return None
permutations = create_permutations(n, k)
induced = None
for subset in permutations:
subgraph = G.subgraph(subset)
if nx.faster_could_be_isomorphic(subgraph, H):
if nx.is_isomorphic(subgraph, H):
induced = subgraph
break # only want to find one
return induced
def create_permutations(n, k):
'''
create_permutations
a function which returns a list of all possible permutations n choose k
Parameters:
n: the total number of items
k: the number of items to choose
Returns:
iterator: to the list of permutations
'''
number_list = []
for x in range(0,n):
number_list.append(x)
return itertools.combinations(number_list, k)
def k_vertex(g, subgraphs):
'''
k_vertex
a function that finds all the k_vertex for k=0 to n (# of g vertices)
Parameters:
g: the graph to finds the k vertex for (networkx)
subgraphs: the list of subgraphs g is to be free of (list of networkx)
Returns:
k_vertexes: python dictionary
eg. [{has_k_vertex: Boolean, combination: [[node,node],[node,node]]}]
'''
nodes = g.nodes()
node = len(g.nodes())
k_vertexes = []
# check for zero vertex
g.add_node(node)
zero_vertex = True
for sub in subgraphs:
induced = induced_subgraph(g, sub)
if induced is not None:
zero_vertex = False
break;
if zero_vertex:
k_vertexes.append({'has_k_vertex':True, 'combinations':[]})
else:
k_vertexes.append({'has_k_vertex':False, 'combinations':[]})
# check the rest now
g.remove_node(node) # remove added node
for k in range(1, node + 1):
k_vertexes.append({'has_k_vertex': False, 'combinations':[]})
for combo in itertools.combinations(nodes, k):
g.add_node(node) # add node
#add the edges
for vertex in combo:
g.add_edge(node, vertex)
does_contain = False # assume it does not contain all the subgraphs
for sub in subgraphs:
induced = induced_subgraph(g, sub)
if induced is not None:
# does contain a forbidden subgraph
does_contain = True
if not does_contain:
# did not contain any forbidden subgraph
k_vertexes[k]['has_k_vertex'] = True
k_vertexes[k]['combinations'].append(combo)
g.remove_node(node) # remove added node and its edges
return k_vertexes
import unittest
import sys
sys.path.append("..") # Adds higher directory to python modules path.
from algorithms.helper import make_cycle, make_claw, make_co_claw
from algorithms.helper import make_diamond, make_co_diamond, make_wheel
from pprint import PrettyPrinter
class tester(unittest.TestCase):
def setUp(self):
self.pp = PrettyPrinter(indent = 4)
def tearDown(self):
pass
def testInducedSubgraph(self):
h = make_claw()
g = make_wheel(7)
induced = induced_subgraph(g, h)
expected = [0, 2, 4, 6]
self.assertEqual(induced.nodes(), expected,
"Contains: Failed to find a claw in W7")
def testC7CoClawClawFree(self):
g = make_cycle(7)
subgraphs = [make_claw(), make_co_claw()]
k_vertexes = k_vertex(g, subgraphs)
for index, k in enumerate(k_vertexes):
if index > 0:
self.assertEqual(k['has_k_vertex'], False,
'''
K Vertex says (claw,co-claw)-free Graph
has a %s-vertex''' % index)
else:
self.assertEqual(k['has_k_vertex'], True,
'''
K Vertex says (claw,co-claw)-free Graph
has no a %s-vertex''' % index)
def testC5DiamondCoDiamondFree(self):
g = make_cycle(5)
subgraphs = [make_diamond(), make_co_diamond()]
k_vertexes = k_vertex(g, subgraphs)
expect = [False, False, True, True, False, False]
for index, k in enumerate(k_vertexes):
self.assertEqual(k['has_k_vertex'], expect[index],
'''K Vertex says (diamond,co-diamond)- free Graph
%d - vertex:%r but should be %r'''
%(index, k['has_k_vertex'], expect[index]))
set_2_vertex = [(0, 1), (0, 4), (1, 2), (2, 3), (3, 4)]
for check in set_2_vertex:
self.assertEqual(check in k_vertexes[2]['combinations'], True,
'''
K vertex missing 2 Vertex set (%d, %d)
on (diamond, co-diamond)-free Grpah
''' %(check[0],check[1]))
set_3_vertex = [(0, 1, 3),
(0, 2, 3),
(0, 2, 4),
(1, 2, 4),
(1, 3, 4)]
for check in set_3_vertex:
self.assertEqual(check in k_vertexes[3]['combinations'], True,
'''
K vertex missing 3 Vertex set (%d, %d, %d)
on (diamond, co-diamond)-free Grpah
''' %(check[0],check[1], check[2]))
| {
"content_hash": "b4dd2173d36b219327428a86bcdd5a3d",
"timestamp": "",
"source": "github",
"line_count": 171,
"max_line_length": 79,
"avg_line_length": 37.28654970760234,
"alnum_prop": 0.5221141781681304,
"repo_name": "fras2560/graph-helper",
"id": "df2a0cee3384e34fb9e909d0603be67626868d44",
"size": "6376",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "algorithms/induced_subgraph.py",
"mode": "33188",
"license": "apache-2.0",
"language": [
{
"name": "Python",
"bytes": "56403"
}
],
"symlink_target": ""
} |
<!DOCTYPE html>
<!--
| Generated by Apache Maven Doxia Site Renderer 1.9.2 from org.apache.maven.plugins:maven-project-info-reports-plugin:3.0.0:summary at 2020-04-14
| Rendered using Apache Maven Default Skin
-->
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
<head>
<meta charset="UTF-8" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<meta name="generator" content="Apache Maven Doxia Site Renderer 1.9.2" />
<title>Permazen Parsing Classes – Project Summary</title>
<link rel="stylesheet" href="./css/maven-base.css" />
<link rel="stylesheet" href="./css/maven-theme.css" />
<link rel="stylesheet" href="./css/site.css" />
<link rel="stylesheet" href="./css/print.css" media="print" />
</head>
<body class="composite">
<div id="banner">
<div id="bannerLeft">Permazen Parsing Classes
</div>
<div class="clear">
<hr/>
</div>
</div>
<div id="breadcrumbs">
<div class="xleft">
<span id="publishDate">Last Published: 2020-04-14</span>
 | <span id="projectVersion">Version: 4.1.6</span>
</div>
<div class="xright"><a href="./" title="Permazen Parsing Classes">Permazen Parsing Classes</a> </div>
<div class="clear">
<hr/>
</div>
</div>
<div id="leftColumn">
<div id="navcolumn">
<h5>Parent Project</h5>
<ul>
<li class="none"><a href="../index.html" title="Permazen">Permazen</a></li>
</ul>
<h5>Project Documentation</h5>
<ul>
<li class="expanded"><a href="project-info.html" title="Project Information">Project Information</a>
<ul>
<li class="none"><a href="dependencies.html" title="Dependencies">Dependencies</a></li>
<li class="none"><a href="dependency-info.html" title="Dependency Information">Dependency Information</a></li>
<li class="none"><a href="dependency-management.html" title="Dependency Management">Dependency Management</a></li>
<li class="none"><a href="distribution-management.html" title="Distribution Management">Distribution Management</a></li>
<li class="none"><a href="index.html" title="About">About</a></li>
<li class="none"><a href="issue-management.html" title="Issue Management">Issue Management</a></li>
<li class="none"><a href="licenses.html" title="Licenses">Licenses</a></li>
<li class="none"><a href="plugin-management.html" title="Plugin Management">Plugin Management</a></li>
<li class="none"><a href="plugins.html" title="Plugins">Plugins</a></li>
<li class="none"><a href="scm.html" title="Source Code Management">Source Code Management</a></li>
<li class="none"><strong>Summary</strong></li>
<li class="none"><a href="team.html" title="Team">Team</a></li>
</ul></li>
</ul>
<a href="http://maven.apache.org/" title="Built by Maven" class="poweredBy">
<img class="poweredBy" alt="Built by Maven" src="./images/logos/maven-feather.png" />
</a>
</div>
</div>
<div id="bodyColumn">
<div id="contentBox">
<section>
<h2><a name="Project_Summary"></a>Project Summary</h2><a name="Project_Summary"></a><section>
<h3><a name="Project_Information"></a>Project Information</h3><a name="Project_Information"></a>
<table border="0" class="bodyTable">
<tr class="a">
<th>Field</th>
<th>Value</th></tr>
<tr class="b">
<td>Name</td>
<td>Permazen Parsing Classes</td></tr>
<tr class="a">
<td>Description</td>
<td>Permazen classes for parsing Java expressions.</td></tr>
<tr class="b">
<td>Homepage</td>
<td><a class="externalLink" href="https://github.com/permazen/permazen/permazen-parse/">https://github.com/permazen/permazen/permazen-parse/</a></td></tr></table></section><section>
<h3><a name="Project_Organization"></a>Project Organization</h3><a name="Project_Organization"></a>
<p>This project does not belong to an organization.</p></section><section>
<h3><a name="Build_Information"></a>Build Information</h3><a name="Build_Information"></a>
<table border="0" class="bodyTable">
<tr class="a">
<th>Field</th>
<th>Value</th></tr>
<tr class="b">
<td>GroupId</td>
<td>io.permazen</td></tr>
<tr class="a">
<td>ArtifactId</td>
<td>permazen-parse</td></tr>
<tr class="b">
<td>Version</td>
<td>4.1.6</td></tr>
<tr class="a">
<td>Type</td>
<td>jar</td></tr>
<tr class="b">
<td>Java Version</td>
<td>1.8</td></tr></table></section><section>
<h3><a name="Download"></a>Download</h3><a name="Download"></a><a class="externalLink" href="https://github.com/permazen/permazen">https://github.com/permazen/permazen</a></section></section>
</div>
</div>
<div class="clear">
<hr/>
</div>
<div id="footer">
<div class="xright">
Copyright © 2020.. </div>
<div class="clear">
<hr/>
</div>
</div>
</body>
</html>
| {
"content_hash": "752f361762e2f153a1da2a970e1d6a19",
"timestamp": "",
"source": "github",
"line_count": 119,
"max_line_length": 191,
"avg_line_length": 41.09243697478992,
"alnum_prop": 0.6298568507157464,
"repo_name": "archiecobbs/jsimpledb",
"id": "726c21091a7cf27029555e8825467b01b0c2802f",
"size": "4890",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "site/permazen-parse/summary.html",
"mode": "33188",
"license": "apache-2.0",
"language": [
{
"name": "CSS",
"bytes": "193300"
},
{
"name": "HTML",
"bytes": "35914312"
},
{
"name": "Java",
"bytes": "5095933"
},
{
"name": "JavaScript",
"bytes": "827"
}
],
"symlink_target": ""
} |
Calculate the moment when someone has lived for 10^9 seconds.
A gigasecond is 10^9 (1,000,000,000) seconds.
## Setup
Go through the setup instructions for TypeScript to
install the necessary dependencies:
http://exercism.io/languages/typescript
## Requirements
Install assignment dependencies:
```bash
$ yarn install
```
## Making the test suite pass
Execute the tests with:
```bash
$ yarn test
```
## Source
Chapter 9 in Chris Pine's online Learn to Program tutorial. [http://pine.fm/LearnToProgram/?Chapter=09](http://pine.fm/LearnToProgram/?Chapter=09)
## Submitting Incomplete Solutions
It's possible to submit an incomplete solution so you can see how others have completed the exercise.
| {
"content_hash": "842624284d243ce1785da9152a18f37b",
"timestamp": "",
"source": "github",
"line_count": 35,
"max_line_length": 146,
"avg_line_length": 20.228571428571428,
"alnum_prop": 0.7584745762711864,
"repo_name": "rootulp/exercism",
"id": "91c7203584793e573a89b727793134e17508452d",
"size": "722",
"binary": false,
"copies": "2",
"ref": "refs/heads/main",
"path": "typescript/gigasecond/README.md",
"mode": "33188",
"license": "mit",
"language": [
{
"name": "CSS",
"bytes": "18900"
},
{
"name": "CoffeeScript",
"bytes": "15342"
},
{
"name": "Elm",
"bytes": "48222"
},
{
"name": "Go",
"bytes": "594636"
},
{
"name": "HTML",
"bytes": "81617"
},
{
"name": "Java",
"bytes": "231244"
},
{
"name": "JavaScript",
"bytes": "126832"
},
{
"name": "Python",
"bytes": "242540"
},
{
"name": "Ruby",
"bytes": "192051"
},
{
"name": "Rust",
"bytes": "77292"
},
{
"name": "TypeScript",
"bytes": "78185"
}
],
"symlink_target": ""
} |
<?xml version="1.0" encoding="utf-8"?>
<FrameLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="wrap_content" >
<Button
android:id="@+id/btnAnalyzeBuild"
style="@style/LabelButton"
android:paddingTop="16dp"
android:paddingBottom="14dp"
android:layout_marginLeft="5dp"
android:layout_marginRight="5dp"
android:layout_marginTop="5dp"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:text="@string/analyze_build"
android:textAppearance="?android:attr/textAppearanceMedium"
android:background="@drawable/skill_item_bg" />
</FrameLayout> | {
"content_hash": "d9e17851bcbf76c3788325783f153785",
"timestamp": "",
"source": "github",
"line_count": 20,
"max_line_length": 71,
"avg_line_length": 37.4,
"alnum_prop": 0.6724598930481284,
"repo_name": "idunnololz/LoLCraft",
"id": "2c0a10d398560c2107bb889d86c93c15b6d72f64",
"size": "748",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "app/src/main/res/layout/item_header_analyze_build.xml",
"mode": "33188",
"license": "apache-2.0",
"language": [
{
"name": "Brainfuck",
"bytes": "61593"
},
{
"name": "Java",
"bytes": "452685"
}
],
"symlink_target": ""
} |
function usage() {
echo "$0 username api_key organisation package_file site_url"
exit 0
}
if [ $# -lt 5 ]; then
usage
fi
BINTRAY_USER=$1
BINTRAY_APIKEY=$2
BINTRAY_ACCOUNT=$3
PACKAGE_FILE=$4
BASE_DESC=$5
FILE_EXTENSION=${PACKAGE_FILE##*.}
BINTRAY_REPO="${FILE_EXTENSION,,}"
XDEBUG=""
DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )"
CURL_SILENT_CMD="curl --write-out %{http_code} --location --silent --output /dev/null -u$BINTRAY_USER:$BINTRAY_APIKEY"
CURL_VERBOSE_CMD="curl --write-out %{http_code} --location -u$BINTRAY_USER:$BINTRAY_APIKEY"
CURL_CMD=$CURL_SILENT_CMD
function grab() {
local REGEX="s/set\($1 \\\"([^\\\"]*)\\\"\)$/\1/p"
local RES=$(sed -nEe "$REGEX" $DIR/../CMakeLists.txt)
echo $RES
}
PACKAGE_NAME=$(grab "CPACK_PACKAGE_NAME")
PACKAGE_DESCRIPTION=$(grab "CPACK_PACKAGE_DESCRIPTION_SUMMARY")
PACKAGE_LICENSE=$(grab "CPACK_RPM_PACKAGE_LICENSE")
PACKAGE_RELEASE=$(basename $(dirname $PACKAGE_FILE))
PACKAGE_ARCH=$(uname -i)
PACKAGE_MAJOR_VERSION=$(grab "CPACK_PACKAGE_VERSION_MAJOR")
PACKAGE_MINOR_VERSION=$(grab "CPACK_PACKAGE_VERSION_MINOR")
PACKAGE_PATCH_VERSION=$(grab "CPACK_PACKAGE_VERSION_PATCH")
PACKAGE_VERSION="$PACKAGE_MAJOR_VERSION.$PACKAGE_MINOR_VERSION.$PACKAGE_PATCH_VERSION"
REPO_FILE_PATH="$PACKAGE_RELEASE/$(basename $PACKAGE_FILE)"
DESC_URL=$BASE_DESC/$PACKAGE_NAME
if [ -z "$PACKAGE_NAME" ] || [ -z "$PACKAGE_VERSION" ] || [ -z "$PACKAGE_RELEASE" ] || [ -z "$PACKAGE_ARCH" ]; then
echo "no PACKAGE metadata information in $PACKAGE_FILE, skipping."
exit -1
fi
if [ $BINTRAY_REPO == "deb" ]; then
DEB_ARCH_ARG="X-Bintray-Debian-Architecture:$PACKAGE_ARCH"
DEB_COMPONENT_ARG="X-Bintray-Debian-Component:main"
DEB_DISTRIBUTION_ARG="X-Bintray-Debian-Distribution:$(lsb_release -sc)"
DEB_ARGS="-H $DEB_ARCH_ARG -H $DEB_COMPONENT_ARG -H $DEB_DISTRIBUTION_ARG"
else
DEB_ARGS=""
fi
echo "PACKAGE_NAME=$PACKAGE_NAME, PACKAGE_VERSION=$PACKAGE_VERSION, PACKAGE_RELEASE=$PACKAGE_RELEASE, PACKAGE_ARCH=$PACKAGE_ARCH"
echo "BINTRAY_USER=$BINTRAY_USER, BINTRAY_ACCOUNT=$BINTRAY_ACCOUNT, BINTRAY_REPO=$BINTRAY_REPO, PACKAGE_FILE=$PACKAGE_FILE, BASE_DESC=$BASE_DESC"
echo "Deleting version from Bintray.."
HTTP_CODE=`$CURL_CMD -H "Content-Type: application/json" -X DELETE https://api.bintray.com/packages/$BINTRAY_ACCOUNT/$BINTRAY_REPO/$PACKAGE_NAME/versions/$PACKAGE_VERSION-$PACKAGE_RELEASE`
if [ "$HTTP_CODE" != "200" ]; then
echo "can't delete package -> $HTTP_CODE"
else
echo "Package deleted"
fi
echo "Creating package on Bintray.."
DATA_JSON="{ \"name\": \"$PACKAGE_NAME\", \"desc\": \"${PACKAGE_DESCRIPTION}\", \"vcs_url\": \"$DESC_URL\", \"labels\": \"\", \"licenses\": [ \"$PACKAGE_LICENSE\" ] }"
if [ "$XDEBUG" = "true" ]; then
echo "DATA_JSON=$DATA_JSON"
fi
HTTP_CODE=`$CURL_CMD -H "Content-Type: application/json" -X POST https://api.bintray.com/packages/$BINTRAY_ACCOUNT/$BINTRAY_REPO/ --data "$DATA_JSON"`
if [ "$HTTP_CODE" != "201" ]; then
echo "can't create package -> $HTTP_CODE"
echo "Assuming package already exists"
else
echo "Package created"
fi
echo "Uploading package to Bintray.."
HTTP_CODE=`$CURL_CMD -T $PACKAGE_FILE -u$BINTRAY_USER:$BINTRAY_APIKEY -H "X-Bintray-Package:$PACKAGE_NAME" -H "X-Bintray-Version:$PACKAGE_VERSION-$PACKAGE_RELEASE" $DEB_ARGS "https://api.bintray.com/content/$BINTRAY_ACCOUNT/$BINTRAY_REPO/$REPO_FILE_PATH;publish=1"`
if [ "$HTTP_CODE" != "201" ]; then
echo "failed to upload package -> $HTTP_CODE"
exit -1
else
echo "Package uploaded"
fi
exit 0
| {
"content_hash": "7679c0cc068a00792983b57e67ce638f",
"timestamp": "",
"source": "github",
"line_count": 97,
"max_line_length": 265,
"avg_line_length": 36.134020618556704,
"alnum_prop": 0.6918687589158345,
"repo_name": "RobAltena/deeplearning4j",
"id": "78fbed7613615f0424dc012ca6bd586a7f58379f",
"size": "4361",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "libnd4j/packages/push_to_bintray.sh",
"mode": "33261",
"license": "apache-2.0",
"language": [
{
"name": "Batchfile",
"bytes": "2469"
},
{
"name": "C",
"bytes": "144275"
},
{
"name": "C#",
"bytes": "138404"
},
{
"name": "C++",
"bytes": "16954560"
},
{
"name": "CMake",
"bytes": "77377"
},
{
"name": "CSS",
"bytes": "10363"
},
{
"name": "Cuda",
"bytes": "2324886"
},
{
"name": "Dockerfile",
"bytes": "1329"
},
{
"name": "FreeMarker",
"bytes": "77045"
},
{
"name": "HTML",
"bytes": "38914"
},
{
"name": "Java",
"bytes": "36293636"
},
{
"name": "JavaScript",
"bytes": "436278"
},
{
"name": "PureBasic",
"bytes": "12256"
},
{
"name": "Python",
"bytes": "325018"
},
{
"name": "Ruby",
"bytes": "4558"
},
{
"name": "Scala",
"bytes": "355054"
},
{
"name": "Shell",
"bytes": "80490"
},
{
"name": "Smarty",
"bytes": "900"
},
{
"name": "Starlark",
"bytes": "931"
},
{
"name": "TypeScript",
"bytes": "80252"
}
],
"symlink_target": ""
} |
<?php
namespace Pagekit\Console;
use Symfony\Component\Console\Input\InputInterface;
use Symfony\Component\Console\Output\OutputInterface;
class ThemeUploadCommand extends ExtensionUploadCommand
{
/**
* {@inheritdoc}
*/
protected $name = 'theme:upload';
/**
* {@inheritdoc}
*/
protected $description = 'Uploads a theme to the marketplace';
/**
* @var string
*/
protected $json = 'theme.json';
/**
* {@inheritdoc}
*/
protected function initialize(InputInterface $input, OutputInterface $output)
{
parent::initialize($input, $output);
$this->path = $this->container['path.themes'];
}
}
| {
"content_hash": "89214e5d26804890d8322de9b1468b92",
"timestamp": "",
"source": "github",
"line_count": 34,
"max_line_length": 81,
"avg_line_length": 20.205882352941178,
"alnum_prop": 0.6244541484716157,
"repo_name": "RobertJGabriel/pagekit",
"id": "5719436c965d66151ce093d6f9f0d5b80f04601e",
"size": "687",
"binary": false,
"copies": "3",
"ref": "refs/heads/develop",
"path": "app/system/modules/console/src/ThemeUploadCommand.php",
"mode": "33261",
"license": "mit",
"language": [
{
"name": "ApacheConf",
"bytes": "834"
},
{
"name": "CSS",
"bytes": "219348"
},
{
"name": "HTML",
"bytes": "5755"
},
{
"name": "JavaScript",
"bytes": "128280"
},
{
"name": "PHP",
"bytes": "2482523"
}
],
"symlink_target": ""
} |
package com.cubedhost.fir;
import com.google.common.collect.HashMultimap;
import com.google.common.collect.ImmutableMap;
import com.google.common.collect.Multimap;
import com.google.gson.Gson;
import com.google.gson.GsonBuilder;
import java.io.File;
import java.io.FileFilter;
import java.io.FileInputStream;
import java.io.IOException;
import java.util.ArrayList;
import java.util.List;
import java.util.Map;
import java.util.zip.ZipEntry;
import java.util.zip.ZipInputStream;
import org.objectweb.asm.ClassReader;
public class Fir {
private static final Gson gson = new GsonBuilder().setPrettyPrinting().create();
private static FileFilter forgeModFilter = (file) -> file.getName().endsWith(".jar") || file.getName().endsWith(".zip");
private Fir() {
}
public static void main(String[] args) throws Exception {
if (args.length < 1) {
System.err.println("Usage: java -jar Fir.jar <input>");
System.err.println("Input can be a single file, multiple files, or a directory, which will be scanned recursively.");
System.exit(1);
}
// Add inputs
List<File> inputs = new ArrayList<>();
Multimap<String, Map<String, Object>> output = HashMultimap.create();
for (String inputString : args) {
File file = new File(inputString);
if (!file.exists()) {
continue;
}
addInputFilesRecursively(inputs, file);
}
// Produce outputs
for (File input : inputs) {
List<Map<String, Object>> processed = processInput(input);
if (processed != null) {
output.putAll(input.getPath(), processed);
}
}
// Print JSON output
System.out.println(gson.toJson(output.asMap()));
}
private static void addInputFilesRecursively(List<File> inputList, File directory) throws IOException {
if (!directory.isDirectory()) {
inputList.add(directory);
return;
}
for (File file : directory.listFiles(forgeModFilter)) {
if (file.isDirectory()) {
addInputFilesRecursively(inputList, file);
} else {
inputList.add(file);
}
}
}
private static List<Map<String, Object>> processInput(File input) {
List<Map<String, Object>> output = new ArrayList<>();
InfoClassVisitor visitor = new InfoClassVisitor(output);
try (ZipInputStream zip = new ZipInputStream(new FileInputStream(input))) {
ZipEntry entry;
while ((entry = zip.getNextEntry()) != null) {
if (!entry.getName().endsWith(".class")) {
continue;
}
ClassReader cr = new ClassReader(zip);
cr.accept(visitor, ClassReader.SKIP_CODE | ClassReader.SKIP_DEBUG | ClassReader.SKIP_FRAMES);
}
} catch (IOException ex) {
ex.printStackTrace();
return null;
}
return output;
}
}
| {
"content_hash": "7620fe19c1620d3bda33fa3622ca1daf",
"timestamp": "",
"source": "github",
"line_count": 94,
"max_line_length": 129,
"avg_line_length": 32.861702127659576,
"alnum_prop": 0.6008416963418582,
"repo_name": "CubedHost/Fir",
"id": "c9a4956380f41f224fa5b2dd335d2b23fd742ddf",
"size": "3089",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "src/main/java/com/cubedhost/fir/Fir.java",
"mode": "33188",
"license": "mit",
"language": [
{
"name": "Java",
"bytes": "5047"
}
],
"symlink_target": ""
} |
#include "sk_tool_utils.h"
#include "SkBlurImageFilter.h"
#include "SkColor.h"
#include "SkDisplacementMapEffect.h"
#include "SkDropShadowImageFilter.h"
#include "SkGradientShader.h"
#include "SkImage.h"
#include "SkImageSource.h"
#include "SkMorphologyImageFilter.h"
#include "SkScalar.h"
#include "SkSurface.h"
#include "gm.h"
namespace skiagm {
// This GM draws image filters with a CTM containing shearing / rotation.
// It checks that the scale portion of the CTM is correctly extracted
// and applied to the image inputs separately from the non-scale portion.
static sk_sp<SkImage> make_gradient_circle(int width, int height) {
SkScalar x = SkIntToScalar(width / 2);
SkScalar y = SkIntToScalar(height / 2);
SkScalar radius = SkMinScalar(x, y) * 0.8f;
auto surface(SkSurface::MakeRasterN32Premul(width, height));
SkCanvas* canvas = surface->getCanvas();
canvas->clear(0x00000000);
SkColor colors[2];
colors[0] = SK_ColorWHITE;
colors[1] = SK_ColorBLACK;
SkPaint paint;
paint.setShader(SkGradientShader::MakeRadial(SkPoint::Make(x, y), radius, colors, nullptr, 2,
SkShader::kClamp_TileMode));
canvas->drawCircle(x, y, radius, paint);
return surface->makeImageSnapshot();
}
class ImageFiltersTransformedGM : public GM {
public:
ImageFiltersTransformedGM() {
this->setBGColor(SK_ColorBLACK);
}
protected:
SkString onShortName() override { return SkString("imagefilterstransformed"); }
SkISize onISize() override { return SkISize::Make(420, 240); }
void onOnceBeforeDraw() override {
fCheckerboard = SkImage::MakeFromBitmap(
sk_tool_utils::create_checkerboard_bitmap(64, 64, 0xFFA0A0A0, 0xFF404040, 8));
fGradientCircle = make_gradient_circle(64, 64);
}
void onDraw(SkCanvas* canvas) override {
sk_sp<SkImageFilter> gradient(SkImageSource::Make(fGradientCircle));
sk_sp<SkImageFilter> checkerboard(SkImageSource::Make(fCheckerboard));
sk_sp<SkImageFilter> filters[] = {
SkBlurImageFilter::Make(12, 0, nullptr),
SkDropShadowImageFilter::Make(0, 15, 8, 0, SK_ColorGREEN,
SkDropShadowImageFilter::kDrawShadowAndForeground_ShadowMode, nullptr),
SkDisplacementMapEffect::Make(SkDisplacementMapEffect::kR_ChannelSelectorType,
SkDisplacementMapEffect::kR_ChannelSelectorType,
12,
std::move(gradient),
checkerboard),
SkDilateImageFilter::Make(2, 2, checkerboard),
SkErodeImageFilter::Make(2, 2, checkerboard),
};
const SkScalar margin = SkIntToScalar(20);
const SkScalar size = SkIntToScalar(60);
for (size_t j = 0; j < 3; j++) {
canvas->save();
canvas->translate(margin, 0);
for (size_t i = 0; i < SK_ARRAY_COUNT(filters); ++i) {
SkPaint paint;
paint.setColor(SK_ColorWHITE);
paint.setImageFilter(filters[i]);
paint.setAntiAlias(true);
canvas->save();
canvas->translate(size * SK_ScalarHalf, size * SK_ScalarHalf);
canvas->scale(SkDoubleToScalar(0.8), SkDoubleToScalar(0.8));
if (j == 1) {
canvas->rotate(SkIntToScalar(45));
} else if (j == 2) {
canvas->skew(SkDoubleToScalar(0.5), SkDoubleToScalar(0.2));
}
canvas->translate(-size * SK_ScalarHalf, -size * SK_ScalarHalf);
canvas->drawOval(SkRect::MakeXYWH(0, size * SkDoubleToScalar(0.1),
size, size * SkDoubleToScalar(0.6)), paint);
canvas->restore();
canvas->translate(size + margin, 0);
}
canvas->restore();
canvas->translate(0, size + margin);
}
}
private:
sk_sp<SkImage> fCheckerboard;
sk_sp<SkImage> fGradientCircle;
typedef GM INHERITED;
};
DEF_GM( return new ImageFiltersTransformedGM; )
}
//////////////////////////////////////////////////////////////////////////////
#include "SkXfermodeImageFilter.h"
DEF_SIMPLE_GM(rotate_imagefilter, canvas, 500, 500) {
SkPaint paint;
const SkRect r = SkRect::MakeXYWH(50, 50, 100, 100);
sk_sp<SkImageFilter> filters[] = {
nullptr,
SkBlurImageFilter::Make(6, 0, nullptr),
SkXfermodeImageFilter::Make(SkXfermode::Make(SkXfermode::kSrcOver_Mode), nullptr),
};
for (auto& filter : filters) {
paint.setAntiAlias(false);
paint.setImageFilter(filter);
canvas->save();
canvas->drawRect(r, paint);
canvas->translate(150, 0);
canvas->save();
canvas->translate(100, 100);
canvas->rotate(30);
canvas->translate(-100, -100);
canvas->drawRect(r, paint);
canvas->restore();
paint.setAntiAlias(true);
canvas->translate(150, 0);
canvas->save();
canvas->translate(100, 100);
canvas->rotate(30);
canvas->translate(-100, -100);
canvas->drawRect(r, paint);
canvas->restore();
canvas->restore();
canvas->translate(0, 150);
}
}
| {
"content_hash": "cc2c403937494540b505fa9450d18098",
"timestamp": "",
"source": "github",
"line_count": 156,
"max_line_length": 97,
"avg_line_length": 34.916666666666664,
"alnum_prop": 0.5814209656691757,
"repo_name": "qrealka/skia-hc",
"id": "7ceff001351e1cba1944c72313d2d2b2b953c7cb",
"size": "5590",
"binary": false,
"copies": "2",
"ref": "refs/heads/master",
"path": "gm/imagefilterstransformed.cpp",
"mode": "33188",
"license": "apache-2.0",
"language": [
{
"name": "Batchfile",
"bytes": "1192"
},
{
"name": "C",
"bytes": "839059"
},
{
"name": "C++",
"bytes": "28766651"
},
{
"name": "CMake",
"bytes": "19140"
},
{
"name": "Go",
"bytes": "7147"
},
{
"name": "HTML",
"bytes": "63935"
},
{
"name": "Java",
"bytes": "106546"
},
{
"name": "JavaScript",
"bytes": "59259"
},
{
"name": "Lua",
"bytes": "25531"
},
{
"name": "Makefile",
"bytes": "10895"
},
{
"name": "Objective-C",
"bytes": "27163"
},
{
"name": "Objective-C++",
"bytes": "95537"
},
{
"name": "Python",
"bytes": "394901"
},
{
"name": "Shell",
"bytes": "57020"
}
],
"symlink_target": ""
} |
title: MakeGravGradGridDH (Python)
keywords: spherical harmonics software package, spherical harmonic transform, legendre functions, multitaper spectral analysis, fortran, Python, gravity, magnetic field
sidebar: mydoc_sidebar
permalink: pymakegravgradgriddh.html
summary:
tags: [python]
toc: false
---
Create 2D cylindrical maps on a flattened ellipsoid of the components of the gravity "gradient" tensor in a local north-oriented reference frame.
## Usage
`vxx`, `vyy`, `vzz`, `vxy`, `vxz`, `vyz` = MakeGravGradGridDH (`cilm`, `gm`, `r0`, [`a`, `f`, `lmax`, `sampling`, `lmax_calc`])
## Returns
`vxx` : float, dimension (2\*`lmax`+2, `sampling`\*(2*`lmax`+2))
: A 2D equally sampled (`n` by `n`) or equally spaced (`n` by 2`n`) grid of the `xx` component of the gravity tensor. The first latitudinal band corresponds to 90 N, the latitudinal band for 90 S is not included, and the latitudinal sampling interval is 180/`n` degrees. The first longitudinal band is 0 E, the longitudinal band for 360 E is not included, and the longitudinal sampling interval is 360/`n` for an equally sampled and 180/`n` for an equally spaced grid, respectively.
`vyy` : float, dimension (2\*`lmax`+2, `sampling`\*(2*`lmax`+2))
: A 2D equally sampled or equally spaced grid of the `yy` component of the gravity tensor.
`vzz` : float, dimension (2\*`lmax`+2, `sampling`\*(2*`lmax`+2))
: A 2D equally sampled or equally spaced grid of the `zz` component of the gravity tensor.
`vxy` : float, dimension (2\*`lmax`+2, `sampling`\*(2*`lmax`+2))
: A 2D equally sampled or equally spaced grid of the `xy` component of the gravity tensor.
`vxz` : float, dimension (2\*`lmax`+2, `sampling`\*(2*`lmax`+2))
: A 2D equally sampled or equally spaced grid of the `xz` component of the gravity tensor.
`vyz` : float, dimension (2\*`lmax`+2, `sampling`\*(2*`lmax`+2))
: A 2D equally sampled or equally spaced grid of the YZ component of the gravity tensor.
## Parameters
`cilm` : float, dimension (2, `lmaxin`+1, `lmaxin`+1)
: The real gravitational potential spherical harmonic coefficients. The coefficients `c1lm` and `c2lm` refer to the cosine and sine coefficients, respectively, with `c1lm=cilm[0,l,m]` and `c2lm=cilm[1,l,m]`.
`gm` : float
: The gravitational constant multiplied by the mass of the planet.
`r0`: float
: The reference radius of the spherical harmonic coefficients.
`a` : float
: The semi-major axis of the flattened ellipsoid on which the field is computed.
`f` : float
: The flattening of the reference ellipsoid: `f=(R_equator-R_pole)/R_equator`.
`lmax` : optional, integer, default = `lmaxin`
: The maximum spherical harmonic degree of the coefficients `cilm`. This determines the number of samples of the output grids, `n=2lmax+2`, and the latitudinal sampling interval, `90/(lmax+1)`.
`sampling` : optional, integer, default = 2
: If 1 the output grids are equally sampled (`n` by `n`). If 2, the grids are equally spaced (`n` by 2`n`).
`lmax_calc` : optional, integer, default = `lmax`
: The maximum spherical harmonic degree used in evaluating the functions. This must be less than or equal to `lmax`.
## Description
`MakeGravGradGridDH` will create 2-dimensional cylindrical maps from the spherical harmonic coefficients `cilm`, equally sampled (`n` by `n`) or equally spaced (`n` by 2`n`) in latitude and longitude, for six components of the gravity "gradient" tensor (all using geocentric coordinates):
`(Vxx, Vxy, Vxz)`
`(Vyx, Vyy, Vyz)`
`(Vzx, Vzy, Vzz)`
The reference frame is north-oriented, where `x` points north, `y` points west, and `z` points upward (all tangent or perpendicular to a sphere of radius r). The gravitational potential is defined as
`V = GM/r Sum_{l=0}^lmax (r0/r)^l Sum_{m=-l}^l C_{lm} Y_{lm}`,
where `r0` is the reference radius of the spherical harmonic coefficients `Clm`, and the gravitational acceleration is
`B = Grad V`.
The gravity tensor is symmetric, and satisfies `Vxx+Vyy+Vzz=0`, though all three diagonal elements are calculated independently in this routine.
The components of the gravity tensor are calculated according to eq. 1 in Petrovskaya and Vershkov (2006), which is based on eq. 3.28 in Reed (1973) (noting that Reed's equations are in terms of latitude and that the `y` axis points east):
`Vzz = Vrr`
`Vxx = 1/r Vr + 1/r^2 Vtt`
`Vyy = 1/r Vr + 1/r^2 /tan(t) Vt + 1/r^2 /sin(t)^2 Vpp`
`Vxy = 1/r^2 /sin(t) Vtp - cos(t)/sin(t)^2 /r^2 Vp`
`Vxz = 1/r^2 Vt - 1/r Vrt`
`Vyz = 1/r^2 /sin(t) Vp - 1/r /sin(t) Vrp`
where `r`, `t`, `p` stand for radius, theta, and phi, respectively, and subscripts on `V` denote partial derivatives.
The output grid are in units of s^-2 and are cacluated on a flattened ellipsoid with semi-major axis `a` and flattening `f`. To obtain units of Eotvos (10^-9 s^-2), multiply the output by 10^9. The calculated values should be considered exact only when the radii on the ellipsoid are less than the maximum radius of the planet (the potential coefficients are simply downward continued in the spectral domain).
The default is to calculate grids for use in the Driscoll and Healy (1994) routines that are equally spaced (`n` by `2n`), but this can be changed to calculate equally sampled grids (`n` by `n`) by setting the optional argument `sampling` to 1. The input value of `lmax` determines the number of samples, `n=2lmax+2`, and the latitudinal sampling interval, 90/(`lmax`+1). The first latitudinal band of the grid corresponds to 90 N, the latitudinal band for 90 S is not calculated, and the latitudinal sampling interval is 180/`n` degrees. The first longitudinal band is 0 E, the longitudinal band for 360 E is not calculated, and the longitudinal sampling interval is 360/`n` for equally sampled and 180/`n` for equally spaced grids, respectively.
## References
Reed, G.B., Application of kinematical geodesy for determining
the short wave length components of the gravity field by satellite gradiometry, Ohio State University, Dept. of Geod. Sciences, Rep. No. 201, Columbus, Ohio, 1973.
Driscoll, J.R. and D.M. Healy, Computing Fourier transforms and convolutions on the 2-sphere, Adv. Appl. Math., 15, 202-250, 1994.
Petrovskaya, M.S. and A.N. Vershkov, Non-singular expressions for the gravity gradients in the local north-oriented and orbital reference frames, J. Geod., 80, 117-127, 2006.
## See also
[makegravgriddh](pymakegravgriddh.html), [makegeoidgriddh](pymakegeoidgriddh.html), [makegriddh](pymakegriddh.html)
| {
"content_hash": "6afea81f96401d3e97a3773784e6b9e7",
"timestamp": "",
"source": "github",
"line_count": 106,
"max_line_length": 747,
"avg_line_length": 61.198113207547166,
"alnum_prop": 0.7273007553568676,
"repo_name": "MMesch/SHTOOLS",
"id": "07796cfb9bd22ba9a7b3a500e4c3e9c12cbe9448",
"size": "6491",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "docs/pages/mydoc/pydoc/pymakegravgradgriddh.md",
"mode": "33188",
"license": "bsd-3-clause",
"language": [
{
"name": "Fortran",
"bytes": "1209672"
},
{
"name": "Makefile",
"bytes": "26802"
},
{
"name": "Python",
"bytes": "244699"
}
],
"symlink_target": ""
} |
<?php @session_start();
require_once('inc/data.inc');
require_once('inc/authorize.inc');
require_once('inc/partitions.inc');
require_once('inc/plural.inc');
require_permission(SET_UP_PERMISSION);
require_once('inc/import-csv.inc');
try {
$partitions = all_partitions();
} catch (PDOException $p) {
$partitions = [];
}
class ImportRoster extends ImportCsvGenerator {
protected function make_state_of_play_div() {
global $partitions;
try {
$nracers = read_single_value("SELECT COUNT(*) FROM RegistrationInfo", array());
} catch (PDOException $p) {
$nracers = -1;
}
?>
<div id="state-of-play" class="<?php echo $nracers <= 0 ? 'hidden' : ''; ?>">
<div id="file-stats" class="hidden">
<span id="file-name">File</span>
contains <span id="file-racer-count">0</span>
racers<span id='file-class-count-and-label'>,
<a id="class-counts-button" href="#">
<span id="file-class-count"></span>
<span id="file-partition-label"><?php echo partition_label_pl_lc(); ?></span>
(<span id='file-class-new-count'></span> new)</a></span>.
</div>
<?php
if ($nracers > 0) {
$n_partitions = count($partitions);
$label = $n_partitions == 1 ? partition_label_lc() : partition_label_pl_lc();
echo "There are already ".$nracers." racer(s) and ".$n_partitions
." <span id='existing-partition-label'>".$label."</span> in the database.";
}
?>
</div><!--- state-of-play -->
<?php
}
protected function make_relabeling_section() {
?>
<label for="partition-label">A segment is called a(n):</label>
<input id="partition-label" name="partition-label" type="text" class="not-mobile"
value="<?php echo partition_label(); ?>"/>
<?php
}
}
?><!DOCTYPE html>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8"/>
<title>Import Roster</title>
<?php make_head_matter_for_import_page(); ?>
<link rel="stylesheet" type="text/css" href="css/import-roster.css"/>
<script type="text/javascript" src="js/modal.js"></script>
<script type="text/javascript" src="js/plural.js"></script>
<script type="text/javascript" src="js/import-roster.js"></script>
</head>
<script type="text/javascript">
function all_partitions() {
return <?php echo json_encode($partitions, JSON_HEX_TAG | JSON_HEX_AMP | JSON_PRETTY_PRINT); ?>;
}
</script>
<body>
<?php
make_banner('Import Roster', 'setup.php');
$page_maker = new ImportRoster;
$page_maker->make_import_csv_div('Import Roster',
array(
array(
'lastname' => array('name' => "Last Name",
'required' => true),
'firstname' => array('name' => "First Name",
'required' => true),
'partition' => array('name' => partition_label(),
'required' => false),
'carnumber' => array('name' => "Car Number",
'required' => false),
'carname' => array('name' => "Car Name",
'required' => false),
'note_from' => array('name' => 'From',
'required' => false),
'exclude' => array('name' => 'Exclude?',
'required' => false)),
array(
'first-last' => array('name' => 'First & Last Name',
'required' => true,
'span' => 2),
1 => array('span' => 4)),
));
?>
<div id="new_partitions_modal" class="modal_dialog block_buttons hidden">
<div id="existing_partitions_div">
</div>
<div id="new_partitions_div">
</div>
<form>
<input type="button" value="Dismiss" onclick='close_modal("#new_partitions_modal");'/>
</form>
</div>
<div class="footer">Or instead: <a href="import-results.php">Import results exported from another race...</a></div>
<?php
require_once('inc/ajax-pending.inc');
?>
</body>
</html>
| {
"content_hash": "acf09ce4dd1679269d4d940c4f6a6c48",
"timestamp": "",
"source": "github",
"line_count": 115,
"max_line_length": 115,
"avg_line_length": 40.678260869565214,
"alnum_prop": 0.4805472424112869,
"repo_name": "jeffpiazza/derbynet",
"id": "b462e4743875296b123798c68cfba2f88a29cb80",
"size": "4678",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "website/import-roster.php",
"mode": "33188",
"license": "mit",
"language": [
{
"name": "CSS",
"bytes": "90627"
},
{
"name": "Dockerfile",
"bytes": "3642"
},
{
"name": "HTML",
"bytes": "8111"
},
{
"name": "Java",
"bytes": "328246"
},
{
"name": "JavaScript",
"bytes": "553864"
},
{
"name": "NASL",
"bytes": "2355"
},
{
"name": "PHP",
"bytes": "2369689"
},
{
"name": "Perl",
"bytes": "1748"
},
{
"name": "Python",
"bytes": "2227"
},
{
"name": "Shell",
"bytes": "310541"
},
{
"name": "Vim Snippet",
"bytes": "580"
}
],
"symlink_target": ""
} |
namespace node {
using v8::Array;
using v8::Context;
using v8::Function;
using v8::FunctionCallbackInfo;
using v8::FunctionTemplate;
using v8::Local;
using v8::NewStringType;
using v8::Object;
using v8::String;
using v8::Value;
class NodeCategorySet : public BaseObject {
public:
static void Initialize(Local<Object> target,
Local<Value> unused,
Local<Context> context,
void* priv);
static void New(const FunctionCallbackInfo<Value>& args);
static void Enable(const FunctionCallbackInfo<Value>& args);
static void Disable(const FunctionCallbackInfo<Value>& args);
const std::set<std::string>& GetCategories() const { return categories_; }
void MemoryInfo(MemoryTracker* tracker) const override {
tracker->TrackField("categories", categories_);
}
SET_MEMORY_INFO_NAME(NodeCategorySet)
SET_SELF_SIZE(NodeCategorySet)
private:
NodeCategorySet(Environment* env,
Local<Object> wrap,
std::set<std::string>&& categories) :
BaseObject(env, wrap), categories_(std::move(categories)) {
MakeWeak();
}
bool enabled_ = false;
const std::set<std::string> categories_;
};
void NodeCategorySet::New(const FunctionCallbackInfo<Value>& args) {
Environment* env = Environment::GetCurrent(args);
std::set<std::string> categories;
CHECK(args[0]->IsArray());
Local<Array> cats = args[0].As<Array>();
for (size_t n = 0; n < cats->Length(); n++) {
Local<Value> category;
if (!cats->Get(env->context(), n).ToLocal(&category)) return;
Utf8Value val(env->isolate(), category);
if (!*val) return;
categories.emplace(*val);
}
CHECK_NOT_NULL(GetTracingAgentWriter());
new NodeCategorySet(env, args.This(), std::move(categories));
}
void NodeCategorySet::Enable(const FunctionCallbackInfo<Value>& args) {
NodeCategorySet* category_set;
ASSIGN_OR_RETURN_UNWRAP(&category_set, args.Holder());
CHECK_NOT_NULL(category_set);
const auto& categories = category_set->GetCategories();
if (!category_set->enabled_ && !categories.empty()) {
// Starts the Tracing Agent if it wasn't started already (e.g. through
// a command line flag.)
StartTracingAgent();
GetTracingAgentWriter()->Enable(categories);
category_set->enabled_ = true;
}
}
void NodeCategorySet::Disable(const FunctionCallbackInfo<Value>& args) {
NodeCategorySet* category_set;
ASSIGN_OR_RETURN_UNWRAP(&category_set, args.Holder());
CHECK_NOT_NULL(category_set);
const auto& categories = category_set->GetCategories();
if (category_set->enabled_ && !categories.empty()) {
GetTracingAgentWriter()->Disable(categories);
category_set->enabled_ = false;
}
}
void GetEnabledCategories(const FunctionCallbackInfo<Value>& args) {
Environment* env = Environment::GetCurrent(args);
std::string categories =
GetTracingAgentWriter()->agent()->GetEnabledCategories();
if (!categories.empty()) {
args.GetReturnValue().Set(
String::NewFromUtf8(env->isolate(),
categories.c_str(),
NewStringType::kNormal,
categories.size()).ToLocalChecked());
}
}
static void SetTraceCategoryStateUpdateHandler(
const FunctionCallbackInfo<Value>& args) {
Environment* env = Environment::GetCurrent(args);
CHECK(args[0]->IsFunction());
env->set_trace_category_state_function(args[0].As<Function>());
}
void NodeCategorySet::Initialize(Local<Object> target,
Local<Value> unused,
Local<Context> context,
void* priv) {
Environment* env = Environment::GetCurrent(context);
env->SetMethod(target, "getEnabledCategories", GetEnabledCategories);
env->SetMethod(
target, "setTraceCategoryStateUpdateHandler",
SetTraceCategoryStateUpdateHandler);
Local<FunctionTemplate> category_set =
env->NewFunctionTemplate(NodeCategorySet::New);
category_set->InstanceTemplate()->SetInternalFieldCount(
NodeCategorySet::kInternalFieldCount);
env->SetProtoMethod(category_set, "enable", NodeCategorySet::Enable);
env->SetProtoMethod(category_set, "disable", NodeCategorySet::Disable);
target->Set(env->context(),
FIXED_ONE_BYTE_STRING(env->isolate(), "CategorySet"),
category_set->GetFunction(env->context()).ToLocalChecked())
.Check();
Local<String> isTraceCategoryEnabled =
FIXED_ONE_BYTE_STRING(env->isolate(), "isTraceCategoryEnabled");
Local<String> trace = FIXED_ONE_BYTE_STRING(env->isolate(), "trace");
// Grab the trace and isTraceCategoryEnabled intrinsics from the binding
// object and expose those to our binding layer.
Local<Object> binding = context->GetExtrasBindingObject();
target->Set(context, isTraceCategoryEnabled,
binding->Get(context, isTraceCategoryEnabled).ToLocalChecked())
.Check();
target->Set(context, trace,
binding->Get(context, trace).ToLocalChecked()).Check();
}
} // namespace node
NODE_MODULE_CONTEXT_AWARE_INTERNAL(trace_events,
node::NodeCategorySet::Initialize)
| {
"content_hash": "bdc794cdeeb5c02cc9b4d6ba4c93d9cd",
"timestamp": "",
"source": "github",
"line_count": 147,
"max_line_length": 77,
"avg_line_length": 35.074829931972786,
"alnum_prop": 0.6788207913110939,
"repo_name": "enclose-io/compiler",
"id": "9adee9e458ccc0fa4e91364d060b96643032ea57",
"size": "5402",
"binary": false,
"copies": "2",
"ref": "refs/heads/master",
"path": "lts/src/node_trace_events.cc",
"mode": "33188",
"license": "mit",
"language": [
{
"name": "Ruby",
"bytes": "11474"
},
{
"name": "Shell",
"bytes": "131"
}
],
"symlink_target": ""
} |
.daterangepicker.dropdown-menu {
max-width: none;
z-index: 3000;
}
.daterangepicker.opensleft .ranges, .daterangepicker.opensleft .calendar {
float: left;
margin: 4px;
}
.daterangepicker.opensright .ranges, .daterangepicker.opensright .calendar,
.daterangepicker.openscenter .ranges, .daterangepicker.openscenter .calendar {
float: right;
margin: 4px;
}
.daterangepicker.single .ranges, .daterangepicker.single .calendar {
float: none;
}
.daterangepicker .ranges {
width: 160px;
text-align: left;
}
.daterangepicker .ranges .range_inputs>div {
float: left;
}
.daterangepicker .ranges .range_inputs>div:nth-child(2) {
padding-left: 11px;
}
.daterangepicker .calendar {
display: none;
max-width: 270px;
}
.daterangepicker.show-calendar .calendar {
display: block;
}
.daterangepicker .calendar.single .calendar-date {
border: none;
}
.daterangepicker .calendar th, .daterangepicker .calendar td {
font-family: 'Helvetica Neue', Helvetica, Arial, sans-serif;
white-space: nowrap;
text-align: center;
min-width: 32px;
}
.daterangepicker .daterangepicker_start_input label,
.daterangepicker .daterangepicker_end_input label {
color: #333;
display: block;
font-size: 11px;
font-weight: normal;
height: 20px;
line-height: 20px;
margin-bottom: 2px;
text-shadow: #fff 1px 1px 0px;
text-transform: uppercase;
width: 74px;
}
.daterangepicker .ranges input {
font-size: 11px;
}
.daterangepicker .ranges .input-mini {
border: 1px solid #ccc;
border-radius: 4px;
color: #555;
display: block;
font-size: 11px;
height: 30px;
line-height: 30px;
vertical-align: middle;
margin: 0 0 10px 0;
padding: 0 6px;
width: 74px;
}
.daterangepicker .ranges ul {
list-style: none;
margin: 0;
padding: 0;
}
.daterangepicker .ranges li {
font-size: 13px;
background: #f5f5f5;
border: 1px solid #f5f5f5;
color: #08c;
padding: 3px 12px;
margin-bottom: 8px;
-webkit-border-radius: 5px;
-moz-border-radius: 5px;
border-radius: 5px;
cursor: pointer;
}
.daterangepicker .ranges li.active, .daterangepicker .ranges li:hover {
background: #08c;
border: 1px solid #08c;
color: #fff;
}
.daterangepicker .calendar-date {
/*border: 1px solid #ddd;*/
padding: 4px;
border-radius: 4px;
background: #fff;
}
.daterangepicker .calendar-time {
text-align: center;
margin: 8px auto 0 auto;
line-height: 30px;
}
.daterangepicker {
position: absolute;
background: #fff;
top: 100px;
left: 20px;
padding: 4px;
margin-top: 1px;
-webkit-border-radius: 4px;
-moz-border-radius: 4px;
border-radius: 4px;
}
.daterangepicker.opensleft:before {
position: absolute;
top: -7px;
right: 9px;
display: inline-block;
border-right: 7px solid transparent;
border-bottom: 7px solid #ccc;
border-left: 7px solid transparent;
border-bottom-color: rgba(0, 0, 0, 0.2);
content: '';
}
.daterangepicker.opensleft:after {
position: absolute;
top: -6px;
right: 10px;
display: inline-block;
border-right: 6px solid transparent;
border-bottom: 6px solid #fff;
border-left: 6px solid transparent;
content: '';
}
.daterangepicker.openscenter:before {
position: absolute;
top: -7px;
left: 0;
right: 0;
width: 0;
margin-left: auto;
margin-right: auto;
display: inline-block;
border-right: 7px solid transparent;
border-bottom: 7px solid #ccc;
border-left: 7px solid transparent;
border-bottom-color: rgba(0, 0, 0, 0.2);
content: '';
}
.daterangepicker.openscenter:after {
position: absolute;
top: -6px;
left: 0;
right: 0;
width: 0;
margin-left: auto;
margin-right: auto;
display: inline-block;
border-right: 6px solid transparent;
border-bottom: 6px solid #fff;
border-left: 6px solid transparent;
content: '';
}
.daterangepicker.opensright:before {
position: absolute;
top: -7px;
left: 9px;
display: inline-block;
border-right: 7px solid transparent;
border-bottom: 7px solid #ccc;
border-left: 7px solid transparent;
border-bottom-color: rgba(0, 0, 0, 0.2);
content: '';
}
.daterangepicker.opensright:after {
position: absolute;
top: -6px;
left: 10px;
display: inline-block;
border-right: 6px solid transparent;
border-bottom: 6px solid #fff;
border-left: 6px solid transparent;
content: '';
}
.daterangepicker table {
width: 100%;
margin: 0;
}
.daterangepicker td, .daterangepicker th {
text-align: center;
width: 20px;
height: 20px;
-webkit-border-radius: 4px;
-moz-border-radius: 4px;
border-radius: 4px;
cursor: pointer;
white-space: nowrap;
}
.daterangepicker td.off {
color: #999;
}
.daterangepicker td.disabled, .daterangepicker option.disabled {
color: #999;
}
.daterangepicker td.available:hover, .daterangepicker th.available:hover {
background: #eee;
}
.daterangepicker td.in-range {
background: #ebf4f8;
-webkit-border-radius: 0;
-moz-border-radius: 0;
border-radius: 0;
}
.daterangepicker td.start-date {
-webkit-border-radius: 4px 0 0 4px;
-moz-border-radius: 4px 0 0 4px;
border-radius: 4px 0 0 4px;
}
.daterangepicker td.end-date {
-webkit-border-radius: 0 4px 4px 0;
-moz-border-radius: 0 4px 4px 0;
border-radius: 0 4px 4px 0;
}
.daterangepicker td.start-date.end-date {
-webkit-border-radius: 4px;
-moz-border-radius: 4px;
border-radius: 4px;
}
.daterangepicker td.active, .daterangepicker td.active:hover {
background-color: #357ebd;
border-color: #3071a9;
color: #fff;
}
.daterangepicker td.week, .daterangepicker th.week {
font-size: 80%;
color: #ccc;
}
.daterangepicker select.monthselect, .daterangepicker select.yearselect {
font-size: 12px;
padding: 1px;
height: auto;
margin: 0;
cursor: default;
}
.daterangepicker select.monthselect {
margin-right: 2%;
width: 56%;
}
.daterangepicker select.yearselect {
width: 40%;
}
.daterangepicker select.hourselect, .daterangepicker select.minuteselect, .daterangepicker select.secondselect, .daterangepicker select.ampmselect {
width: 50px;
margin-bottom: 0;
}
.daterangepicker_start_input {
float: left;
}
.daterangepicker_end_input {
float: left;
padding-left: 11px
}
.daterangepicker th.month {
width: auto;
}
| {
"content_hash": "e7d9c4a6c2b93089b038b93ee16e42e5",
"timestamp": "",
"source": "github",
"line_count": 312,
"max_line_length": 148,
"avg_line_length": 19.887820512820515,
"alnum_prop": 0.6960515713134569,
"repo_name": "joyplus/o2oadmin",
"id": "c17bb23317baa627808c7dcfd50b4ff6d1ed0e44",
"size": "6482",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "static/css/daterangepicker-bs3.css",
"mode": "33188",
"license": "mit",
"language": [
{
"name": "CSS",
"bytes": "810862"
},
{
"name": "Go",
"bytes": "234182"
},
{
"name": "JavaScript",
"bytes": "3320005"
},
{
"name": "Smarty",
"bytes": "475469"
}
],
"symlink_target": ""
} |
import { initCookies, getCookie } from "./cookies";
import { addStaffButtons, getStaff, getStaffMenuHTML, openStaffLightBox } from "./manage";
import { prepareThumbnails, preparePostPreviews } from "./postutil";
import { initSettings } from "./settings";
import { initTopBar, TopBarButton, DropDownMenu } from "./topbar";
import { initQR } from "./qr";
import { opRegex } from "./vars";
let currentStaff = null;
let $watchedThreadsBtn = null;
let $staffBtn = null;
export function toTop() {
window.scrollTo(0,0);
}
window.toTop = toTop;
export function toBottom() {
window.scrollTo(0,document.body.scrollHeight);
}
window.toBottom = toBottom;
export function changePage(sel) {
let info = getPageThread();
if(info.board == "" || info.op == -1) return;
if(sel.value != "")
window.location = webroot + info.board + "/res/" + info.op + "p" + sel.value + ".html";
}
function getBoard() {
let rootIndex = window.location.pathname.indexOf(webroot);
let board = window.location.pathname.substring(rootIndex+webroot.length);
if(board.length > 0 && board.indexOf("/") > -1) {
board = board.split("/")[0];
} else {
board = "";
}
return board;
}
export function getPageThread() {
let arr = opRegex.exec(window.location.pathname);
let info = {
board: getBoard(),
boardID: -1,
op: -1,
page: 0
};
if(arr == null) return info;
if(arr.length > 1) info.op = arr[1];
if(arr.length > 3) info.page = arr[3];
if(arr.board != "") info.boardID = $("form#postform input[name=boardid]").val() -1;
return info;
}
function handleKeydown(e) {
let tag = "";
if(!e.ctrlKey || e.target.nodeName != "TEXTAREA") return;
switch(e.keyCode) {
case 10: // Enter key
case 13: // Enter key in Chrome/IE
document.getElementById("postform").submit();
break;
case 66: // B
tag = "b"; // bold
break;
case 73: // I
tag = "i"; // italics
break;
case 82: // R
tag = "s"; // strikethrough
break;
case 83:
tag = "?"; // spoiler (not yet implemented)
break;
case 85: // U
tag = "u"; // underline
break;
}
if(tag == "") return;
e.preventDefault();
let ta = e.target;
let val = ta.value;
let ss = ta.selectionStart;
let se = ta.selectionEnd;
let r = se + 2 + tag.length;
ta.value = val.slice(0, ss) + ("[" + tag + "]") + val.slice(ss, se) + ("[/" + tag + "]") + val.slice(se);
ta.setSelectionRange(r, r);
}
$(() => {
let pageThread = getPageThread();
let style = getCookie("style", defaultStyle);
let themeElem = document.getElementById("theme");
if(themeElem) themeElem.setAttribute("href", `${webroot}css/${style}`);
currentStaff = getStaff();
initCookies();
initTopBar();
initSettings();
$watchedThreadsBtn = new TopBarButton("WT", () => {});
if(currentStaff.rank > 0) {
$staffBtn = new TopBarButton("Staff", () => {
window.location = "/manage?action=dashboard"
})
/* $staffBtn = new DropDownMenu("Staff",getStaffMenuHTML())
$("a#staff.dropdown-button").click(function() {
$("a.staffmenu-item").click(function() {
let url = $(this).attr("id");
openStaffLightBox(url);
});
}); */
// addStaffButtons();
}
if(pageThread.board != "") {
prepareThumbnails();
if(getCookie("useqr") == "true") initQR(pageThread);
}
preparePostPreviews(false);
$(".plus").click(function() {
let block = $(this).parent().next();
if(block.css("display") == "none") {
block.show();
$(this).html("-");
} else {
block.hide();
$(this).html("+");
}
});
let threadMenuOpen = false;
$(".thread-ddown a, body").click(function(e) {
e.stopPropagation();
let postID = $(this).parent().parent().parent().attr("id");
let isOP = $(this).parent().parent().parent().attr("class") == "thread";
if(postID == undefined) return;
if($(this).parent().find("div.thread-ddown-menu").length == 0) {
$("div.thread-ddown-menu").remove();
let menuHTML = `<div class="thread-ddown-menu" id="${postID}">`;
if(!isOP) menuHTML += `<ul><li><a href="javascript:hidePost(${postID});" class="hide-post">Show/Hide post</a></li>`;
menuHTML +=
`<li><a href="javascript:deletePost(${postID});" class="delete-post">Delete post</a></li>` +
`<li><a href="javascript:reportPost(${postID});" class="report-post">Report Post</a></li></ul></div>`
$(this).parent().append(menuHTML);
threadMenuOpen = true;
} else {
$("div.thread-ddown-menu").remove();
threadMenuOpen = false;
}
});
$(document).keydown(handleKeydown);
});
| {
"content_hash": "06a1dfd53c9277004c2e9a26b05682a6",
"timestamp": "",
"source": "github",
"line_count": 158,
"max_line_length": 119,
"avg_line_length": 28,
"alnum_prop": 0.6252260397830018,
"repo_name": "Eggbertx/gochan",
"id": "7fb06bcd9424fa8784fca923fd217858f40655ec",
"size": "4424",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "frontend/src/index.js",
"mode": "33261",
"license": "bsd-2-clause",
"language": [
{
"name": "CSS",
"bytes": "16766"
},
{
"name": "Dockerfile",
"bytes": "173"
},
{
"name": "Go",
"bytes": "168719"
},
{
"name": "HTML",
"bytes": "32605"
},
{
"name": "JavaScript",
"bytes": "23310"
},
{
"name": "Ruby",
"bytes": "829"
},
{
"name": "Shell",
"bytes": "16959"
},
{
"name": "TSQL",
"bytes": "20153"
}
],
"symlink_target": ""
} |
ACCEPTED
#### According to
International Plant Names Index
#### Published in
null
#### Original name
null
### Remarks
null | {
"content_hash": "68003c6d2f965e4390420b8953a72ed3",
"timestamp": "",
"source": "github",
"line_count": 13,
"max_line_length": 31,
"avg_line_length": 9.692307692307692,
"alnum_prop": 0.7063492063492064,
"repo_name": "mdoering/backbone",
"id": "703f8d4202bb365a3cc3bc49fb2686ee6bfbfdd5",
"size": "177",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "life/Plantae/Magnoliophyta/Magnoliopsida/Asterales/Asteraceae/Leontodon/Leontodon runcinatus/README.md",
"mode": "33188",
"license": "apache-2.0",
"language": [],
"symlink_target": ""
} |
Ti=Representations and Warranties of {_the_Company}
Olist=<ol><li>{Organization.Sec}<li>{Power.Sec}<li>{Authorization.Sec}<li>{GovtConsent.Sec}<li>{ComplyLaw.Sec}<li>{ComplyInstruments.Sec}<li>{Offering.Sec}<li>{UseOfProceeds.Sec}</ol>
Organization.=[G/Techstars-Equity-CmA/NotePurchase/Sec/Rep/Company/Organize/0.md]
Power.=[G/Techstars-Equity-CmA/NotePurchase/Sec/Rep/Company/Power/0.md]
Authorization.=[G/Techstars-Equity-CmA/NotePurchase/Sec/Rep/Company/Authorize/0.md]
GovtConsent.=[G/Techstars-Equity-CmA/NotePurchase/Sec/Rep/Company/GovtConsent/0.md]
ComplyLaw.=[G/Techstars-Equity-CmA/NotePurchase/Sec/Rep/Company/Comply/Law/0.md]
ComplyInstruments.=[G/Techstars-Equity-CmA/NotePurchase/Sec/Rep/Company/Comply/Instrument/0.md]
Offering.=[G/Techstars-Equity-CmA/NotePurchase/Sec/Rep/Company/Offer/0.md]
UseOfProceeds.=[G/Techstars-Equity-CmA/NotePurchase/Sec/Rep/Company/Proceeds/0.md]
=[G/Z/ol/0]
| {
"content_hash": "d959a9bc4bb743b6817c3d758555eaca",
"timestamp": "",
"source": "github",
"line_count": 21,
"max_line_length": 183,
"avg_line_length": 43.57142857142857,
"alnum_prop": 0.7857923497267759,
"repo_name": "CommonAccord/Cmacc-Source",
"id": "6c68205ec236b095aa9977e25e64a16362f1fcbe",
"size": "915",
"binary": false,
"copies": "2",
"ref": "refs/heads/master",
"path": "Doc/G/Techstars-Equity-CmA/NotePurchase/Sec/Rep/Company/1.md",
"mode": "33188",
"license": "mit",
"language": [
{
"name": "CSS",
"bytes": "2498"
},
{
"name": "PHP",
"bytes": "1231"
}
],
"symlink_target": ""
} |
package fi.jgke.tagger.unit.controller;
import fi.jgke.tagger.controller.DefaultController;
import fi.jgke.tagger.domain.Source;
import fi.jgke.tagger.repository.SourceRepository;
import fi.jgke.tagger.service.ThumbnailService;
import java.util.ArrayList;
import java.util.List;
import org.junit.Test;
import static org.junit.Assert.*;
import org.junit.Before;
import org.mockito.InjectMocks;
import org.mockito.Mock;
import org.mockito.Mockito;
import org.mockito.MockitoAnnotations;
public class DefaultControllerTest {
public DefaultControllerTest() {
}
@InjectMocks
DefaultController defaultController;
@Mock
SourceRepository sourceRepository;
@Mock
ThumbnailService thumbnailService;
@Before
public void init() {
MockitoAnnotations.initMocks(this);
}
@Test
public void testHandleDefault() {
assertEquals("redirect:/sources", defaultController.handleDefault());
}
@Test
public void testRecreateAllThumbnails() {
List<Source> sources = new ArrayList<>();
sources.add(new Source());
sources.add(new Source());
Mockito.when(sourceRepository.findAll()).thenReturn(sources);
String result = defaultController.recreateAllThumbnails();
assertEquals("redirect:/", result);
for (Source s : sources) {
Mockito.verify(thumbnailService).createThumbnailForSource(s);
Mockito.verify(sourceRepository).save(s);
}
}
}
| {
"content_hash": "af4437072661c828908acf9ed0565aeb",
"timestamp": "",
"source": "github",
"line_count": 57,
"max_line_length": 77,
"avg_line_length": 26.140350877192983,
"alnum_prop": 0.7080536912751678,
"repo_name": "jgke/tagger",
"id": "cf0f86ffd38fe1fed12f48b55d68beccb7974373",
"size": "2093",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "src/test/java/fi/jgke/tagger/unit/controller/DefaultControllerTest.java",
"mode": "33188",
"license": "apache-2.0",
"language": [
{
"name": "HTML",
"bytes": "22639"
},
{
"name": "Java",
"bytes": "117529"
}
],
"symlink_target": ""
} |
namespace ui {
CursorProxyMojo::CursorProxyMojo(service_manager::Connector* connector)
: connector_(connector->Clone()) {
connector->ConnectToInterface(ui::mojom::kServiceName, &main_cursor_ptr_);
}
void CursorProxyMojo::InitializeOnEvdev() {
evdev_ref_ = base::PlatformThread::CurrentRef();
connector_->ConnectToInterface(ui::mojom::kServiceName, &evdev_cursor_ptr_);
}
CursorProxyMojo::~CursorProxyMojo() {}
void CursorProxyMojo::CursorSet(gfx::AcceleratedWidget widget,
const std::vector<SkBitmap>& bitmaps,
const gfx::Point& location,
int frame_delay_ms) {
if (evdev_ref_ == base::PlatformThread::CurrentRef()) {
evdev_cursor_ptr_->SetCursor(widget, bitmaps, location, frame_delay_ms);
} else {
main_cursor_ptr_->SetCursor(widget, bitmaps, location, frame_delay_ms);
}
}
void CursorProxyMojo::Move(gfx::AcceleratedWidget widget,
const gfx::Point& location) {
if (evdev_ref_ == base::PlatformThread::CurrentRef()) {
evdev_cursor_ptr_->MoveCursor(widget, location);
} else {
main_cursor_ptr_->MoveCursor(widget, location);
}
}
} // namespace ui
| {
"content_hash": "3dc793506b31486515ff5a7e1bbd5c1e",
"timestamp": "",
"source": "github",
"line_count": 35,
"max_line_length": 78,
"avg_line_length": 34.714285714285715,
"alnum_prop": 0.6477366255144033,
"repo_name": "Samsung/ChromiumGStreamerBackend",
"id": "ff24d4ad81b008317f8f584c6c6e8949aba20d0d",
"size": "1554",
"binary": false,
"copies": "2",
"ref": "refs/heads/master",
"path": "ui/ozone/platform/drm/cursor_proxy_mojo.cc",
"mode": "33188",
"license": "bsd-3-clause",
"language": [],
"symlink_target": ""
} |
require "tokenator/version"
require "tokenator/core"
module Tokenator
def self.new
PTB.new
end
end
| {
"content_hash": "8769c6f1936a10cc193d4df4ffbc8c6e",
"timestamp": "",
"source": "github",
"line_count": 8,
"max_line_length": 27,
"avg_line_length": 13.5,
"alnum_prop": 0.7407407407407407,
"repo_name": "Amval/tokenator",
"id": "03a734f9c23c2a4f0db2cc2c39d9610d88debd8d",
"size": "108",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "lib/tokenator.rb",
"mode": "33188",
"license": "mit",
"language": [
{
"name": "Ruby",
"bytes": "6502"
},
{
"name": "Shell",
"bytes": "131"
}
],
"symlink_target": ""
} |
from bs4 import BeautifulSoup
import requests
import time
def get_movie_budgets( page_index):
r = requests.get('https://www.the-numbers.com/movie/budgets/all/%s'% (page_index,))
html_doc = r.content
soup = BeautifulSoup(html_doc, 'html.parser')
rows = [tr for tr in soup.find_all('tr') if len(tr) == 13 ]
return [(row.contents[4].a.string.encode('utf-8').strip(), row.contents[6].string.encode('utf-8').strip(), row.contents[10].string.encode('utf-8').strip()) for row in rows]
def write_movie_data( filename="gross.dat", max_page=120):
page_index_list = [(100*i)+1 for i in range(max_page)]
for index in page_index_list:
time.sleep(4)
movies = get_movie_budgets( str(index))
file = open(filename,'a')
for m in movies:
file.write('{}|{}|{}\n'.format(*m))
file.close()
if __name__ == '__main__':
write_movie_data()
| {
"content_hash": "061707a4db43771edc87ce732fa20bea",
"timestamp": "",
"source": "github",
"line_count": 31,
"max_line_length": 176,
"avg_line_length": 29.387096774193548,
"alnum_prop": 0.6125137211855104,
"repo_name": "mariosky/databook",
"id": "a582006196099f8a43b3ee481a2618f2212cf6ad",
"size": "911",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "ejemplos/peliculas_taquilleras/gross.py",
"mode": "33188",
"license": "apache-2.0",
"language": [
{
"name": "Jupyter Notebook",
"bytes": "53580"
},
{
"name": "Python",
"bytes": "8334"
},
{
"name": "TeX",
"bytes": "8899"
}
],
"symlink_target": ""
} |
package org.sasm.tree;
import org.sasm.*;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.List;
/**
* A node that represents a type annotation on a local or resource variable.
*
* @author Eric Bruneton
*/
public class LocalVariableAnnotationNode extends TypeAnnotationNode {
/**
* The fist instructions corresponding to the continuous ranges that make
* the scope of this local variable (inclusive). Must not be <tt>null</tt>.
*/
public List<LabelNode> start;
/**
* The last instructions corresponding to the continuous ranges that make
* the scope of this local variable (exclusive). This list must have the
* same size as the 'start' list. Must not be <tt>null</tt>.
*/
public List<LabelNode> end;
/**
* The local variable's index out each range. This list must have the same
* size as the 'start' list. Must not be <tt>null</tt>.
*/
public List<Integer> index;
/**
* Constructs a new {@link LocalVariableAnnotationNode}. <i>Subclasses must
* not use this constructor</i>. Instead, they must use the
* {@link #LocalVariableAnnotationNode(int, org.sasm.TypePath, org.sasm.tree.LabelNode[], org.sasm.tree.LabelNode[], int[], String)}
* version.
*
* @param typeRef
* a reference to the annotated type. See {@link org.sasm.TypeReference}.
* @param typePath
* the path to the annotated type argument, wildcard bound, array
* element type, or static inner type within 'typeRef'. May be
* <tt>null</tt> if the annotation targets 'typeRef' as a whole.
* @param start
* the fist instructions corresponding to the continuous ranges
* that make the scope of this local variable (inclusive).
* @param end
* the last instructions corresponding to the continuous ranges
* that make the scope of this local variable (exclusive). This
* array must have the same size as the 'start' array.
* @param index
* the local variable's index out each range. This array must have
* the same size as the 'start' array.
* @param desc
* the class descriptor of the annotation class.
*/
public LocalVariableAnnotationNode(int typeRef, TypePath typePath, LabelNode[] start, LabelNode[] end, int[] index,
String desc) {
this(Opcodes.ASM5, typeRef, typePath, start, end, index, desc);
}
/**
* Constructs a new {@link LocalVariableAnnotationNode}.
*
* @param api
* the ASM API version implemented by this visitor. Must be one
* of {@link org.sasm.Opcodes#ASM4} or {@link org.sasm.Opcodes#ASM5}.
* @param typeRef
* a reference to the annotated type. See {@link org.sasm.TypeReference}.
* @param start
* the fist instructions corresponding to the continuous ranges
* that make the scope of this local variable (inclusive).
* @param end
* the last instructions corresponding to the continuous ranges
* that make the scope of this local variable (exclusive). This
* array must have the same size as the 'start' array.
* @param index
* the local variable's index out each range. This array must have
* the same size as the 'start' array.
* @param typePath
* the path to the annotated type argument, wildcard bound, array
* element type, or static inner type within 'typeRef'. May be
* <tt>null</tt> if the annotation targets 'typeRef' as a whole.
* @param desc
* the class descriptor of the annotation class.
*/
public LocalVariableAnnotationNode(int api, int typeRef, TypePath typePath, LabelNode[] start, LabelNode[] end,
int[] index, String desc) {
super(api, typeRef, typePath, desc);
this.start = new ArrayList<>(start.length);
this.start.addAll(Arrays.asList(start));
this.end = new ArrayList<>(end.length);
this.end.addAll(Arrays.asList(end));
this.index = new ArrayList<>(index.length);
for (int i : index) {
this.index.add(i);
}
}
/**
* Makes the given visitor visit this type annotation.
*
* @param mv the visitor that must visit this annotation.
*/
public void accept(MethodVisitor mv) {
Label[] start = new Label[this.start.size()];
Label[] end = new Label[this.end.size()];
int[] index = new int[this.index.size()];
for (int i = 0; i < start.length; ++i) {
start[i] = this.start.get(i).getLabel();
end[i] = this.end.get(i).getLabel();
index[i] = this.index.get(i);
}
accept(mv.visitLocalVariableAnnotation(typeRef, typePath, start, end, index, desc, true));
}
}
| {
"content_hash": "87bfb276cbc069976963c44ceccc23a6",
"timestamp": "",
"source": "github",
"line_count": 119,
"max_line_length": 136,
"avg_line_length": 42.65546218487395,
"alnum_prop": 0.6048069345941687,
"repo_name": "iZeus/SASM",
"id": "c0d4db73febd53bd01ec2e6f9fc8fe6f91fee423",
"size": "5076",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "src/org/sasm/tree/LocalVariableAnnotationNode.java",
"mode": "33188",
"license": "apache-2.0",
"language": [],
"symlink_target": ""
} |
package com.datastax.driver.core.exceptions;
import com.datastax.driver.core.ConsistencyLevel;
import com.datastax.driver.core.WriteType;
import java.net.InetSocketAddress;
/**
* A non-timeout error during a write query.
* <p/>
* This happens when some of the replicas that were contacted by the coordinator replied with an error.
*/
@SuppressWarnings("serial")
public class WriteFailureException extends QueryConsistencyException {
private final WriteType writeType;
private final int failed;
/**
* This constructor should only be used internally by the driver
* when decoding error responses.
*/
public WriteFailureException(ConsistencyLevel consistency, WriteType writeType, int received, int required, int failed) {
this(null, consistency, writeType, received, required, failed);
}
public WriteFailureException(InetSocketAddress address, ConsistencyLevel consistency, WriteType writeType, int received, int required, int failed) {
super(address, String.format("Cassandra failure during write query at consistency %s "
+ "(%d responses were required but only %d replica responded, %d failed)",
consistency, required, received, failed),
consistency,
received,
required);
this.writeType = writeType;
this.failed = failed;
}
private WriteFailureException(InetSocketAddress address, String msg, Throwable cause,
ConsistencyLevel consistency, WriteType writeType, int received, int required, int failed) {
super(address, msg, cause, consistency, received, required);
this.writeType = writeType;
this.failed = failed;
}
/**
* The type of the write for which a timeout was raised.
*
* @return the type of the write for which a timeout was raised.
*/
public WriteType getWriteType() {
return writeType;
}
/**
* Returns the number of replicas that experienced a failure while executing the request.
*
* @return the number of failures.
*/
public int getFailures() {
return failed;
}
@Override
public WriteFailureException copy() {
return new WriteFailureException(getAddress(), getMessage(), this, getConsistencyLevel(), getWriteType(),
getReceivedAcknowledgements(), getRequiredAcknowledgements(), getFailures());
}
public WriteFailureException copy(InetSocketAddress address) {
return new WriteFailureException(
address,
getMessage(),
this,
getConsistencyLevel(),
getWriteType(),
getReceivedAcknowledgements(),
getRequiredAcknowledgements(),
failed);
}
}
| {
"content_hash": "279bc5f308a0c7b020acfacd128dd6b6",
"timestamp": "",
"source": "github",
"line_count": 80,
"max_line_length": 152,
"avg_line_length": 35.875,
"alnum_prop": 0.6494773519163763,
"repo_name": "DICL/cassandra-driver",
"id": "079c882c16522d43a3d4a2403f74aef193334813",
"size": "3497",
"binary": false,
"copies": "2",
"ref": "refs/heads/3.0",
"path": "driver-core/src/main/java/com/datastax/driver/core/exceptions/WriteFailureException.java",
"mode": "33188",
"license": "apache-2.0",
"language": [
{
"name": "Java",
"bytes": "1038347"
},
{
"name": "Python",
"bytes": "6866"
},
{
"name": "Shell",
"bytes": "2574"
}
],
"symlink_target": ""
} |
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<!--NewPage-->
<HTML>
<HEAD>
<!-- Generated by javadoc (build 1.6.0_45) on Thu Mar 26 16:48:33 UTC 2015 -->
<META http-equiv="Content-Type" content="text/html; charset=UTF-8">
<TITLE>
com.hazelcast (Hazelcast Root 3.4.2 API)
</TITLE>
<META NAME="date" CONTENT="2015-03-26">
<LINK REL ="stylesheet" TYPE="text/css" HREF="../../stylesheet.css" TITLE="Style">
<SCRIPT type="text/javascript">
function windowTitle()
{
if (location.href.indexOf('is-external=true') == -1) {
parent.document.title="com.hazelcast (Hazelcast Root 3.4.2 API)";
}
}
</SCRIPT>
<NOSCRIPT>
</NOSCRIPT>
</HEAD>
<BODY BGCOLOR="white" onload="windowTitle();">
<HR>
<!-- ========= START OF TOP NAVBAR ======= -->
<A NAME="navbar_top"><!-- --></A>
<A HREF="#skip-navbar_top" title="Skip navigation links"></A>
<TABLE BORDER="0" WIDTH="100%" CELLPADDING="1" CELLSPACING="0" SUMMARY="">
<TR>
<TD COLSPAN=2 BGCOLOR="#EEEEFF" CLASS="NavBarCell1">
<A NAME="navbar_top_firstrow"><!-- --></A>
<TABLE BORDER="0" CELLPADDING="0" CELLSPACING="3" SUMMARY="">
<TR ALIGN="center" VALIGN="top">
<TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="../../overview-summary.html"><FONT CLASS="NavBarFont1"><B>Overview</B></FONT></A> </TD>
<TD BGCOLOR="#FFFFFF" CLASS="NavBarCell1Rev"> <FONT CLASS="NavBarFont1Rev"><B>Package</B></FONT> </TD>
<TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <FONT CLASS="NavBarFont1">Class</FONT> </TD>
<TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="package-use.html"><FONT CLASS="NavBarFont1"><B>Use</B></FONT></A> </TD>
<TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="package-tree.html"><FONT CLASS="NavBarFont1"><B>Tree</B></FONT></A> </TD>
<TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="../../deprecated-list.html"><FONT CLASS="NavBarFont1"><B>Deprecated</B></FONT></A> </TD>
<TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="../../index-all.html"><FONT CLASS="NavBarFont1"><B>Index</B></FONT></A> </TD>
<TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="../../help-doc.html"><FONT CLASS="NavBarFont1"><B>Help</B></FONT></A> </TD>
</TR>
</TABLE>
</TD>
<TD ALIGN="right" VALIGN="top" ROWSPAN=3><EM>
</EM>
</TD>
</TR>
<TR>
<TD BGCOLOR="white" CLASS="NavBarCell2"><FONT SIZE="-2">
PREV PACKAGE
<A HREF="../../com/hazelcast/ascii/package-summary.html"><B>NEXT PACKAGE</B></A></FONT></TD>
<TD BGCOLOR="white" CLASS="NavBarCell2"><FONT SIZE="-2">
<A HREF="../../index.html?com/hazelcast/package-summary.html" target="_top"><B>FRAMES</B></A>
<A HREF="package-summary.html" target="_top"><B>NO FRAMES</B></A>
<SCRIPT type="text/javascript">
<!--
if(window==top) {
document.writeln('<A HREF="../../allclasses-noframe.html"><B>All Classes</B></A>');
}
//-->
</SCRIPT>
<NOSCRIPT>
<A HREF="../../allclasses-noframe.html"><B>All Classes</B></A>
</NOSCRIPT>
</FONT></TD>
</TR>
</TABLE>
<A NAME="skip-navbar_top"></A>
<!-- ========= END OF TOP NAVBAR ========= -->
<HR>
<H2>
Package com.hazelcast
</H2>
<TABLE BORDER="1" WIDTH="100%" CELLPADDING="3" CELLSPACING="0" SUMMARY="">
<TR BGCOLOR="#CCCCFF" CLASS="TableHeadingColor">
<TH ALIGN="left" COLSPAN="2"><FONT SIZE="+2">
<B>Class Summary</B></FONT></TH>
</TR>
<TR BGCOLOR="white" CLASS="TableRowColor">
<TD WIDTH="15%"><B><A HREF="../../com/hazelcast/PlaceHolder.html" title="class in com.hazelcast">PlaceHolder</A></B></TD>
<TD> </TD>
</TR>
</TABLE>
<P>
<DL>
</DL>
<HR>
<!-- ======= START OF BOTTOM NAVBAR ====== -->
<A NAME="navbar_bottom"><!-- --></A>
<A HREF="#skip-navbar_bottom" title="Skip navigation links"></A>
<TABLE BORDER="0" WIDTH="100%" CELLPADDING="1" CELLSPACING="0" SUMMARY="">
<TR>
<TD COLSPAN=2 BGCOLOR="#EEEEFF" CLASS="NavBarCell1">
<A NAME="navbar_bottom_firstrow"><!-- --></A>
<TABLE BORDER="0" CELLPADDING="0" CELLSPACING="3" SUMMARY="">
<TR ALIGN="center" VALIGN="top">
<TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="../../overview-summary.html"><FONT CLASS="NavBarFont1"><B>Overview</B></FONT></A> </TD>
<TD BGCOLOR="#FFFFFF" CLASS="NavBarCell1Rev"> <FONT CLASS="NavBarFont1Rev"><B>Package</B></FONT> </TD>
<TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <FONT CLASS="NavBarFont1">Class</FONT> </TD>
<TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="package-use.html"><FONT CLASS="NavBarFont1"><B>Use</B></FONT></A> </TD>
<TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="package-tree.html"><FONT CLASS="NavBarFont1"><B>Tree</B></FONT></A> </TD>
<TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="../../deprecated-list.html"><FONT CLASS="NavBarFont1"><B>Deprecated</B></FONT></A> </TD>
<TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="../../index-all.html"><FONT CLASS="NavBarFont1"><B>Index</B></FONT></A> </TD>
<TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="../../help-doc.html"><FONT CLASS="NavBarFont1"><B>Help</B></FONT></A> </TD>
</TR>
</TABLE>
</TD>
<TD ALIGN="right" VALIGN="top" ROWSPAN=3><EM>
</EM>
</TD>
</TR>
<TR>
<TD BGCOLOR="white" CLASS="NavBarCell2"><FONT SIZE="-2">
PREV PACKAGE
<A HREF="../../com/hazelcast/ascii/package-summary.html"><B>NEXT PACKAGE</B></A></FONT></TD>
<TD BGCOLOR="white" CLASS="NavBarCell2"><FONT SIZE="-2">
<A HREF="../../index.html?com/hazelcast/package-summary.html" target="_top"><B>FRAMES</B></A>
<A HREF="package-summary.html" target="_top"><B>NO FRAMES</B></A>
<SCRIPT type="text/javascript">
<!--
if(window==top) {
document.writeln('<A HREF="../../allclasses-noframe.html"><B>All Classes</B></A>');
}
//-->
</SCRIPT>
<NOSCRIPT>
<A HREF="../../allclasses-noframe.html"><B>All Classes</B></A>
</NOSCRIPT>
</FONT></TD>
</TR>
</TABLE>
<A NAME="skip-navbar_bottom"></A>
<!-- ======== END OF BOTTOM NAVBAR ======= -->
<HR>
Copyright © 2015 <a href="http://www.hazelcast.com/">Hazelcast, Inc.</a>. All Rights Reserved.
</BODY>
</HTML>
| {
"content_hash": "70b44bcc8e52262210ebba671a6a6d29",
"timestamp": "",
"source": "github",
"line_count": 158,
"max_line_length": 150,
"avg_line_length": 38.58860759493671,
"alnum_prop": 0.6275217319993439,
"repo_name": "akiskip/KoDeMat-Collaboration-Platform-Application",
"id": "ccf8966ce36badb09b7fd6071db3e464b503eeea",
"size": "6097",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "KoDeMat_TouchScreen/lib/hazelcast-3.4.2/hazelcast-3.4.2/docs/javadoc/com/hazelcast/package-summary.html",
"mode": "33188",
"license": "apache-2.0",
"language": [
{
"name": "Batchfile",
"bytes": "1255"
},
{
"name": "CSS",
"bytes": "12362"
},
{
"name": "GLSL",
"bytes": "105719"
},
{
"name": "HTML",
"bytes": "17271482"
},
{
"name": "Java",
"bytes": "1388877"
},
{
"name": "JavaScript",
"bytes": "110983"
},
{
"name": "Shell",
"bytes": "1365"
}
],
"symlink_target": ""
} |
var EventRange = Class.extend({
unzonedRange: null,
eventDef: null,
eventInstance: null, // optional
constructor: function(unzonedRange, eventDef, eventInstance) {
this.unzonedRange = unzonedRange;
this.eventDef = eventDef;
if (eventInstance) {
this.eventInstance = eventInstance;
}
}
});
| {
"content_hash": "36bdbe71ed6e8aee1101c4825a44d03e",
"timestamp": "",
"source": "github",
"line_count": 17,
"max_line_length": 63,
"avg_line_length": 18.235294117647058,
"alnum_prop": 0.7161290322580646,
"repo_name": "pietervisser/fullcalendar",
"id": "2cef8df413609fbd08fb3819fcdaa26cf090563b",
"size": "311",
"binary": false,
"copies": "2",
"ref": "refs/heads/master",
"path": "src/models/event/EventRange.js",
"mode": "33188",
"license": "mit",
"language": [
{
"name": "CSS",
"bytes": "38795"
},
{
"name": "HTML",
"bytes": "154124"
},
{
"name": "JavaScript",
"bytes": "1174712"
},
{
"name": "Shell",
"bytes": "4766"
}
],
"symlink_target": ""
} |
OtherService::OtherService() = default;
OtherService::~OtherService() = default;
int OtherService::getRandomInt(int limit)
{
return -(qrand() % limit);
}
| {
"content_hash": "9daa51528a503da9625df4dbc3612577",
"timestamp": "",
"source": "github",
"line_count": 8,
"max_line_length": 41,
"avg_line_length": 20,
"alnum_prop": 0.70625,
"repo_name": "joncol/jcon-cpp",
"id": "0b9c58552c146c1fc0e3e886c67d45043925ad1e",
"size": "209",
"binary": false,
"copies": "2",
"ref": "refs/heads/master",
"path": "src/other_service.cpp",
"mode": "33188",
"license": "mit",
"language": [
{
"name": "C",
"bytes": "671"
},
{
"name": "C++",
"bytes": "88238"
},
{
"name": "CMake",
"bytes": "4575"
},
{
"name": "Emacs Lisp",
"bytes": "28"
},
{
"name": "Nix",
"bytes": "890"
},
{
"name": "QMake",
"bytes": "1851"
},
{
"name": "Ruby",
"bytes": "1277"
}
],
"symlink_target": ""
} |
{% extends "base.html" %}
{% block content %}
<div id="root"></div>
<script>
window.props = {{ props | safe }};
window.root = document.getElementById('root');
</script>
{% load static %}
<script src={% static 'feedback/src/dist/index.js' %}?{% now "U" %}></script>
{% endblock %} | {
"content_hash": "4e70c7e0d39a218265a9c0d2015feb0d",
"timestamp": "",
"source": "github",
"line_count": 11,
"max_line_length": 77,
"avg_line_length": 26.181818181818183,
"alnum_prop": 0.5972222222222222,
"repo_name": "duosproject/duos-web",
"id": "40adf2bb0eefd14f3c759261e470e7eef4ac0f9f",
"size": "288",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "feedback/templates/feedback/author_survey.html",
"mode": "33188",
"license": "mit",
"language": [
{
"name": "CSS",
"bytes": "633"
},
{
"name": "HTML",
"bytes": "1820"
},
{
"name": "JavaScript",
"bytes": "5666"
},
{
"name": "Python",
"bytes": "7325"
}
],
"symlink_target": ""
} |
package com.google.gwt.sample.validation.shared;
import com.google.gwt.sample.validation.server.ServerConstraint;
import com.google.gwt.user.client.rpc.IsSerializable;
import java.util.Map;
import javax.validation.Valid;
import javax.validation.constraints.Max;
import javax.validation.constraints.NotNull;
import javax.validation.constraints.Size;
/**
* A sample bean to show validation on.
*/
@ServerConstraint(groups = ServerGroup.class)
public class Person implements IsSerializable {
@Valid
private Address address;
@Valid
private Map<String, Address> otherAddresses;
@NotNull
@Size(min = 4, message = "{custom.name.size.message}")
private String name;
private long ssn;
public Address getAddress() {
return address;
}
public String getName() {
return name;
}
public void setAddress(Address address) {
this.address = address;
}
public void setName(String name) {
this.name = name;
}
public void setSsn(long ssn) {
this.ssn = ssn;
}
@Max(999999999)
protected long getSsn() {
return ssn;
}
}
| {
"content_hash": "8db0e1770f67ddd20be4404ac2ef4a2c",
"timestamp": "",
"source": "github",
"line_count": 57,
"max_line_length": 64,
"avg_line_length": 18.92982456140351,
"alnum_prop": 0.7173308619091752,
"repo_name": "dougkoellmer/swarm",
"id": "c24ef952c1933095106642b2a54df8d1102a7325",
"size": "1669",
"binary": false,
"copies": "2",
"ref": "refs/heads/master",
"path": "tools/gwt/samples/Validation/src/main/java/com/google/gwt/sample/validation/shared/Person.java",
"mode": "33188",
"license": "mit",
"language": [
{
"name": "Batchfile",
"bytes": "72"
},
{
"name": "CSS",
"bytes": "25294"
},
{
"name": "Java",
"bytes": "1386664"
},
{
"name": "JavaScript",
"bytes": "401014"
},
{
"name": "Perl",
"bytes": "5572"
},
{
"name": "Shell",
"bytes": "6620"
}
],
"symlink_target": ""
} |
<?xml version="1.0" encoding="UTF-8"?>
<!--
Licensed to the Apache Software Foundation (ASF) under one or more
contributor license agreements. See the NOTICE file distributed with
this work for additional information regarding copyright ownership.
The ASF licenses this file to You under the Apache License, Version 2.0
(the "License"); you may not use this file except in compliance with
the License. You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
-->
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
<modelVersion>4.0.0</modelVersion>
<parent>
<groupId>org.apache.camel</groupId>
<artifactId>components-starter</artifactId>
<version>2.22.0-SNAPSHOT</version>
</parent>
<artifactId>camel-yammer-starter</artifactId>
<packaging>jar</packaging>
<name>Spring-Boot Starter :: Camel :: Yammer</name>
<description>Spring-Boot Starter for Camel Yammer Component</description>
<dependencies>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter</artifactId>
<version>${spring-boot-version}</version>
</dependency>
<dependency>
<groupId>org.apache.camel</groupId>
<artifactId>camel-yammer</artifactId>
<version>${project.version}</version>
</dependency>
<!--START OF GENERATED CODE-->
<dependency>
<groupId>org.apache.camel</groupId>
<artifactId>camel-core-starter</artifactId>
</dependency>
<dependency>
<groupId>org.apache.camel</groupId>
<artifactId>camel-spring-boot-starter</artifactId>
</dependency>
<!--END OF GENERATED CODE-->
</dependencies>
</project>
| {
"content_hash": "0fa919fe3a77de39acea02bb11edf031",
"timestamp": "",
"source": "github",
"line_count": 53,
"max_line_length": 201,
"avg_line_length": 41.0188679245283,
"alnum_prop": 0.7083716651333947,
"repo_name": "jonmcewen/camel",
"id": "72282f5d2593c3b776275a140a48e8161d5d3dcc",
"size": "2174",
"binary": false,
"copies": "4",
"ref": "refs/heads/master",
"path": "platforms/spring-boot/components-starter/camel-yammer-starter/pom.xml",
"mode": "33188",
"license": "apache-2.0",
"language": [
{
"name": "Apex",
"bytes": "6519"
},
{
"name": "Batchfile",
"bytes": "1518"
},
{
"name": "CSS",
"bytes": "30373"
},
{
"name": "Elm",
"bytes": "10852"
},
{
"name": "FreeMarker",
"bytes": "11410"
},
{
"name": "Groovy",
"bytes": "54390"
},
{
"name": "HTML",
"bytes": "190919"
},
{
"name": "Java",
"bytes": "68307055"
},
{
"name": "JavaScript",
"bytes": "90399"
},
{
"name": "Makefile",
"bytes": "513"
},
{
"name": "PLSQL",
"bytes": "1419"
},
{
"name": "Protocol Buffer",
"bytes": "2514"
},
{
"name": "Python",
"bytes": "36"
},
{
"name": "Ruby",
"bytes": "4802"
},
{
"name": "Scala",
"bytes": "323702"
},
{
"name": "Shell",
"bytes": "17107"
},
{
"name": "Tcl",
"bytes": "4974"
},
{
"name": "Thrift",
"bytes": "6979"
},
{
"name": "XQuery",
"bytes": "546"
},
{
"name": "XSLT",
"bytes": "284638"
}
],
"symlink_target": ""
} |
'use strict';
const globalHooks = require('../../../hooks');
const hooks = require('feathers-hooks');
const auth = require('feathers-authentication').hooks;
exports.before = {
all: [],
find: [
auth.verifyToken(),
auth.populateUser(),
auth.restrictToAuthenticated()
],
get: [],
create: [
auth.hashPassword()
],
update: [
auth.verifyToken(),
auth.populateUser(),
auth.restrictToAuthenticated(),
auth.restrictToOwner({ ownerField: '_id' })
],
patch: [
auth.verifyToken(),
auth.populateUser(),
auth.restrictToAuthenticated(),
auth.restrictToOwner({ ownerField: '_id' })
],
remove: [
auth.verifyToken(),
auth.populateUser(),
auth.restrictToAuthenticated(),
auth.restrictToOwner({ ownerField: '_id' })
]
};
exports.after = {
all: [hooks.remove('password')],
find: [],
get: [],
create: [],
update: [],
patch: [],
remove: []
};
| {
"content_hash": "6742dd5d3d085682eab0696c521a27aa",
"timestamp": "",
"source": "github",
"line_count": 46,
"max_line_length": 54,
"avg_line_length": 20.108695652173914,
"alnum_prop": 0.6064864864864865,
"repo_name": "kieusonlam/vue-feathers-wepack",
"id": "337f38c7035463e977050a8982b1307585d23ba2",
"size": "925",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "src/services/user/hooks/index.js",
"mode": "33188",
"license": "mit",
"language": [
{
"name": "HTML",
"bytes": "805"
},
{
"name": "JavaScript",
"bytes": "28944"
},
{
"name": "Vue",
"bytes": "13810"
}
],
"symlink_target": ""
} |
using System.IO;
using HttpMultipartParser;
using Nancy.ModelBinding;
using Nancy.Swagger.Demo.Models;
using System.Linq;
namespace Nancy.Swagger.Demo.Modules
{
public class ServiceDetailsModule : NancyModule
{
public ServiceDetailsModule() : base("/service")
{
Get("/", _ => "Hello again, Swagger!", null, "ServiceHome");
Get("/details", _ => new ServiceDetails()
{
Name = "Nancy Swagger Service",
Owner = new ServiceOwner()
{
CompanyName = "Swagger Example Inc.",
CompanyContactEmail = "[email protected]"
},
Customers = new []
{
new ServiceCustomer() {CustomerName = "Jack"},
new ServiceCustomer() {CustomerName = "Jill"}
}
}, null, "GetDetails");
Get("/customers", _ => new[]
{
new ServiceCustomer() {CustomerName = "Jack"},
new ServiceCustomer() {CustomerName = "Jill"}
}, null, "GetCustomers");
Get("/customers/{name}", _ => new ServiceCustomer() {CustomerName = "Jack"}, null, "GetCustomer");
Post("/customer/{service}", parameters =>
{
var result = this.Bind<ServiceCustomer>();
return result;
}, null, "PostNewCustomer");
Post("/customer/{name}/file", async parameters =>
{
var parsed = new MultipartFormDataParser(Request.Body);
var file = parsed.Files.FirstOrDefault()?.Data;
if(file == null)
{
return "File Parsing Failed";
}
var reader = new StreamReader(file);
return await reader.ReadToEndAsync();
}, null, "PostCustomerReview");
}
}
} | {
"content_hash": "e1d1fb65a012e5bcf19639cb2998664b",
"timestamp": "",
"source": "github",
"line_count": 59,
"max_line_length": 110,
"avg_line_length": 33.220338983050844,
"alnum_prop": 0.4943877551020408,
"repo_name": "catcherwong/Nancy.Swagger",
"id": "a9dcc4fe81ebc2c093e0b4ba2d6d23219a4d4186",
"size": "1962",
"binary": false,
"copies": "3",
"ref": "refs/heads/master",
"path": "samples/Nancy.Swagger.Demo/Modules/ServiceDetailsModule.cs",
"mode": "33188",
"license": "mit",
"language": [
{
"name": "Batchfile",
"bytes": "338"
},
{
"name": "C#",
"bytes": "418749"
}
],
"symlink_target": ""
} |
package kieker.tools.traceAnalysis.filter;
import kieker.analysis.IProjectContext;
import kieker.analysis.plugin.annotation.Plugin;
import kieker.analysis.plugin.annotation.RepositoryPort;
import kieker.analysis.plugin.filter.AbstractFilterPlugin;
import kieker.common.configuration.Configuration;
import kieker.common.logging.Log;
import kieker.common.logging.LogFactory;
import kieker.common.util.signature.Signature;
import kieker.tools.traceAnalysis.systemModel.AllocationComponent;
import kieker.tools.traceAnalysis.systemModel.AssemblyComponent;
import kieker.tools.traceAnalysis.systemModel.ComponentType;
import kieker.tools.traceAnalysis.systemModel.Execution;
import kieker.tools.traceAnalysis.systemModel.ExecutionContainer;
import kieker.tools.traceAnalysis.systemModel.Operation;
import kieker.tools.traceAnalysis.systemModel.repository.SystemModelRepository;
/**
* @author Andre van Hoorn
*
* @since 1.2
*/
@Plugin(repositoryPorts = { @RepositoryPort(name = AbstractTraceAnalysisFilter.REPOSITORY_PORT_NAME_SYSTEM_MODEL, repositoryType = SystemModelRepository.class) })
public abstract class AbstractTraceAnalysisFilter extends AbstractFilterPlugin {
public static final String CONFIG_PROPERTY_VALUE_VERBOSE = "false";
/** The name of the repository port for the system model repository. */
public static final String REPOSITORY_PORT_NAME_SYSTEM_MODEL = "systemModelRepository";
protected static final Log LOG = LogFactory.getLog(AbstractTraceAnalysisFilter.class); // NOPMD (inherited constructor)
private volatile SystemModelRepository systemEntityFactory;
/**
* Creates a new instance of this class using the given parameters.
*
* @param configuration
* The configuration for this component.
* @param projectContext
* The project context for this component.
*/
public AbstractTraceAnalysisFilter(final Configuration configuration, final IProjectContext projectContext) {
super(configuration, projectContext);
}
@Override
public Configuration getCurrentConfiguration() {
return new Configuration();
}
public static final Execution createExecutionByEntityNames(final SystemModelRepository systemModelRepository,
final String executionContainerName, final String assemblyComponentTypeName, final String componentTypeName,
final Signature operationSignature, final long traceId, final String sessionId, final int eoi, final int ess,
final long tin, final long tout, final boolean assumed) {
final String allocationComponentName = new StringBuilder(executionContainerName).append("::").append(assemblyComponentTypeName).toString();
final String operationFactoryName = new StringBuilder(componentTypeName).append(".").append(operationSignature).toString();
AllocationComponent allocInst = systemModelRepository.getAllocationFactory()
.lookupAllocationComponentInstanceByNamedIdentifier(allocationComponentName);
if (allocInst == null) { // Allocation component instance doesn't exist
AssemblyComponent assemblyComponent = systemModelRepository.getAssemblyFactory()
.lookupAssemblyComponentInstanceByNamedIdentifier(assemblyComponentTypeName);
if (assemblyComponent == null) { // assembly instance doesn't exist
ComponentType componentType = systemModelRepository.getTypeRepositoryFactory().lookupComponentTypeByNamedIdentifier(assemblyComponentTypeName);
if (componentType == null) { // NOPMD NOCS (NestedIf)
// Component type doesn't exist
componentType = systemModelRepository.getTypeRepositoryFactory().createAndRegisterComponentType(assemblyComponentTypeName,
assemblyComponentTypeName);
}
assemblyComponent = systemModelRepository.getAssemblyFactory()
.createAndRegisterAssemblyComponentInstance(assemblyComponentTypeName, componentType);
}
ExecutionContainer execContainer = systemModelRepository.getExecutionEnvironmentFactory()
.lookupExecutionContainerByNamedIdentifier(executionContainerName);
if (execContainer == null) { // doesn't exist, yet
execContainer = systemModelRepository.getExecutionEnvironmentFactory()
.createAndRegisterExecutionContainer(executionContainerName, executionContainerName);
}
allocInst = systemModelRepository.getAllocationFactory()
.createAndRegisterAllocationComponentInstance(allocationComponentName, assemblyComponent, execContainer);
}
Operation op = systemModelRepository.getOperationFactory().lookupOperationByNamedIdentifier(operationFactoryName);
if (op == null) { // Operation doesn't exist
op = systemModelRepository.getOperationFactory()
.createAndRegisterOperation(operationFactoryName, allocInst.getAssemblyComponent().getType(), operationSignature);
allocInst.getAssemblyComponent().getType().addOperation(op);
}
return new Execution(op, allocInst, traceId, sessionId, eoi, ess, tin, tout, assumed);
}
public static final Execution createExecutionByEntityNames(final SystemModelRepository systemModelRepository,
final String executionContainerName, final String assemblyComponentTypeName,
final Signature operationSignature, final long traceId, final String sessionId, final int eoi, final int ess,
final long tin, final long tout, final boolean assumed) {
return AbstractTraceAnalysisFilter.createExecutionByEntityNames(systemModelRepository, executionContainerName, assemblyComponentTypeName,
assemblyComponentTypeName, operationSignature, traceId, sessionId, eoi, ess, tin, tout, assumed);
}
protected final Execution createExecutionByEntityNames(final String executionContainerName, final String assemblyComponentTypeName,
final String componentTypeName, final Signature operationSignature, final long traceId, final String sessionId, final int eoi, final int ess,
final long tin, final long tout, final boolean assumed) {
return AbstractTraceAnalysisFilter.createExecutionByEntityNames(this.getSystemEntityFactory(), executionContainerName, assemblyComponentTypeName,
componentTypeName, operationSignature, traceId, sessionId, eoi, ess, tin, tout, assumed);
}
protected final Execution createExecutionByEntityNames(final String executionContainerName, final String assemblyComponentTypeName,
final Signature operationSignature, final long traceId, final String sessionId, final int eoi, final int ess,
final long tin, final long tout, final boolean assumed) {
return AbstractTraceAnalysisFilter.createExecutionByEntityNames(this.getSystemEntityFactory(), executionContainerName, assemblyComponentTypeName,
assemblyComponentTypeName, operationSignature, traceId, sessionId, eoi, ess, tin, tout, assumed);
}
/**
* Prints a debug message to the logger. The output is prepended by a header which includes the name of this plugin instance.
*
* @param lines
* The lines to be printed.
*/
protected void printDebugLogMessage(final String[] lines) {
if (LOG.isDebugEnabled()) {
LOG.debug("");
LOG.debug("#");
LOG.debug("# Plugin: " + this.getName());
for (final String l : lines) {
LOG.debug(l);
}
}
}
protected void printErrorLogMessage(final String[] lines) {
LOG.error("");
LOG.error("#");
LOG.error("# Plugin: " + this.getName());
for (final String l : lines) {
LOG.error(l);
}
}
public final SystemModelRepository getSystemEntityFactory() {
if (this.systemEntityFactory == null) {
this.systemEntityFactory = (SystemModelRepository)
this.getRepository(REPOSITORY_PORT_NAME_SYSTEM_MODEL);
}
if (this.systemEntityFactory == null) {
LOG.error("Failed to connect to system model repository via repository port '"
+ REPOSITORY_PORT_NAME_SYSTEM_MODEL + "' (not connected?)");
}
return this.systemEntityFactory;
}
}
| {
"content_hash": "616f4ef305f15721b328df0800550965",
"timestamp": "",
"source": "github",
"line_count": 157,
"max_line_length": 162,
"avg_line_length": 49.152866242038215,
"alnum_prop": 0.7957755604509524,
"repo_name": "HaStr/kieker",
"id": "e2a92b2ee5f6cc99bc3273d4ce7eb2f32c537279",
"size": "8493",
"binary": false,
"copies": "1",
"ref": "refs/heads/stable",
"path": "kieker-tools/src/kieker/tools/traceAnalysis/filter/AbstractTraceAnalysisFilter.java",
"mode": "33188",
"license": "apache-2.0",
"language": [
{
"name": "Batchfile",
"bytes": "7208"
},
{
"name": "CSS",
"bytes": "24891"
},
{
"name": "HTML",
"bytes": "103357"
},
{
"name": "Java",
"bytes": "5376692"
},
{
"name": "Python",
"bytes": "14400"
},
{
"name": "R",
"bytes": "11710"
},
{
"name": "Roff",
"bytes": "94560"
},
{
"name": "Shell",
"bytes": "86559"
},
{
"name": "TeX",
"bytes": "215941"
}
],
"symlink_target": ""
} |
<?php
namespace common\modules\wizard\generators\model;
use Yii;
use yii\db\Schema;
use yii\helpers\Inflector;
/**
* This generator will generate one ActiveRecord classes for the specified database table.
*
* @author ChisWill
*/
class Generator extends \common\modules\wizard\Generator
{
// 公共属性
public $alias;
public $aliasFlag = false;
// 虚拟字段
public $tableName;
public $modelNamespace;
public $isExtend;
// 默认配置设定
public $mainNamespace = 'common\models';
public $baseClass = 'common\components\ARModel';
public $generateLabelsFromComments = true;
public function rules()
{
return [
[['tableName'], 'required', 'message' => '{attribute} 不能为空~!'],
[['tableName', 'modelNamespace'], 'filter', 'filter' => 'trim'],
[['tableName'], 'validateTableName'],
[['isExtend'], 'safe'],
[['modelNamespace'], 'validateModelNamespace', 'skipOnEmpty' => false]
];
}
public function attributeLabels()
{
return [
'tableName' => '表名',
'isExtend' => '继承选项'
];
}
/**
* Validates the [[tableName]] attribute.
*/
public function validateTableName()
{
$db = $this->getDbConnection();
if (strpos($this->tableName, '->') !== false) {
$pieces = explode('->', $this->tableName);
$this->tableName = $pieces[0];
$this->alias = $pieces[1];
$this->aliasFlag = true;
} else {
$this->alias = $this->tableName;
}
$tableName = $db->tablePrefix . $this->tableName;
$class = $this->generateClassName($tableName);
if ($this->isReservedKeyword($class)) {
$this->addError('tableName', "Table '$tableName' will generate a class which is a reserved PHP keyword.");
} elseif ($db->getTableSchema($tableName, true) === null) {
$this->addError('tableName', "Table '{$tableName}' does not exist.");
}
}
/**
* Validates the [[modelNamespace]] attribute.
*/
public function validateModelNamespace()
{
if (!$this->modelNamespace && !$this->isExtend) {
$this->addError('modelNamespace', '继承选项与命名空间必须选择填一个~!');
} elseif ($this->modelNamespace) {
$this->modelNamespace = trim(str_replace('/', '\\', $this->modelNamespace), '\\');
try {
Yii::getAlias('@' . explode('\\', $this->modelNamespace)[0]);
} catch (\yii\base\InvalidParamException $e) {
$this->addError('modelNamespace', $e->getMessage());
}
}
}
/**
* Generates the default condition for the specified table.
* @param \yii\db\TableSchema $table the table schema
* @return array the generated condition
*/
public function generateCompares($table)
{
$compares = [];
foreach ($table->columns as $column) {
switch ($column->type) {
// 数值型都采用“精确匹配”模式
case Schema::TYPE_SMALLINT:
case Schema::TYPE_INTEGER:
case Schema::TYPE_BIGINT:
case Schema::TYPE_BOOLEAN:
case Schema::TYPE_FLOAT:
case Schema::TYPE_DOUBLE:
case Schema::TYPE_DECIMAL:
case Schema::TYPE_MONEY:
$compares['equal'][] = $column->name;
break;
// 非数值型都采用“模糊匹配”模式
default:
$compares['like'][] = $column->name;
}
}
return $compares;
}
/**
* Generates the attribute labels for the specified table.
* @param \yii\db\TableSchema $table the table schema
* @return array the generated attribute labels (name => label)
*/
public function generateLabels($table)
{
$labels = [];
foreach ($table->columns as $column) {
if ($this->generateLabelsFromComments && !empty($column->comment)) {
$labels[$column->name] = $column->comment;
} elseif (!strcasecmp($column->name, 'id')) {
$labels[$column->name] = 'ID';
} else {
$label = Inflector::camel2words($column->name);
if (!empty($label) && substr_compare($label, ' id', -3, 3, true) === 0) {
$label = substr($label, 0, -3) . ' ID';
}
$labels[$column->name] = $label;
}
}
return $labels;
}
/**
* Generates validation rules for the specified table.
* @param \yii\db\TableSchema $table the table schema
* @return array the generated validation rules
*/
public function generateRules($table)
{
$types = [];
$lengths = [];
foreach ($table->columns as $column) {
if ($column->autoIncrement) {
continue;
}
if (!$column->allowNull && $column->defaultValue === null) {
$types['required'][] = $column->name;
}
switch ($column->type) {
case Schema::TYPE_TEXT:
$types['default'][] = $column->name;
break;
case Schema::TYPE_SMALLINT:
case Schema::TYPE_INTEGER:
case Schema::TYPE_BIGINT:
$types['integer'][] = $column->name;
break;
case Schema::TYPE_BOOLEAN:
$types['boolean'][] = $column->name;
break;
case Schema::TYPE_FLOAT:
case Schema::TYPE_DOUBLE:
case Schema::TYPE_DECIMAL:
case Schema::TYPE_MONEY:
$types['number'][] = $column->name;
break;
case Schema::TYPE_DATE:
case Schema::TYPE_TIME:
case Schema::TYPE_DATETIME:
case Schema::TYPE_TIMESTAMP:
$types['safe'][] = $column->name;
break;
default: // strings
if ($column->size > 0) {
$lengths[$column->size][] = $column->name;
} else {
$types['string'][] = $column->name;
}
// 如果字段中包含email,则给予email验证规则
if (preg_match('/\w?email$/Ui', $column->name)) {
$types['email'][] = $column->name;
}
}
}
$rules = [];
foreach ($types as $type => $columns) {
if ($type === 'default') {
$rules[] = "[['" . implode("', '", $columns) . "'], 'default', 'value' => '']";
} else {
$rules[] = "[['" . implode("', '", $columns) . "'], '$type']";
}
}
foreach ($lengths as $length => $columns) {
$rules[] = "[['" . implode("', '", $columns) . "'], 'string', 'max' => $length]";
}
// Unique indexes rules
try {
$db = $this->getDbConnection();
$uniqueIndexes = $db->getSchema()->findUniqueIndexes($table);
foreach ($uniqueIndexes as $uniqueColumns) {
// Avoid validating auto incremental columns
if (!$this->isColumnAutoIncremental($table, $uniqueColumns)) {
$attributesCount = count($uniqueColumns);
if ($attributesCount == 1) {
$rules[] = "[['" . $uniqueColumns[0] . "'], 'unique']";
} elseif ($attributesCount > 1) {
$labels = array_intersect_key($this->generateLabels($table), array_flip($uniqueColumns));
$lastLabel = array_pop($labels);
$columnsList = implode("', '", $uniqueColumns);
$rules[] = "[['" . $columnsList . "'], 'unique', 'targetAttribute' => ['" . $columnsList . "'], 'message' => 'The combination of " . implode(', ', $labels) . " and " . $lastLabel . " has already been taken.']";
}
}
}
} catch (\yii\base\NotSupportedException $e) {
// doesn't support unique indexes information...do nothing
}
return $rules;
}
/**
* Generates a class name from the specified table name.
* @param string $tableName the table name (which may contain schema prefix)
* @return string the generated class name
*/
public function generateClassName($tableName)
{
$db = $this->getDbConnection();
$patterns = [];
$patterns[] = "/^{$db->tablePrefix}(.*?)$/";
$patterns[] = "/^(.*?){$db->tablePrefix}$/";
if (strpos($this->tableName, '*') !== false) {
$pattern = $this->tableName;
if (($pos = strrpos($pattern, '.')) !== false) {
$pattern = substr($pattern, $pos + 1);
}
$patterns[] = '/^' . str_replace('*', '(\w+)', $pattern) . '$/';
}
$className = $tableName;
foreach ($patterns as $pattern) {
if (preg_match($pattern, $tableName, $matches)) {
$className = $matches[1];
break;
}
}
return Inflector::id2camel($className, '_');
}
/**
* Checks if any of the specified columns is auto incremental.
* @param \yii\db\TableSchema $table the table schema
* @param array $columns columns to check for autoIncrement property
* @return boolean whether any of the specified columns is auto incremental.
*/
private function isColumnAutoIncremental($table, $columns)
{
foreach ($columns as $column) {
if (isset($table->columns[$column]) && $table->columns[$column]->autoIncrement) {
return true;
}
}
return false;
}
/**
* @return Connection the DB connection as specified by [[db]].
*/
public function getDbConnection()
{
return Yii::$app->get('db', false);
}
}
| {
"content_hash": "b8b203e6b983b1b8449e05ad9920bf60",
"timestamp": "",
"source": "github",
"line_count": 285,
"max_line_length": 234,
"avg_line_length": 36.75087719298246,
"alnum_prop": 0.4765132709566546,
"repo_name": "ChisWill/cii",
"id": "61ec07e9f0a7abe19c0fbdb65d3a25c45c1bb020",
"size": "10644",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "common/modules/wizard/generators/model/Generator.php",
"mode": "33188",
"license": "bsd-3-clause",
"language": [
{
"name": "ApacheConf",
"bytes": "879"
},
{
"name": "Batchfile",
"bytes": "1030"
},
{
"name": "CSS",
"bytes": "276918"
},
{
"name": "HTML",
"bytes": "59034"
},
{
"name": "JavaScript",
"bytes": "218844"
},
{
"name": "PHP",
"bytes": "821630"
},
{
"name": "PLSQL",
"bytes": "217269"
}
],
"symlink_target": ""
} |
package org.dcm4chex.archive.mbean;
import java.io.BufferedInputStream;
import java.io.File;
import java.io.FileInputStream;
import java.io.IOException;
import java.io.InputStream;
import java.nio.ByteBuffer;
import java.rmi.RemoteException;
import java.util.Collection;
import java.util.Iterator;
import javax.ejb.CreateException;
import javax.ejb.FinderException;
import javax.management.Notification;
import javax.management.NotificationListener;
import org.apache.log4j.Logger;
import org.dcm4che.data.Dataset;
import org.dcm4che.data.DcmObjectFactory;
import org.dcm4che.data.DcmParser;
import org.dcm4che.data.DcmParserFactory;
import org.dcm4che.data.FileFormat;
import org.dcm4che.dict.Tags;
import org.dcm4chex.archive.common.PrivateTags;
import org.dcm4chex.archive.config.RetryIntervalls;
import org.dcm4chex.archive.ejb.interfaces.CheckStudyPatient;
import org.dcm4chex.archive.ejb.interfaces.CheckStudyPatientHome;
import org.dcm4chex.archive.ejb.interfaces.FileDTO;
import org.dcm4chex.archive.util.Convert;
import org.dcm4chex.archive.util.EJBHomeFactory;
import org.dcm4chex.archive.util.FileUtils;
import org.jboss.system.ServiceMBeanSupport;
/**
* @author [email protected]
* @version $Revision: 2715 $ $Date: 2006-08-28 17:51:01 +0800 (周一, 28 8月 2006) $
* @since 08.08.2006
*
*/
public class CheckStudyPatientService extends ServiceMBeanSupport {
private static final String SCHEDULER_NAME = "CheckStudyPatient";
private final TimerSupport timer = new TimerSupport(this);
private long taskInterval = 0L;
private Integer studyStatus;
private Integer errorStudyStatus;
private Integer successStudyStatus;
private Integer checkedStudyStatus;
private String sourceAET;
private int limitNumberOfStudiesPerTask;
private String issuer;
private Integer listenerID;
private static final Logger log = Logger.getLogger(CheckStudyPatientService.class);
private static final DcmObjectFactory oFact =
DcmObjectFactory.getInstance();
private static final DcmParserFactory pFact =
DcmParserFactory.getInstance();
private final NotificationListener consistentCheckListener = new NotificationListener() {
public void handleNotification(Notification notif, Object handback) {
try {
check();
} catch (Exception e) {
log.error("Study patient check failed!", e);
}
}
};
public final String getTaskInterval() {
return RetryIntervalls.formatIntervalZeroAsNever(taskInterval);
}
public void setTaskInterval(String interval) {
long oldInterval = taskInterval;
taskInterval = RetryIntervalls.parseIntervalOrNever(interval);
if (getState() == STARTED && oldInterval != taskInterval) {
timer.stopScheduler(SCHEDULER_NAME, listenerID,
consistentCheckListener);
listenerID = timer.startScheduler(SCHEDULER_NAME, taskInterval,
consistentCheckListener);
}
}
/**
* @return Returns the sourceAET.
*/
public String getSourceAET() {
return sourceAET == null ? "*" : sourceAET;
}
/**
* @param sourceAET The sourceAET to set.
*/
public void setSourceAET(String sourceAET) {
this.sourceAET = "*".equals(sourceAET) ? null:sourceAET;
}
/**
* @return Returns the studyStatus.
*/
public String getStudyStatus() {
return studyStatus == null ? "*" : String.valueOf(studyStatus.intValue());
}
/**
* @param studyStatus The studyStatus to set.
*/
public void setStudyStatus(String studyStatus) {
this.studyStatus = "*".equals(studyStatus) ? null : new Integer(studyStatus);
}
/**
* @return Returns the errorStudyStatus.
*/
public String getErrorStudyStatus() {
return errorStudyStatus == null ? "NONE" : String.valueOf(errorStudyStatus.intValue());
}
/**
* @param errorStudyStatus The errorStudyStatus to set.
*/
public void setErrorStudyStatus(String errorStudyStatus) {
this.errorStudyStatus = "NONE".equalsIgnoreCase(errorStudyStatus) ? null : new Integer(errorStudyStatus);
}
/**
* @return Returns the successStudyStatus.
*/
public String getSuccessStudyStatus() {
return successStudyStatus == null ? "NONE" : String.valueOf(successStudyStatus.intValue());
}
/**
* @param successStudyStatus The successStudyStatus to set.
*/
public void setSuccessStudyStatus(String successStudyStatus) {
this.successStudyStatus = "NONE".equalsIgnoreCase(successStudyStatus) ? null : new Integer(successStudyStatus);
}
/**
* @return Returns the checkedStudyStatus.
*/
public String getCheckedStudyStatus() {
return checkedStudyStatus == null ? "NONE" : String.valueOf(checkedStudyStatus.intValue());
}
/**
* @param checkedStudyStatus The checkedStudyStatus to set.
*/
public void setCheckedStudyStatus(String checkedStudyStatus) {
this.checkedStudyStatus = "NONE".equalsIgnoreCase(checkedStudyStatus) ? null : new Integer(checkedStudyStatus);
}
/**
* @return Returns the issuer.
*/
public String getIssuer() {
return issuer;
}
/**
* @param issuer The issuer to set.
*/
public void setIssuer(String issuer) {
this.issuer = issuer;
}
public int getLimitNumberOfStudiesPerTask() {
return limitNumberOfStudiesPerTask;
}
public void setLimitNumberOfStudiesPerTask(int limit) {
this.limitNumberOfStudiesPerTask = limit;
}
public int findStudiesWithPatientCoercion() throws RemoteException, FinderException, CreateException {
return check(false)[1];
}
public String check() throws RemoteException, FinderException, CreateException {
int[] ia = check(true);
if ( ia[0] == 0 ) return "Nothing to do!";
return ia[0]+"studies checked!"+ ia[1]+" studies moved to new patient(s)!";
}
private int[] check(boolean update) throws RemoteException, FinderException, CreateException {
int updated = 0;
long l = System.currentTimeMillis();
CheckStudyPatient checker = newConsistencyCheck();
Collection col = checker.findStudiesForTest(studyStatus, sourceAET, limitNumberOfStudiesPerTask );
if ( col.isEmpty() ) return new int[]{0,0};
Object[] oa;
int i = 0;
Dataset ds, dsDB;
Dataset[] dsa;
long studyPk;
for ( Iterator iter = col.iterator() ; iter.hasNext() ; ) {
oa = (Object[]) iter.next();
dsa = checkPatInfo( dsDB=(Dataset)oa[0], (FileDTO)oa[1]);
ByteBuffer bb = dsDB.getByteBuffer(PrivateTags.StudyPk);
studyPk = Convert.toLong(bb.array());
if ( dsa != null ) {
if ( dsa[1] != null ) {
ds = dsa[1];
i++;
ds.putLO(Tags.IssuerOfPatientID, issuer);
ds = checker.moveStudyToNewPatient(ds, studyPk);
if ( successStudyStatus != null )
checker.updateStudyStatus(studyPk,successStudyStatus);
log.info("PatientInfo of file and DB differs! A new patient was created and study (pk="+studyPk+") moved! new patient:");
log.info(ds);
} else {
if ( checkedStudyStatus != null )
checker.updateStudyStatus(studyPk,checkedStudyStatus);
}
} else {
if ( errorStudyStatus != null )
checker.updateStudyStatus(studyPk,errorStudyStatus);
}
}
return new int[]{col.size(),i};
}
/**
* @param dataset
* @param fileDTO
*/
private Dataset[] checkPatInfo(Dataset dsDB, FileDTO fileDTO) {
log.info("check Patientinfo for "+dsDB.getString(Tags.PatientID)+" with file "+fileDTO);
String fsPath = fileDTO.getDirectoryPath();
String filePath = fileDTO.getFilePath();
File f = FileUtils.toFile(fsPath, filePath);
InputStream in = null;
DcmParser parser = null;
Dataset dsFile = null;
try {
in = new BufferedInputStream(new FileInputStream(f));
parser = pFact.newDcmParser(in);
FileFormat format = parser.detectFileFormat();
if (format != null) {
dsFile = oFact.newDataset();
parser.setDcmHandler(dsFile.getDcmHandler());
parser.parseDcmFile(format, Tags.PixelData);
}
return comparePatInfo(dsDB,dsFile) ? new Dataset[]{dsDB,null} : new Dataset[]{dsDB,dsFile};
} catch ( IOException x ) {
log.error("Check patient Info with data file failed! ", x);
return null;
}
}
/**
* @param dsDB
* @param ds
* @return
*/
private boolean comparePatInfo(Dataset dsDB, Dataset dsFile) {
if ( ! compareTag(dsDB,dsFile,Tags.PatientID) ) return false;
if ( ! compareTag(dsDB,dsFile,Tags.IssuerOfPatientID) ) {
if ( !issuer.equals( dsDB.getString(Tags.IssuerOfPatientID) ) ) return false;
}
if ( ! compareTag(dsDB,dsFile,Tags.PatientName) ) return false;
if ( ! compareTag(dsDB,dsFile,Tags.PatientSex) ) return false;
if ( ! compareTag(dsDB,dsFile,Tags.PatientBirthDate) ) return false;
return true;
}
private boolean compareTag(Dataset ds, Dataset ds1, int tag) {
String s = ds.getString(tag);
if ( s != null ) {
return s.equals(ds1.getString(tag));
} else {
return ds1.getString(tag)==null;
}
}
protected void startService() throws Exception {
timer.init();
listenerID = timer.startScheduler(SCHEDULER_NAME, taskInterval,
consistentCheckListener);
}
protected void stopService() throws Exception {
timer.stopScheduler(SCHEDULER_NAME, listenerID,
consistentCheckListener);
super.stopService();
}
private CheckStudyPatient newConsistencyCheck() {
try {
CheckStudyPatientHome home = (CheckStudyPatientHome) EJBHomeFactory
.getFactory().lookup(CheckStudyPatientHome.class,
CheckStudyPatientHome.JNDI_NAME);
return home.create();
} catch (Exception e) {
throw new RuntimeException("Failed to access CheckStudyPatient EJB:",
e);
}
}
} | {
"content_hash": "81e19b159010233be36b7f8d5a851122",
"timestamp": "",
"source": "github",
"line_count": 298,
"max_line_length": 129,
"avg_line_length": 33.70134228187919,
"alnum_prop": 0.6790799561883899,
"repo_name": "medicayun/medicayundicom",
"id": "074fbea59c9a6e68feda03bb6b017f9cc2eaba34",
"size": "11925",
"binary": false,
"copies": "3",
"ref": "refs/heads/master",
"path": "dcm4jboss-all/tags/DCM4CHEE_2_10_3/dcm4jboss-sar/src/java/org/dcm4chex/archive/mbean/CheckStudyPatientService.java",
"mode": "33188",
"license": "apache-2.0",
"language": [],
"symlink_target": ""
} |
#ifndef _MULTI_PLANT_H_
#define _MULTI_PLANT_H_
#include "plant.h"
#include <vector>
/** Allows combining multiple plants into one.
* Sub-plants are specified by parameters of the form
* \b plant_i <em> = <class> <chapter> </em>, with \b i
* being a continuous index starting at 0, <class> being the
* type of plant to use, and <chapter> being the configuration
* chapter its parameters are described in.
*
* States, measurements and actions of sub-plants will be
* appended to each other in the order they have been declared.
*
* \note While this module offers a convenient method for joining
* simpler plants into a larger scene without having
* redundant code, it should be used with caution. Plants
* that enforce fixed cycle times will not work as intended
* anymore, since pauses are executed one after another.
*
* @ingroup PLANT */
class MultiPlant : public CLS::Plant {
public:
bool get_next_plant_state(const double *current_plant_state, const double *current_action, double *next_plant_state);
bool get_measurement(const double *plant_state, double *measurement);
bool init(int &plant_state_dim, int &measurement_dim, int &action_dim, double &delta_t, const char *fname=0, const char *chapter=0);
bool check_initial_state(double *initial_plant_state);
void deinit();
void notify_episode_starts();
void notify_episode_stops();
void notify_command_string(const char* buf);
void notify_suspend_for_aux_call_cmd();
void notify_return_from_aux_call_cmd();
protected:
int _pdim, _i;
std::vector<int> _pstart, _mstart, _astart;
std::vector<Plant*> _plants;
};
#endif
| {
"content_hash": "db2858d0ec2421880362a137da47012a",
"timestamp": "",
"source": "github",
"line_count": 42,
"max_line_length": 134,
"avg_line_length": 39.5,
"alnum_prop": 0.7082579867389994,
"repo_name": "AADC-Fruit/AADC_2015_FRUIT",
"id": "96f3c3dfd307c1db50631849d15d5bb7b0f0143c",
"size": "1659",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "Freestyle/clsquare/src/plant/MultiPlant/multiplant.h",
"mode": "33261",
"license": "bsd-3-clause",
"language": [
{
"name": "Apex",
"bytes": "5619"
},
{
"name": "Batchfile",
"bytes": "4242"
},
{
"name": "C",
"bytes": "34545"
},
{
"name": "C++",
"bytes": "3324319"
},
{
"name": "CMake",
"bytes": "187891"
},
{
"name": "CSS",
"bytes": "33023"
},
{
"name": "Gnuplot",
"bytes": "423"
},
{
"name": "HTML",
"bytes": "25123155"
},
{
"name": "JavaScript",
"bytes": "520130"
},
{
"name": "Makefile",
"bytes": "207"
},
{
"name": "R",
"bytes": "553"
},
{
"name": "Shell",
"bytes": "10599"
},
{
"name": "TeX",
"bytes": "58099"
}
],
"symlink_target": ""
} |
ACCEPTED
#### According to
The Catalogue of Life, 3rd January 2011
#### Published in
Annls mycol. 2: 163 (1904)
#### Original name
Phyllachora vossiae Syd. & P. Syd., 1904
### Remarks
null | {
"content_hash": "3a4d4a712b24dc3a295c8c847bc39350",
"timestamp": "",
"source": "github",
"line_count": 13,
"max_line_length": 40,
"avg_line_length": 14.76923076923077,
"alnum_prop": 0.6875,
"repo_name": "mdoering/backbone",
"id": "fdeec1dd06dfeba97ec77a516a242e2406d23f4c",
"size": "256",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "life/Fungi/Ascomycota/Sordariomycetes/Phyllachorales/Phyllachoraceae/Phyllachora/Phyllachora vossiae/README.md",
"mode": "33188",
"license": "apache-2.0",
"language": [],
"symlink_target": ""
} |
#include <linux/module.h>
#include <linux/delay.h>
#include <linux/dmi.h>
#include <linux/input/mt.h>
#include <linux/serio.h>
#include <linux/libps2.h>
#include <linux/slab.h>
#include "psmouse.h"
#include "synaptics.h"
/*
* The x/y limits are taken from the Synaptics TouchPad interfacing Guide,
* section 2.3.2, which says that they should be valid regardless of the
* actual size of the sensor.
* Note that newer firmware allows querying device for maximum useable
* coordinates.
*/
#define XMIN 0
#define XMAX 6143
#define YMIN 0
#define YMAX 6143
#define XMIN_NOMINAL 1472
#define XMAX_NOMINAL 5472
#define YMIN_NOMINAL 1408
#define YMAX_NOMINAL 4448
/* Size in bits of absolute position values reported by the hardware */
#define ABS_POS_BITS 13
/*
* These values should represent the absolute maximum value that will
* be reported for a positive position value. Some Synaptics firmware
* uses this value to indicate a finger near the edge of the touchpad
* whose precise position cannot be determined.
*
* At least one touchpad is known to report positions in excess of this
* value which are actually negative values truncated to the 13-bit
* reporting range. These values have never been observed to be lower
* than 8184 (i.e. -8), so we treat all values greater than 8176 as
* negative and any other value as positive.
*/
#define X_MAX_POSITIVE 8176
#define Y_MAX_POSITIVE 8176
/*****************************************************************************
* Stuff we need even when we do not want native Synaptics support
****************************************************************************/
/*
* Set the synaptics touchpad mode byte by special commands
*/
static int synaptics_mode_cmd(struct psmouse *psmouse, unsigned char mode)
{
unsigned char param[1];
if (psmouse_sliced_command(psmouse, mode))
return -1;
param[0] = SYN_PS_SET_MODE2;
if (ps2_command(&psmouse->ps2dev, param, PSMOUSE_CMD_SETRATE))
return -1;
return 0;
}
int synaptics_detect(struct psmouse *psmouse, bool set_properties)
{
struct ps2dev *ps2dev = &psmouse->ps2dev;
unsigned char param[4];
param[0] = 0;
ps2_command(ps2dev, param, PSMOUSE_CMD_SETRES);
ps2_command(ps2dev, param, PSMOUSE_CMD_SETRES);
ps2_command(ps2dev, param, PSMOUSE_CMD_SETRES);
ps2_command(ps2dev, param, PSMOUSE_CMD_SETRES);
ps2_command(ps2dev, param, PSMOUSE_CMD_GETINFO);
if (param[1] != 0x47)
return -ENODEV;
if (set_properties) {
psmouse->vendor = "Synaptics";
psmouse->name = "TouchPad";
}
return 0;
}
void synaptics_reset(struct psmouse *psmouse)
{
/* reset touchpad back to relative mode, gestures enabled */
synaptics_mode_cmd(psmouse, 0);
}
#ifdef CONFIG_MOUSE_PS2_SYNAPTICS
/*****************************************************************************
* Synaptics communications functions
****************************************************************************/
/*
* Synaptics touchpads report the y coordinate from bottom to top, which is
* opposite from what userspace expects.
* This function is used to invert y before reporting.
*/
static int synaptics_invert_y(int y)
{
return YMAX_NOMINAL + YMIN_NOMINAL - y;
}
/*
* Send a command to the synpatics touchpad by special commands
*/
static int synaptics_send_cmd(struct psmouse *psmouse, unsigned char c, unsigned char *param)
{
if (psmouse_sliced_command(psmouse, c))
return -1;
if (ps2_command(&psmouse->ps2dev, param, PSMOUSE_CMD_GETINFO))
return -1;
return 0;
}
/*
* Read the model-id bytes from the touchpad
* see also SYN_MODEL_* macros
*/
static int synaptics_model_id(struct psmouse *psmouse)
{
struct synaptics_data *priv = psmouse->private;
unsigned char mi[3];
if (synaptics_send_cmd(psmouse, SYN_QUE_MODEL, mi))
return -1;
priv->model_id = (mi[0]<<16) | (mi[1]<<8) | mi[2];
return 0;
}
/*
* Read the board id from the touchpad
* The board id is encoded in the "QUERY MODES" response
*/
static int synaptics_board_id(struct psmouse *psmouse)
{
struct synaptics_data *priv = psmouse->private;
unsigned char bid[3];
if (synaptics_send_cmd(psmouse, SYN_QUE_MODES, bid))
return -1;
priv->board_id = ((bid[0] & 0xfc) << 6) | bid[1];
return 0;
}
/*
* Read the firmware id from the touchpad
*/
static int synaptics_firmware_id(struct psmouse *psmouse)
{
struct synaptics_data *priv = psmouse->private;
unsigned char fwid[3];
if (synaptics_send_cmd(psmouse, SYN_QUE_FIRMWARE_ID, fwid))
return -1;
priv->firmware_id = (fwid[0] << 16) | (fwid[1] << 8) | fwid[2];
return 0;
}
/*
* Read the capability-bits from the touchpad
* see also the SYN_CAP_* macros
*/
static int synaptics_capability(struct psmouse *psmouse)
{
struct synaptics_data *priv = psmouse->private;
unsigned char cap[3];
if (synaptics_send_cmd(psmouse, SYN_QUE_CAPABILITIES, cap))
return -1;
priv->capabilities = (cap[0] << 16) | (cap[1] << 8) | cap[2];
priv->ext_cap = priv->ext_cap_0c = 0;
/*
* Older firmwares had submodel ID fixed to 0x47
*/
if (SYN_ID_FULL(priv->identity) < 0x705 &&
SYN_CAP_SUBMODEL_ID(priv->capabilities) != 0x47) {
return -1;
}
/*
* Unless capExtended is set the rest of the flags should be ignored
*/
if (!SYN_CAP_EXTENDED(priv->capabilities))
priv->capabilities = 0;
if (SYN_EXT_CAP_REQUESTS(priv->capabilities) >= 1) {
if (synaptics_send_cmd(psmouse, SYN_QUE_EXT_CAPAB, cap)) {
psmouse_warn(psmouse,
"device claims to have extended capabilities, but I'm not able to read them.\n");
} else {
priv->ext_cap = (cap[0] << 16) | (cap[1] << 8) | cap[2];
/*
* if nExtBtn is greater than 8 it should be considered
* invalid and treated as 0
*/
if (SYN_CAP_MULTI_BUTTON_NO(priv->ext_cap) > 8)
priv->ext_cap &= 0xff0fff;
}
}
if (SYN_EXT_CAP_REQUESTS(priv->capabilities) >= 4) {
if (synaptics_send_cmd(psmouse, SYN_QUE_EXT_CAPAB_0C, cap)) {
psmouse_warn(psmouse,
"device claims to have extended capability 0x0c, but I'm not able to read it.\n");
} else {
priv->ext_cap_0c = (cap[0] << 16) | (cap[1] << 8) | cap[2];
}
}
return 0;
}
/*
* Identify Touchpad
* See also the SYN_ID_* macros
*/
static int synaptics_identify(struct psmouse *psmouse)
{
struct synaptics_data *priv = psmouse->private;
unsigned char id[3];
if (synaptics_send_cmd(psmouse, SYN_QUE_IDENTIFY, id))
return -1;
priv->identity = (id[0]<<16) | (id[1]<<8) | id[2];
if (SYN_ID_IS_SYNAPTICS(priv->identity))
return 0;
return -1;
}
/*
* Read touchpad resolution and maximum reported coordinates
* Resolution is left zero if touchpad does not support the query
*/
static const int *quirk_min_max;
static int synaptics_resolution(struct psmouse *psmouse)
{
struct synaptics_data *priv = psmouse->private;
unsigned char resp[3];
if (quirk_min_max) {
priv->x_min = quirk_min_max[0];
priv->x_max = quirk_min_max[1];
priv->y_min = quirk_min_max[2];
priv->y_max = quirk_min_max[3];
return 0;
}
if (SYN_ID_MAJOR(priv->identity) < 4)
return 0;
if (synaptics_send_cmd(psmouse, SYN_QUE_RESOLUTION, resp) == 0) {
if (resp[0] != 0 && (resp[1] & 0x80) && resp[2] != 0) {
priv->x_res = resp[0]; /* x resolution in units/mm */
priv->y_res = resp[2]; /* y resolution in units/mm */
}
}
if (SYN_EXT_CAP_REQUESTS(priv->capabilities) >= 5 &&
SYN_CAP_MAX_DIMENSIONS(priv->ext_cap_0c)) {
if (synaptics_send_cmd(psmouse, SYN_QUE_EXT_MAX_COORDS, resp)) {
psmouse_warn(psmouse,
"device claims to have max coordinates query, but I'm not able to read it.\n");
} else {
priv->x_max = (resp[0] << 5) | ((resp[1] & 0x0f) << 1);
priv->y_max = (resp[2] << 5) | ((resp[1] & 0xf0) >> 3);
}
}
if (SYN_EXT_CAP_REQUESTS(priv->capabilities) >= 7 &&
SYN_CAP_MIN_DIMENSIONS(priv->ext_cap_0c)) {
if (synaptics_send_cmd(psmouse, SYN_QUE_EXT_MIN_COORDS, resp)) {
psmouse_warn(psmouse,
"device claims to have min coordinates query, but I'm not able to read it.\n");
} else {
priv->x_min = (resp[0] << 5) | ((resp[1] & 0x0f) << 1);
priv->y_min = (resp[2] << 5) | ((resp[1] & 0xf0) >> 3);
}
}
return 0;
}
static int synaptics_query_hardware(struct psmouse *psmouse)
{
if (synaptics_identify(psmouse))
return -1;
if (synaptics_model_id(psmouse))
return -1;
if (synaptics_firmware_id(psmouse))
return -1;
if (synaptics_board_id(psmouse))
return -1;
if (synaptics_capability(psmouse))
return -1;
if (synaptics_resolution(psmouse))
return -1;
return 0;
}
static int synaptics_set_advanced_gesture_mode(struct psmouse *psmouse)
{
static unsigned char param = 0xc8;
struct synaptics_data *priv = psmouse->private;
if (!(SYN_CAP_ADV_GESTURE(priv->ext_cap_0c) ||
SYN_CAP_IMAGE_SENSOR(priv->ext_cap_0c)))
return 0;
if (psmouse_sliced_command(psmouse, SYN_QUE_MODEL))
return -1;
if (ps2_command(&psmouse->ps2dev, ¶m, PSMOUSE_CMD_SETRATE))
return -1;
/* Advanced gesture mode also sends multi finger data */
priv->capabilities |= BIT(1);
return 0;
}
static int synaptics_set_mode(struct psmouse *psmouse)
{
struct synaptics_data *priv = psmouse->private;
priv->mode = 0;
if (priv->absolute_mode)
priv->mode |= SYN_BIT_ABSOLUTE_MODE;
if (priv->disable_gesture)
priv->mode |= SYN_BIT_DISABLE_GESTURE;
if (psmouse->rate >= 80)
priv->mode |= SYN_BIT_HIGH_RATE;
if (SYN_CAP_EXTENDED(priv->capabilities))
priv->mode |= SYN_BIT_W_MODE;
if (synaptics_mode_cmd(psmouse, priv->mode))
return -1;
if (priv->absolute_mode &&
synaptics_set_advanced_gesture_mode(psmouse)) {
psmouse_err(psmouse, "Advanced gesture mode init failed.\n");
return -1;
}
return 0;
}
static void synaptics_set_rate(struct psmouse *psmouse, unsigned int rate)
{
struct synaptics_data *priv = psmouse->private;
if (rate >= 80) {
priv->mode |= SYN_BIT_HIGH_RATE;
psmouse->rate = 80;
} else {
priv->mode &= ~SYN_BIT_HIGH_RATE;
psmouse->rate = 40;
}
synaptics_mode_cmd(psmouse, priv->mode);
}
/*****************************************************************************
* Synaptics pass-through PS/2 port support
****************************************************************************/
static int synaptics_pt_write(struct serio *serio, unsigned char c)
{
struct psmouse *parent = serio_get_drvdata(serio->parent);
char rate_param = SYN_PS_CLIENT_CMD; /* indicates that we want pass-through port */
if (psmouse_sliced_command(parent, c))
return -1;
if (ps2_command(&parent->ps2dev, &rate_param, PSMOUSE_CMD_SETRATE))
return -1;
return 0;
}
static int synaptics_pt_start(struct serio *serio)
{
struct psmouse *parent = serio_get_drvdata(serio->parent);
struct synaptics_data *priv = parent->private;
serio_pause_rx(parent->ps2dev.serio);
priv->pt_port = serio;
serio_continue_rx(parent->ps2dev.serio);
return 0;
}
static void synaptics_pt_stop(struct serio *serio)
{
struct psmouse *parent = serio_get_drvdata(serio->parent);
struct synaptics_data *priv = parent->private;
serio_pause_rx(parent->ps2dev.serio);
priv->pt_port = NULL;
serio_continue_rx(parent->ps2dev.serio);
}
static int synaptics_is_pt_packet(unsigned char *buf)
{
return (buf[0] & 0xFC) == 0x84 && (buf[3] & 0xCC) == 0xC4;
}
static void synaptics_pass_pt_packet(struct serio *ptport, unsigned char *packet)
{
struct psmouse *child = serio_get_drvdata(ptport);
if (child && child->state == PSMOUSE_ACTIVATED) {
serio_interrupt(ptport, packet[1], 0);
serio_interrupt(ptport, packet[4], 0);
serio_interrupt(ptport, packet[5], 0);
if (child->pktsize == 4)
serio_interrupt(ptport, packet[2], 0);
} else
serio_interrupt(ptport, packet[1], 0);
}
static void synaptics_pt_activate(struct psmouse *psmouse)
{
struct synaptics_data *priv = psmouse->private;
struct psmouse *child = serio_get_drvdata(priv->pt_port);
/* adjust the touchpad to child's choice of protocol */
if (child) {
if (child->pktsize == 4)
priv->mode |= SYN_BIT_FOUR_BYTE_CLIENT;
else
priv->mode &= ~SYN_BIT_FOUR_BYTE_CLIENT;
if (synaptics_mode_cmd(psmouse, priv->mode))
psmouse_warn(psmouse,
"failed to switch guest protocol\n");
}
}
static void synaptics_pt_create(struct psmouse *psmouse)
{
struct serio *serio;
serio = kzalloc(sizeof(struct serio), GFP_KERNEL);
if (!serio) {
psmouse_err(psmouse,
"not enough memory for pass-through port\n");
return;
}
serio->id.type = SERIO_PS_PSTHRU;
strlcpy(serio->name, "Synaptics pass-through", sizeof(serio->name));
strlcpy(serio->phys, "synaptics-pt/serio0", sizeof(serio->name));
serio->write = synaptics_pt_write;
serio->start = synaptics_pt_start;
serio->stop = synaptics_pt_stop;
serio->parent = psmouse->ps2dev.serio;
psmouse->pt_activate = synaptics_pt_activate;
psmouse_info(psmouse, "serio: %s port at %s\n",
serio->name, psmouse->phys);
serio_register_port(serio);
}
/*****************************************************************************
* Functions to interpret the absolute mode packets
****************************************************************************/
static void synaptics_mt_state_set(struct synaptics_mt_state *state, int count,
int sgm, int agm)
{
state->count = count;
state->sgm = sgm;
state->agm = agm;
}
static void synaptics_parse_agm(const unsigned char buf[],
struct synaptics_data *priv,
struct synaptics_hw_state *hw)
{
struct synaptics_hw_state *agm = &priv->agm;
int agm_packet_type;
agm_packet_type = (buf[5] & 0x30) >> 4;
switch (agm_packet_type) {
case 1:
/* Gesture packet: (x, y, z) half resolution */
agm->w = hw->w;
agm->x = (((buf[4] & 0x0f) << 8) | buf[1]) << 1;
agm->y = (((buf[4] & 0xf0) << 4) | buf[2]) << 1;
agm->z = ((buf[3] & 0x30) | (buf[5] & 0x0f)) << 1;
break;
case 2:
/* AGM-CONTACT packet: (count, sgm, agm) */
synaptics_mt_state_set(&agm->mt_state, buf[1], buf[2], buf[4]);
break;
default:
break;
}
/* Record that at least one AGM has been received since last SGM */
priv->agm_pending = true;
}
static int synaptics_parse_hw_state(const unsigned char buf[],
struct synaptics_data *priv,
struct synaptics_hw_state *hw)
{
memset(hw, 0, sizeof(struct synaptics_hw_state));
if (SYN_MODEL_NEWABS(priv->model_id)) {
hw->w = (((buf[0] & 0x30) >> 2) |
((buf[0] & 0x04) >> 1) |
((buf[3] & 0x04) >> 2));
hw->left = (buf[0] & 0x01) ? 1 : 0;
hw->right = (buf[0] & 0x02) ? 1 : 0;
if (SYN_CAP_CLICKPAD(priv->ext_cap_0c)) {
/*
* Clickpad's button is transmitted as middle button,
* however, since it is primary button, we will report
* it as BTN_LEFT.
*/
hw->left = ((buf[0] ^ buf[3]) & 0x01) ? 1 : 0;
} else if (SYN_CAP_MIDDLE_BUTTON(priv->capabilities)) {
hw->middle = ((buf[0] ^ buf[3]) & 0x01) ? 1 : 0;
if (hw->w == 2)
hw->scroll = (signed char)(buf[1]);
}
if (SYN_CAP_FOUR_BUTTON(priv->capabilities)) {
hw->up = ((buf[0] ^ buf[3]) & 0x01) ? 1 : 0;
hw->down = ((buf[0] ^ buf[3]) & 0x02) ? 1 : 0;
}
if ((SYN_CAP_ADV_GESTURE(priv->ext_cap_0c) ||
SYN_CAP_IMAGE_SENSOR(priv->ext_cap_0c)) &&
hw->w == 2) {
synaptics_parse_agm(buf, priv, hw);
return 1;
}
hw->x = (((buf[3] & 0x10) << 8) |
((buf[1] & 0x0f) << 8) |
buf[4]);
hw->y = (((buf[3] & 0x20) << 7) |
((buf[1] & 0xf0) << 4) |
buf[5]);
hw->z = buf[2];
if (SYN_CAP_MULTI_BUTTON_NO(priv->ext_cap) &&
((buf[0] ^ buf[3]) & 0x02)) {
switch (SYN_CAP_MULTI_BUTTON_NO(priv->ext_cap) & ~0x01) {
default:
/*
* if nExtBtn is greater than 8 it should be
* considered invalid and treated as 0
*/
break;
case 8:
hw->ext_buttons |= ((buf[5] & 0x08)) ? 0x80 : 0;
hw->ext_buttons |= ((buf[4] & 0x08)) ? 0x40 : 0;
case 6:
hw->ext_buttons |= ((buf[5] & 0x04)) ? 0x20 : 0;
hw->ext_buttons |= ((buf[4] & 0x04)) ? 0x10 : 0;
case 4:
hw->ext_buttons |= ((buf[5] & 0x02)) ? 0x08 : 0;
hw->ext_buttons |= ((buf[4] & 0x02)) ? 0x04 : 0;
case 2:
hw->ext_buttons |= ((buf[5] & 0x01)) ? 0x02 : 0;
hw->ext_buttons |= ((buf[4] & 0x01)) ? 0x01 : 0;
}
}
} else {
hw->x = (((buf[1] & 0x1f) << 8) | buf[2]);
hw->y = (((buf[4] & 0x1f) << 8) | buf[5]);
hw->z = (((buf[0] & 0x30) << 2) | (buf[3] & 0x3F));
hw->w = (((buf[1] & 0x80) >> 4) | ((buf[0] & 0x04) >> 1));
hw->left = (buf[0] & 0x01) ? 1 : 0;
hw->right = (buf[0] & 0x02) ? 1 : 0;
}
/*
* Convert wrap-around values to negative. (X|Y)_MAX_POSITIVE
* is used by some firmware to indicate a finger at the edge of
* the touchpad whose precise position cannot be determined, so
* convert these values to the maximum axis value.
*/
if (hw->x > X_MAX_POSITIVE)
hw->x -= 1 << ABS_POS_BITS;
else if (hw->x == X_MAX_POSITIVE)
hw->x = XMAX;
if (hw->y > Y_MAX_POSITIVE)
hw->y -= 1 << ABS_POS_BITS;
else if (hw->y == Y_MAX_POSITIVE)
hw->y = YMAX;
return 0;
}
static void synaptics_report_semi_mt_slot(struct input_dev *dev, int slot,
bool active, int x, int y)
{
input_mt_slot(dev, slot);
input_mt_report_slot_state(dev, MT_TOOL_FINGER, active);
if (active) {
input_report_abs(dev, ABS_MT_POSITION_X, x);
input_report_abs(dev, ABS_MT_POSITION_Y, synaptics_invert_y(y));
}
}
static void synaptics_report_semi_mt_data(struct input_dev *dev,
const struct synaptics_hw_state *a,
const struct synaptics_hw_state *b,
int num_fingers)
{
if (num_fingers >= 2) {
synaptics_report_semi_mt_slot(dev, 0, true, min(a->x, b->x),
min(a->y, b->y));
synaptics_report_semi_mt_slot(dev, 1, true, max(a->x, b->x),
max(a->y, b->y));
} else if (num_fingers == 1) {
synaptics_report_semi_mt_slot(dev, 0, true, a->x, a->y);
synaptics_report_semi_mt_slot(dev, 1, false, 0, 0);
} else {
synaptics_report_semi_mt_slot(dev, 0, false, 0, 0);
synaptics_report_semi_mt_slot(dev, 1, false, 0, 0);
}
}
static void synaptics_report_buttons(struct psmouse *psmouse,
const struct synaptics_hw_state *hw)
{
struct input_dev *dev = psmouse->dev;
struct synaptics_data *priv = psmouse->private;
int i;
input_report_key(dev, BTN_LEFT, hw->left);
input_report_key(dev, BTN_RIGHT, hw->right);
if (SYN_CAP_MIDDLE_BUTTON(priv->capabilities))
input_report_key(dev, BTN_MIDDLE, hw->middle);
if (SYN_CAP_FOUR_BUTTON(priv->capabilities)) {
input_report_key(dev, BTN_FORWARD, hw->up);
input_report_key(dev, BTN_BACK, hw->down);
}
for (i = 0; i < SYN_CAP_MULTI_BUTTON_NO(priv->ext_cap); i++)
input_report_key(dev, BTN_0 + i, hw->ext_buttons & (1 << i));
}
static void synaptics_report_slot(struct input_dev *dev, int slot,
const struct synaptics_hw_state *hw)
{
input_mt_slot(dev, slot);
input_mt_report_slot_state(dev, MT_TOOL_FINGER, (hw != NULL));
if (!hw)
return;
input_report_abs(dev, ABS_MT_POSITION_X, hw->x);
input_report_abs(dev, ABS_MT_POSITION_Y, synaptics_invert_y(hw->y));
input_report_abs(dev, ABS_MT_PRESSURE, hw->z);
}
static void synaptics_report_mt_data(struct psmouse *psmouse,
struct synaptics_mt_state *mt_state,
const struct synaptics_hw_state *sgm)
{
struct input_dev *dev = psmouse->dev;
struct synaptics_data *priv = psmouse->private;
struct synaptics_hw_state *agm = &priv->agm;
struct synaptics_mt_state *old = &priv->mt_state;
switch (mt_state->count) {
case 0:
synaptics_report_slot(dev, 0, NULL);
synaptics_report_slot(dev, 1, NULL);
break;
case 1:
if (mt_state->sgm == -1) {
synaptics_report_slot(dev, 0, NULL);
synaptics_report_slot(dev, 1, NULL);
} else if (mt_state->sgm == 0) {
synaptics_report_slot(dev, 0, sgm);
synaptics_report_slot(dev, 1, NULL);
} else {
synaptics_report_slot(dev, 0, NULL);
synaptics_report_slot(dev, 1, sgm);
}
break;
default:
/*
* If the finger slot contained in SGM is valid, and either
* hasn't changed, or is new, or the old SGM has now moved to
* AGM, then report SGM in MTB slot 0.
* Otherwise, empty MTB slot 0.
*/
if (mt_state->sgm != -1 &&
(mt_state->sgm == old->sgm ||
old->sgm == -1 || mt_state->agm == old->sgm))
synaptics_report_slot(dev, 0, sgm);
else
synaptics_report_slot(dev, 0, NULL);
/*
* If the finger slot contained in AGM is valid, and either
* hasn't changed, or is new, then report AGM in MTB slot 1.
* Otherwise, empty MTB slot 1.
*
* However, in the case where the AGM is new, make sure that
* that it is either the same as the old SGM, or there was no
* SGM.
*
* Otherwise, if the SGM was just 1, and the new AGM is 2, then
* the new AGM will keep the old SGM's tracking ID, which can
* cause apparent drumroll. This happens if in the following
* valid finger sequence:
*
* Action SGM AGM (MTB slot:Contact)
* 1. Touch contact 0 (0:0)
* 2. Touch contact 1 (0:0, 1:1)
* 3. Lift contact 0 (1:1)
* 4. Touch contacts 2,3 (0:2, 1:3)
*
* In step 4, contact 3, in AGM must not be given the same
* tracking ID as contact 1 had in step 3. To avoid this,
* the first agm with contact 3 is dropped and slot 1 is
* invalidated (tracking ID = -1).
*/
if (mt_state->agm != -1 &&
(mt_state->agm == old->agm ||
(old->agm == -1 &&
(old->sgm == -1 || mt_state->agm == old->sgm))))
synaptics_report_slot(dev, 1, agm);
else
synaptics_report_slot(dev, 1, NULL);
break;
}
/* Don't use active slot count to generate BTN_TOOL events. */
input_mt_report_pointer_emulation(dev, false);
/* Send the number of fingers reported by touchpad itself. */
input_mt_report_finger_count(dev, mt_state->count);
synaptics_report_buttons(psmouse, sgm);
input_sync(dev);
}
/* Handle case where mt_state->count = 0 */
static void synaptics_image_sensor_0f(struct synaptics_data *priv,
struct synaptics_mt_state *mt_state)
{
synaptics_mt_state_set(mt_state, 0, -1, -1);
priv->mt_state_lost = false;
}
/* Handle case where mt_state->count = 1 */
static void synaptics_image_sensor_1f(struct synaptics_data *priv,
struct synaptics_mt_state *mt_state)
{
struct synaptics_hw_state *agm = &priv->agm;
struct synaptics_mt_state *old = &priv->mt_state;
/*
* If the last AGM was (0,0,0), and there is only one finger left,
* then we absolutely know that SGM contains slot 0, and all other
* fingers have been removed.
*/
if (priv->agm_pending && agm->z == 0) {
synaptics_mt_state_set(mt_state, 1, 0, -1);
priv->mt_state_lost = false;
return;
}
switch (old->count) {
case 0:
synaptics_mt_state_set(mt_state, 1, 0, -1);
break;
case 1:
/*
* If mt_state_lost, then the previous transition was 3->1,
* and SGM now contains either slot 0 or 1, but we don't know
* which. So, we just assume that the SGM now contains slot 1.
*
* If pending AGM and either:
* (a) the previous SGM slot contains slot 0, or
* (b) there was no SGM slot
* then, the SGM now contains slot 1
*
* Case (a) happens with very rapid "drum roll" gestures, where
* slot 0 finger is lifted and a new slot 1 finger touches
* within one reporting interval.
*
* Case (b) happens if initially two or more fingers tap
* briefly, and all but one lift before the end of the first
* reporting interval.
*
* (In both these cases, slot 0 will becomes empty, so SGM
* contains slot 1 with the new finger)
*
* Else, if there was no previous SGM, it now contains slot 0.
*
* Otherwise, SGM still contains the same slot.
*/
if (priv->mt_state_lost ||
(priv->agm_pending && old->sgm <= 0))
synaptics_mt_state_set(mt_state, 1, 1, -1);
else if (old->sgm == -1)
synaptics_mt_state_set(mt_state, 1, 0, -1);
break;
case 2:
/*
* If mt_state_lost, we don't know which finger SGM contains.
*
* So, report 1 finger, but with both slots empty.
* We will use slot 1 on subsequent 1->1
*/
if (priv->mt_state_lost) {
synaptics_mt_state_set(mt_state, 1, -1, -1);
break;
}
/*
* Since the last AGM was NOT (0,0,0), it was the finger in
* slot 0 that has been removed.
* So, SGM now contains previous AGM's slot, and AGM is now
* empty.
*/
synaptics_mt_state_set(mt_state, 1, old->agm, -1);
break;
case 3:
/*
* Since last AGM was not (0,0,0), we don't know which finger
* is left.
*
* So, report 1 finger, but with both slots empty.
* We will use slot 1 on subsequent 1->1
*/
synaptics_mt_state_set(mt_state, 1, -1, -1);
priv->mt_state_lost = true;
break;
case 4:
case 5:
/* mt_state was updated by AGM-CONTACT packet */
break;
}
}
/* Handle case where mt_state->count = 2 */
static void synaptics_image_sensor_2f(struct synaptics_data *priv,
struct synaptics_mt_state *mt_state)
{
struct synaptics_mt_state *old = &priv->mt_state;
switch (old->count) {
case 0:
synaptics_mt_state_set(mt_state, 2, 0, 1);
break;
case 1:
/*
* If previous SGM contained slot 1 or higher, SGM now contains
* slot 0 (the newly touching finger) and AGM contains SGM's
* previous slot.
*
* Otherwise, SGM still contains slot 0 and AGM now contains
* slot 1.
*/
if (old->sgm >= 1)
synaptics_mt_state_set(mt_state, 2, 0, old->sgm);
else
synaptics_mt_state_set(mt_state, 2, 0, 1);
break;
case 2:
/*
* If mt_state_lost, SGM now contains either finger 1 or 2, but
* we don't know which.
* So, we just assume that the SGM contains slot 0 and AGM 1.
*/
if (priv->mt_state_lost)
synaptics_mt_state_set(mt_state, 2, 0, 1);
/*
* Otherwise, use the same mt_state, since it either hasn't
* changed, or was updated by a recently received AGM-CONTACT
* packet.
*/
break;
case 3:
/*
* 3->2 transitions have two unsolvable problems:
* 1) no indication is given which finger was removed
* 2) no way to tell if agm packet was for finger 3
* before 3->2, or finger 2 after 3->2.
*
* So, report 2 fingers, but empty all slots.
* We will guess slots [0,1] on subsequent 2->2.
*/
synaptics_mt_state_set(mt_state, 2, -1, -1);
priv->mt_state_lost = true;
break;
case 4:
case 5:
/* mt_state was updated by AGM-CONTACT packet */
break;
}
}
/* Handle case where mt_state->count = 3 */
static void synaptics_image_sensor_3f(struct synaptics_data *priv,
struct synaptics_mt_state *mt_state)
{
struct synaptics_mt_state *old = &priv->mt_state;
switch (old->count) {
case 0:
synaptics_mt_state_set(mt_state, 3, 0, 2);
break;
case 1:
/*
* If previous SGM contained slot 2 or higher, SGM now contains
* slot 0 (one of the newly touching fingers) and AGM contains
* SGM's previous slot.
*
* Otherwise, SGM now contains slot 0 and AGM contains slot 2.
*/
if (old->sgm >= 2)
synaptics_mt_state_set(mt_state, 3, 0, old->sgm);
else
synaptics_mt_state_set(mt_state, 3, 0, 2);
break;
case 2:
/*
* If the AGM previously contained slot 3 or higher, then the
* newly touching finger is in the lowest available slot.
*
* If SGM was previously 1 or higher, then the new SGM is
* now slot 0 (with a new finger), otherwise, the new finger
* is now in a hidden slot between 0 and AGM's slot.
*
* In all such cases, the SGM now contains slot 0, and the AGM
* continues to contain the same slot as before.
*/
if (old->agm >= 3) {
synaptics_mt_state_set(mt_state, 3, 0, old->agm);
break;
}
/*
* After some 3->1 and all 3->2 transitions, we lose track
* of which slot is reported by SGM and AGM.
*
* For 2->3 in this state, report 3 fingers, but empty all
* slots, and we will guess (0,2) on a subsequent 0->3.
*
* To userspace, the resulting transition will look like:
* 2:[0,1] -> 3:[-1,-1] -> 3:[0,2]
*/
if (priv->mt_state_lost) {
synaptics_mt_state_set(mt_state, 3, -1, -1);
break;
}
/*
* If the (SGM,AGM) really previously contained slots (0, 1),
* then we cannot know what slot was just reported by the AGM,
* because the 2->3 transition can occur either before or after
* the AGM packet. Thus, this most recent AGM could contain
* either the same old slot 1 or the new slot 2.
* Subsequent AGMs will be reporting slot 2.
*
* To userspace, the resulting transition will look like:
* 2:[0,1] -> 3:[0,-1] -> 3:[0,2]
*/
synaptics_mt_state_set(mt_state, 3, 0, -1);
break;
case 3:
/*
* If, for whatever reason, the previous agm was invalid,
* Assume SGM now contains slot 0, AGM now contains slot 2.
*/
if (old->agm <= 2)
synaptics_mt_state_set(mt_state, 3, 0, 2);
/*
* mt_state either hasn't changed, or was updated by a recently
* received AGM-CONTACT packet.
*/
break;
case 4:
case 5:
/* mt_state was updated by AGM-CONTACT packet */
break;
}
}
/* Handle case where mt_state->count = 4, or = 5 */
static void synaptics_image_sensor_45f(struct synaptics_data *priv,
struct synaptics_mt_state *mt_state)
{
/* mt_state was updated correctly by AGM-CONTACT packet */
priv->mt_state_lost = false;
}
static void synaptics_image_sensor_process(struct psmouse *psmouse,
struct synaptics_hw_state *sgm)
{
struct synaptics_data *priv = psmouse->private;
struct synaptics_hw_state *agm = &priv->agm;
struct synaptics_mt_state mt_state;
/* Initialize using current mt_state (as updated by last agm) */
mt_state = agm->mt_state;
/*
* Update mt_state using the new finger count and current mt_state.
*/
if (sgm->z == 0)
synaptics_image_sensor_0f(priv, &mt_state);
else if (sgm->w >= 4)
synaptics_image_sensor_1f(priv, &mt_state);
else if (sgm->w == 0)
synaptics_image_sensor_2f(priv, &mt_state);
else if (sgm->w == 1 && mt_state.count <= 3)
synaptics_image_sensor_3f(priv, &mt_state);
else
synaptics_image_sensor_45f(priv, &mt_state);
/* Send resulting input events to user space */
synaptics_report_mt_data(psmouse, &mt_state, sgm);
/* Store updated mt_state */
priv->mt_state = agm->mt_state = mt_state;
priv->agm_pending = false;
}
/*
* called for each full received packet from the touchpad
*/
static void synaptics_process_packet(struct psmouse *psmouse)
{
struct input_dev *dev = psmouse->dev;
struct synaptics_data *priv = psmouse->private;
struct synaptics_hw_state hw;
int num_fingers;
int finger_width;
if (synaptics_parse_hw_state(psmouse->packet, priv, &hw))
return;
if (SYN_CAP_IMAGE_SENSOR(priv->ext_cap_0c)) {
synaptics_image_sensor_process(psmouse, &hw);
return;
}
if (hw.scroll) {
priv->scroll += hw.scroll;
while (priv->scroll >= 4) {
input_report_key(dev, BTN_BACK, !hw.down);
input_sync(dev);
input_report_key(dev, BTN_BACK, hw.down);
input_sync(dev);
priv->scroll -= 4;
}
while (priv->scroll <= -4) {
input_report_key(dev, BTN_FORWARD, !hw.up);
input_sync(dev);
input_report_key(dev, BTN_FORWARD, hw.up);
input_sync(dev);
priv->scroll += 4;
}
return;
}
if (hw.z > 0 && hw.x > 1) {
num_fingers = 1;
finger_width = 5;
if (SYN_CAP_EXTENDED(priv->capabilities)) {
switch (hw.w) {
case 0 ... 1:
if (SYN_CAP_MULTIFINGER(priv->capabilities))
num_fingers = hw.w + 2;
break;
case 2:
if (SYN_MODEL_PEN(priv->model_id))
; /* Nothing, treat a pen as a single finger */
break;
case 4 ... 15:
if (SYN_CAP_PALMDETECT(priv->capabilities))
finger_width = hw.w;
break;
}
}
} else {
num_fingers = 0;
finger_width = 0;
}
if (SYN_CAP_ADV_GESTURE(priv->ext_cap_0c))
synaptics_report_semi_mt_data(dev, &hw, &priv->agm,
num_fingers);
/* Post events
* BTN_TOUCH has to be first as mousedev relies on it when doing
* absolute -> relative conversion
*/
if (hw.z > 30) input_report_key(dev, BTN_TOUCH, 1);
if (hw.z < 25) input_report_key(dev, BTN_TOUCH, 0);
if (num_fingers > 0) {
input_report_abs(dev, ABS_X, hw.x);
input_report_abs(dev, ABS_Y, synaptics_invert_y(hw.y));
}
input_report_abs(dev, ABS_PRESSURE, hw.z);
if (SYN_CAP_PALMDETECT(priv->capabilities))
input_report_abs(dev, ABS_TOOL_WIDTH, finger_width);
input_report_key(dev, BTN_TOOL_FINGER, num_fingers == 1);
if (SYN_CAP_MULTIFINGER(priv->capabilities)) {
input_report_key(dev, BTN_TOOL_DOUBLETAP, num_fingers == 2);
input_report_key(dev, BTN_TOOL_TRIPLETAP, num_fingers == 3);
}
synaptics_report_buttons(psmouse, &hw);
input_sync(dev);
}
static int synaptics_validate_byte(struct psmouse *psmouse,
int idx, unsigned char pkt_type)
{
static const unsigned char newabs_mask[] = { 0xC8, 0x00, 0x00, 0xC8, 0x00 };
static const unsigned char newabs_rel_mask[] = { 0xC0, 0x00, 0x00, 0xC0, 0x00 };
static const unsigned char newabs_rslt[] = { 0x80, 0x00, 0x00, 0xC0, 0x00 };
static const unsigned char oldabs_mask[] = { 0xC0, 0x60, 0x00, 0xC0, 0x60 };
static const unsigned char oldabs_rslt[] = { 0xC0, 0x00, 0x00, 0x80, 0x00 };
const char *packet = psmouse->packet;
if (idx < 0 || idx > 4)
return 0;
switch (pkt_type) {
case SYN_NEWABS:
case SYN_NEWABS_RELAXED:
return (packet[idx] & newabs_rel_mask[idx]) == newabs_rslt[idx];
case SYN_NEWABS_STRICT:
return (packet[idx] & newabs_mask[idx]) == newabs_rslt[idx];
case SYN_OLDABS:
return (packet[idx] & oldabs_mask[idx]) == oldabs_rslt[idx];
default:
psmouse_err(psmouse, "unknown packet type %d\n", pkt_type);
return 0;
}
}
static unsigned char synaptics_detect_pkt_type(struct psmouse *psmouse)
{
int i;
for (i = 0; i < 5; i++)
if (!synaptics_validate_byte(psmouse, i, SYN_NEWABS_STRICT)) {
psmouse_info(psmouse, "using relaxed packet validation\n");
return SYN_NEWABS_RELAXED;
}
return SYN_NEWABS_STRICT;
}
static psmouse_ret_t synaptics_process_byte(struct psmouse *psmouse)
{
struct synaptics_data *priv = psmouse->private;
if (psmouse->pktcnt >= 6) { /* Full packet received */
if (unlikely(priv->pkt_type == SYN_NEWABS))
priv->pkt_type = synaptics_detect_pkt_type(psmouse);
if (SYN_CAP_PASS_THROUGH(priv->capabilities) &&
synaptics_is_pt_packet(psmouse->packet)) {
if (priv->pt_port)
synaptics_pass_pt_packet(priv->pt_port, psmouse->packet);
} else
synaptics_process_packet(psmouse);
return PSMOUSE_FULL_PACKET;
}
return synaptics_validate_byte(psmouse, psmouse->pktcnt - 1, priv->pkt_type) ?
PSMOUSE_GOOD_DATA : PSMOUSE_BAD_DATA;
}
/*****************************************************************************
* Driver initialization/cleanup functions
****************************************************************************/
static void set_abs_position_params(struct input_dev *dev,
struct synaptics_data *priv, int x_code,
int y_code)
{
int x_min = priv->x_min ?: XMIN_NOMINAL;
int x_max = priv->x_max ?: XMAX_NOMINAL;
int y_min = priv->y_min ?: YMIN_NOMINAL;
int y_max = priv->y_max ?: YMAX_NOMINAL;
int fuzz = SYN_CAP_REDUCED_FILTERING(priv->ext_cap_0c) ?
SYN_REDUCED_FILTER_FUZZ : 0;
input_set_abs_params(dev, x_code, x_min, x_max, fuzz, 0);
input_set_abs_params(dev, y_code, y_min, y_max, fuzz, 0);
input_abs_set_res(dev, x_code, priv->x_res);
input_abs_set_res(dev, y_code, priv->y_res);
}
static void set_input_params(struct input_dev *dev, struct synaptics_data *priv)
{
int i;
/* Things that apply to both modes */
__set_bit(INPUT_PROP_POINTER, dev->propbit);
__set_bit(EV_KEY, dev->evbit);
__set_bit(BTN_LEFT, dev->keybit);
__set_bit(BTN_RIGHT, dev->keybit);
if (SYN_CAP_MIDDLE_BUTTON(priv->capabilities))
__set_bit(BTN_MIDDLE, dev->keybit);
if (!priv->absolute_mode) {
/* Relative mode */
__set_bit(EV_REL, dev->evbit);
__set_bit(REL_X, dev->relbit);
__set_bit(REL_Y, dev->relbit);
return;
}
/* Absolute mode */
__set_bit(EV_ABS, dev->evbit);
set_abs_position_params(dev, priv, ABS_X, ABS_Y);
input_set_abs_params(dev, ABS_PRESSURE, 0, 255, 0, 0);
if (SYN_CAP_IMAGE_SENSOR(priv->ext_cap_0c)) {
set_abs_position_params(dev, priv, ABS_MT_POSITION_X,
ABS_MT_POSITION_Y);
/* Image sensors can report per-contact pressure */
input_set_abs_params(dev, ABS_MT_PRESSURE, 0, 255, 0, 0);
input_mt_init_slots(dev, 2, INPUT_MT_POINTER);
/* Image sensors can signal 4 and 5 finger clicks */
__set_bit(BTN_TOOL_QUADTAP, dev->keybit);
__set_bit(BTN_TOOL_QUINTTAP, dev->keybit);
} else if (SYN_CAP_ADV_GESTURE(priv->ext_cap_0c)) {
/* Non-image sensors with AGM use semi-mt */
__set_bit(INPUT_PROP_SEMI_MT, dev->propbit);
input_mt_init_slots(dev, 2, 0);
set_abs_position_params(dev, priv, ABS_MT_POSITION_X,
ABS_MT_POSITION_Y);
}
if (SYN_CAP_PALMDETECT(priv->capabilities))
input_set_abs_params(dev, ABS_TOOL_WIDTH, 0, 15, 0, 0);
__set_bit(BTN_TOUCH, dev->keybit);
__set_bit(BTN_TOOL_FINGER, dev->keybit);
if (SYN_CAP_MULTIFINGER(priv->capabilities)) {
__set_bit(BTN_TOOL_DOUBLETAP, dev->keybit);
__set_bit(BTN_TOOL_TRIPLETAP, dev->keybit);
}
if (SYN_CAP_FOUR_BUTTON(priv->capabilities) ||
SYN_CAP_MIDDLE_BUTTON(priv->capabilities)) {
__set_bit(BTN_FORWARD, dev->keybit);
__set_bit(BTN_BACK, dev->keybit);
}
for (i = 0; i < SYN_CAP_MULTI_BUTTON_NO(priv->ext_cap); i++)
__set_bit(BTN_0 + i, dev->keybit);
__clear_bit(EV_REL, dev->evbit);
__clear_bit(REL_X, dev->relbit);
__clear_bit(REL_Y, dev->relbit);
if (SYN_CAP_CLICKPAD(priv->ext_cap_0c)) {
__set_bit(INPUT_PROP_BUTTONPAD, dev->propbit);
/* Clickpads report only left button */
__clear_bit(BTN_RIGHT, dev->keybit);
__clear_bit(BTN_MIDDLE, dev->keybit);
}
}
static ssize_t synaptics_show_disable_gesture(struct psmouse *psmouse,
void *data, char *buf)
{
struct synaptics_data *priv = psmouse->private;
return sprintf(buf, "%c\n", priv->disable_gesture ? '1' : '0');
}
static ssize_t synaptics_set_disable_gesture(struct psmouse *psmouse,
void *data, const char *buf,
size_t len)
{
struct synaptics_data *priv = psmouse->private;
unsigned int value;
int err;
err = kstrtouint(buf, 10, &value);
if (err)
return err;
if (value > 1)
return -EINVAL;
if (value == priv->disable_gesture)
return len;
priv->disable_gesture = value;
if (value)
priv->mode |= SYN_BIT_DISABLE_GESTURE;
else
priv->mode &= ~SYN_BIT_DISABLE_GESTURE;
if (synaptics_mode_cmd(psmouse, priv->mode))
return -EIO;
return len;
}
PSMOUSE_DEFINE_ATTR(disable_gesture, S_IWUSR | S_IRUGO, NULL,
synaptics_show_disable_gesture,
synaptics_set_disable_gesture);
static void synaptics_disconnect(struct psmouse *psmouse)
{
struct synaptics_data *priv = psmouse->private;
if (!priv->absolute_mode && SYN_ID_DISGEST_SUPPORTED(priv->identity))
device_remove_file(&psmouse->ps2dev.serio->dev,
&psmouse_attr_disable_gesture.dattr);
synaptics_reset(psmouse);
kfree(priv);
psmouse->private = NULL;
}
static int synaptics_reconnect(struct psmouse *psmouse)
{
struct synaptics_data *priv = psmouse->private;
struct synaptics_data old_priv = *priv;
unsigned char param[2];
int retry = 0;
int error;
do {
psmouse_reset(psmouse);
if (retry) {
/*
* On some boxes, right after resuming, the touchpad
* needs some time to finish initializing (I assume
* it needs time to calibrate) and start responding
* to Synaptics-specific queries, so let's wait a
* bit.
*/
ssleep(1);
}
ps2_command(&psmouse->ps2dev, param, PSMOUSE_CMD_GETID);
error = synaptics_detect(psmouse, 0);
} while (error && ++retry < 3);
if (error)
return -1;
if (retry > 1)
psmouse_dbg(psmouse, "reconnected after %d tries\n", retry);
if (synaptics_query_hardware(psmouse)) {
psmouse_err(psmouse, "Unable to query device.\n");
return -1;
}
if (synaptics_set_mode(psmouse)) {
psmouse_err(psmouse, "Unable to initialize device.\n");
return -1;
}
if (old_priv.identity != priv->identity ||
old_priv.model_id != priv->model_id ||
old_priv.capabilities != priv->capabilities ||
old_priv.ext_cap != priv->ext_cap) {
psmouse_err(psmouse,
"hardware appears to be different: id(%ld-%ld), model(%ld-%ld), caps(%lx-%lx), ext(%lx-%lx).\n",
old_priv.identity, priv->identity,
old_priv.model_id, priv->model_id,
old_priv.capabilities, priv->capabilities,
old_priv.ext_cap, priv->ext_cap);
return -1;
}
return 0;
}
static bool impaired_toshiba_kbc;
static const struct dmi_system_id __initconst toshiba_dmi_table[] = {
#if defined(CONFIG_DMI) && defined(CONFIG_X86)
{
/* Toshiba Satellite */
.matches = {
DMI_MATCH(DMI_SYS_VENDOR, "TOSHIBA"),
DMI_MATCH(DMI_PRODUCT_NAME, "Satellite"),
},
},
{
/* Toshiba Dynabook */
.matches = {
DMI_MATCH(DMI_SYS_VENDOR, "TOSHIBA"),
DMI_MATCH(DMI_PRODUCT_NAME, "dynabook"),
},
},
{
/* Toshiba Portege M300 */
.matches = {
DMI_MATCH(DMI_SYS_VENDOR, "TOSHIBA"),
DMI_MATCH(DMI_PRODUCT_NAME, "PORTEGE M300"),
},
},
{
/* Toshiba Portege M300 */
.matches = {
DMI_MATCH(DMI_SYS_VENDOR, "TOSHIBA"),
DMI_MATCH(DMI_PRODUCT_NAME, "Portable PC"),
DMI_MATCH(DMI_PRODUCT_VERSION, "Version 1.0"),
},
},
#endif
{ }
};
static bool broken_olpc_ec;
static const struct dmi_system_id __initconst olpc_dmi_table[] = {
#if defined(CONFIG_DMI) && defined(CONFIG_OLPC)
{
/* OLPC XO-1 or XO-1.5 */
.matches = {
DMI_MATCH(DMI_SYS_VENDOR, "OLPC"),
DMI_MATCH(DMI_PRODUCT_NAME, "XO"),
},
},
#endif
{ }
};
static const struct dmi_system_id min_max_dmi_table[] __initconst = {
#if defined(CONFIG_DMI)
{
/* Lenovo ThinkPad Helix */
.matches = {
DMI_MATCH(DMI_SYS_VENDOR, "LENOVO"),
DMI_MATCH(DMI_PRODUCT_VERSION, "ThinkPad Helix"),
},
.driver_data = (int []){1024, 5052, 2258, 4832},
},
{
/* Lenovo ThinkPad X240 */
.matches = {
DMI_MATCH(DMI_SYS_VENDOR, "LENOVO"),
DMI_MATCH(DMI_PRODUCT_VERSION, "ThinkPad X240"),
},
.driver_data = (int []){1232, 5710, 1156, 4696},
},
{
/* Lenovo ThinkPad Edge E431 */
.matches = {
DMI_MATCH(DMI_SYS_VENDOR, "LENOVO"),
DMI_MATCH(DMI_PRODUCT_VERSION, "ThinkPad Edge E431"),
},
.driver_data = (int []){1024, 5022, 2508, 4832},
},
{
/* Lenovo ThinkPad T431s */
.matches = {
DMI_MATCH(DMI_SYS_VENDOR, "LENOVO"),
DMI_MATCH(DMI_PRODUCT_VERSION, "ThinkPad T431"),
},
.driver_data = (int []){1024, 5112, 2024, 4832},
},
{
/* Lenovo ThinkPad T440s */
.matches = {
DMI_MATCH(DMI_SYS_VENDOR, "LENOVO"),
DMI_MATCH(DMI_PRODUCT_VERSION, "ThinkPad T440"),
},
.driver_data = (int []){1024, 5112, 2024, 4832},
},
{
/* Lenovo ThinkPad L440 */
.matches = {
DMI_MATCH(DMI_SYS_VENDOR, "LENOVO"),
DMI_MATCH(DMI_PRODUCT_VERSION, "ThinkPad L440"),
},
.driver_data = (int []){1024, 5112, 2024, 4832},
},
{
/* Lenovo ThinkPad T540p */
.matches = {
DMI_MATCH(DMI_SYS_VENDOR, "LENOVO"),
DMI_MATCH(DMI_PRODUCT_VERSION, "ThinkPad T540"),
},
.driver_data = (int []){1024, 5056, 2058, 4832},
},
{
/* Lenovo ThinkPad L540 */
.matches = {
DMI_MATCH(DMI_SYS_VENDOR, "LENOVO"),
DMI_MATCH(DMI_PRODUCT_VERSION, "ThinkPad L540"),
},
.driver_data = (int []){1024, 5112, 2024, 4832},
},
{
/* Lenovo Yoga S1 */
.matches = {
DMI_MATCH(DMI_SYS_VENDOR, "LENOVO"),
DMI_EXACT_MATCH(DMI_PRODUCT_VERSION,
"ThinkPad S1 Yoga"),
},
.driver_data = (int []){1232, 5710, 1156, 4696},
},
{
/* Lenovo ThinkPad X1 Carbon Haswell (3rd generation) */
.matches = {
DMI_MATCH(DMI_SYS_VENDOR, "LENOVO"),
DMI_MATCH(DMI_PRODUCT_VERSION,
"ThinkPad X1 Carbon 2nd"),
},
.driver_data = (int []){1024, 5112, 2024, 4832},
},
#endif
{ }
};
void __init synaptics_module_init(void)
{
const struct dmi_system_id *min_max_dmi;
impaired_toshiba_kbc = dmi_check_system(toshiba_dmi_table);
broken_olpc_ec = dmi_check_system(olpc_dmi_table);
min_max_dmi = dmi_first_match(min_max_dmi_table);
if (min_max_dmi)
quirk_min_max = min_max_dmi->driver_data;
}
static int __synaptics_init(struct psmouse *psmouse, bool absolute_mode)
{
struct synaptics_data *priv;
int err = -1;
/*
* The OLPC XO has issues with Synaptics' absolute mode; the constant
* packet spew overloads the EC such that key presses on the keyboard
* are missed. Given that, don't even attempt to use Absolute mode.
* Relative mode seems to work just fine.
*/
if (absolute_mode && broken_olpc_ec) {
psmouse_info(psmouse,
"OLPC XO detected, not enabling Synaptics protocol.\n");
return -ENODEV;
}
psmouse->private = priv = kzalloc(sizeof(struct synaptics_data), GFP_KERNEL);
if (!priv)
return -ENOMEM;
psmouse_reset(psmouse);
if (synaptics_query_hardware(psmouse)) {
psmouse_err(psmouse, "Unable to query device.\n");
goto init_fail;
}
priv->absolute_mode = absolute_mode;
if (SYN_ID_DISGEST_SUPPORTED(priv->identity))
priv->disable_gesture = true;
if (synaptics_set_mode(psmouse)) {
psmouse_err(psmouse, "Unable to initialize device.\n");
goto init_fail;
}
priv->pkt_type = SYN_MODEL_NEWABS(priv->model_id) ? SYN_NEWABS : SYN_OLDABS;
psmouse_info(psmouse,
"Touchpad model: %ld, fw: %ld.%ld, id: %#lx, caps: %#lx/%#lx/%#lx, board id: %lu, fw id: %lu\n",
SYN_ID_MODEL(priv->identity),
SYN_ID_MAJOR(priv->identity), SYN_ID_MINOR(priv->identity),
priv->model_id,
priv->capabilities, priv->ext_cap, priv->ext_cap_0c,
priv->board_id, priv->firmware_id);
set_input_params(psmouse->dev, priv);
/*
* Encode touchpad model so that it can be used to set
* input device->id.version and be visible to userspace.
* Because version is __u16 we have to drop something.
* Hardware info bits seem to be good candidates as they
* are documented to be for Synaptics corp. internal use.
*/
psmouse->model = ((priv->model_id & 0x00ff0000) >> 8) |
(priv->model_id & 0x000000ff);
if (absolute_mode) {
psmouse->protocol_handler = synaptics_process_byte;
psmouse->pktsize = 6;
} else {
/* Relative mode follows standard PS/2 mouse protocol */
psmouse->protocol_handler = psmouse_process_byte;
psmouse->pktsize = 3;
}
psmouse->set_rate = synaptics_set_rate;
psmouse->disconnect = synaptics_disconnect;
psmouse->reconnect = synaptics_reconnect;
psmouse->cleanup = synaptics_reset;
/* Synaptics can usually stay in sync without extra help */
psmouse->resync_time = 0;
if (SYN_CAP_PASS_THROUGH(priv->capabilities))
synaptics_pt_create(psmouse);
/*
* Toshiba's KBC seems to have trouble handling data from
* Synaptics at full rate. Switch to a lower rate (roughly
* the same rate as a standard PS/2 mouse).
*/
if (psmouse->rate >= 80 && impaired_toshiba_kbc) {
psmouse_info(psmouse,
"Toshiba %s detected, limiting rate to 40pps.\n",
dmi_get_system_info(DMI_PRODUCT_NAME));
psmouse->rate = 40;
}
if (!priv->absolute_mode && SYN_ID_DISGEST_SUPPORTED(priv->identity)) {
err = device_create_file(&psmouse->ps2dev.serio->dev,
&psmouse_attr_disable_gesture.dattr);
if (err) {
psmouse_err(psmouse,
"Failed to create disable_gesture attribute (%d)",
err);
goto init_fail;
}
}
return 0;
init_fail:
kfree(priv);
return err;
}
int synaptics_init(struct psmouse *psmouse)
{
return __synaptics_init(psmouse, true);
}
int synaptics_init_relative(struct psmouse *psmouse)
{
return __synaptics_init(psmouse, false);
}
bool synaptics_supported(void)
{
return true;
}
#else /* CONFIG_MOUSE_PS2_SYNAPTICS */
void __init synaptics_module_init(void)
{
}
int synaptics_init(struct psmouse *psmouse)
{
return -ENOSYS;
}
bool synaptics_supported(void)
{
return false;
}
#endif /* CONFIG_MOUSE_PS2_SYNAPTICS */
| {
"content_hash": "8c2befa73705322e9fce07fe43053f42",
"timestamp": "",
"source": "github",
"line_count": 1715,
"max_line_length": 103,
"avg_line_length": 27.630320699708456,
"alnum_prop": 0.6363693918034863,
"repo_name": "Ant-OS/android_kernel_moto_shamu",
"id": "d60c9b7ad1b8a9c1eed1c2185879dfdb80d4866e",
"size": "48363",
"binary": false,
"copies": "244",
"ref": "refs/heads/master",
"path": "drivers/input/mouse/synaptics.c",
"mode": "33188",
"license": "apache-2.0",
"language": [
{
"name": "ASP",
"bytes": "4528"
},
{
"name": "Assembly",
"bytes": "9738337"
},
{
"name": "Awk",
"bytes": "18681"
},
{
"name": "C",
"bytes": "467488098"
},
{
"name": "C++",
"bytes": "3473858"
},
{
"name": "Clojure",
"bytes": "547"
},
{
"name": "Groff",
"bytes": "22012"
},
{
"name": "Lex",
"bytes": "40805"
},
{
"name": "Makefile",
"bytes": "1342678"
},
{
"name": "Objective-C",
"bytes": "1121986"
},
{
"name": "Perl",
"bytes": "461504"
},
{
"name": "Python",
"bytes": "33978"
},
{
"name": "Scilab",
"bytes": "21433"
},
{
"name": "Shell",
"bytes": "138789"
},
{
"name": "SourcePawn",
"bytes": "4687"
},
{
"name": "UnrealScript",
"bytes": "6113"
},
{
"name": "Yacc",
"bytes": "83091"
}
],
"symlink_target": ""
} |
/**
* @fileoverview
* Shuffl code to load cards into the workspace.
*
* @author Graham Klyne
* @version $Id: shuffl-loadworkspace.js 788 2010-05-12 15:55:59Z [email protected] $
*
* Coypyright (C) 2009, University of Oxford
*
* Licensed under the MIT License. You may obtain a copy of the License at:
*
* http://www.opensource.org/licenses/mit-license.php
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
// ----------------------------------------------------------------
// General workp[sace I/O helper functions
// ----------------------------------------------------------------
/**
* Test a returned session value: if it is null, report a storage handler
* error, invoke the callback with that error, and return 'true',
* otherwise return 'false'
*/
shuffl.noStorageHandler = function (session, uri, callback)
{
if (session == null)
{
var e = new shuffl.Error("No storage handler for "+uri);
shuffl.showError(e);
callback(e);
return true;
}
return false;
};
// ----------------------------------------------------------------
// Load up workspace
// ----------------------------------------------------------------
/**
* Load data for a single card.
*
* @param session is a storage access session to be used to read the
* card data
* @param wscoluri URI of workspace collection, used as base for resolving
* the card data URI.
* @param uri URI of card description.
* @param callback function called when the load is complete.
*
* The callback is invoked with an Error object, or an object containing
* the card data.
*/
shuffl.readCard = function (session, wscoluri, dataref, callback) {
log.debug("shuffl.readCard: "+wscoluri+", "+dataref);
wscoluri = jQuery.uri(wscoluri, session.getBaseUri());
var datauri = jQuery.uri(dataref, wscoluri);
////log.debug("- datauri "+datauri);
session.getData(datauri, "json", function (data)
{
if (data instanceof shuffl.Error)
{
shuffl.showError(data.toString());
}
else try
{
////var json = jQuery.secureEvalJSON(data.data);
////var json = jQuery.evalJSON(data.data);
////log.debug("- data.data "+data.data);
////log.debug("- data.uri "+data.uri);
////log.debug("- data.relref "+data.relref);
////var json = eval('('+data.data+')');
data = data.data;
data['shuffl:dataref'] = dataref.toString();
data['shuffl:datauri'] = datauri.toString();
data['shuffl:dataRW'] = false; // Assume not writeable for now
} catch (e) {
shuffl.showError(e);
data = e;
};
callback(data);
});
};
/**
* Load card data into the workspace.
*
* Note that loading data is done using pure web GET requests, without
* reference to storage protocol specifics. The URIs used may be different
* from the storage updsate URIs (cf. AtomPub edit URIs), which are stored as
* part of the data.
*
* The data loaded is added to any data which may already be present.
*
* A "shuffl:AllCardsLoaded" event is triggered to allow cards to complete
* initializing when the all cards defined by the indicated resource have
* been loaded.
*
* @param uri URI of workspace description.
* @param callback function called when the load is complete.
*
* The callback is invoked with an Error object, or an empty dictionary.
*/
shuffl.loadWorkspace = function(uri, callback) {
log.debug("shuffl.loadWorkspace: "+uri);
var datauri = jQuery.uri(uri);
var session = shuffl.makeStorageSession(datauri);
if (shuffl.noStorageHandler(session, datauri, callback)) return;
var m = new shuffl.AsyncComputation();
m.eval(function(val,callback) {
log.debug("Load layout from "+val);
session.getData(val.toString(), "json", callback);
});
m.eval(function(data,callback) {
if (data instanceof shuffl.Error)
{
log.debug("Error from session.getData");
shuffl.showError(data.toString());
callback(data);
return;
}
var json = data.data;
// When layout JSON has been read and parsed...
log.debug("Loading workspace content");
var i;
var stockbar = json['shuffl:workspace']['shuffl:stockbar'];
var layout = json['shuffl:workspace']['shuffl:layout'];
////log.debug("- layout: "+jQuery.toJSON(layout));
// Display and save location information
var wsuri = jQuery.uri().resolve(uri);
////log.debug("Display location of workspace, and save values: "+wsuri);
shuffl.showLocation(wsuri.toString());
// TODO: save URI not string?
jQuery('#workspace').data('location', wsuri.toString());
jQuery('#workspace').data('wsname', shuffl.uriName(wsuri));
jQuery('#workspace').data('wsdata', json);
// Load up stock bar
for (i = 0 ; i < stockbar.length ; i++) {
////log.debug("Loading stockbar["+i+"]: "+shuffl.objectString(stockbar[i]));
// Create and append new blank stockpile element
// TODO: use createStockpile helper
var stockpile = shuffl.stockpile_blank.clone();
stockpile.attr(stockbar[i]['id']);
stockpile.addClass(stockbar[i]['class']);
stockpile.text(stockbar[i]['label']);
stockpile.data( 'makeCard', shuffl.createCardFromStock );
stockpile.data( 'CardType', stockbar[i]['type'] );
stockpile.draggable(shuffl.stockDraggable);
jQuery('#stockbar').append(shuffl.stockpile_space.clone()).append(stockpile);
};
// Load up card data
////log.debug("Loading layout "+jQuery.toJSON(layout)+", "+layout.length,+", "+(typeof layout.length));
if (typeof layout.length != "number")
{
var e2 = new shuffl.Error("Invalid workspace description (shuffl:layout should be an array)");
shuffl.showError(e2);
callback(e2);
return;
}
function readLayoutCard(layout) {
////log.debug("readLayoutCard "+feeduri+", "+layout['data']);
// Function creates closure with specific layout definition
return function(val, callback) {
////log.debug("readCard "+feeduri+", "+layout['data']);
shuffl.readCard(session, datauri, layout['data'], function (data) {
if (data instanceof shuffl.Error)
{
shuffl.showError(data.toString());
callback(data);
}
else
{
// Card data available
shuffl.placeCardFromData(layout, data);
callback(val);
};
});
};
};
var m2 = new shuffl.AsyncComputation();
for (i = 0 ; i < layout.length ; i++) {
// Queue up function to read next card
m2.eval(readLayoutCard(layout[i]));
};
// Kick off loading cards
m2.exec({}, function (val) {
// All cards loaded: fire a "shuffl:AllCardsLoaded" event
// if no error returned, then invoke caller's callback.
// The "shuffl:AllCardsLoaded" event is provided to allow
// cards to complete initializing when the workspace is loaded.
if (!(val instanceof Error))
{
jQuery(".shuffl-card").trigger("shuffl:AllCardsLoaded");
}
callback(val);
});
});
// Kick of the workspace load
m.exec(datauri, callback);
};
/**
* Reset workspace: remove all stockbar entries, cards and other values
* introduced by loadWorkspace from the workspace.
*
* @param callback function called when reset is complete.
* (This function currently executes synchronously, but
* for consistency with other workspace functions it
* follows the asynchonour callback pattern.)
*
* The callback is invoked with an Error object, or an empty dictionary.
*/
shuffl.resetWorkspace = function(callback) {
log.debug("Reset workspace");
jQuery('#workspace_status').text("");
jQuery('#workspace').data('location', null);
jQuery('#workspace').data('wsname', null);
jQuery('#workspace').data('wsdata', null);
// Empty stock bar
jQuery('#stockbar .shuffl-stockpile, #stockbar .shuffl-spacer').remove();
// Remove card data
jQuery('#layout').empty();
callback({});
};
// End.
| {
"content_hash": "dc660c7be215c2bc5284d8493bacaa3e",
"timestamp": "",
"source": "github",
"line_count": 232,
"max_line_length": 115,
"avg_line_length": 40.75431034482759,
"alnum_prop": 0.5539925965097832,
"repo_name": "tectronics/admiral-jiscmrd",
"id": "5c276f6c23ad70414227e8eff485f1c9d0ac9080",
"size": "9455",
"binary": false,
"copies": "2",
"ref": "refs/heads/master",
"path": "spike/apps/js/shuffl/shuffl-loadworkspace.js",
"mode": "33188",
"license": "mit",
"language": [
{
"name": "ApacheConf",
"bytes": "8097"
},
{
"name": "Brainfuck",
"bytes": "90"
},
{
"name": "C",
"bytes": "16"
},
{
"name": "CSS",
"bytes": "27036"
},
{
"name": "HTML",
"bytes": "474331"
},
{
"name": "JavaScript",
"bytes": "3208858"
},
{
"name": "Mako",
"bytes": "74"
},
{
"name": "PHP",
"bytes": "6124"
},
{
"name": "Python",
"bytes": "1759473"
},
{
"name": "Shell",
"bytes": "67444"
}
],
"symlink_target": ""
} |
namespace {
GURL GetURLForLayoutTest(const std::string& test_name,
FilePath* current_working_directory,
bool* enable_pixel_dumping,
std::string* expected_pixel_hash) {
// A test name is formated like file:///path/to/test'--pixel-test'pixelhash
std::string path_or_url = test_name;
std::string pixel_switch;
std::string pixel_hash;
std::string::size_type separator_position = path_or_url.find('\'');
if (separator_position != std::string::npos) {
pixel_switch = path_or_url.substr(separator_position + 1);
path_or_url.erase(separator_position);
}
separator_position = pixel_switch.find('\'');
if (separator_position != std::string::npos) {
pixel_hash = pixel_switch.substr(separator_position + 1);
pixel_switch.erase(separator_position);
}
if (enable_pixel_dumping) {
*enable_pixel_dumping =
(pixel_switch == "--pixel-test" || pixel_switch == "-p");
}
if (expected_pixel_hash)
*expected_pixel_hash = pixel_hash;
GURL test_url(path_or_url);
if (!(test_url.is_valid() && test_url.has_scheme())) {
#if defined(OS_WIN)
std::wstring wide_path_or_url =
base::SysNativeMBToWide(path_or_url);
test_url = net::FilePathToFileURL(FilePath(wide_path_or_url));
#else
test_url = net::FilePathToFileURL(FilePath(path_or_url));
#endif
}
FilePath local_path;
{
base::ThreadRestrictions::ScopedAllowIO allow_io;
if (net::FileURLToFilePath(test_url, &local_path)) {
// We're outside of the message loop here, and this is a test.
file_util::SetCurrentDirectory(local_path.DirName());
}
if (current_working_directory)
file_util::GetCurrentDirectory(current_working_directory);
}
return test_url;
}
bool GetNextTest(const CommandLine::StringVector& args,
size_t* position,
std::string* test) {
if (*position >= args.size())
return false;
if (args[*position] == FILE_PATH_LITERAL("-"))
return !!std::getline(std::cin, *test, '\n');
#if defined(OS_WIN)
*test = WideToUTF8(args[(*position)++]);
#else
*test = args[(*position)++];
#endif
return true;
}
} // namespace
// Main routine for running as the Browser process.
int ShellBrowserMain(const content::MainFunctionParams& parameters) {
scoped_ptr<content::BrowserMainRunner> main_runner_(
content::BrowserMainRunner::Create());
int exit_code = main_runner_->Initialize(parameters);
if (exit_code >= 0)
return exit_code;
if (CommandLine::ForCurrentProcess()->HasSwitch(
switches::kCheckLayoutTestSysDeps)) {
return 0;
}
bool layout_test_mode =
CommandLine::ForCurrentProcess()->HasSwitch(switches::kDumpRenderTree);
if (layout_test_mode) {
content::WebKitTestController test_controller;
std::string test_string;
CommandLine::StringVector args =
CommandLine::ForCurrentProcess()->GetArgs();
size_t command_line_position = 0;
#if defined(OS_ANDROID)
std::cout << "#READY\n";
std::cout.flush();
#endif
while (GetNextTest(args, &command_line_position, &test_string)) {
if (test_string.empty())
continue;
if (test_string == "QUIT")
break;
bool enable_pixel_dumps;
std::string pixel_hash;
FilePath cwd;
GURL test_url = GetURLForLayoutTest(
test_string, &cwd, &enable_pixel_dumps, &pixel_hash);
if (!content::WebKitTestController::Get()->PrepareForLayoutTest(
test_url, cwd, enable_pixel_dumps, pixel_hash)) {
break;
}
main_runner_->Run();
if (!content::WebKitTestController::Get()->ResetAfterLayoutTest())
break;
}
exit_code = 0;
} else {
exit_code = main_runner_->Run();
}
main_runner_->Shutdown();
return exit_code;
}
| {
"content_hash": "9630246487b21fdc9cb4a0d938dfc52c",
"timestamp": "",
"source": "github",
"line_count": 126,
"max_line_length": 77,
"avg_line_length": 30.349206349206348,
"alnum_prop": 0.638336820083682,
"repo_name": "leighpauls/k2cro4",
"id": "8447c9c1969fb8aa62ab32b6d63ba09782d6c8e3",
"size": "4565",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "content/shell/shell_browser_main.cc",
"mode": "33188",
"license": "bsd-3-clause",
"language": [
{
"name": "ASP",
"bytes": "3062"
},
{
"name": "AppleScript",
"bytes": "25392"
},
{
"name": "Arduino",
"bytes": "464"
},
{
"name": "Assembly",
"bytes": "68131038"
},
{
"name": "C",
"bytes": "242794338"
},
{
"name": "C#",
"bytes": "11024"
},
{
"name": "C++",
"bytes": "353525184"
},
{
"name": "Common Lisp",
"bytes": "3721"
},
{
"name": "D",
"bytes": "1931"
},
{
"name": "Emacs Lisp",
"bytes": "1639"
},
{
"name": "F#",
"bytes": "4992"
},
{
"name": "FORTRAN",
"bytes": "10404"
},
{
"name": "Java",
"bytes": "3845159"
},
{
"name": "JavaScript",
"bytes": "39146656"
},
{
"name": "Lua",
"bytes": "13768"
},
{
"name": "Matlab",
"bytes": "22373"
},
{
"name": "Objective-C",
"bytes": "21887598"
},
{
"name": "PHP",
"bytes": "2344144"
},
{
"name": "Perl",
"bytes": "49033099"
},
{
"name": "Prolog",
"bytes": "2926122"
},
{
"name": "Python",
"bytes": "39863959"
},
{
"name": "R",
"bytes": "262"
},
{
"name": "Racket",
"bytes": "359"
},
{
"name": "Ruby",
"bytes": "304063"
},
{
"name": "Scheme",
"bytes": "14853"
},
{
"name": "Shell",
"bytes": "9195117"
},
{
"name": "Tcl",
"bytes": "1919771"
},
{
"name": "Verilog",
"bytes": "3092"
},
{
"name": "Visual Basic",
"bytes": "1430"
},
{
"name": "eC",
"bytes": "5079"
}
],
"symlink_target": ""
} |
import pyaf.Bench.TS_datasets as tsds
import tests.artificial.process_artificial_dataset as art
art.process_dataset(N = 1024 , FREQ = 'D', seed = 0, trendtype = "LinearTrend", cycle_length = 5, transform = "Difference", sigma = 0.0, exog_count = 0, ar_order = 0); | {
"content_hash": "dbff247a0dbc870ad7fceb531a37a477",
"timestamp": "",
"source": "github",
"line_count": 7,
"max_line_length": 167,
"avg_line_length": 38.142857142857146,
"alnum_prop": 0.7078651685393258,
"repo_name": "antoinecarme/pyaf",
"id": "1b42dfa28eec998be44366a7d95a89f157f23c78",
"size": "267",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "tests/artificial/transf_Difference/trend_LinearTrend/cycle_5/ar_/test_artificial_1024_Difference_LinearTrend_5__0.py",
"mode": "33188",
"license": "bsd-3-clause",
"language": [
{
"name": "Makefile",
"bytes": "6773299"
},
{
"name": "Procfile",
"bytes": "24"
},
{
"name": "Python",
"bytes": "54209093"
},
{
"name": "R",
"bytes": "807"
},
{
"name": "Shell",
"bytes": "3619"
}
],
"symlink_target": ""
} |
layout: single
title: "javascript project for beginners"
desc: "JavaScript is a popular programming language used for building web applications, among many other things."
keywords: "js, javascript"
categories: [javascript]
tag: [js, javascript]
---
The best way to learn a new programming language is to build projects.
I have created a list of 40 beginner friendly project tutorials in Vanilla JavaScript, React, and TypeScript.
My advice for tutorials would be to watch the video, build the project, break it apart and rebuild it your own way. Experiment with adding new features or using different methods.
That will test if you have really learned the concepts or not.
You can click on any of the projects listed below to jump to that section of the article.
Vanilla JavaScript Projects
---------------------------
1. [How to create a Color Flipper](#how-to-create-a-color-flipper)
2. [How to create a counter](#how-to-create-a-counter)
3. [How to create a review carousel](#how-to-create-a-review-carousel)
4. [How to create a responsive navbar](#how-to-create-a-responsive-navbar)
5. [How to create a sidebar](#how-to-create-a-sidebar)
6. [How to create a modal](#how-to-create-a-modal)
7. [How to create a FAQ page](#how-to-create-a-faq-page)
8. [How to create a restaurant menu page](#how-to-create-a-restaurant-menu-page)
9. [How to create a video background](#how-to-create-a-video-background)
10. [How to create a navigation bar on scroll](#how-to-create-a-navigation-bar-on-scroll)
11. [How to create tabs that display different content](#how-to-create-tabs-that-display-different-content)
12. [How to create a countdown clock](#how-to-create-a-countdown-clock)
13. [How to create your own Lorem ipsum](#how-to-create-your-own-lorem-ipsum)
14. [How to create a grocery list](#how-to-create-a-grocery-list)
15. [How to create an image slider](#how-to-create-an-image-slider)
16. [How to create a Rock Paper Scissors game](#how-to-create-a-rock-paper-scissors-game)
17. [How to create a Simon Game](#how-to-create-a-simon-game)
18. [How to create a Platformer Game](#how-to-create-a-platformer-game)
19. [How to create Doodle Jump](#how-to-create-doodle-jump-and-flappy-bird)
20. [How to create Flappy Bird](#how-to-create-doodle-jump-and-flappy-bird)
21. [How to create a Memory game](#how-to-create-seven-classic-games-with-ania-kubow)
22. [How to create a Whack-a-mole game](#how-to-create-seven-classic-games-with-ania-kubow)
23. [How to create Connect Four game](#how-to-create-seven-classic-games-with-ania-kubow)
24. [How to create a Snake game](#how-to-create-seven-classic-games-with-ania-kubow)
25. [How to create a Space Invaders game](#how-to-create-seven-classic-games-with-ania-kubow)
26. [How to create a Frogger game](#how-to-create-seven-classic-games-with-ania-kubow)
27. [How to create a Tetris game](#how-to-create-seven-classic-games-with-ania-kubow)
React Projects
--------------
1. [How to build a Tic-Tac-Toe game using React Hooks](#how-to-build-a-tic-tac-toe-game-using-react-hooks)
2. [How to build a Tetris Game using React Hooks](#how-to-build-a-tetris-game-using-react-hooks)
3. [How to create a Birthday Reminder App](#how-to-create-a-birthday-reminder-app)
4. [How to create a tours page](#how-to-create-a-tours-page)
5. [How to create an accordion menu](#how-to-create-an-accordion-menu)
6. [How to create tabs for a portfolio page](#how-to-create-tabs-for-a-portfolio-page)
7. [How to create a review slider](#how-to-create-a-review-slider)
8. [How to create a color generator](#how-to-create-a-color-generator)
9. [How to create a Stripe payment menu page](#how-to-create-a-stripe-payment-menu-page)
10. [How to create a shopping cart page](#how-to-create-a-shopping-cart-page)
11. [How to create a cocktail search page](#how-to-create-a-cocktail-search-page)
TypeScript Projects
-------------------
1. [How to build a Quiz App with React and TypeScript](#how-to-build-a-quiz-app-with-react-and-typescript)
2. [How to create an Arkanoid game with TypeScript](#how-to-create-an-arkanoid-game-with-typescript)
Vanilla JavaScript Projects
---------------------------
If you have not learned JavaScript fundamentals, then I would suggest watching [this course](https://www.youtube.com/watch?v=PkZNo7MFNFg) before proceeding with the projects.
Many of the screenshots below [are from here](https://www.vanillajavascriptprojects.com/).
### How to create a Color Flipper

In this [John Smilga tutorial](https://www.youtube.com/watch?v=3PHXvlpOkf4&t=421s), you will learn how to create a random background color changer. This is a good project to get you started working with the DOM.
In [Leonardo Maldonado's article](/news/whats-the-document-object-model-and-why-you-should-know-how-to-use-it-1a2d0bc5429d/#:~:text=Advantages,the%20page%20without%20a%20refresh.) on why it is important to learn about the DOM, he states:
> By manipulating the DOM, you have infinite possibilities. You can create applications that update the data of the page without needing a refresh. Also, you can create applications that are customizable by the user and then change the layout of the page without a refresh.
Key concepts covered:
* arrays
* document.getElementById()
* document.querySelector()
* addEventListener()
* document.body.style.backgroundColor
* Math.floor()
* Math.random()
* array.length
Before you get started, I would suggest watching the [introduction](https://www.youtube.com/watch?v=3PHXvlpOkf4&t=0s) where John goes over how to access the setup files for all of his projects.
### How to create a Counter

In this John Smilga [tutorial](https://www.youtube.com/watch?v=3PHXvlpOkf4&t=1825s), you will learn how to create a counter and write conditions that change the color based on positive or negative numbers displayed.
This project will give you more practice working with the DOM and you can use this simple counter in other projects like a pomodoro clock.
Key concepts covered:
* document.querySelectorAll()
* forEach()
* addEventListener()
* currentTarget property
* classList
* textContent
### How to create a Review carousel

In this [tutorial](https://www.youtube.com/watch?v=3PHXvlpOkf4&t=2644s), you will learn how to create a carousel of reviews with a button that generates random reviews.
This is a good feature to have on an ecommerce site to display customer reviews or a personal portfolio to display client reviews.
Key concepts covered:
* objects
* DOMContentLoaded
* addEventListener()
* array.length
* textContent
### How to create a responsive Navbar

In this [tutorial](https://www.youtube.com/watch?v=3PHXvlpOkf4&t=4289s), you will learn how to create a responsive navbar that will show the hamburger menu for smaller devices.
Learning how to develop responsive websites is an important part of being a web developer. This is a popular feature used on a lot of websites.
Key concepts covered:
* document.querySelector()
* addEventListener()
* classList.toggle()
### How to create a Sidebar

In this [tutorial](https://www.youtube.com/watch?v=3PHXvlpOkf4&t=5181s), you will learn how to create a sidebar with animation.
This is a cool feature that you can add to your personal website.
Key concepts covered:
* document.querySelector()
* addEventListener()
* classList.toggle()
* classList.remove()
### How to create a Modal

In this [tutorial](https://www.youtube.com/watch?v=3PHXvlpOkf4&t=5943s), you will learn how to create a modal window which is used on websites to get users to do or see something specific.
A good example of a modal window would be if a user made changes in a site without saving them and tried to go to another page. You can create a modal window that warns them to save their changes or else that information will be lost.
Key concepts covered:
* document.querySelector()
* addEventListener()
* classList.add()
* classList.remove()
### How to create a FAQ page

In this [tutorial](https://www.youtube.com/watch?v=3PHXvlpOkf4&t=6506s), you will learn how to create a frequently asked questions page which educates users about a business and drives traffic to the website through organic search results.
Key concepts covered:
* document.querySelectorAll()
* addEventListener()
* forEach()
* classList.remove()
* classList.toggle()
### How to create a restaurant menu page

In this [tutorial](https://www.youtube.com/watch?v=3PHXvlpOkf4&t=8185s), you will learn how to make a restaurant menu page that filters through the different food menus. This is a fun project that will teach you higher order functions like map, reduce, and filter.
In [Yazeed Bzadough's article](/news/a-quick-intro-to-higher-order-functions-in-javascript-1a014f89c6b/) on higher order functions, he states:
> the greatest benefit of HOFs is greater reusability.
Key concepts covered:
* arrays
* objects
* forEach()
* DOMContentLoaded
* map, reduce, and filter
* innerHTML
* includes method
### How to create a video background

In this [tutorial](https://www.youtube.com/watch?v=3PHXvlpOkf4&t=11773s), you will learn how to make a video background with a play and pause feature. This is a common feature found in a lot of websites.
Key concepts covered:
* document.querySelector()
* addEventListener()
* classList.contains()
* classList.add()
* classList.remove()
* play()
* pause()
### How to create a navigation bar on scroll

In this [tutorial](https://www.youtube.com/watch?v=3PHXvlpOkf4&t=12765s), you will learn how to create a navbar that slides down when scrolling and then stays at a fixed position at a certain height.
This is a popular feature found on many professional websites.
Key concepts covered:
* document.getElementById()
* getFullYear()
* getBoundingClientRect()
* slice method
* window.scrollTo()
### How to create tabs that display different content

In this [tutorial](https://www.youtube.com/watch?v=3PHXvlpOkf4&t=16575s), you will learn how to create tabs that will display different content which is useful when creating single page applications.
Key concepts covered:
* classList.add()
* classList.remove()
* forEach()
* addEventListener()
### How to create a countdown clock

In this [tutorial](https://www.youtube.com/watch?v=3PHXvlpOkf4&t=17933s), you will learn how to make a countdown clock which can be used when a new product is coming out or a sale is about to end on an ecommerce site.
Key concepts covered:
* getFullYear()
* getMonth()
* getDate()
* Math.floor()
* setInterval()
* clearInterval()
### How to create your own Lorem ipsum

In this [tutorial](https://www.youtube.com/watch?v=3PHXvlpOkf4&t=21395s), you will learn how to create your own Lorem ipsum generator.
Lorem ipsum is the go to placeholder text for websites. This is a fun project to show off your creativity and create your own text.
Key concepts covered:
* parseInt()
* Math.floor()
* Math.random()
* isNaN()
* slice method
* event.preventDefault()
### How to create a grocery list

In this [tutorial](https://www.youtube.com/watch?v=3PHXvlpOkf4&t=22703s), you will learn how to update and delete items from a grocery list and create a simple CRUD (Create, Read, Update, and Delete) application.
CRUD plays a very important role in developing full stack applications. Without it, you wouldn't be able to do things like edit or delete posts on your favorite social media platform.
Key concepts covered:
* DOMContentLoaded
* new Date()
* createAttribute()
* setAttributeNode()
* appendChild()
* filter()
* map()
### How to create an image slider

In this [tutorial](https://www.youtube.com/watch?v=3PHXvlpOkf4&t=28874s), you will learn how to build an image slider that you can add to any website.
Key concepts covered:
* querySelectorAll()
* addEventListener()
* forEach()
* if/else statements
### How to create a Rock Paper Scissors game

In this [tutorial](https://www.youtube.com/watch?v=jaVNP3nIAv0), Tenzin will teach you how to create a Rock Paper Scissors game. This is a fun project that will give more practice working with the DOM.
Key concepts covered:
* addEventListener()
* Math.floor()
* Math.random()
* switch statements
### How to create a Simon Game

In this [tutorial](https://www.youtube.com/watch?v=n_ec3eowFLQ), Beau Carnes will teach you how to create the classic Simon Game. This is a good project that will get you thinking about the different components behind the game and how you would build out each of those functionalities.
Key concepts covered:
* querySelector()
* addEventListener()
* setInterval()
* clearInterval()
* setTimeout()
* play()
* Math.floor()
* Math.random()
### How to create a Platformer Game

In this [tutorial](https://www.youtube.com/watch?v=w-OKdSHRlfA), Frank Poth will teach you how to build a platformer game. This project will introduce you to Object Oriented Programming principles and the Model, View, Controller software pattern.
Key concepts covered:
* this keyword
* for loop
* switch statements
* OOP principles
* MVC pattern
* Canvas API
### How to create Doodle Jump and Flappy Bird

In this [video series](https://www.youtube.com/watch?v=8xPsg6yv7TU&t=0s), Ania Kubow will teach you how to build [Doodle Jump](https://www.youtube.com/watch?v=8xPsg6yv7TU&t=114s) and [Flappy Bird](https://www.youtube.com/watch?v=8xPsg6yv7TU&t=3102s).
Building games are a fun way to learn more about JavaScript and will cover many popular JavaScript methods.
Key concepts covered:
* createElement()
* forEach()
* setInterval()
* clearInterval()
* removeChild()
* appendChild()
* addEventListener()
* removeEventListener()
### How to create seven classic games with Ania Kubow

You will have a lot of fun creating seven games in [this course](https://www.youtube.com/watch?v=lhNdUVh3qCc) by Ania Kubow:
1. [Memory Game](https://www.youtube.com/watch?v=lhNdUVh3qCc&t=115s)
2. [Whack-a-mole](https://www.youtube.com/watch?v=lhNdUVh3qCc&t=699s)
3. [Connect Four](https://www.youtube.com/watch?v=lhNdUVh3qCc&t=1187s)
4. [Snake](https://www.youtube.com/watch?v=lhNdUVh3qCc&t=1657s)
5. [Space Invaders](https://www.youtube.com/watch?v=lhNdUVh3qCc&t=2590s)
6. [Frogger](https://www.youtube.com/watch?v=lhNdUVh3qCc&t=3546s)
7. [Tetris](https://www.youtube.com/watch?v=lhNdUVh3qCc&t=4778s)
Key concepts covered:
* for loops
* onclick event
* arrow functions
* sort()
* pop()
* unshift()
* push()
* indexOf()
* includes()
* splice()
* concat()
React Projects
--------------
If you are not familiar with React fundamentals, then I would suggest taking [this course](https://www.youtube.com/watch?v=4UZrsTqkcW4) before proceeding with the projects.
### How to build a Tic-Tac-Toe game using React Hooks

In this [freeCodeCamp article](/news/learn-how-to-build-tic-tac-toe-with-react-hooks/), Per Harald Borgen talks about Scrimba's Tic-Tac-Toe game tutorial led by Thomas Weibenfalk. You can view the [video course](https://www.youtube.com/watch?v=Z5RbPrK4VqM) on Scimba's YouTube Channel.
This is a good project to start getting comfortable with React basics and working with hooks.
Key concepts covered:
* useState()
* import / export
* JSX
### How to build a Tetris Game using React Hooks

In this [tutorial](https://www.youtube.com/watch?v=ZGOaCxX8HIU), Thomas Weibenfalk will teach you how to build a Tetris game using React Hooks and styled components.
Key concepts covered:
* useState()
* useEffect()
* useRef()
* useCallback()
* styled components
### How to create a Birthday Reminder App

Screenshot from [https://react-projects.netlify.app/](https://react-projects.netlify.app/)
In this [John Smilga course,](https://www.youtube.com/watch?v=a_7Z7C_JCyo&t=438s) you will learn how to create a birthday reminder app. This is a good project to start getting comfortable with React basics and working with hooks.
I would also suggest watching [John's video](https://www.youtube.com/watch?v=a_7Z7C_JCyo&t=214s) on the startup files for this project.
Key concepts covered:
* useState()
* import / export
* JSX
* map()
### How to create a Tours Page

Screenshot from [https://react-projects.netlify.app/](https://react-projects.netlify.app/)
In this [tutorial](https://www.youtube.com/watch?v=a_7Z7C_JCyo&t=1181s), you will learn how to create a tours page where the user can delete which tours they are not interested in.
This will give you practice with React hooks and the async/await pattern.
Key concepts covered:
* try...catch statement
* async/await pattern
* useEffect()
* useState()
### How to create an accordion menu

Screenshot from [https://react-projects.netlify.app/](https://react-projects.netlify.app/)
In this [tutorial](https://www.youtube.com/watch?v=a_7Z7C_JCyo&t=4642s), you will learn how to create a questions and answers accordion menu. These menus can be helpful in revealing content to users in a progressive way.
Key concepts covered:
* React icons
* useState()
* map()
### How to create tabs for a portfolio page

Screenshot from [https://react-projects.netlify.app/](https://react-projects.netlify.app/)
In this [tutorial](https://www.youtube.com/watch?v=a_7Z7C_JCyo&t=6726s), you will learn how to create tabs for a mock portfolio page. Tabs are useful when you want to display different content in single page applications.
Key concepts covered:
* async/await pattern
* React icons
* useEffect()
* useState()
### How to create a review slider

Screenshot from [https://react-projects.netlify.app/](https://react-projects.netlify.app/)
In this [tutorial](https://www.youtube.com/watch?v=a_7Z7C_JCyo&t=8020s), you will learn how to create a review slider that changes to a new review every few seconds.
This is a cool feature that you can incorporate into an ecommerce site or portfolio.
Key concepts covered:
* React icons
* useEffect()
* useState()
* map()
### How to create a color generator

Screenshot from [https://react-projects.netlify.app/](https://react-projects.netlify.app/)
In this [tutorial](https://www.youtube.com/watch?v=a_7Z7C_JCyo&t=11329s), you will learn how to create a color generator. This is a good project to continue practicing working with hooks and setTimeout.
Key concepts covered:
* setTimeout()
* clearTimeout()
* useEffect()
* useState()
* try...catch statement
* event.preventDefault()
### How to create a Stripe payment menu page

Screenshot from [https://react-projects.netlify.app/](https://react-projects.netlify.app/)
In this [tutorial](https://www.youtube.com/watch?v=a_7Z7C_JCyo&t=20686s), you will learn how to create a Stripe payment menu page. This project will give you good practice on how to design a product landing page using React components.
Key concepts covered:
* React icons
* useRef()
* useEffect()
* useState()
* useContext()
### How to create a shopping cart page

Screenshot from [https://react-projects.netlify.app/](https://react-projects.netlify.app/)
In this [tutorial](https://www.youtube.com/watch?v=a_7Z7C_JCyo&t=24115s), you will learn how to create a shopping cart page that updates and deletes items. This project will also be a good introduction to the useReducer hook.
Key concepts covered:
* map()
* filter()
* `<svg>` elements
* useReducer()
* useContext()
### How to create a cocktail search page

Screenshot from [https://react-projects.netlify.app/](https://react-projects.netlify.app/)
In this [tutorial](https://www.youtube.com/watch?v=a_7Z7C_JCyo&t=27597s), you will learn how to create a cocktail search page. This project will give you an introduction to how to use React router.
React router gives you the ability to create a navigation on your website and change views to different components like an about or contact page.
Key concepts covered:
* `<Router>`
* `<Switch>`
* useCallback()
* useContext()
* useEffect()
* useState()
TypeScript Projects
-------------------
If you are unfamiliar with TypeScript, then I would suggest watching [this course](https://www.youtube.com/watch?v=gp5H0Vw39yw) before proceeding with this project.
### How to build a Quiz App with React and TypeScript

In this [tutorial](https://www.youtube.com/watch?v=F2JCjVSZlG0), Thomas Weibenfalk will teach you how to build a quiz app with React and TypeScript. This is a good opportunity to practice the basics of TypeScript.
Key concepts covered:
* React.FC
* styled components
* dangerouslySetInnerHTML
### How to create an Arkanoid game with TypeScript

In this [tutorial](https://www.youtube.com/watch?v=7bejSTim38A), Thomas Weibenfalk will teach you how to build the classic Arkanoid game in TypeScript. This is a good project that will give you practice working with the basic concepts for TypeScript.
Key concepts covered:
* Types
* Classes
* Modules
* HTMLCanvasElement
I hope you enjoy this list of 40 project tutorials in Vanilla JavaScript, React and TypeScript.
Happy coding!
<div style="text-align: right">Theo <a href="https://www.freecodecamp.org/news/javascript-projects-for-beginners/">freecodecamp</a></div>
| {
"content_hash": "d73a833720cd6d709883bf6520c675c9",
"timestamp": "",
"source": "github",
"line_count": 628,
"max_line_length": 285,
"avg_line_length": 39.060509554140125,
"alnum_prop": 0.7225030574806359,
"repo_name": "ducdongmg/ducdongmg.github.io",
"id": "8c56b91654051de049671c260047d6f6c5db154b",
"size": "24539",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "_posts/2021-12-20-javascript-projects-for-beginners.md",
"mode": "33188",
"license": "mit",
"language": [
{
"name": "CSS",
"bytes": "2780"
},
{
"name": "HTML",
"bytes": "58337"
},
{
"name": "JavaScript",
"bytes": "53349"
},
{
"name": "Ruby",
"bytes": "660"
},
{
"name": "SCSS",
"bytes": "65581"
}
],
"symlink_target": ""
} |
+++
categories="article"
date="2012-05-29T01:08:53+03:00"
issue="2012-01"
issue_name="2012 - #01"
issue_id="1"
number="16"
file = "https://static.nuclear-power-engineering.ru/articles/2012/01/16.pdf"
first_page="135"
last_page="143"
udc="621.039.543.4"
title="On the Issues of Uranium Reprocessed from High Burnup Fuels"
original_title="Использование регенерированного урана из топлива с глубоким выгоранием"
authors=["DyachenkoAI", "BalagurovNA", "ArtisyukVV"]
rubric = "fuelcycle"
rubric_name = "Fuel cycle and nuclear waste management"
outputs=["HTML", "DOI"]
doi="https://doi.org/10.26583/npe.2012.1.16"
+++
The present paper focuses on analysis of nuclide composition in spent fuel of VVER-1000 from the view point of uranium reprocessing. The consideration is given to even uranium isotopes compensation, savings of separate work units, associated saving of uranium resources and economics. | {
"content_hash": "938a509b7d6a4939796913f4a95dac4a",
"timestamp": "",
"source": "github",
"line_count": 23,
"max_line_length": 284,
"avg_line_length": 39.08695652173913,
"alnum_prop": 0.7664071190211346,
"repo_name": "nuclear-power-engineering/nuclear-power-engineering",
"id": "04a7e60e4ae246ad86738481c4c65dae77e7a804",
"size": "962",
"binary": false,
"copies": "1",
"ref": "refs/heads/develop",
"path": "content_en/article/2012/01/16.md",
"mode": "33188",
"license": "mit",
"language": [
{
"name": "CSS",
"bytes": "4157"
},
{
"name": "Dockerfile",
"bytes": "674"
},
{
"name": "HTML",
"bytes": "49832"
},
{
"name": "JavaScript",
"bytes": "3411"
},
{
"name": "Shell",
"bytes": "1258"
}
],
"symlink_target": ""
} |
<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="fill_parent" android:layout_height="fill_parent"
android:background="@drawable/splasf_bgg">
<ImageView android:src="@drawable/splash_logo"
android:layout_width="wrap_content" android:scaleType="fitCenter"
android:id="@+id/logo_bg2" android:layout_height="wrap_content"
android:layout_centerHorizontal="true" android:layout_marginTop="100dp">
</ImageView>
<ImageView android:layout_width="wrap_content"
android:scaleType="fitCenter" android:id="@+id/logo_bg1"
android:layout_height="wrap_content" android:layout_centerHorizontal="true"
android:layout_below="@+id/logo_bg2"></ImageView>
<LinearLayout android:layout_height="wrap_content" android:gravity="center"
android:layout_alignParentBottom="true" android:layout_width="fill_parent">
<TextView android:text="@string/index_info"
android:textColor="@color/white"
android:id="@+id/textView2" android:textSize="22dp"
android:layout_width="wrap_content"
android:layout_height="wrap_content"></TextView>
</LinearLayout>
</RelativeLayout>
| {
"content_hash": "619f284ba83aba281fbc9384646d4674",
"timestamp": "",
"source": "github",
"line_count": 22,
"max_line_length": 77,
"avg_line_length": 52.72727272727273,
"alnum_prop": 0.7577586206896552,
"repo_name": "iniesta2014/GSinaWeiBo",
"id": "3c43123aa4330667a11d3308f37d0e47e67e9eb3",
"size": "1160",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "res/layout/log.xml",
"mode": "33188",
"license": "apache-2.0",
"language": [
{
"name": "Java",
"bytes": "761226"
}
],
"symlink_target": ""
} |
title: NetworkLabels
category: feature
authors: alkaplan, danken, lvernia, moti, mpavlik
wiki_category: Feature
wiki_title: Features/NetworkLabels
wiki_revision_count: 66
wiki_last_updated: 2014-09-15
feature_name: Network Labels
feature_modules: Networking
feature_status: Released
---
# Network Labels
## Summary
**Network labels** feature provides the ability to label networks and to use that label on the host's interfaces, so the label abstracts the networks from the physical interface/bond (which can be labelled with one or more labels).
The host network configuration can be done by manipulating the network label:
\* Labeling a network will attach that network to all hosts interfaces which are tagged with that label.
* Removing a label from the network will trigger the network removal from all hosts interfaces/bonds which are tagged with that label.
## Owner
* Name: [ Moti Asayag](User:masayag)
* Email: [email protected]
## Benefit to oVirt
**Network labels** designed to ease and to simplify the maintenance of a data-center, in respect to hosts network configuration.
With the **Network labels** feature the amount of actions required by the administrator are significantly reduced. Also, in a relative simple manner the host network configuration is kept in-sync with the logical network definition.
## Detailed Description
For simplicity, we'd avoid introducing a 'label' entity. The label will be defined by:
* A new property 'label' will be added to the network: We start with a single label, and if needed we can extend label on network label to represent few labels.
* A new property 'labels' will be added to the host interface.
- The property 'labels' represents the list of labels that the NIC are marked with.
- On **host** labeling is allowed only for physical interfaces or bonds (VLANs/bridge labeling is not allowed).
The labels represent a varied list of networks, depending on the network assignment to the cluster:
\* The network is defined on the data-center level.
* Network can be attached to a host only if it is assigned to its cluster.
**For example:**
networks 'red' and 'blue' labelled 'lbl1'
network 'red' is assigned to a cluster 'A' and 'B'.
network 'blue' is assigned to a cluster 'B'.
Therefore in the context of cluster 'A' label 'lbl1' represents only network 'red' and in the context of cluster 'B' it represents 'red' and 'blue'.
Once network 'blue' is assigned to cluster 'A', label 'lbl1' will stand for it as well as for network 'red'. Assigning 'blue' to cluster 'A' triggers adding the network 'red' to all of the hosts interfaces in the cluster which are labelled 'lbl1'.
If network 'blue' will be unassigned from cluster 'B', label 'lbl1' will represent only network 'red'. Therefore it should trigger the removal of network 'blue' from all of the hosts interfaces in the cluster which are labelled 'lbl1'.
**More examples:** When a change is made to the network label, it will trigger an action for all of the hosts which one of their interfaces is labelled with the same label:
Network 'red' - lbl1
Network 'blue' - lbl1
Host X - eth0 - lbl1
Host Y - bond0 - lbl1
* Removing 'lbl1' from network 'red' will trigger the removal of network 'red' from eth0 (Host X) and from bond0 (Host Y)
* Adding network 'green' with label 'lbl1' will trigger the addition of network 'green' to eth0 (Host X) and to bond0 (Host Y)
The network label should contain only numbers, digits, dash or underscore (comply with the pattern [0-9a-zA-Z_-]+).
#### Labeling a network or an interface
When the host interface is the first to be labelled and later on a new network is labelled with the same label, the 'Assign Network to cluster' action will trigger the attachment of the network to all of the hosts carrying that label on one of their interfaces.
When the network is labelled prior to labeling the host interface, labeling the interface will be done as part of the 'Setup Networks' action. The 'Setup Networks' will be the responsible to translate the label into the appropriate list of networks it represents and to validate the correctness of the label.
Defining a network label on network indicates the administrator enhances the usage of the network labels feature to apply a network to all of the hosts carrying the same label on their interfaces.
Hence, no further indication is required add the network to all of the hosts (i.e. by property 'Apply to all hosts').
#### Unlabeling a network or an interface
A network label can be removed either by clearing the label on network update or by removing the label from the host interface via 'setup networks':
\* Removing the label from the host interface will remove all of the networks which are associated to that label.
* Removing the label from the network will remove the network from all of the interfaces that have this label.
#### Changing a label of a network or an interface
This actions is considered as adding and removing of a network label.
Changing a label of a network will remove it the network from all of the hosts which had their interfaces labelled with the old name and will add that network to any other interface in that data-center tagged with the new label.
#### Pre-'Setup Networks' execution
At the first step of the 'Setup Networks' parameters validation, a translation of the labels to a list of networks will be done.
The translation will rely on the host interface's set of labels.
'Setup Networks' API will support both labeling and attaching the networks to the interface/bond.
Removing a labelled network from a labelled interface will be blocked, as labelled networks should be managed according to the interface label. In order to remove a network, the administrator should remove the label from the interface and manage the interface individually.
#### Assigning Network to a Cluster
When attaching a labelled network to a cluster, which the label already specified on the cluster's host interfaces will result in adding that network to all of the hosts in that cluster carrying that label on their interfaces.
#### Detaching Network from a Cluster
When a labelled network is detached from a cluster, the network will be removed from any labelled interface within that cluster.
#### Moving host between clusters
Moving host between cluster that supports 'network labels' to a cluster which doesn't will be blocked if labels are used on that host.
\* Moving a host that uses labels from version greater than 3.0 to cluster 3.0 will be blocked.
## Networks with roles
If a labeled network is marked on a cluster to act as a display network or migration network, it will be configured on the host via the label with a DHCP boot protocol, so the host will be able to get an IP address automatically for that network. This is a limitation for role networks, and without IP address, the host will not be able to serve vms.
#### Network Label constraints
The network labels feature relies on the 'Setup Networks' API to configure the networks on the hosts.
There are certain configurations which aren't supported by the 'Setup Networks' API and defining the network label in that manner will fail the operation and will result in a useless label declaration. The following network configuration on a single interface are prohibited:
1. Any combination of 2 non-vlan networks:
1. 2 VM networks
2. 2 non-VM networks
3. VM network and a non-VM network
2. A VM network and vlan networks
#### User Experience
For managing labels on host level:
* In Network main tab ---> the 'Hosts sub-tab', the 'Network Device' column will contain tag image if the network is attached to the host via label.
* In 'Setup Networks' dialog an option to adding the *labels* will be added, represented as a tag icon on the interface (left side of the setup networks dialog). Clicking the tag icon opens a new dialog for type the labels, in a drop-down/combo-box which will auto-complete the label name based on other labels that are in use in the same data-center (by hosts or by networks).
* In host interfaces sub-tab, 'name' or 'bond' column will contain tag image if the interface have label. The tooltip of the tag image will contain the list of the labels on this interface.
For managing labels on network level:
* In 'Add/Edit Network' dialog a new property *label* will be added.
- Before submitting, an verification for the validity of the label is being examined: If two networks which are attached to a specific cluster cannot co-exit on the host nic by that label, a warning message will be appeared to the user.
* In 'network main tab' a *label* icon is added next to the network name, when hovers it displays the label name.
|---------------------------------------|-----------------------------------|---------------------------------------------|------------------------------------------|
|  |  |  |  |
#### REST
##### Host level
The network label on host nic level are represented as a sub-collection of the nic resource:
/api/hosts/{host:id}/nics/{nic:id}/labels Supported actions:
* **GET** returns a list of nic's labels
* **POST** adds a new label and will trigger setupNetworks which will be interpreted to attaching all of the matching labelled networks to the nic.
- The setup-networks designed to maintain consistency of the label on the host.
/api/hosts/{host:id}/nics/{nic:id}/labels/{label:id}
Supported actions:
* **GET** returns a specific label
* **DELETE** removes a label from a nic and removes the networks managed by it
- The setup-networks designed to maintain consistency of the label on the host.
A representation of **label** element:
` `<label id="label_name" />
A representation of **labels** element:
` `<labels>
` `<label id="label_name_1" />
` `<label id="label_name_2" />
` `</labels>
###### Phase 2 (when UI will use the RESTAPI)
The user will be able to provide the list of labels per nic via as part of the setupnetworks API:
` `*`/api/hosts/{host:id}/nics/setupnetworks`*
**POST** request example:
<action>
` `<host_nics>
` `<host_nic>
` `<labels>
`<label id="label_name_1" />`
`<label id="label_name_2" />`
` `</labels>
...
` `</host_nic>
...
` `</host_nics>
</action>
##### Network level
The network level are represent as a sub-collection of network:
/api/networks/{network:id}/labels
Supported actions:
* **GET** returns all of the labels for a specific network
* **POST** add a label to network (starting with a single label per network)
/api/networks/{network:id}/labels/{label:id}
Supported actions:
* **GET** returns a specific label
* **DELETE** - removes a label from network
A representation of **label** element:
` `<network>
...
` `<labels>
` `<label>`lbl1`</label>
` `</labels>
...
` `<network>
#### Search Engine
For phase 1:
* A query for all networks which are labelled with specific label will be supported.
For phase 2:
* A query for all hosts which are labelled with specific label will be supported.
## Dependencies / Related Features
The feature will use the [Multi-Host Network Configuration](Features/MultiHostNetworkConfiguration) feature to achieve its goals.
## Documentation / External references
## Testing
Testing can be done on a host with 1 nic - it requires to define the management network on the data-center level as non-vm network. If there are more than a single nic, the management network can be a vm network. The constraint is due to the fact that no mix of vm network (non-tagged) can co-exist on the same nic with any other network type.
Via API:
1. Set label 'lbl' to network 'red' and 'blue' (both vlan) and attach them to cluster X: POST <label id="lbl"/> to /api/networks/{network:id}/labels for each network.
2. Send a POST label request to an unassigned host's nic in that cluster to /api/hosts/{host:id}/nics/{nic:id}/labels: <label id="lbl"/>
3. Verify label is created
4. Verify networks 'red' and 'blue' were attached to the labeled nic.
5. Delete 'lbl' from that nic by sending a DELETE to /api/hosts/{host:id}/nics/{nic:id}/labels/lbl
6. Verify both 'red' and 'blue' were removed from that host.
Via Webadmin:
1. Label vlan network 'green' with label 'aaa', assign the network to a cluster where the host resides.
2. Label nic on host cluster via 'setup networks' dialog
3. Verify 'green' was automatically dragged on that nic.
4. Confirm the action, and verify 'green' appears on top of that host in the host's interface sub-tab.
5. Detach 'green' from that cluster
6. Verify 'green' is no longer configured on that host
7. Attach 'green' to that cluster
8. Verify 'green' is no configured on that host.
The test can be expanded to several hosts, and to multiple actions (all networks should be tagged/vlan) such as:
1. Label host nics with labels 'aaa' and 'bbb'
2. Label networks X and Y with 'aaa' and A and B with 'bbb'.
3. Via the cluster tab, select the target cluster and from the networks sub tab open click the 'manage networks' button
4. Check X, Y, A and B to be assigned to that cluster and confirm.
5. Open setup networks dialog of that host and verify the networks were properly attached to the nics by the label
6. From the same 'manage networks' dialog detach networks X and A from the cluster
7. Confirm networks X and A were removed from the host, and only networks Y and B are assigned.
8. Edit X network and remove the label from it.
9. Verify network X was removed from the host.
10. Edit X network and label it with 'bbb'.
11. Verify network X was configured on the host.
<Category:Feature> <Category:Networking>
| {
"content_hash": "ed609acb23e8a58b917a97effd3bef8f",
"timestamp": "",
"source": "github",
"line_count": 277,
"max_line_length": 379,
"avg_line_length": 50.6173285198556,
"alnum_prop": 0.7320447899579202,
"repo_name": "jasonbrooks/ovirt-stg",
"id": "7663d541793a95490b0dcb2b3e8bff938a423739",
"size": "14202",
"binary": false,
"copies": "1",
"ref": "refs/heads/pr-docs-merge",
"path": "source/feature/network/networklabels.html.md",
"mode": "33188",
"license": "mit",
"language": [
{
"name": "CSS",
"bytes": "52687"
},
{
"name": "HTML",
"bytes": "127561"
},
{
"name": "JavaScript",
"bytes": "1173"
},
{
"name": "Ruby",
"bytes": "34010"
},
{
"name": "Shell",
"bytes": "1879"
}
],
"symlink_target": ""
} |
A .NET Fast Very Late Binding invoker

#### Basically…
### Reflection is hard… And dreadfully slow!
Horizon addresses these issues by supplying a **simple to use** API.
Underneath the covers, Horizon will create and cache **Expression Trees**. This means there will be a small *one time hit* which will be hardly noticeable.
### From then on, Horizon will be **blazing fast**!
As if that wasn't enough, Horizon also supports the *DLR's Binders*, making it super easy to plug it into your very own *DynamicObject*s! Hooray!
| {
"content_hash": "6fd42363b1fb6f4c65d63156d517b216",
"timestamp": "",
"source": "github",
"line_count": 15,
"max_line_length": 156,
"avg_line_length": 44.333333333333336,
"alnum_prop": 0.7578947368421053,
"repo_name": "StevenThuriot/Horizon",
"id": "edd0500d654e27784873618781ddf0a2967a2eaf",
"size": "784",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "README.md",
"mode": "33188",
"license": "mit",
"language": [
{
"name": "C#",
"bytes": "105061"
}
],
"symlink_target": ""
} |
package GAL::Parser::korean_snp;
use strict;
use vars qw($VERSION);
$VERSION = 0.2.0;
use base qw(GAL::Parser);
use GAL::Reader::DelimitedLine;
=head1 NAME
GAL::Parser::korean_snp - Parse SNV files from the first Korean Genome
=head1 VERSION
This document describes GAL::Parser::korean_snp version 0.2.0
=head1 SYNOPSIS
my $parser = GAL::Parser::korean_snp->new(file => 'korean_snp.gff');
while (my $feature_hash = $parser->next_feature_hash) {
print $parser->to_gff3($feature_hash) . "\n";
}
=head1 DESCRIPTION
L<GAL::Parser::korean_snp> provides a parser for SNV files from the
first Korean genome published by Ahn, et al. 2009
(http://www.ncbi.nlm.nih.gov/pubmed/19470904).
=head1 Constructor
New L<GAL::Parser::korean_snp> objects are created by the class method new.
Arguments should be passed to the constructor as a list (or reference)
of key value pairs. All attributes of the L<GAL::Parser::korean_snp> object
can be set in the call to new. An simple example of object creation
would look like this:
my $parser = GAL::Parser::korean_snp->new(file => 'korean_snp.gff');
The constructor recognizes the following parameters which will set the
appropriate attributes:
=over 4
=item * C<< file => feature_file.txt >>
This optional parameter provides the filename for the file containing
the data to be parsed. While this parameter is optional either it, or
the following fh parameter must be set.
=item * C<< fh => feature_file.txt >>
This optional parameter provides a filehandle to read data from. While
this parameter is optional either it, or the following fh parameter
must be set.
=back
=cut
#-----------------------------------------------------------------------------
=head2 new
Title : new
Usage : GAL::Parser::korean_snp->new();
Function: Creates a GAL::Parser::korean_snp object;
Returns : A GAL::Parser::korean_snp object
Args : See the attributes described above.
=cut
sub new {
my ($class, @args) = @_;
my $self = $class->SUPER::new(@args);
return $self;
}
#-----------------------------------------------------------------------------
sub _initialize_args {
my ($self, @args) = @_;
######################################################################
# This block of code handels class attributes. Use the
# @valid_attributes below to define the valid attributes for
# this class. You must have identically named get/set methods
# for each attribute. Leave the rest of this block alone!
######################################################################
my $args = $self->SUPER::_initialize_args(@args);
my @valid_attributes = qw(); # Set valid class attributes here
$self->set_attributes($args, @valid_attributes);
######################################################################
}
#-----------------------------------------------------------------------------
=head2 parse_record
Title : parse_record
Usage : $a = $self->parse_record();
Function: Parse the data from a record.
Returns : A hash ref needed by Feature.pm to create a Feature object
Args : A hash ref of fields that this sub can understand (In this case GFF3).
=cut
sub parse_record {
my ($self, $record) = @_;
my $id = $record->{id};
my $seqid = $record->{chromosome};
my $source = 'KOBIC';
my $type = 'SNV';
my $start = $record->{location};
my $end = $record->{location};
my $score = '.';
my $strand = '+';
my $phase = '.';
# Het with ref: get var_alleles and remove ref. ref_reads and var_reads OK
# chr10 56397 C CT rs12262442 28 C/T 17 11
# chr10 61776 T CT rs61838967 15 T/C 7 8
# chr10 65803 T CT KOREFSNP1 27 T/C 19 8
# chr10 68106 C AC KOREFSNP2 43 C/A 22 21
# chr10 84136 C CT rs4607995 24 C/T 10 13
# chr10 84238 A AT rs10904041 22 A/T 5 16
# Het but not ref: get var_alleles. assign var_reads to correct var and calculate alter_var_reads from total - var_reads
# chr10 12625631 A GT rs2815636 42 A/G 0 21
# chr10 13864035 A CT rs5025431 27 A/T 0 15
# chr10 14292681 G AC rs11528656 29 G/A 0 18
# chr10 14771944 C AG rs3107794 29 C/G 0 15
# chr10 15075637 A CG rs9731518 29 A/G 4 16
# Homozygous get var_alleles and use only one. ref_reads and var_reads OK
# chr10 168434 T GG rs7089889 20 T/G 0 20
# chr10 173151 T CC rs7476951 19 T/C 0 19
# chr10 175171 G TT rs7898275 25 G/T 0 25
# chr10 175358 C TT rs7910845 26 C/T 0 26
# $self->fields([qw(chromosome location ref_seq var_seqs id total_reads read_seqs ref_reads var_reads)]);
my $reference_seq = $record->{ref_seq};
my %variant_seqs = map {$_, 1} split //, $record->{var_seqs};
my @variant_seqs = keys %variant_seqs;
my $total_reads = $record->{total_reads};
# chr10 56397 C CT rs12262442 28 C/T 17 11
my @read_seqs = split m|/|, $record->{read_seqs};
my %read_counts = ($read_seqs[0] => $record->{ref_reads},
$read_seqs[1] => $record->{var_reads},
);
my @variant_reads = map {$read_counts{$_} || $total_reads - $record->{var_reads}} @variant_seqs;
my $zygosity = scalar @variant_seqs > 1 ? 'heterozygous' : 'homozygous';
my $attributes = {Reference_seq => [$reference_seq],
Variant_seq => \@variant_seqs,
Variant_reads => \@variant_reads,
Total_reads => [$total_reads],
Zygosity => [$zygosity],
ID => [$id],
};
my $feature_data = {feature_id => $id,
seqid => $seqid,
source => $source,
type => $type,
start => $start,
end => $end,
score => $score,
strand => $strand,
phase => $phase,
attributes => $attributes,
};
return $feature_data;
}
#-----------------------------------------------------------------------------
=head2 reader
Title : reader
Usage : $a = $self->reader
Function: Return the reader object.
Returns : A GAL::Reader::DelimitedLine singleton.
Args : None
=cut
sub reader {
my $self = shift;
if (! $self->{reader}) {
my @field_names = qw(chromosome location ref_seq var_seqs id
total_reads read_seqs ref_reads var_reads);
my $reader = GAL::Reader::DelimitedLine->new(field_names => \@field_names);
$self->{reader} = $reader;
}
return $self->{reader};
}
#-----------------------------------------------------------------------------
=head1 DIAGNOSTICS
L<GAL::Parser::korean_snp> does not throw any warnings or errors.
=head1 CONFIGURATION AND ENVIRONMENT
L<GAL::Parser::korean_snp> requires no configuration files or environment variables.
=head1 DEPENDENCIES
L<GAL::Parser>
L<GAL::Reader::DelimitedLine>
=head1 INCOMPATIBILITIES
None reported.
=head1 BUGS AND LIMITATIONS
No bugs have been reported.
Please report any bugs or feature requests to:
[email protected]
=head1 AUTHOR
Barry Moore <[email protected]>
=head1 LICENCE AND COPYRIGHT
Copyright (c) 2010-2014, Barry Moore <[email protected]>. All
rights reserved.
This module is free software; you can redistribute it and/or
modify it under the same terms as Perl itself (See LICENSE).
=head1 DISCLAIMER OF WARRANTY
BECAUSE THIS SOFTWARE IS LICENSED FREE OF CHARGE, THERE IS NO WARRANTY
FOR THE SOFTWARE, TO THE EXTENT PERMITTED BY APPLICABLE LAW. EXCEPT
WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR OTHER
PARTIES PROVIDE THE SOFTWARE "AS IS" WITHOUT WARRANTY OF ANY KIND,
EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE
IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE
SOFTWARE IS WITH YOU. SHOULD THE SOFTWARE PROVE DEFECTIVE, YOU ASSUME
THE COST OF ALL NECESSARY SERVICING, REPAIR, OR CORRECTION.
IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING
WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY AND/OR
REDISTRIBUTE THE SOFTWARE AS PERMITTED BY THE ABOVE LICENCE, BE LIABLE
TO YOU FOR DAMAGES, INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL, OR
CONSEQUENTIAL DAMAGES ARISING OUT OF THE USE OR INABILITY TO USE THE
SOFTWARE (INCLUDING BUT NOT LIMITED TO LOSS OF DATA OR DATA BEING
RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD PARTIES OR A
FAILURE OF THE SOFTWARE TO OPERATE WITH ANY OTHER SOFTWARE), EVEN IF
SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH
DAMAGES.
=cut
1;
| {
"content_hash": "97ceec856af364a08aec7e8d2cc7fa47",
"timestamp": "",
"source": "github",
"line_count": 274,
"max_line_length": 122,
"avg_line_length": 32.77007299270073,
"alnum_prop": 0.5982848869584586,
"repo_name": "4ureliek/TEanalysis",
"id": "aade5199f92c29e1bf76d55f38ed64179c6dcd6a",
"size": "8979",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "Lib/GAL/Parser/korean_snp.pm",
"mode": "33188",
"license": "mit",
"language": [
{
"name": "Perl",
"bytes": "1861087"
},
{
"name": "Perl 6",
"bytes": "8744"
}
],
"symlink_target": ""
} |
/**
* Definition of the map's footer (game objects)
* @author Sebastian Straub <[email protected]>
*/
package de.nx42.maps4cim.objects; | {
"content_hash": "23bd254eecd09c4dab280c710ece8f43",
"timestamp": "",
"source": "github",
"line_count": 5,
"max_line_length": 54,
"avg_line_length": 29,
"alnum_prop": 0.7310344827586207,
"repo_name": "Klamann/maps4cim",
"id": "e5b85b9dd94c4e82a19dc2ff1490aa626f255e8c",
"size": "145",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "maps4cim-core/src/main/java/de/nx42/maps4cim/objects/package-info.java",
"mode": "33188",
"license": "apache-2.0",
"language": [
{
"name": "HTML",
"bytes": "815298"
},
{
"name": "Java",
"bytes": "1012653"
},
{
"name": "Shell",
"bytes": "42"
}
],
"symlink_target": ""
} |
<?xml version='1.0' encoding='UTF-8'?>
<hopsanobjectappearance version="0.3">
<modelobject sourcecode="HydraulicPressureSourceC.hpp" typename="HydraulicPressureSourceC" displayname="C-type Pressure Source">
<icons>
<icon scale="1" path="pressuresource_user.svg" iconrotation="ON" type="user"/>
<icon scale="1" path="pressuresource_iso.svg" iconrotation="ON" type="iso"/>
</icons>
<help>
<md>HydraulicPressureSourceC.md</md>
</help>
<ports>
<port x="0.5" y="1" a="90" name="p"/>
<port x="0.5" y="0" a="90" name="P1"/>
</ports>
</modelobject>
</hopsanobjectappearance>
| {
"content_hash": "8989abbe860361c5c2af0c088243abde",
"timestamp": "",
"source": "github",
"line_count": 16,
"max_line_length": 132,
"avg_line_length": 42.6875,
"alnum_prop": 0.5900439238653001,
"repo_name": "Hopsan/hopsan",
"id": "6a9ae28a06bffb20e0ffd035dfc51201f5e07cda",
"size": "683",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "componentLibraries/defaultLibrary/Hydraulic/Sources&Sinks/HydraulicPressureSourceC.xml",
"mode": "33188",
"license": "apache-2.0",
"language": [
{
"name": "Batchfile",
"bytes": "6842"
},
{
"name": "C",
"bytes": "211307"
},
{
"name": "C++",
"bytes": "8125248"
},
{
"name": "CMake",
"bytes": "35439"
},
{
"name": "HTML",
"bytes": "113099"
},
{
"name": "Inno Setup",
"bytes": "4034"
},
{
"name": "MATLAB",
"bytes": "11965"
},
{
"name": "Makefile",
"bytes": "6066"
},
{
"name": "Mathematica",
"bytes": "15604656"
},
{
"name": "Modelica",
"bytes": "5652"
},
{
"name": "Python",
"bytes": "92629"
},
{
"name": "QMake",
"bytes": "88819"
},
{
"name": "Shell",
"bytes": "47273"
}
],
"symlink_target": ""
} |
import hash from 'object-hash'
import Phaser from 'phaser'
import config from './config'
import {getAngle} from './utils'
export default class Intersection extends Phaser.Point {
constructor (x, y) {
super(x, y)
this.streets = []
this.graphic = null
this.id = hash.sha1({
x,
y
})
this.equal = Phaser.Point.equals.bind(Phaser.Point, this)
}
draw (graphics, color = 0xff00ff) {
graphics.lineStyle(config.STREET_WIDTH / 2, color, 0.5)
this.graphic = graphics.drawCircle(this.x, this.y, config.STREET_WIDTH / 2)
}
addStreet (street) {
if (!this.onStreet(street)) {
this.streets.push(street)
}
}
// check if an intersection is on a specific street
onStreet (street) {
return this.streets.find(s => s.id === street.id) !== undefined
}
// get the angle between two streets on an intersection
getAngle (street1, street2) {
// get the points surrounding an intersection (if existent)
const getPoints = (street) => { // use arrow to preserve 'this'
const iIx = street.intersections.indexOf(this)
const l = street.points.length // allow slice to step over the max index
const points = street.points.slice(Math.max(iIx - 1, 0), Math.min(l, iIx + 2))
if (points.length < 2) {
throw new Error('Calculating angle returns less than 2 points', street)
}
return points // 2-3 points
}
const p1 = getPoints(street1)
const p2 = getPoints(street2)
// figure out which point is the actual intersection (common point)
let p1Ix, p2Ix
if (p1.length === 2) {
if (p1[0].equals(this)) {
p1Ix = 0
} else p1Ix = 1
} else p1Ix = 1
if (p2.length === 2) {
if (p2[0].equals(this)) {
p2Ix = 0
} else p2Ix = 1
} else p2Ix = 1
const angles = []
for (let i = 1; i < p1.length; i++) {
for (let o = 1; o < p2.length; o++) {
angles.push({
angle: getAngle(p1[p1Ix], p1[i * (i - p1Ix)], p2[o * (o - p2Ix)]), // rad
street1: p1[i * (i - p1Ix)],
street2: p2[o * (o - p2Ix)]
})
}
}
return angles
}
}
| {
"content_hash": "2a9bb54d9e0040a1c0e656af9cc077e9",
"timestamp": "",
"source": "github",
"line_count": 74,
"max_line_length": 84,
"avg_line_length": 29.04054054054054,
"alnum_prop": 0.5858538855281527,
"repo_name": "anoff/phaser-microlight",
"id": "c6de68314ff0b6765ff665829e47e05720e6b5ed",
"size": "2149",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "lib/intersection.js",
"mode": "33188",
"license": "mit",
"language": [
{
"name": "HTML",
"bytes": "352"
},
{
"name": "JavaScript",
"bytes": "3567631"
}
],
"symlink_target": ""
} |
require "pathname"
require "vagrant/util/ssh"
module Vagrant
module Action
module Builtin
# This class will exec into a full fledged SSH console into the
# remote machine. This middleware assumes that the VM is running and
# ready for SSH, and uses the {Machine#ssh_info} method to retrieve
# SSH information necessary to connect.
#
# Note: If there are any middleware after `SSHExec`, they will **not**
# run, since exec replaces the currently running process.
class SSHExec
# For quick access to the `SSH` class.
include Vagrant::Util
def initialize(app, env)
@app = app
end
def call(env)
# Grab the SSH info from the machine or the environment
info = env[:ssh_info]
info ||= env[:machine].ssh_info
# If the result is nil, then the machine is telling us that it is
# not yet ready for SSH, so we raise this exception.
raise Errors::SSHNotReady if info.nil?
info[:private_key_path] ||= []
# Check SSH key permissions
info[:private_key_path].each do |path|
SSH.check_key_permissions(Pathname.new(path))
end
if info[:private_key_path].empty? && info[:password]
env[:ui].warn(I18n.t("vagrant.ssh_exec_password"))
end
# Exec!
SSH.exec(info, env[:ssh_opts])
end
end
end
end
end
| {
"content_hash": "5969185f9abb7dde4d3d562c7f92c10c",
"timestamp": "",
"source": "github",
"line_count": 49,
"max_line_length": 76,
"avg_line_length": 30.020408163265305,
"alnum_prop": 0.5948334466349422,
"repo_name": "trivoallan/vagrant",
"id": "23b2090667505815ad10070a8143e304b84b6c1c",
"size": "1471",
"binary": false,
"copies": "2",
"ref": "refs/heads/master",
"path": "lib/vagrant/action/builtin/ssh_exec.rb",
"mode": "33188",
"license": "mit",
"language": [],
"symlink_target": ""
} |
import { PlayerTournamentViewData } from "./PlayerTournamentViewData";
import { BinaryNetworkID } from "../../core/data/BinaryNetworkID";
import { AbstractData } from "../../core/data/AbstractData";
export class SrvPlayerTournamentViewData extends AbstractData {
public tourNetworkIDVO:BinaryNetworkID;
public playerTournamentView:PlayerTournamentViewData;
constructor(parent?:AbstractData) {
super(parent);
}
}
| {
"content_hash": "57ec1183e25c28a84343fbd374ae969c",
"timestamp": "",
"source": "github",
"line_count": 17,
"max_line_length": 70,
"avg_line_length": 25.176470588235293,
"alnum_prop": 0.7733644859813084,
"repo_name": "gesh123/MyLibrary",
"id": "f7cf9068b1b9c9cf10722e793d418158884fa78e",
"size": "429",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "src/client/app/poker/connection/protocol/generated/data/SrvPlayerTournamentViewData.ts",
"mode": "33188",
"license": "mit",
"language": [
{
"name": "CSS",
"bytes": "1191"
},
{
"name": "HTML",
"bytes": "595"
},
{
"name": "JavaScript",
"bytes": "7934"
},
{
"name": "TypeScript",
"bytes": "1251145"
}
],
"symlink_target": ""
} |
package no.kantega.publishing.admin.taglib;
import no.kantega.commons.client.util.ValidationError;
import no.kantega.commons.client.util.ValidationErrors;
import no.kantega.commons.exception.SystemException;
import no.kantega.commons.util.LocaleLabels;
import no.kantega.publishing.admin.AdminSessionAttributes;
import no.kantega.publishing.admin.content.InputScreenRenderer;
import no.kantega.publishing.api.content.attribute.AttributeDataType;
import no.kantega.publishing.common.Aksess;
import no.kantega.publishing.common.data.Content;
import no.kantega.publishing.common.data.attributes.Attribute;
import no.kantega.publishing.common.factory.AttributeFactory;
import org.springframework.web.context.support.WebApplicationContextUtils;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.jsp.JspException;
import javax.servlet.jsp.tagext.TagSupport;
import java.io.IOException;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
public class RenderAttributeTag extends TagSupport {
private String type;
private String value;
private String name;
private String title;
private String titlekey;
private String helpText;
private int maxLength = -1;
private Attribute attribute;
private AttributeFactory attributeFactory;
public void setType(String type) {
this.type = type;
}
public void setValue(String value) {
this.value = value;
}
public void setName(String name) {
this.name = name;
}
public void setTitle(String title) {
this.title = title;
}
public void setTitlekey(String titlekey) {
this.titlekey = titlekey;
}
public void setHelptext(String helpText) {
this.helpText = helpText;
}
public void setMaxlength(int maxLength) {
this.maxLength = maxLength;
}
public void setAttribute(Attribute attribute) {
this.attribute = attribute;
}
public int doStartTag() throws JspException {
setAttributeFactoryIfNull();
HttpServletRequest request = (HttpServletRequest)pageContext.getRequest();
Content content = (Content)request.getSession(true).getAttribute(AdminSessionAttributes.CURRENT_EDIT_CONTENT);
try {
if (attribute == null) {
attribute = attributeFactory.newAttribute(type);
}
if (value != null && value.length() > 0) {
attribute.setValue(value);
}
attribute.setName(name);
if (titlekey != null) {
title = LocaleLabels.getLabel(titlekey, Aksess.getDefaultAdminLocale());
}
if (title != null) {
attribute.setTitle(title);
}
if (helpText != null) {
attribute.setHelpText(helpText);
}
if (maxLength != -1) {
attribute.setMaxLength(maxLength);
}
Map<String, List<ValidationError>> fieldErrors = new HashMap<>();
ValidationErrors errors = (ValidationErrors)request.getAttribute("errors");
if (errors != null) {
for (ValidationError error : errors.getErrors()) {
if (error.getField() != null && error.getField().length() > 0) {
List<ValidationError> errorsForField = fieldErrors.get(error.getField());
if (errorsForField == null) {
errorsForField = new ArrayList<>();
fieldErrors.put(error.getField(), errorsForField);
}
errorsForField.add(error);
}
}
}
InputScreenRenderer renderer = new InputScreenRenderer(pageContext, content, AttributeDataType.CONTENT_DATA);
renderer.renderNormalAttribute(pageContext.getOut(), request, fieldErrors, attribute);
} catch (IOException | SystemException | ClassNotFoundException | InstantiationException | IllegalAccessException e) {
throw new JspException(e);
} finally {
value = null;
helpText = null;
title = null;
name = null;
type = null;
titlekey = null;
maxLength = -1;
attribute = null;
}
return SKIP_BODY;
}
private void setAttributeFactoryIfNull() {
if (attributeFactory == null){
attributeFactory = WebApplicationContextUtils.getRequiredWebApplicationContext(pageContext.getServletContext()).getBean("aksessAttributeFactory", AttributeFactory.class);
}
}
public int doEndTag() throws JspException {
return EVAL_PAGE;
}
}
| {
"content_hash": "a6854b8ce144ab6d8a5fc1da557b57b6",
"timestamp": "",
"source": "github",
"line_count": 140,
"max_line_length": 182,
"avg_line_length": 34.27857142857143,
"alnum_prop": 0.6330485517816211,
"repo_name": "kantega/Flyt-cms",
"id": "e416432b8be6f249aa1093f7008414462e3725f6",
"size": "4799",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "modules/core/src/main/java/no/kantega/publishing/admin/taglib/RenderAttributeTag.java",
"mode": "33261",
"license": "apache-2.0",
"language": [
{
"name": "CSS",
"bytes": "102415"
},
{
"name": "Groovy",
"bytes": "9509"
},
{
"name": "HTML",
"bytes": "1484"
},
{
"name": "Java",
"bytes": "4322582"
},
{
"name": "JavaScript",
"bytes": "562456"
},
{
"name": "XSLT",
"bytes": "3705"
}
],
"symlink_target": ""
} |
// Licensed to the .NET Foundation under one or more agreements.
// The .NET Foundation licenses this file to you under the MIT license.
// See the LICENSE file in the project root for more information.
/*XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
XX XX
XX Arm64 Code Generator XX
XX XX
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
*/
#include "jitpch.h"
#ifdef _MSC_VER
#pragma hdrstop
#endif
#ifndef LEGACY_BACKEND // This file is ONLY used for the RyuJIT backend that uses the linear scan register allocator
#ifdef _TARGET_ARM64_
#include "emit.h"
#include "codegen.h"
#include "lower.h"
#include "gcinfo.h"
#include "gcinfoencoder.h"
/*
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
XX XX
XX Prolog / Epilog XX
XX XX
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
*/
//------------------------------------------------------------------------
// genInstrWithConstant: we will typically generate one instruction
//
// ins reg1, reg2, imm
//
// However the imm might not fit as a directly encodable immediate,
// when it doesn't fit we generate extra instruction(s) that sets up
// the 'regTmp' with the proper immediate value.
//
// mov regTmp, imm
// ins reg1, reg2, regTmp
//
// Arguments:
// ins - instruction
// attr - operation size and GC attribute
// reg1, reg2 - first and second register operands
// imm - immediate value (third operand when it fits)
// tmpReg - temp register to use when the 'imm' doesn't fit
// inUnwindRegion - true if we are in a prolog/epilog region with unwind codes
//
// Return Value:
// returns true if the immediate was too large and tmpReg was used and modified.
//
bool CodeGen::genInstrWithConstant(instruction ins,
emitAttr attr,
regNumber reg1,
regNumber reg2,
ssize_t imm,
regNumber tmpReg,
bool inUnwindRegion /* = false */)
{
bool immFitsInIns = false;
emitAttr size = EA_SIZE(attr);
// reg1 is usually a dest register
// reg2 is always source register
assert(tmpReg != reg2); // regTmp can not match any source register
switch (ins)
{
case INS_add:
case INS_sub:
if (imm < 0)
{
imm = -imm;
ins = (ins == INS_add) ? INS_sub : INS_add;
}
immFitsInIns = emitter::emitIns_valid_imm_for_add(imm, size);
break;
case INS_strb:
case INS_strh:
case INS_str:
// reg1 is a source register for store instructions
assert(tmpReg != reg1); // regTmp can not match any source register
immFitsInIns = emitter::emitIns_valid_imm_for_ldst_offset(imm, size);
break;
case INS_ldrsb:
case INS_ldrsh:
case INS_ldrsw:
case INS_ldrb:
case INS_ldrh:
case INS_ldr:
immFitsInIns = emitter::emitIns_valid_imm_for_ldst_offset(imm, size);
break;
default:
assert(!"Unexpected instruction in genInstrWithConstant");
break;
}
if (immFitsInIns)
{
// generate a single instruction that encodes the immediate directly
getEmitter()->emitIns_R_R_I(ins, attr, reg1, reg2, imm);
}
else
{
// caller can specify REG_NA for tmpReg, when it "knows" that the immediate will always fit
assert(tmpReg != REG_NA);
// generate two or more instructions
// first we load the immediate into tmpReg
instGen_Set_Reg_To_Imm(size, tmpReg, imm);
regTracker.rsTrackRegTrash(tmpReg);
// when we are in an unwind code region
// we record the extra instructions using unwindPadding()
if (inUnwindRegion)
{
compiler->unwindPadding();
}
// generate the instruction using a three register encoding with the immediate in tmpReg
getEmitter()->emitIns_R_R_R(ins, attr, reg1, reg2, tmpReg);
}
return immFitsInIns;
}
//------------------------------------------------------------------------
// genStackPointerAdjustment: add a specified constant value to the stack pointer in either the prolog
// or the epilog. The unwind codes for the generated instructions are produced. An available temporary
// register is required to be specified, in case the constant is too large to encode in an "add"
// instruction (or "sub" instruction if we choose to use one), such that we need to load the constant
// into a register first, before using it.
//
// Arguments:
// spDelta - the value to add to SP (can be negative)
// tmpReg - an available temporary register
// pTmpRegIsZero - If we use tmpReg, and pTmpRegIsZero is non-null, we set *pTmpRegIsZero to 'false'.
// Otherwise, we don't touch it.
//
// Return Value:
// None.
void CodeGen::genStackPointerAdjustment(ssize_t spDelta, regNumber tmpReg, bool* pTmpRegIsZero)
{
// Even though INS_add is specified here, the encoder will choose either
// an INS_add or an INS_sub and encode the immediate as a positive value
//
if (genInstrWithConstant(INS_add, EA_PTRSIZE, REG_SPBASE, REG_SPBASE, spDelta, tmpReg, true))
{
if (pTmpRegIsZero != nullptr)
{
*pTmpRegIsZero = false;
}
}
// spDelta is negative in the prolog, positive in the epilog, but we always tell the unwind codes the positive
// value.
ssize_t spDeltaAbs = abs(spDelta);
unsigned unwindSpDelta = (unsigned)spDeltaAbs;
assert((ssize_t)unwindSpDelta == spDeltaAbs); // make sure that it fits in a unsigned
compiler->unwindAllocStack(unwindSpDelta);
}
//------------------------------------------------------------------------
// genPrologSaveRegPair: Save a pair of general-purpose or floating-point/SIMD registers in a function or funclet
// prolog. If possible, we use pre-indexed addressing to adjust SP and store the registers with a single instruction.
// The caller must ensure that we can use the STP instruction, and that spOffset will be in the legal range for that
// instruction.
//
// Arguments:
// reg1 - First register of pair to save.
// reg2 - Second register of pair to save.
// spOffset - The offset from SP to store reg1 (must be positive or zero).
// spDelta - If non-zero, the amount to add to SP before the register saves (must be negative or
// zero).
// lastSavedWasPreviousPair - True if the last prolog instruction was to save the previous register pair. This
// allows us to emit the "save_next" unwind code.
// tmpReg - An available temporary register. Needed for the case of large frames.
// pTmpRegIsZero - If we use tmpReg, and pTmpRegIsZero is non-null, we set *pTmpRegIsZero to 'false'.
// Otherwise, we don't touch it.
//
// Return Value:
// None.
void CodeGen::genPrologSaveRegPair(regNumber reg1,
regNumber reg2,
int spOffset,
int spDelta,
bool lastSavedWasPreviousPair,
regNumber tmpReg,
bool* pTmpRegIsZero)
{
assert(spOffset >= 0);
assert(spDelta <= 0);
assert((spDelta % 16) == 0); // SP changes must be 16-byte aligned
assert(genIsValidFloatReg(reg1) == genIsValidFloatReg(reg2)); // registers must be both general-purpose, or both
// FP/SIMD
bool needToSaveRegs = true;
if (spDelta != 0)
{
if ((spOffset == 0) && (spDelta >= -512))
{
// We can use pre-indexed addressing.
// stp REG, REG + 1, [SP, #spDelta]!
// 64-bit STP offset range: -512 to 504, multiple of 8.
getEmitter()->emitIns_R_R_R_I(INS_stp, EA_PTRSIZE, reg1, reg2, REG_SPBASE, spDelta, INS_OPTS_PRE_INDEX);
compiler->unwindSaveRegPairPreindexed(reg1, reg2, spDelta);
needToSaveRegs = false;
}
else // (spDelta < -512))
{
// We need to do SP adjustment separately from the store; we can't fold in a pre-indexed addressing and the
// non-zero offset.
// generate sub SP,SP,imm
genStackPointerAdjustment(spDelta, tmpReg, pTmpRegIsZero);
}
}
if (needToSaveRegs)
{
// stp REG, REG + 1, [SP, #offset]
// 64-bit STP offset range: -512 to 504, multiple of 8.
assert(spOffset <= 504);
getEmitter()->emitIns_R_R_R_I(INS_stp, EA_PTRSIZE, reg1, reg2, REG_SPBASE, spOffset);
if (lastSavedWasPreviousPair)
{
// This works as long as we've only been saving pairs, in order, and we've saved the previous one just
// before this one.
compiler->unwindSaveNext();
}
else
{
compiler->unwindSaveRegPair(reg1, reg2, spOffset);
}
}
}
//------------------------------------------------------------------------
// genPrologSaveReg: Like genPrologSaveRegPair, but for a single register. Save a single general-purpose or
// floating-point/SIMD register in a function or funclet prolog. Note that if we wish to change SP (i.e., spDelta != 0),
// then spOffset must be 8. This is because otherwise we would create an alignment hole above the saved register, not
// below it, which we currently don't support. This restriction could be loosened if the callers change to handle it
// (and this function changes to support using pre-indexed STR addressing). The caller must ensure that we can use the
// STR instruction, and that spOffset will be in the legal range for that instruction.
//
// Arguments:
// reg1 - Register to save.
// spOffset - The offset from SP to store reg1 (must be positive or zero).
// spDelta - If non-zero, the amount to add to SP before the register saves (must be negative or
// zero).
// tmpReg - An available temporary register. Needed for the case of large frames.
// pTmpRegIsZero - If we use tmpReg, and pTmpRegIsZero is non-null, we set *pTmpRegIsZero to 'false'.
// Otherwise, we don't touch it.
//
// Return Value:
// None.
void CodeGen::genPrologSaveReg(regNumber reg1, int spOffset, int spDelta, regNumber tmpReg, bool* pTmpRegIsZero)
{
assert(spOffset >= 0);
assert(spDelta <= 0);
assert((spDelta % 16) == 0); // SP changes must be 16-byte aligned
if (spDelta != 0)
{
// generate sub SP,SP,imm
genStackPointerAdjustment(spDelta, tmpReg, pTmpRegIsZero);
}
// str REG, [SP, #offset]
// 64-bit STR offset range: 0 to 32760, multiple of 8.
getEmitter()->emitIns_R_R_I(INS_str, EA_PTRSIZE, reg1, REG_SPBASE, spOffset);
compiler->unwindSaveReg(reg1, spOffset);
}
//------------------------------------------------------------------------
// genEpilogRestoreRegPair: This is the opposite of genPrologSaveRegPair(), run in the epilog instead of the prolog.
// The stack pointer adjustment, if requested, is done after the register restore, using post-index addressing.
// The caller must ensure that we can use the LDP instruction, and that spOffset will be in the legal range for that
// instruction.
//
// Arguments:
// reg1 - First register of pair to restore.
// reg2 - Second register of pair to restore.
// spOffset - The offset from SP to load reg1 (must be positive or zero).
// spDelta - If non-zero, the amount to add to SP after the register restores (must be positive or
// zero).
// tmpReg - An available temporary register. Needed for the case of large frames.
// pTmpRegIsZero - If we use tmpReg, and pTmpRegIsZero is non-null, we set *pTmpRegIsZero to 'false'.
// Otherwise, we don't touch it.
//
// Return Value:
// None.
void CodeGen::genEpilogRestoreRegPair(
regNumber reg1, regNumber reg2, int spOffset, int spDelta, regNumber tmpReg, bool* pTmpRegIsZero)
{
assert(spOffset >= 0);
assert(spDelta >= 0);
assert((spDelta % 16) == 0); // SP changes must be 16-byte aligned
if (spDelta != 0)
{
if ((spOffset == 0) && (spDelta <= 504))
{
// Fold the SP change into this instruction.
// ldp reg1, reg2, [SP], #spDelta
getEmitter()->emitIns_R_R_R_I(INS_ldp, EA_PTRSIZE, reg1, reg2, REG_SPBASE, spDelta, INS_OPTS_POST_INDEX);
compiler->unwindSaveRegPairPreindexed(reg1, reg2, -spDelta);
}
else // (spDelta > 504))
{
// Can't fold in the SP change; need to use a separate ADD instruction.
// ldp reg1, reg2, [SP, #offset]
getEmitter()->emitIns_R_R_R_I(INS_ldp, EA_PTRSIZE, reg1, reg2, REG_SPBASE, spOffset);
compiler->unwindSaveRegPair(reg1, reg2, spOffset);
// generate add SP,SP,imm
genStackPointerAdjustment(spDelta, tmpReg, pTmpRegIsZero);
}
}
else
{
// ldp reg1, reg2, [SP, #offset]
getEmitter()->emitIns_R_R_R_I(INS_ldp, EA_PTRSIZE, reg1, reg2, REG_SPBASE, spOffset);
compiler->unwindSaveRegPair(reg1, reg2, spOffset);
}
}
//------------------------------------------------------------------------
// genEpilogRestoreReg: The opposite of genPrologSaveReg(), run in the epilog instead of the prolog.
//
// Arguments:
// reg1 - Register to restore.
// spOffset - The offset from SP to restore reg1 (must be positive or zero).
// spDelta - If non-zero, the amount to add to SP after the register restores (must be positive or
// zero).
// tmpReg - An available temporary register. Needed for the case of large frames.
// pTmpRegIsZero - If we use tmpReg, and pTmpRegIsZero is non-null, we set *pTmpRegIsZero to 'false'.
// Otherwise, we don't touch it.
//
// Return Value:
// None.
void CodeGen::genEpilogRestoreReg(regNumber reg1, int spOffset, int spDelta, regNumber tmpReg, bool* pTmpRegIsZero)
{
assert(spOffset >= 0);
assert(spDelta >= 0);
assert((spDelta % 16) == 0); // SP changes must be 16-byte aligned
// ldr reg1, [SP, #offset]
getEmitter()->emitIns_R_R_I(INS_ldr, EA_PTRSIZE, reg1, REG_SPBASE, spOffset);
compiler->unwindSaveReg(reg1, spOffset);
if (spDelta != 0)
{
// generate add SP,SP,imm
genStackPointerAdjustment(spDelta, tmpReg, pTmpRegIsZero);
}
}
//------------------------------------------------------------------------
// genSaveCalleeSavedRegistersHelp: Save the callee-saved registers in 'regsToSaveMask' to the stack frame
// in the function or funclet prolog. The save set does not contain FP, since that is
// guaranteed to be saved separately, so we can set up chaining. We can only use the instructions
// that are allowed by the unwind codes. Integer registers are stored at lower addresses,
// FP/SIMD registers are stored at higher addresses. There are no gaps. The caller ensures that
// there is enough space on the frame to store these registers, and that the store instructions
// we need to use (STR or STP) are encodable with the stack-pointer immediate offsets we need to
// use. Note that the save set can contain LR if this is a frame without a frame pointer, in
// which case LR is saved along with the other callee-saved registers. The caller can tell us
// to fold in a stack pointer adjustment, which we will do with the first instruction. Note that
// the stack pointer adjustment must be by a multiple of 16 to preserve the invariant that the
// stack pointer is always 16 byte aligned. If we are saving an odd number of callee-saved
// registers, though, we will have an empty aligment slot somewhere. It turns out we will put
// it below (at a lower address) the callee-saved registers, as that is currently how we
// do frame layout. This means that the first stack offset will be 8 and the stack pointer
// adjustment must be done by a SUB, and not folded in to a pre-indexed store.
//
// Arguments:
// regsToSaveMask - The mask of callee-saved registers to save. If empty, this function does nothing.
// lowestCalleeSavedOffset - The offset from SP that is the beginning of the callee-saved register area. Note that
// if non-zero spDelta, then this is the offset of the first save *after* that
// SP adjustment.
// spDelta - If non-zero, the amount to add to SP before the register saves (must be negative or
// zero).
//
// Return Value:
// None.
void CodeGen::genSaveCalleeSavedRegistersHelp(regMaskTP regsToSaveMask, int lowestCalleeSavedOffset, int spDelta)
{
assert(spDelta <= 0);
unsigned regsToSaveCount = genCountBits(regsToSaveMask);
if (regsToSaveCount == 0)
{
if (spDelta != 0)
{
// Currently this is the case for varargs only
// whose size is MAX_REG_ARG * REGSIZE_BYTES = 64 bytes.
genStackPointerAdjustment(spDelta, REG_NA, nullptr);
}
return;
}
assert((spDelta % 16) == 0);
assert((regsToSaveMask & RBM_FP) == 0); // we never save FP here
assert(regsToSaveCount <= genCountBits(RBM_CALLEE_SAVED | RBM_LR)); // We also save LR, even though it is not in
// RBM_CALLEE_SAVED.
regMaskTP maskSaveRegsFloat = regsToSaveMask & RBM_ALLFLOAT;
regMaskTP maskSaveRegsInt = regsToSaveMask & ~maskSaveRegsFloat;
int spOffset = lowestCalleeSavedOffset; // this is the offset *after* we change SP.
unsigned intRegsToSaveCount = genCountBits(maskSaveRegsInt);
unsigned floatRegsToSaveCount = genCountBits(maskSaveRegsFloat);
bool isPairSave = false;
#ifdef DEBUG
bool isRegsToSaveCountOdd = ((intRegsToSaveCount + floatRegsToSaveCount) % 2 != 0);
#endif
// Save the integer registers
bool lastSavedWasPair = false;
while (maskSaveRegsInt != RBM_NONE)
{
// If this is the first store that needs to change SP (spDelta != 0),
// then the offset must be 8 to account for alignment for the odd count
// or it must be 0 for the even count.
assert((spDelta == 0) || (isRegsToSaveCountOdd && spOffset == REGSIZE_BYTES) ||
(!isRegsToSaveCountOdd && spOffset == 0));
isPairSave = (intRegsToSaveCount >= 2);
regMaskTP reg1Mask = genFindLowestBit(maskSaveRegsInt);
regNumber reg1 = genRegNumFromMask(reg1Mask);
maskSaveRegsInt &= ~reg1Mask;
intRegsToSaveCount -= 1;
if (isPairSave)
{
// We can use a STP instruction.
regMaskTP reg2Mask = genFindLowestBit(maskSaveRegsInt);
regNumber reg2 = genRegNumFromMask(reg2Mask);
assert((reg2 == REG_NEXT(reg1)) || (reg2 == REG_LR));
maskSaveRegsInt &= ~reg2Mask;
intRegsToSaveCount -= 1;
genPrologSaveRegPair(reg1, reg2, spOffset, spDelta, lastSavedWasPair, REG_IP0, nullptr);
// TODO-ARM64-CQ: this code works in the prolog, but it's a bit weird to think about "next" when generating
// this epilog, to get the codes to match. Turn this off until that is better understood.
// lastSavedWasPair = true;
spOffset += 2 * REGSIZE_BYTES;
}
else
{
// No register pair; we use a STR instruction.
genPrologSaveReg(reg1, spOffset, spDelta, REG_IP0, nullptr);
lastSavedWasPair = false;
spOffset += REGSIZE_BYTES;
}
spDelta = 0; // We've now changed SP already, if necessary; don't do it again.
}
assert(intRegsToSaveCount == 0);
// Save the floating-point/SIMD registers
lastSavedWasPair = false;
while (maskSaveRegsFloat != RBM_NONE)
{
// If this is the first store that needs to change SP (spDelta != 0),
// then the offset must be 8 to account for alignment for the odd count
// or it must be 0 for the even count.
assert((spDelta == 0) || (isRegsToSaveCountOdd && spOffset == REGSIZE_BYTES) ||
(!isRegsToSaveCountOdd && spOffset == 0));
isPairSave = (floatRegsToSaveCount >= 2);
regMaskTP reg1Mask = genFindLowestBit(maskSaveRegsFloat);
regNumber reg1 = genRegNumFromMask(reg1Mask);
maskSaveRegsFloat &= ~reg1Mask;
floatRegsToSaveCount -= 1;
if (isPairSave)
{
// We can use a STP instruction.
regMaskTP reg2Mask = genFindLowestBit(maskSaveRegsFloat);
regNumber reg2 = genRegNumFromMask(reg2Mask);
assert(reg2 == REG_NEXT(reg1));
maskSaveRegsFloat &= ~reg2Mask;
floatRegsToSaveCount -= 1;
genPrologSaveRegPair(reg1, reg2, spOffset, spDelta, lastSavedWasPair, REG_IP0, nullptr);
// TODO-ARM64-CQ: this code works in the prolog, but it's a bit weird to think about "next" when generating
// this epilog, to get the codes to match. Turn this off until that is better understood.
// lastSavedWasPair = true;
spOffset += 2 * FPSAVE_REGSIZE_BYTES;
}
else
{
// No register pair; we use a STR instruction.
genPrologSaveReg(reg1, spOffset, spDelta, REG_IP0, nullptr);
lastSavedWasPair = false;
spOffset += FPSAVE_REGSIZE_BYTES;
}
spDelta = 0; // We've now changed SP already, if necessary; don't do it again.
}
assert(floatRegsToSaveCount == 0);
}
//------------------------------------------------------------------------
// genRestoreCalleeSavedRegistersHelp: Restore the callee-saved registers in 'regsToRestoreMask' from the stack frame
// in the function or funclet epilog. This exactly reverses the actions of genSaveCalleeSavedRegistersHelp().
//
// Arguments:
// regsToRestoreMask - The mask of callee-saved registers to restore. If empty, this function does nothing.
// lowestCalleeSavedOffset - The offset from SP that is the beginning of the callee-saved register area.
// spDelta - If non-zero, the amount to add to SP after the register restores (must be positive or
// zero).
//
// Here's an example restore sequence:
// ldp x27, x28, [sp,#96]
// ldp x25, x26, [sp,#80]
// ldp x23, x24, [sp,#64]
// ldp x21, x22, [sp,#48]
// ldp x19, x20, [sp,#32]
//
// For the case of non-zero spDelta, we assume the base of the callee-save registers to restore is at SP, and
// the last restore adjusts SP by the specified amount. For example:
// ldp x27, x28, [sp,#64]
// ldp x25, x26, [sp,#48]
// ldp x23, x24, [sp,#32]
// ldp x21, x22, [sp,#16]
// ldp x19, x20, [sp], #80
//
// Note you call the unwind functions specifying the prolog operation that is being un-done. So, for example, when
// generating a post-indexed load, you call the unwind function for specifying the corresponding preindexed store.
//
// Return Value:
// None.
void CodeGen::genRestoreCalleeSavedRegistersHelp(regMaskTP regsToRestoreMask, int lowestCalleeSavedOffset, int spDelta)
{
assert(spDelta >= 0);
unsigned regsToRestoreCount = genCountBits(regsToRestoreMask);
if (regsToRestoreCount == 0)
{
if (spDelta != 0)
{
// Currently this is the case for varargs only
// whose size is MAX_REG_ARG * REGSIZE_BYTES = 64 bytes.
genStackPointerAdjustment(spDelta, REG_NA, nullptr);
}
return;
}
assert((spDelta % 16) == 0);
assert((regsToRestoreMask & RBM_FP) == 0); // we never restore FP here
assert(regsToRestoreCount <=
genCountBits(RBM_CALLEE_SAVED | RBM_LR)); // We also save LR, even though it is not in RBM_CALLEE_SAVED.
regMaskTP maskRestoreRegsFloat = regsToRestoreMask & RBM_ALLFLOAT;
regMaskTP maskRestoreRegsInt = regsToRestoreMask & ~maskRestoreRegsFloat;
assert(REGSIZE_BYTES == FPSAVE_REGSIZE_BYTES);
int spOffset = lowestCalleeSavedOffset + regsToRestoreCount * REGSIZE_BYTES; // Point past the end, to start. We
// predecrement to find the offset to
// load from.
unsigned floatRegsToRestoreCount = genCountBits(maskRestoreRegsFloat);
unsigned intRegsToRestoreCount = genCountBits(maskRestoreRegsInt);
int stackDelta = 0;
bool isPairRestore = false;
bool thisIsTheLastRestoreInstruction = false;
#ifdef DEBUG
bool isRegsToRestoreCountOdd = ((floatRegsToRestoreCount + intRegsToRestoreCount) % 2 != 0);
#endif
// We want to restore in the opposite order we saved, so the unwind codes match. Be careful to handle odd numbers of
// callee-saved registers properly.
// Restore the floating-point/SIMD registers
while (maskRestoreRegsFloat != RBM_NONE)
{
thisIsTheLastRestoreInstruction = (floatRegsToRestoreCount <= 2) && (maskRestoreRegsInt == RBM_NONE);
isPairRestore = (floatRegsToRestoreCount % 2) == 0;
// Update stack delta only if it is the last restore (the first save).
if (thisIsTheLastRestoreInstruction)
{
assert(stackDelta == 0);
stackDelta = spDelta;
}
// Update stack offset.
if (isPairRestore)
{
spOffset -= 2 * FPSAVE_REGSIZE_BYTES;
}
else
{
spOffset -= FPSAVE_REGSIZE_BYTES;
}
// If this is the last restore (the first save) that needs to change SP (stackDelta != 0),
// then the offset must be 8 to account for alignment for the odd count
// or it must be 0 for the even count.
assert((stackDelta == 0) || (isRegsToRestoreCountOdd && spOffset == FPSAVE_REGSIZE_BYTES) ||
(!isRegsToRestoreCountOdd && spOffset == 0));
regMaskTP reg2Mask = genFindHighestBit(maskRestoreRegsFloat);
regNumber reg2 = genRegNumFromMask(reg2Mask);
maskRestoreRegsFloat &= ~reg2Mask;
floatRegsToRestoreCount -= 1;
if (isPairRestore)
{
regMaskTP reg1Mask = genFindHighestBit(maskRestoreRegsFloat);
regNumber reg1 = genRegNumFromMask(reg1Mask);
maskRestoreRegsFloat &= ~reg1Mask;
floatRegsToRestoreCount -= 1;
genEpilogRestoreRegPair(reg1, reg2, spOffset, stackDelta, REG_IP1, nullptr);
}
else
{
genEpilogRestoreReg(reg2, spOffset, stackDelta, REG_IP1, nullptr);
}
}
assert(floatRegsToRestoreCount == 0);
// Restore the integer registers
while (maskRestoreRegsInt != RBM_NONE)
{
thisIsTheLastRestoreInstruction = (intRegsToRestoreCount <= 2);
isPairRestore = (intRegsToRestoreCount % 2) == 0;
// Update stack delta only if it is the last restore (the first save).
if (thisIsTheLastRestoreInstruction)
{
assert(stackDelta == 0);
stackDelta = spDelta;
}
// Update stack offset.
spOffset -= REGSIZE_BYTES;
if (isPairRestore)
{
spOffset -= REGSIZE_BYTES;
}
// If this is the last restore (the first save) that needs to change SP (stackDelta != 0),
// then the offset must be 8 to account for alignment for the odd count
// or it must be 0 for the even count.
assert((stackDelta == 0) || (isRegsToRestoreCountOdd && spOffset == REGSIZE_BYTES) ||
(!isRegsToRestoreCountOdd && spOffset == 0));
regMaskTP reg2Mask = genFindHighestBit(maskRestoreRegsInt);
regNumber reg2 = genRegNumFromMask(reg2Mask);
maskRestoreRegsInt &= ~reg2Mask;
intRegsToRestoreCount -= 1;
if (isPairRestore)
{
regMaskTP reg1Mask = genFindHighestBit(maskRestoreRegsInt);
regNumber reg1 = genRegNumFromMask(reg1Mask);
maskRestoreRegsInt &= ~reg1Mask;
intRegsToRestoreCount -= 1;
genEpilogRestoreRegPair(reg1, reg2, spOffset, stackDelta, REG_IP1, nullptr);
}
else
{
genEpilogRestoreReg(reg2, spOffset, stackDelta, REG_IP1, nullptr);
}
}
assert(intRegsToRestoreCount == 0);
}
// clang-format off
/*****************************************************************************
*
* Generates code for an EH funclet prolog.
*
* Funclets have the following incoming arguments:
*
* catch: x0 = the exception object that was caught (see GT_CATCH_ARG)
* filter: x0 = the exception object to filter (see GT_CATCH_ARG), x1 = CallerSP of the containing function
* finally/fault: none
*
* Funclets set the following registers on exit:
*
* catch: x0 = the address at which execution should resume (see BBJ_EHCATCHRET)
* filter: x0 = non-zero if the handler should handle the exception, zero otherwise (see GT_RETFILT)
* finally/fault: none
*
* The ARM64 funclet prolog sequence is one of the following (Note: #framesz is total funclet frame size,
* including everything; #outsz is outgoing argument space. #framesz must be a multiple of 16):
*
* Frame type 1:
* For #outsz == 0 and #framesz <= 512:
* stp fp,lr,[sp,-#framesz]! ; establish the frame, save FP/LR
* stp x19,x20,[sp,#xxx] ; save callee-saved registers, as necessary
*
* The funclet frame is thus:
*
* | |
* |-----------------------|
* | incoming |
* | arguments |
* +=======================+ <---- Caller's SP
* |Callee saved registers | // multiple of 8 bytes
* |-----------------------|
* | PSP slot | // 8 bytes (omitted in CoreRT ABI)
* |-----------------------|
* ~ alignment padding ~ // To make the whole frame 16 byte aligned.
* |-----------------------|
* | Saved FP, LR | // 16 bytes
* |-----------------------| <---- Ambient SP
* | | |
* ~ | Stack grows ~
* | | downward |
* V
*
* Frame type 2:
* For #outsz != 0 and #framesz <= 512:
* sub sp,sp,#framesz ; establish the frame
* stp fp,lr,[sp,#outsz] ; save FP/LR.
* stp x19,x20,[sp,#xxx] ; save callee-saved registers, as necessary
*
* The funclet frame is thus:
*
* | |
* |-----------------------|
* | incoming |
* | arguments |
* +=======================+ <---- Caller's SP
* |Callee saved registers | // multiple of 8 bytes
* |-----------------------|
* | PSP slot | // 8 bytes (omitted in CoreRT ABI)
* |-----------------------|
* ~ alignment padding ~ // To make the whole frame 16 byte aligned.
* |-----------------------|
* | Saved FP, LR | // 16 bytes
* |-----------------------|
* | Outgoing arg space | // multiple of 8 bytes
* |-----------------------| <---- Ambient SP
* | | |
* ~ | Stack grows ~
* | | downward |
* V
*
* Frame type 3:
* For #framesz > 512:
* stp fp,lr,[sp,- (#framesz - #outsz)]! ; establish the frame, save FP/LR: note that it is guaranteed here that (#framesz - #outsz) <= 168
* stp x19,x20,[sp,#xxx] ; save callee-saved registers, as necessary
* sub sp,sp,#outsz ; create space for outgoing argument space
*
* The funclet frame is thus:
*
* | |
* |-----------------------|
* | incoming |
* | arguments |
* +=======================+ <---- Caller's SP
* |Callee saved registers | // multiple of 8 bytes
* |-----------------------|
* | PSP slot | // 8 bytes (omitted in CoreRT ABI)
* |-----------------------|
* ~ alignment padding ~ // To make the first SP subtraction 16 byte aligned
* |-----------------------|
* | Saved FP, LR | // 16 bytes
* |-----------------------|
* ~ alignment padding ~ // To make the whole frame 16 byte aligned (specifically, to 16-byte align the outgoing argument space).
* |-----------------------|
* | Outgoing arg space | // multiple of 8 bytes
* |-----------------------| <---- Ambient SP
* | | |
* ~ | Stack grows ~
* | | downward |
* V
*
* Both #1 and #2 only change SP once. That means that there will be a maximum of one alignment slot needed. For the general case, #3,
* it is possible that we will need to add alignment to both changes to SP, leading to 16 bytes of alignment. Remember that the stack
* pointer needs to be 16 byte aligned at all times. The size of the PSP slot plus callee-saved registers space is a maximum of 168 bytes:
* (1 PSP slot + 12 integer registers + 8 FP/SIMD registers) * 8 bytes. The outgoing argument size, however, can be very large, if we call a
* function that takes a large number of arguments (note that we currently use the same outgoing argument space size in the funclet as for the main
* function, even if the funclet doesn't have any calls, or has a much smaller, or larger, maximum number of outgoing arguments for any call).
* In that case, we need to 16-byte align the initial change to SP, before saving off the callee-saved registers and establishing the PSPsym,
* so we can use the limited immediate offset encodings we have available, before doing another 16-byte aligned SP adjustment to create the
* outgoing argument space. Both changes to SP might need to add alignment padding.
*
* Note that in all cases, the PSPSym is in exactly the same position with respect to Caller-SP, and that location is the same relative to Caller-SP
* as in the main function.
*
* ; After this header, fill the PSP slot, for use by the VM (it gets reported with the GC info), or by code generation of nested filters.
* ; This is not part of the "OS prolog"; it has no associated unwind data, and is not reversed in the funclet epilog.
*
* if (this is a filter funclet)
* {
* // x1 on entry to a filter funclet is CallerSP of the containing function:
* // either the main function, or the funclet for a handler that this filter is dynamically nested within.
* // Note that a filter can be dynamically nested within a funclet even if it is not statically within
* // a funclet. Consider:
* //
* // try {
* // try {
* // throw new Exception();
* // } catch(Exception) {
* // throw new Exception(); // The exception thrown here ...
* // }
* // } filter { // ... will be processed here, while the "catch" funclet frame is still on the stack
* // } filter-handler {
* // }
* //
* // Because of this, we need a PSP in the main function anytime a filter funclet doesn't know whether the enclosing frame will
* // be a funclet or main function. We won't know any time there is a filter protecting nested EH. To simplify, we just always
* // create a main function PSP for any function with a filter.
*
* ldr x1, [x1, #CallerSP_to_PSP_slot_delta] ; Load the CallerSP of the main function (stored in the PSP of the dynamically containing funclet or function)
* str x1, [sp, #SP_to_PSP_slot_delta] ; store the PSP
* add fp, x1, #Function_CallerSP_to_FP_delta ; re-establish the frame pointer
* }
* else
* {
* // This is NOT a filter funclet. The VM re-establishes the frame pointer on entry.
* // TODO-ARM64-CQ: if VM set x1 to CallerSP on entry, like for filters, we could save an instruction.
*
* add x3, fp, #Function_FP_to_CallerSP_delta ; compute the CallerSP, given the frame pointer. x3 is scratch.
* str x3, [sp, #SP_to_PSP_slot_delta] ; store the PSP
* }
*
* An example epilog sequence is then:
*
* add sp,sp,#outsz ; if any outgoing argument space
* ... ; restore callee-saved registers
* ldp x19,x20,[sp,#xxx]
* ldp fp,lr,[sp],#framesz
* ret lr
*
* The funclet frame is thus:
*
* | |
* |-----------------------|
* | incoming |
* | arguments |
* +=======================+ <---- Caller's SP
* |Callee saved registers | // multiple of 8 bytes
* |-----------------------|
* | PSP slot | // 8 bytes (omitted in CoreRT ABI)
* |-----------------------|
* | Saved FP, LR | // 16 bytes
* |-----------------------|
* ~ alignment padding ~ // To make the whole frame 16 byte aligned.
* |-----------------------|
* | Outgoing arg space | // multiple of 8 bytes
* |-----------------------| <---- Ambient SP
* | | |
* ~ | Stack grows ~
* | | downward |
* V
*/
// clang-format on
void CodeGen::genFuncletProlog(BasicBlock* block)
{
#ifdef DEBUG
if (verbose)
printf("*************** In genFuncletProlog()\n");
#endif
assert(block != NULL);
assert(block->bbFlags & BBF_FUNCLET_BEG);
ScopedSetVariable<bool> _setGeneratingProlog(&compiler->compGeneratingProlog, true);
gcInfo.gcResetForBB();
compiler->unwindBegProlog();
regMaskTP maskSaveRegsFloat = genFuncletInfo.fiSaveRegs & RBM_ALLFLOAT;
regMaskTP maskSaveRegsInt = genFuncletInfo.fiSaveRegs & ~maskSaveRegsFloat;
// Funclets must always save LR and FP, since when we have funclets we must have an FP frame.
assert((maskSaveRegsInt & RBM_LR) != 0);
assert((maskSaveRegsInt & RBM_FP) != 0);
bool isFilter = (block->bbCatchTyp == BBCT_FILTER);
regMaskTP maskArgRegsLiveIn;
if (isFilter)
{
maskArgRegsLiveIn = RBM_R0 | RBM_R1;
}
else if ((block->bbCatchTyp == BBCT_FINALLY) || (block->bbCatchTyp == BBCT_FAULT))
{
maskArgRegsLiveIn = RBM_NONE;
}
else
{
maskArgRegsLiveIn = RBM_R0;
}
int lowestCalleeSavedOffset = genFuncletInfo.fiSP_to_CalleeSave_delta;
if (genFuncletInfo.fiFrameType == 1)
{
getEmitter()->emitIns_R_R_R_I(INS_stp, EA_PTRSIZE, REG_FP, REG_LR, REG_SPBASE, genFuncletInfo.fiSpDelta1,
INS_OPTS_PRE_INDEX);
compiler->unwindSaveRegPairPreindexed(REG_FP, REG_LR, genFuncletInfo.fiSpDelta1);
assert(genFuncletInfo.fiSpDelta2 == 0);
assert(genFuncletInfo.fiSP_to_FPLR_save_delta == 0);
}
else if (genFuncletInfo.fiFrameType == 2)
{
// fiFrameType==2 constraints:
assert(genFuncletInfo.fiSpDelta1 < 0);
assert(genFuncletInfo.fiSpDelta1 >= -512);
// generate sub SP,SP,imm
genStackPointerAdjustment(genFuncletInfo.fiSpDelta1, REG_NA, nullptr);
assert(genFuncletInfo.fiSpDelta2 == 0);
getEmitter()->emitIns_R_R_R_I(INS_stp, EA_PTRSIZE, REG_FP, REG_LR, REG_SPBASE,
genFuncletInfo.fiSP_to_FPLR_save_delta);
compiler->unwindSaveRegPair(REG_FP, REG_LR, genFuncletInfo.fiSP_to_FPLR_save_delta);
}
else
{
assert(genFuncletInfo.fiFrameType == 3);
getEmitter()->emitIns_R_R_R_I(INS_stp, EA_PTRSIZE, REG_FP, REG_LR, REG_SPBASE, genFuncletInfo.fiSpDelta1,
INS_OPTS_PRE_INDEX);
compiler->unwindSaveRegPairPreindexed(REG_FP, REG_LR, genFuncletInfo.fiSpDelta1);
lowestCalleeSavedOffset += genFuncletInfo.fiSpDelta2; // We haven't done the second adjustment of SP yet.
}
maskSaveRegsInt &= ~(RBM_LR | RBM_FP); // We've saved these now
genSaveCalleeSavedRegistersHelp(maskSaveRegsInt | maskSaveRegsFloat, lowestCalleeSavedOffset, 0);
if (genFuncletInfo.fiFrameType == 3)
{
// Note that genFuncletInfo.fiSpDelta2 is always a negative value
assert(genFuncletInfo.fiSpDelta2 < 0);
// generate sub SP,SP,imm
genStackPointerAdjustment(genFuncletInfo.fiSpDelta2, REG_R2, nullptr);
}
// This is the end of the OS-reported prolog for purposes of unwinding
compiler->unwindEndProlog();
// If there is no PSPSym (CoreRT ABI), we are done.
if (compiler->lvaPSPSym == BAD_VAR_NUM)
{
return;
}
if (isFilter)
{
// This is the first block of a filter
// Note that register x1 = CallerSP of the containing function
// X1 is overwritten by the first Load (new callerSP)
// X2 is scratch when we have a large constant offset
// Load the CallerSP of the main function (stored in the PSP of the dynamically containing funclet or function)
genInstrWithConstant(ins_Load(TYP_I_IMPL), EA_PTRSIZE, REG_R1, REG_R1,
genFuncletInfo.fiCallerSP_to_PSP_slot_delta, REG_R2, false);
regTracker.rsTrackRegTrash(REG_R1);
// Store the PSP value (aka CallerSP)
genInstrWithConstant(ins_Store(TYP_I_IMPL), EA_PTRSIZE, REG_R1, REG_SPBASE,
genFuncletInfo.fiSP_to_PSP_slot_delta, REG_R2, false);
// re-establish the frame pointer
genInstrWithConstant(INS_add, EA_PTRSIZE, REG_FPBASE, REG_R1, genFuncletInfo.fiFunction_CallerSP_to_FP_delta,
REG_R2, false);
}
else // This is a non-filter funclet
{
// X3 is scratch, X2 can also become scratch
// compute the CallerSP, given the frame pointer. x3 is scratch.
genInstrWithConstant(INS_add, EA_PTRSIZE, REG_R3, REG_FPBASE, -genFuncletInfo.fiFunction_CallerSP_to_FP_delta,
REG_R2, false);
regTracker.rsTrackRegTrash(REG_R3);
genInstrWithConstant(ins_Store(TYP_I_IMPL), EA_PTRSIZE, REG_R3, REG_SPBASE,
genFuncletInfo.fiSP_to_PSP_slot_delta, REG_R2, false);
}
}
/*****************************************************************************
*
* Generates code for an EH funclet epilog.
*/
void CodeGen::genFuncletEpilog()
{
#ifdef DEBUG
if (verbose)
printf("*************** In genFuncletEpilog()\n");
#endif
ScopedSetVariable<bool> _setGeneratingEpilog(&compiler->compGeneratingEpilog, true);
bool unwindStarted = false;
if (!unwindStarted)
{
// We can delay this until we know we'll generate an unwindable instruction, if necessary.
compiler->unwindBegEpilog();
unwindStarted = true;
}
regMaskTP maskRestoreRegsFloat = genFuncletInfo.fiSaveRegs & RBM_ALLFLOAT;
regMaskTP maskRestoreRegsInt = genFuncletInfo.fiSaveRegs & ~maskRestoreRegsFloat;
// Funclets must always save LR and FP, since when we have funclets we must have an FP frame.
assert((maskRestoreRegsInt & RBM_LR) != 0);
assert((maskRestoreRegsInt & RBM_FP) != 0);
maskRestoreRegsInt &= ~(RBM_LR | RBM_FP); // We restore FP/LR at the end
int lowestCalleeSavedOffset = genFuncletInfo.fiSP_to_CalleeSave_delta;
if (genFuncletInfo.fiFrameType == 3)
{
// Note that genFuncletInfo.fiSpDelta2 is always a negative value
assert(genFuncletInfo.fiSpDelta2 < 0);
// generate add SP,SP,imm
genStackPointerAdjustment(-genFuncletInfo.fiSpDelta2, REG_R2, nullptr);
lowestCalleeSavedOffset += genFuncletInfo.fiSpDelta2;
}
regMaskTP regsToRestoreMask = maskRestoreRegsInt | maskRestoreRegsFloat;
genRestoreCalleeSavedRegistersHelp(regsToRestoreMask, lowestCalleeSavedOffset, 0);
if (genFuncletInfo.fiFrameType == 1)
{
getEmitter()->emitIns_R_R_R_I(INS_ldp, EA_PTRSIZE, REG_FP, REG_LR, REG_SPBASE, -genFuncletInfo.fiSpDelta1,
INS_OPTS_POST_INDEX);
compiler->unwindSaveRegPairPreindexed(REG_FP, REG_LR, genFuncletInfo.fiSpDelta1);
assert(genFuncletInfo.fiSpDelta2 == 0);
assert(genFuncletInfo.fiSP_to_FPLR_save_delta == 0);
}
else if (genFuncletInfo.fiFrameType == 2)
{
getEmitter()->emitIns_R_R_R_I(INS_ldp, EA_PTRSIZE, REG_FP, REG_LR, REG_SPBASE,
genFuncletInfo.fiSP_to_FPLR_save_delta);
compiler->unwindSaveRegPair(REG_FP, REG_LR, genFuncletInfo.fiSP_to_FPLR_save_delta);
// fiFrameType==2 constraints:
assert(genFuncletInfo.fiSpDelta1 < 0);
assert(genFuncletInfo.fiSpDelta1 >= -512);
// generate add SP,SP,imm
genStackPointerAdjustment(-genFuncletInfo.fiSpDelta1, REG_NA, nullptr);
assert(genFuncletInfo.fiSpDelta2 == 0);
}
else
{
assert(genFuncletInfo.fiFrameType == 3);
getEmitter()->emitIns_R_R_R_I(INS_ldp, EA_PTRSIZE, REG_FP, REG_LR, REG_SPBASE, -genFuncletInfo.fiSpDelta1,
INS_OPTS_POST_INDEX);
compiler->unwindSaveRegPairPreindexed(REG_FP, REG_LR, genFuncletInfo.fiSpDelta1);
}
inst_RV(INS_ret, REG_LR, TYP_I_IMPL);
compiler->unwindReturn(REG_LR);
compiler->unwindEndEpilog();
}
/*****************************************************************************
*
* Capture the information used to generate the funclet prologs and epilogs.
* Note that all funclet prologs are identical, and all funclet epilogs are
* identical (per type: filters are identical, and non-filters are identical).
* Thus, we compute the data used for these just once.
*
* See genFuncletProlog() for more information about the prolog/epilog sequences.
*/
void CodeGen::genCaptureFuncletPrologEpilogInfo()
{
if (!compiler->ehAnyFunclets())
return;
assert(isFramePointerUsed());
assert(compiler->lvaDoneFrameLayout == Compiler::FINAL_FRAME_LAYOUT); // The frame size and offsets must be
// finalized
genFuncletInfo.fiFunction_CallerSP_to_FP_delta = genCallerSPtoFPdelta();
regMaskTP rsMaskSaveRegs = regSet.rsMaskCalleeSaved;
assert((rsMaskSaveRegs & RBM_LR) != 0);
assert((rsMaskSaveRegs & RBM_FP) != 0);
unsigned PSPSize = (compiler->lvaPSPSym != BAD_VAR_NUM) ? REGSIZE_BYTES : 0;
unsigned saveRegsCount = genCountBits(rsMaskSaveRegs);
unsigned saveRegsPlusPSPSize = saveRegsCount * REGSIZE_BYTES + PSPSize;
if (compiler->info.compIsVarArgs)
{
// For varargs we always save all of the integer register arguments
// so that they are contiguous with the incoming stack arguments.
saveRegsPlusPSPSize += MAX_REG_ARG * REGSIZE_BYTES;
}
unsigned saveRegsPlusPSPSizeAligned = (unsigned)roundUp(saveRegsPlusPSPSize, STACK_ALIGN);
assert(compiler->lvaOutgoingArgSpaceSize % REGSIZE_BYTES == 0);
unsigned outgoingArgSpaceAligned = (unsigned)roundUp(compiler->lvaOutgoingArgSpaceSize, STACK_ALIGN);
unsigned maxFuncletFrameSizeAligned = saveRegsPlusPSPSizeAligned + outgoingArgSpaceAligned;
assert((maxFuncletFrameSizeAligned % STACK_ALIGN) == 0);
int SP_to_FPLR_save_delta;
int SP_to_PSP_slot_delta;
int CallerSP_to_PSP_slot_delta;
if (maxFuncletFrameSizeAligned <= 512)
{
unsigned funcletFrameSize = saveRegsPlusPSPSize + compiler->lvaOutgoingArgSpaceSize;
unsigned funcletFrameSizeAligned = (unsigned)roundUp(funcletFrameSize, STACK_ALIGN);
assert(funcletFrameSizeAligned <= maxFuncletFrameSizeAligned);
unsigned funcletFrameAlignmentPad = funcletFrameSizeAligned - funcletFrameSize;
assert((funcletFrameAlignmentPad == 0) || (funcletFrameAlignmentPad == REGSIZE_BYTES));
SP_to_FPLR_save_delta = compiler->lvaOutgoingArgSpaceSize;
SP_to_PSP_slot_delta = SP_to_FPLR_save_delta + 2 /* FP, LR */ * REGSIZE_BYTES + funcletFrameAlignmentPad;
CallerSP_to_PSP_slot_delta = -(int)(saveRegsPlusPSPSize - 2 /* FP, LR */ * REGSIZE_BYTES);
if (compiler->lvaOutgoingArgSpaceSize == 0)
{
genFuncletInfo.fiFrameType = 1;
}
else
{
genFuncletInfo.fiFrameType = 2;
}
genFuncletInfo.fiSpDelta1 = -(int)funcletFrameSizeAligned;
genFuncletInfo.fiSpDelta2 = 0;
assert(genFuncletInfo.fiSpDelta1 + genFuncletInfo.fiSpDelta2 == -(int)funcletFrameSizeAligned);
}
else
{
unsigned saveRegsPlusPSPAlignmentPad = saveRegsPlusPSPSizeAligned - saveRegsPlusPSPSize;
assert((saveRegsPlusPSPAlignmentPad == 0) || (saveRegsPlusPSPAlignmentPad == REGSIZE_BYTES));
SP_to_FPLR_save_delta = outgoingArgSpaceAligned;
SP_to_PSP_slot_delta = SP_to_FPLR_save_delta + 2 /* FP, LR */ * REGSIZE_BYTES + saveRegsPlusPSPAlignmentPad;
CallerSP_to_PSP_slot_delta =
-(int)(saveRegsPlusPSPSizeAligned - 2 /* FP, LR */ * REGSIZE_BYTES - saveRegsPlusPSPAlignmentPad);
genFuncletInfo.fiFrameType = 3;
genFuncletInfo.fiSpDelta1 = -(int)saveRegsPlusPSPSizeAligned;
genFuncletInfo.fiSpDelta2 = -(int)outgoingArgSpaceAligned;
assert(genFuncletInfo.fiSpDelta1 + genFuncletInfo.fiSpDelta2 == -(int)maxFuncletFrameSizeAligned);
}
/* Now save it for future use */
genFuncletInfo.fiSaveRegs = rsMaskSaveRegs;
genFuncletInfo.fiSP_to_FPLR_save_delta = SP_to_FPLR_save_delta;
genFuncletInfo.fiSP_to_PSP_slot_delta = SP_to_PSP_slot_delta;
genFuncletInfo.fiSP_to_CalleeSave_delta = SP_to_PSP_slot_delta + REGSIZE_BYTES;
genFuncletInfo.fiCallerSP_to_PSP_slot_delta = CallerSP_to_PSP_slot_delta;
#ifdef DEBUG
if (verbose)
{
printf("\n");
printf("Funclet prolog / epilog info\n");
printf(" Save regs: ");
dspRegMask(genFuncletInfo.fiSaveRegs);
printf("\n");
printf(" Function CallerSP-to-FP delta: %d\n", genFuncletInfo.fiFunction_CallerSP_to_FP_delta);
printf(" SP to FP/LR save location delta: %d\n", genFuncletInfo.fiSP_to_FPLR_save_delta);
printf(" SP to PSP slot delta: %d\n", genFuncletInfo.fiSP_to_PSP_slot_delta);
printf(" SP to callee-saved area delta: %d\n", genFuncletInfo.fiSP_to_CalleeSave_delta);
printf(" Caller SP to PSP slot delta: %d\n", genFuncletInfo.fiCallerSP_to_PSP_slot_delta);
printf(" Frame type: %d\n", genFuncletInfo.fiFrameType);
printf(" SP delta 1: %d\n", genFuncletInfo.fiSpDelta1);
printf(" SP delta 2: %d\n", genFuncletInfo.fiSpDelta2);
if (compiler->lvaPSPSym != BAD_VAR_NUM)
{
if (CallerSP_to_PSP_slot_delta !=
compiler->lvaGetCallerSPRelativeOffset(compiler->lvaPSPSym)) // for debugging
{
printf("lvaGetCallerSPRelativeOffset(lvaPSPSym): %d\n",
compiler->lvaGetCallerSPRelativeOffset(compiler->lvaPSPSym));
}
}
}
assert(genFuncletInfo.fiSP_to_FPLR_save_delta >= 0);
assert(genFuncletInfo.fiSP_to_PSP_slot_delta >= 0);
assert(genFuncletInfo.fiSP_to_CalleeSave_delta >= 0);
assert(genFuncletInfo.fiCallerSP_to_PSP_slot_delta <= 0);
if (compiler->lvaPSPSym != BAD_VAR_NUM)
{
assert(genFuncletInfo.fiCallerSP_to_PSP_slot_delta ==
compiler->lvaGetCallerSPRelativeOffset(compiler->lvaPSPSym)); // same offset used in main function and
// funclet!
}
#endif // DEBUG
}
/*
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
XX XX
XX End Prolog / Epilog XX
XX XX
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
*/
BasicBlock* CodeGen::genCallFinally(BasicBlock* block)
{
// Generate a call to the finally, like this:
// mov x0,qword ptr [fp + 10H] / sp // Load x0 with PSPSym, or sp if PSPSym is not used
// bl finally-funclet
// b finally-return // Only for non-retless finally calls
// The 'b' can be a NOP if we're going to the next block.
if (compiler->lvaPSPSym != BAD_VAR_NUM)
{
getEmitter()->emitIns_R_S(ins_Load(TYP_I_IMPL), EA_PTRSIZE, REG_R0, compiler->lvaPSPSym, 0);
}
else
{
getEmitter()->emitIns_R_R(INS_mov, EA_PTRSIZE, REG_R0, REG_SPBASE);
}
getEmitter()->emitIns_J(INS_bl_local, block->bbJumpDest);
if (block->bbFlags & BBF_RETLESS_CALL)
{
// We have a retless call, and the last instruction generated was a call.
// If the next block is in a different EH region (or is the end of the code
// block), then we need to generate a breakpoint here (since it will never
// get executed) to get proper unwind behavior.
if ((block->bbNext == nullptr) || !BasicBlock::sameEHRegion(block, block->bbNext))
{
instGen(INS_bkpt); // This should never get executed
}
}
else
{
// Because of the way the flowgraph is connected, the liveness info for this one instruction
// after the call is not (can not be) correct in cases where a variable has a last use in the
// handler. So turn off GC reporting for this single instruction.
getEmitter()->emitDisableGC();
// Now go to where the finally funclet needs to return to.
if (block->bbNext->bbJumpDest == block->bbNext->bbNext)
{
// Fall-through.
// TODO-ARM64-CQ: Can we get rid of this instruction, and just have the call return directly
// to the next instruction? This would depend on stack walking from within the finally
// handler working without this instruction being in this special EH region.
instGen(INS_nop);
}
else
{
inst_JMP(EJ_jmp, block->bbNext->bbJumpDest);
}
getEmitter()->emitEnableGC();
}
// The BBJ_ALWAYS is used because the BBJ_CALLFINALLY can't point to the
// jump target using bbJumpDest - that is already used to point
// to the finally block. So just skip past the BBJ_ALWAYS unless the
// block is RETLESS.
if (!(block->bbFlags & BBF_RETLESS_CALL))
{
assert(block->isBBCallAlwaysPair());
block = block->bbNext;
}
return block;
}
void CodeGen::genEHCatchRet(BasicBlock* block)
{
// For long address (default): `adrp + add` will be emitted.
// For short address (proven later): `adr` will be emitted.
getEmitter()->emitIns_R_L(INS_adr, EA_PTRSIZE, block->bbJumpDest, REG_INTRET);
}
// move an immediate value into an integer register
void CodeGen::instGen_Set_Reg_To_Imm(emitAttr size, regNumber reg, ssize_t imm, insFlags flags)
{
// reg cannot be a FP register
assert(!genIsValidFloatReg(reg));
if (!compiler->opts.compReloc)
{
size = EA_SIZE(size); // Strip any Reloc flags from size if we aren't doing relocs
}
if (EA_IS_RELOC(size))
{
// This emits a pair of adrp/add (two instructions) with fix-ups.
getEmitter()->emitIns_R_AI(INS_adrp, size, reg, imm);
}
else if (imm == 0)
{
instGen_Set_Reg_To_Zero(size, reg, flags);
}
else
{
if (emitter::emitIns_valid_imm_for_mov(imm, size))
{
getEmitter()->emitIns_R_I(INS_mov, size, reg, imm);
}
else
{
// Arm64 allows any arbitrary 16-bit constant to be loaded into a register halfword
// There are three forms
// movk which loads into any halfword preserving the remaining halfwords
// movz which loads into any halfword zeroing the remaining halfwords
// movn which loads into any halfword zeroing the remaining halfwords then bitwise inverting the register
// In some cases it is preferable to use movn, because it has the side effect of filling the other halfwords
// with ones
// Determine whether movn or movz will require the fewest instructions to populate the immediate
int preferMovn = 0;
for (int i = (size == EA_8BYTE) ? 48 : 16; i >= 0; i -= 16)
{
if (uint16_t(imm >> i) == 0xffff)
++preferMovn; // a single movk 0xffff could be skipped if movn was used
else if (uint16_t(imm >> i) == 0x0000)
--preferMovn; // a single movk 0 could be skipped if movz was used
}
// Select the first instruction. Any additional instruction will use movk
instruction ins = (preferMovn > 0) ? INS_movn : INS_movz;
// Initial movz or movn will fill the remaining bytes with the skipVal
// This can allow skipping filling a halfword
uint16_t skipVal = (preferMovn > 0) ? 0xffff : 0;
unsigned bits = (size == EA_8BYTE) ? 64 : 32;
// Iterate over imm examining 16 bits at a time
for (unsigned i = 0; i < bits; i += 16)
{
uint16_t imm16 = uint16_t(imm >> i);
if (imm16 != skipVal)
{
if (ins == INS_movn)
{
// For the movn case, we need to bitwise invert the immediate. This is because
// (movn x0, ~imm16) === (movz x0, imm16; or x0, x0, #0xffff`ffff`ffff`0000)
imm16 = ~imm16;
}
getEmitter()->emitIns_R_I_I(ins, size, reg, imm16, i, INS_OPTS_LSL);
// Once the initial movz/movn is emitted the remaining instructions will all use movk
ins = INS_movk;
}
}
// We must emit a movn or movz or we have not done anything
// The cases which hit this assert should be (emitIns_valid_imm_for_mov() == true) and
// should not be in this else condition
assert(ins == INS_movk);
}
// The caller may have requested that the flags be set on this mov (rarely/never)
if (flags == INS_FLAGS_SET)
{
getEmitter()->emitIns_R_I(INS_tst, size, reg, 0);
}
}
regTracker.rsTrackRegIntCns(reg, imm);
}
/***********************************************************************************
*
* Generate code to set a register 'targetReg' of type 'targetType' to the constant
* specified by the constant (GT_CNS_INT or GT_CNS_DBL) in 'tree'. This does not call
* genProduceReg() on the target register.
*/
void CodeGen::genSetRegToConst(regNumber targetReg, var_types targetType, GenTree* tree)
{
switch (tree->gtOper)
{
case GT_CNS_INT:
{
// relocatable values tend to come down as a CNS_INT of native int type
// so the line between these two opcodes is kind of blurry
GenTreeIntConCommon* con = tree->AsIntConCommon();
ssize_t cnsVal = con->IconValue();
if (con->ImmedValNeedsReloc(compiler))
{
instGen_Set_Reg_To_Imm(EA_HANDLE_CNS_RELOC, targetReg, cnsVal);
regTracker.rsTrackRegTrash(targetReg);
}
else
{
genSetRegToIcon(targetReg, cnsVal, targetType);
}
}
break;
case GT_CNS_DBL:
{
emitter* emit = getEmitter();
emitAttr size = emitActualTypeSize(tree);
double constValue = tree->AsDblCon()->gtDconVal;
// Make sure we use "movi reg, 0x00" only for positive zero (0.0) and not for negative zero (-0.0)
if (*(__int64*)&constValue == 0)
{
// A faster/smaller way to generate 0.0
// We will just zero out the entire vector register for both float and double
emit->emitIns_R_I(INS_movi, EA_16BYTE, targetReg, 0x00, INS_OPTS_16B);
}
else if (emitter::emitIns_valid_imm_for_fmov(constValue))
{
// We can load the FP constant using the fmov FP-immediate for this constValue
emit->emitIns_R_F(INS_fmov, size, targetReg, constValue);
}
else
{
// Get a temp integer register to compute long address.
regNumber addrReg = tree->GetSingleTempReg();
// We must load the FP constant from the constant pool
// Emit a data section constant for the float or double constant.
CORINFO_FIELD_HANDLE hnd = emit->emitFltOrDblConst(constValue, size);
// For long address (default): `adrp + ldr + fmov` will be emitted.
// For short address (proven later), `ldr` will be emitted.
emit->emitIns_R_C(INS_ldr, size, targetReg, addrReg, hnd, 0);
}
}
break;
default:
unreached();
}
}
// Generate code to get the high N bits of a N*N=2N bit multiplication result
void CodeGen::genCodeForMulHi(GenTreeOp* treeNode)
{
assert(!treeNode->gtOverflowEx());
genConsumeOperands(treeNode);
regNumber targetReg = treeNode->gtRegNum;
var_types targetType = treeNode->TypeGet();
emitter* emit = getEmitter();
emitAttr attr = emitActualTypeSize(treeNode);
unsigned isUnsigned = (treeNode->gtFlags & GTF_UNSIGNED);
GenTree* op1 = treeNode->gtGetOp1();
GenTree* op2 = treeNode->gtGetOp2();
assert(!varTypeIsFloating(targetType));
// The arithmetic node must be sitting in a register (since it's not contained)
assert(targetReg != REG_NA);
if (EA_SIZE(attr) == EA_8BYTE)
{
instruction ins = isUnsigned ? INS_umulh : INS_smulh;
regNumber r = emit->emitInsTernary(ins, attr, treeNode, op1, op2);
assert(r == targetReg);
}
else
{
assert(EA_SIZE(attr) == EA_4BYTE);
instruction ins = isUnsigned ? INS_umull : INS_smull;
regNumber r = emit->emitInsTernary(ins, EA_4BYTE, treeNode, op1, op2);
emit->emitIns_R_R_I(isUnsigned ? INS_lsr : INS_asr, EA_8BYTE, targetReg, targetReg, 32);
}
genProduceReg(treeNode);
}
// Generate code for ADD, SUB, MUL, DIV, UDIV, AND, OR and XOR
// This method is expected to have called genConsumeOperands() before calling it.
void CodeGen::genCodeForBinary(GenTree* treeNode)
{
const genTreeOps oper = treeNode->OperGet();
regNumber targetReg = treeNode->gtRegNum;
var_types targetType = treeNode->TypeGet();
emitter* emit = getEmitter();
assert(oper == GT_ADD || oper == GT_SUB || oper == GT_MUL || oper == GT_DIV || oper == GT_UDIV || oper == GT_AND ||
oper == GT_OR || oper == GT_XOR);
GenTree* op1 = treeNode->gtGetOp1();
GenTree* op2 = treeNode->gtGetOp2();
instruction ins = genGetInsForOper(treeNode->OperGet(), targetType);
if ((treeNode->gtFlags & GTF_SET_FLAGS) != 0)
{
switch (oper)
{
case GT_ADD:
ins = INS_adds;
break;
case GT_SUB:
ins = INS_subs;
break;
case GT_AND:
ins = INS_ands;
break;
default:
noway_assert(!"Unexpected BinaryOp with GTF_SET_FLAGS set");
}
}
// The arithmetic node must be sitting in a register (since it's not contained)
assert(targetReg != REG_NA);
regNumber r = emit->emitInsTernary(ins, emitActualTypeSize(treeNode), treeNode, op1, op2);
assert(r == targetReg);
genProduceReg(treeNode);
}
//------------------------------------------------------------------------
// genCodeForLclVar: Produce code for a GT_LCL_VAR node.
//
// Arguments:
// tree - the GT_LCL_VAR node
//
void CodeGen::genCodeForLclVar(GenTreeLclVar* tree)
{
var_types targetType = tree->TypeGet();
emitter* emit = getEmitter();
unsigned varNum = tree->gtLclNum;
assert(varNum < compiler->lvaCount);
LclVarDsc* varDsc = &(compiler->lvaTable[varNum]);
bool isRegCandidate = varDsc->lvIsRegCandidate();
// lcl_vars are not defs
assert((tree->gtFlags & GTF_VAR_DEF) == 0);
// If this is a register candidate that has been spilled, genConsumeReg() will
// reload it at the point of use. Otherwise, if it's not in a register, we load it here.
if (!isRegCandidate && !(tree->gtFlags & GTF_SPILLED))
{
// targetType must be a normal scalar type and not a TYP_STRUCT
assert(targetType != TYP_STRUCT);
instruction ins = ins_Load(targetType);
emitAttr attr = emitTypeSize(targetType);
attr = varTypeIsFloating(targetType) ? attr : emit->emitInsAdjustLoadStoreAttr(ins, attr);
emit->emitIns_R_S(ins, attr, tree->gtRegNum, varNum, 0);
genProduceReg(tree);
}
}
//------------------------------------------------------------------------
// genCodeForStoreLclFld: Produce code for a GT_STORE_LCL_FLD node.
//
// Arguments:
// tree - the GT_STORE_LCL_FLD node
//
void CodeGen::genCodeForStoreLclFld(GenTreeLclFld* tree)
{
var_types targetType = tree->TypeGet();
regNumber targetReg = tree->gtRegNum;
emitter* emit = getEmitter();
noway_assert(targetType != TYP_STRUCT);
#ifdef FEATURE_SIMD
// storing of TYP_SIMD12 (i.e. Vector3) field
if (tree->TypeGet() == TYP_SIMD12)
{
genStoreLclTypeSIMD12(tree);
return;
}
#endif // FEATURE_SIMD
// record the offset
unsigned offset = tree->gtLclOffs;
// We must have a stack store with GT_STORE_LCL_FLD
noway_assert(targetReg == REG_NA);
unsigned varNum = tree->gtLclNum;
assert(varNum < compiler->lvaCount);
LclVarDsc* varDsc = &(compiler->lvaTable[varNum]);
// Ensure that lclVar nodes are typed correctly.
assert(!varDsc->lvNormalizeOnStore() || targetType == genActualType(varDsc->TypeGet()));
GenTree* data = tree->gtOp1;
genConsumeRegs(data);
regNumber dataReg = REG_NA;
if (data->isContainedIntOrIImmed())
{
assert(data->IsIntegralConst(0));
dataReg = REG_ZR;
}
else
{
assert(!data->isContained());
dataReg = data->gtRegNum;
}
assert(dataReg != REG_NA);
instruction ins = ins_Store(targetType);
emitAttr attr = emitTypeSize(targetType);
attr = varTypeIsFloating(targetType) ? attr : emit->emitInsAdjustLoadStoreAttr(ins, attr);
emit->emitIns_S_R(ins, attr, dataReg, varNum, offset);
genUpdateLife(tree);
varDsc->lvRegNum = REG_STK;
}
//------------------------------------------------------------------------
// genCodeForStoreLclVar: Produce code for a GT_STORE_LCL_VAR node.
//
// Arguments:
// tree - the GT_STORE_LCL_VAR node
//
void CodeGen::genCodeForStoreLclVar(GenTreeLclVar* tree)
{
var_types targetType = tree->TypeGet();
regNumber targetReg = tree->gtRegNum;
emitter* emit = getEmitter();
unsigned varNum = tree->gtLclNum;
assert(varNum < compiler->lvaCount);
LclVarDsc* varDsc = &(compiler->lvaTable[varNum]);
// Ensure that lclVar nodes are typed correctly.
assert(!varDsc->lvNormalizeOnStore() || targetType == genActualType(varDsc->TypeGet()));
GenTree* data = tree->gtOp1;
// var = call, where call returns a multi-reg return value
// case is handled separately.
if (data->gtSkipReloadOrCopy()->IsMultiRegCall())
{
genMultiRegCallStoreToLocal(tree);
}
else
{
#ifdef FEATURE_SIMD
// storing of TYP_SIMD12 (i.e. Vector3) field
if (tree->TypeGet() == TYP_SIMD12)
{
genStoreLclTypeSIMD12(tree);
return;
}
#endif // FEATURE_SIMD
genConsumeRegs(data);
regNumber dataReg = REG_NA;
if (data->isContainedIntOrIImmed())
{
// This is only possible for a zero-init.
assert(data->IsIntegralConst(0));
if (varTypeIsSIMD(targetType))
{
assert(targetReg != REG_NA);
getEmitter()->emitIns_R_I(INS_movi, EA_16BYTE, targetReg, 0x00, INS_OPTS_16B);
genProduceReg(tree);
return;
}
dataReg = REG_ZR;
}
else
{
assert(!data->isContained());
dataReg = data->gtRegNum;
}
assert(dataReg != REG_NA);
if (targetReg == REG_NA) // store into stack based LclVar
{
inst_set_SV_var(tree);
instruction ins = ins_Store(targetType);
emitAttr attr = emitTypeSize(targetType);
attr = varTypeIsFloating(targetType) ? attr : emit->emitInsAdjustLoadStoreAttr(ins, attr);
emit->emitIns_S_R(ins, attr, dataReg, varNum, /* offset */ 0);
genUpdateLife(tree);
varDsc->lvRegNum = REG_STK;
}
else // store into register (i.e move into register)
{
if (dataReg != targetReg)
{
// Assign into targetReg when dataReg (from op1) is not the same register
inst_RV_RV(ins_Copy(targetType), targetReg, dataReg, targetType);
}
genProduceReg(tree);
}
}
}
//------------------------------------------------------------------------
// genReturn: Generates code for return statement.
// In case of struct return, delegates to the genStructReturn method.
//
// Arguments:
// treeNode - The GT_RETURN or GT_RETFILT tree node.
//
// Return Value:
// None
//
void CodeGen::genReturn(GenTree* treeNode)
{
assert(treeNode->OperGet() == GT_RETURN || treeNode->OperGet() == GT_RETFILT);
GenTree* op1 = treeNode->gtGetOp1();
var_types targetType = treeNode->TypeGet();
// A void GT_RETFILT is the end of a finally. For non-void filter returns we need to load the result in the return
// register, if it's not already there. The processing is the same as GT_RETURN. For filters, the IL spec says the
// result is type int32. Further, the only legal values are 0 or 1; the use of other values is "undefined".
assert(!treeNode->OperIs(GT_RETFILT) || (targetType == TYP_VOID) || (targetType == TYP_INT));
#ifdef DEBUG
if (targetType == TYP_VOID)
{
assert(op1 == nullptr);
}
#endif
if (isStructReturn(treeNode))
{
genStructReturn(treeNode);
}
else if (targetType != TYP_VOID)
{
assert(op1 != nullptr);
noway_assert(op1->gtRegNum != REG_NA);
genConsumeReg(op1);
regNumber retReg = varTypeIsFloating(treeNode) ? REG_FLOATRET : REG_INTRET;
bool movRequired = (op1->gtRegNum != retReg);
if (!movRequired)
{
if (op1->OperGet() == GT_LCL_VAR)
{
GenTreeLclVarCommon* lcl = op1->AsLclVarCommon();
bool isRegCandidate = compiler->lvaTable[lcl->gtLclNum].lvIsRegCandidate();
if (isRegCandidate && ((op1->gtFlags & GTF_SPILLED) == 0))
{
// We may need to generate a zero-extending mov instruction to load the value from this GT_LCL_VAR
unsigned lclNum = lcl->gtLclNum;
LclVarDsc* varDsc = &(compiler->lvaTable[lclNum]);
var_types op1Type = genActualType(op1->TypeGet());
var_types lclType = genActualType(varDsc->TypeGet());
if (genTypeSize(op1Type) < genTypeSize(lclType))
{
movRequired = true;
}
}
}
}
if (movRequired)
{
emitAttr attr = emitActualTypeSize(targetType);
getEmitter()->emitIns_R_R(INS_mov, attr, retReg, op1->gtRegNum);
}
}
#ifdef PROFILING_SUPPORTED
// There will be a single return block while generating profiler ELT callbacks.
//
// Reason for not materializing Leave callback as a GT_PROF_HOOK node after GT_RETURN:
// In flowgraph and other places assert that the last node of a block marked as
// GT_RETURN is either a GT_RETURN or GT_JMP or a tail call. It would be nice to
// maintain such an invariant irrespective of whether profiler hook needed or not.
// Also, there is not much to be gained by materializing it as an explicit node.
if (compiler->compCurBB == compiler->genReturnBB)
{
genProfilingLeaveCallback();
}
#endif
}
/***********************************************************************************************
* Generate code for localloc
*/
void CodeGen::genLclHeap(GenTree* tree)
{
assert(tree->OperGet() == GT_LCLHEAP);
GenTree* size = tree->gtOp.gtOp1;
noway_assert((genActualType(size->gtType) == TYP_INT) || (genActualType(size->gtType) == TYP_I_IMPL));
regNumber targetReg = tree->gtRegNum;
regNumber regCnt = REG_NA;
regNumber pspSymReg = REG_NA;
var_types type = genActualType(size->gtType);
emitAttr easz = emitTypeSize(type);
BasicBlock* endLabel = nullptr;
BasicBlock* loop = nullptr;
unsigned stackAdjustment = 0;
#ifdef DEBUG
// Verify ESP
if (compiler->opts.compStackCheckOnRet)
{
noway_assert(compiler->lvaReturnEspCheck != 0xCCCCCCCC &&
compiler->lvaTable[compiler->lvaReturnEspCheck].lvDoNotEnregister &&
compiler->lvaTable[compiler->lvaReturnEspCheck].lvOnFrame);
getEmitter()->emitIns_S_R(INS_cmp, EA_PTRSIZE, REG_SPBASE, compiler->lvaReturnEspCheck, 0);
BasicBlock* esp_check = genCreateTempLabel();
emitJumpKind jmpEqual = genJumpKindForOper(GT_EQ, CK_SIGNED);
inst_JMP(jmpEqual, esp_check);
getEmitter()->emitIns(INS_bkpt);
genDefineTempLabel(esp_check);
}
#endif
noway_assert(isFramePointerUsed()); // localloc requires Frame Pointer to be established since SP changes
noway_assert(genStackLevel == 0); // Can't have anything on the stack
// Whether method has PSPSym.
bool hasPspSym;
#if FEATURE_EH_FUNCLETS
hasPspSym = (compiler->lvaPSPSym != BAD_VAR_NUM);
#else
hasPspSym = false;
#endif
// compute the amount of memory to allocate to properly STACK_ALIGN.
size_t amount = 0;
if (size->IsCnsIntOrI())
{
// If size is a constant, then it must be contained.
assert(size->isContained());
// If amount is zero then return null in targetReg
amount = size->gtIntCon.gtIconVal;
if (amount == 0)
{
instGen_Set_Reg_To_Zero(EA_PTRSIZE, targetReg);
goto BAILOUT;
}
// 'amount' is the total numbe of bytes to localloc to properly STACK_ALIGN
amount = AlignUp(amount, STACK_ALIGN);
}
else
{
// If 0 bail out by returning null in targetReg
genConsumeRegAndCopy(size, targetReg);
endLabel = genCreateTempLabel();
getEmitter()->emitIns_R_R(INS_tst, easz, targetReg, targetReg);
emitJumpKind jmpEqual = genJumpKindForOper(GT_EQ, CK_SIGNED);
inst_JMP(jmpEqual, endLabel);
// Compute the size of the block to allocate and perform alignment.
// If the method has no PSPSym and compInitMem=true, we can reuse targetReg as regcnt,
// since we don't need any internal registers.
if (!hasPspSym && compiler->info.compInitMem)
{
assert(tree->AvailableTempRegCount() == 0);
regCnt = targetReg;
}
else
{
regCnt = tree->ExtractTempReg();
if (regCnt != targetReg)
{
inst_RV_RV(INS_mov, regCnt, targetReg, size->TypeGet());
}
}
// Align to STACK_ALIGN
// regCnt will be the total number of bytes to localloc
inst_RV_IV(INS_add, regCnt, (STACK_ALIGN - 1), emitActualTypeSize(type));
inst_RV_IV(INS_and, regCnt, ~(STACK_ALIGN - 1), emitActualTypeSize(type));
}
stackAdjustment = 0;
#if FEATURE_EH_FUNCLETS
// If we have PSPsym, then need to re-locate it after localloc.
if (hasPspSym)
{
stackAdjustment += STACK_ALIGN;
// Save a copy of PSPSym
pspSymReg = tree->ExtractTempReg();
getEmitter()->emitIns_R_S(ins_Load(TYP_I_IMPL), EA_PTRSIZE, pspSymReg, compiler->lvaPSPSym, 0);
}
#endif
#if FEATURE_FIXED_OUT_ARGS
// If we have an outgoing arg area then we must adjust the SP by popping off the
// outgoing arg area. We will restore it right before we return from this method.
//
// Localloc is supposed to return stack space that is STACK_ALIGN'ed. The following
// are the cases that needs to be handled:
// i) Method has PSPSym + out-going arg area.
// It is guaranteed that size of out-going arg area is STACK_ALIGNED (see fgMorphArgs).
// Therefore, we will pop-off RSP upto out-going arg area before locallocating.
// We need to add padding to ensure RSP is STACK_ALIGN'ed while re-locating PSPSym + arg area.
// ii) Method has no PSPSym but out-going arg area.
// Almost same case as above without the requirement to pad for the final RSP to be STACK_ALIGN'ed.
// iii) Method has PSPSym but no out-going arg area.
// Nothing to pop-off from the stack but needs to relocate PSPSym with SP padded.
// iv) Method has neither PSPSym nor out-going arg area.
// Nothing needs to popped off from stack nor relocated.
if (compiler->lvaOutgoingArgSpaceSize > 0)
{
assert((compiler->lvaOutgoingArgSpaceSize % STACK_ALIGN) == 0); // This must be true for the stack to remain
// aligned
inst_RV_IV(INS_add, REG_SPBASE, compiler->lvaOutgoingArgSpaceSize, EA_PTRSIZE);
stackAdjustment += compiler->lvaOutgoingArgSpaceSize;
}
#endif
if (size->IsCnsIntOrI())
{
// We should reach here only for non-zero, constant size allocations.
assert(amount > 0);
// For small allocations we will generate up to four stp instructions
size_t cntStackAlignedWidthItems = (amount >> STACK_ALIGN_SHIFT);
if (cntStackAlignedWidthItems <= 4)
{
while (cntStackAlignedWidthItems != 0)
{
// We can use pre-indexed addressing.
// stp ZR, ZR, [SP, #-16]!
getEmitter()->emitIns_R_R_R_I(INS_stp, EA_PTRSIZE, REG_ZR, REG_ZR, REG_SPBASE, -16, INS_OPTS_PRE_INDEX);
cntStackAlignedWidthItems -= 1;
}
goto ALLOC_DONE;
}
else if (!compiler->info.compInitMem && (amount < compiler->eeGetPageSize())) // must be < not <=
{
// Since the size is a page or less, simply adjust the SP value
// The SP might already be in the guard page, must touch it BEFORE
// the alloc, not after.
// ldr wz, [SP, #0]
getEmitter()->emitIns_R_R_I(INS_ldr, EA_4BYTE, REG_ZR, REG_SP, 0);
inst_RV_IV(INS_sub, REG_SP, amount, EA_PTRSIZE);
goto ALLOC_DONE;
}
// else, "mov regCnt, amount"
// If the method has no PSPSym and compInitMem=true, we can reuse targetReg as regcnt.
// Since size is a constant, regCnt is not yet initialized.
assert(regCnt == REG_NA);
if (!hasPspSym && compiler->info.compInitMem)
{
assert(tree->AvailableTempRegCount() == 0);
regCnt = targetReg;
}
else
{
regCnt = tree->ExtractTempReg();
}
genSetRegToIcon(regCnt, amount, ((int)amount == amount) ? TYP_INT : TYP_LONG);
}
if (compiler->info.compInitMem)
{
BasicBlock* loop = genCreateTempLabel();
// At this point 'regCnt' is set to the total number of bytes to locAlloc.
// Since we have to zero out the allocated memory AND ensure that RSP is always valid
// by tickling the pages, we will just push 0's on the stack.
//
// Note: regCnt is guaranteed to be even on Amd64 since STACK_ALIGN/TARGET_POINTER_SIZE = 2
// and localloc size is a multiple of STACK_ALIGN.
// Loop:
genDefineTempLabel(loop);
// We can use pre-indexed addressing.
// stp ZR, ZR, [SP, #-16]!
getEmitter()->emitIns_R_R_R_I(INS_stp, EA_PTRSIZE, REG_ZR, REG_ZR, REG_SPBASE, -16, INS_OPTS_PRE_INDEX);
// If not done, loop
// Note that regCnt is the number of bytes to stack allocate.
// Therefore we need to subtract 16 from regcnt here.
assert(genIsValidIntReg(regCnt));
inst_RV_IV(INS_subs, regCnt, 16, emitActualTypeSize(type));
emitJumpKind jmpNotEqual = genJumpKindForOper(GT_NE, CK_SIGNED);
inst_JMP(jmpNotEqual, loop);
}
else
{
// At this point 'regCnt' is set to the total number of bytes to locAlloc.
//
// We don't need to zero out the allocated memory. However, we do have
// to tickle the pages to ensure that SP is always valid and is
// in sync with the "stack guard page". Note that in the worst
// case SP is on the last byte of the guard page. Thus you must
// touch SP-0 first not SP-0x1000.
//
// Another subtlety is that you don't want SP to be exactly on the
// boundary of the guard page because PUSH is predecrement, thus
// call setup would not touch the guard page but just beyond it
//
// Note that we go through a few hoops so that SP never points to
// illegal pages at any time during the tickling process
//
// subs regCnt, SP, regCnt // regCnt now holds ultimate SP
// bvc Loop // result is smaller than orignial SP (no wrap around)
// mov regCnt, #0 // Overflow, pick lowest possible value
//
// Loop:
// ldr wzr, [SP + 0] // tickle the page - read from the page
// sub regTmp, SP, PAGE_SIZE // decrement SP by eeGetPageSize()
// cmp regTmp, regCnt
// jb Done
// mov SP, regTmp
// j Loop
//
// Done:
// mov SP, regCnt
//
// Setup the regTmp
regNumber regTmp = tree->GetSingleTempReg();
BasicBlock* loop = genCreateTempLabel();
BasicBlock* done = genCreateTempLabel();
// subs regCnt, SP, regCnt // regCnt now holds ultimate SP
getEmitter()->emitIns_R_R_R(INS_subs, EA_PTRSIZE, regCnt, REG_SPBASE, regCnt);
inst_JMP(EJ_vc, loop); // branch if the V flag is not set
// Overflow, set regCnt to lowest possible value
instGen_Set_Reg_To_Zero(EA_PTRSIZE, regCnt);
genDefineTempLabel(loop);
// tickle the page - Read from the updated SP - this triggers a page fault when on the guard page
getEmitter()->emitIns_R_R_I(INS_ldr, EA_4BYTE, REG_ZR, REG_SPBASE, 0);
// decrement SP by eeGetPageSize()
getEmitter()->emitIns_R_R_I(INS_sub, EA_PTRSIZE, regTmp, REG_SPBASE, compiler->eeGetPageSize());
getEmitter()->emitIns_R_R(INS_cmp, EA_PTRSIZE, regTmp, regCnt);
emitJumpKind jmpLTU = genJumpKindForOper(GT_LT, CK_UNSIGNED);
inst_JMP(jmpLTU, done);
// Update SP to be at the next page of stack that we will tickle
getEmitter()->emitIns_R_R(INS_mov, EA_PTRSIZE, REG_SPBASE, regTmp);
// Jump to loop and tickle new stack address
inst_JMP(EJ_jmp, loop);
// Done with stack tickle loop
genDefineTempLabel(done);
// Now just move the final value to SP
getEmitter()->emitIns_R_R(INS_mov, EA_PTRSIZE, REG_SPBASE, regCnt);
}
ALLOC_DONE:
// Re-adjust SP to allocate PSPSym and out-going arg area
if (stackAdjustment != 0)
{
assert((stackAdjustment % STACK_ALIGN) == 0); // This must be true for the stack to remain aligned
assert(stackAdjustment > 0);
getEmitter()->emitIns_R_R_I(INS_sub, EA_PTRSIZE, REG_SPBASE, REG_SPBASE, (int)stackAdjustment);
#if FEATURE_EH_FUNCLETS
// Write PSPSym to its new location.
if (hasPspSym)
{
assert(genIsValidIntReg(pspSymReg));
getEmitter()->emitIns_S_R(ins_Store(TYP_I_IMPL), EA_PTRSIZE, pspSymReg, compiler->lvaPSPSym, 0);
}
#endif
// Return the stackalloc'ed address in result register.
// TargetReg = RSP + stackAdjustment.
//
getEmitter()->emitIns_R_R_I(INS_add, EA_PTRSIZE, targetReg, REG_SPBASE, (int)stackAdjustment);
}
else // stackAdjustment == 0
{
// Move the final value of SP to targetReg
inst_RV_RV(INS_mov, targetReg, REG_SPBASE);
}
BAILOUT:
if (endLabel != nullptr)
genDefineTempLabel(endLabel);
// Write the lvaLocAllocSPvar stack frame slot
if (compiler->lvaLocAllocSPvar != BAD_VAR_NUM)
{
getEmitter()->emitIns_S_R(ins_Store(TYP_I_IMPL), EA_PTRSIZE, targetReg, compiler->lvaLocAllocSPvar, 0);
}
#if STACK_PROBES
if (compiler->opts.compNeedStackProbes)
{
genGenerateStackProbe();
}
#endif
#ifdef DEBUG
// Update new ESP
if (compiler->opts.compStackCheckOnRet)
{
noway_assert(compiler->lvaReturnEspCheck != 0xCCCCCCCC &&
compiler->lvaTable[compiler->lvaReturnEspCheck].lvDoNotEnregister &&
compiler->lvaTable[compiler->lvaReturnEspCheck].lvOnFrame);
getEmitter()->emitIns_S_R(ins_Store(TYP_I_IMPL), EA_PTRSIZE, targetReg, compiler->lvaReturnEspCheck, 0);
}
#endif
genProduceReg(tree);
}
//------------------------------------------------------------------------
// genCodeForNegNot: Produce code for a GT_NEG/GT_NOT node.
//
// Arguments:
// tree - the node
//
void CodeGen::genCodeForNegNot(GenTree* tree)
{
assert(tree->OperIs(GT_NEG, GT_NOT));
var_types targetType = tree->TypeGet();
assert(!tree->OperIs(GT_NOT) || !varTypeIsFloating(targetType));
regNumber targetReg = tree->gtRegNum;
instruction ins = genGetInsForOper(tree->OperGet(), targetType);
// The arithmetic node must be sitting in a register (since it's not contained)
assert(!tree->isContained());
// The dst can only be a register.
assert(targetReg != REG_NA);
GenTree* operand = tree->gtGetOp1();
assert(!operand->isContained());
// The src must be a register.
regNumber operandReg = genConsumeReg(operand);
getEmitter()->emitIns_R_R(ins, emitActualTypeSize(tree), targetReg, operandReg);
genProduceReg(tree);
}
//------------------------------------------------------------------------
// genCodeForDivMod: Produce code for a GT_DIV/GT_UDIV node. We don't see MOD:
// (1) integer MOD is morphed into a sequence of sub, mul, div in fgMorph;
// (2) float/double MOD is morphed into a helper call by front-end.
//
// Arguments:
// tree - the node
//
void CodeGen::genCodeForDivMod(GenTreeOp* tree)
{
assert(tree->OperIs(GT_DIV, GT_UDIV));
var_types targetType = tree->TypeGet();
emitter* emit = getEmitter();
genConsumeOperands(tree);
if (varTypeIsFloating(targetType))
{
// Floating point divide never raises an exception
genCodeForBinary(tree);
}
else // an integer divide operation
{
GenTree* divisorOp = tree->gtGetOp2();
emitAttr size = EA_ATTR(genTypeSize(genActualType(tree->TypeGet())));
if (divisorOp->IsIntegralConst(0))
{
// We unconditionally throw a divide by zero exception
genJumpToThrowHlpBlk(EJ_jmp, SCK_DIV_BY_ZERO);
// We still need to call genProduceReg
genProduceReg(tree);
}
else // the divisor is not the constant zero
{
regNumber divisorReg = divisorOp->gtRegNum;
// Generate the require runtime checks for GT_DIV or GT_UDIV
if (tree->gtOper == GT_DIV)
{
BasicBlock* sdivLabel = genCreateTempLabel();
// Two possible exceptions:
// (AnyVal / 0) => DivideByZeroException
// (MinInt / -1) => ArithmeticException
//
bool checkDividend = true;
// Do we have an immediate for the 'divisorOp'?
//
if (divisorOp->IsCnsIntOrI())
{
GenTreeIntConCommon* intConstTree = divisorOp->AsIntConCommon();
ssize_t intConstValue = intConstTree->IconValue();
assert(intConstValue != 0); // already checked above by IsIntegralConst(0))
if (intConstValue != -1)
{
checkDividend = false; // We statically know that the dividend is not -1
}
}
else // insert check for divison by zero
{
// Check if the divisor is zero throw a DivideByZeroException
emit->emitIns_R_I(INS_cmp, size, divisorReg, 0);
emitJumpKind jmpEqual = genJumpKindForOper(GT_EQ, CK_SIGNED);
genJumpToThrowHlpBlk(jmpEqual, SCK_DIV_BY_ZERO);
}
if (checkDividend)
{
// Check if the divisor is not -1 branch to 'sdivLabel'
emit->emitIns_R_I(INS_cmp, size, divisorReg, -1);
emitJumpKind jmpNotEqual = genJumpKindForOper(GT_NE, CK_SIGNED);
inst_JMP(jmpNotEqual, sdivLabel);
// If control flow continues past here the 'divisorReg' is known to be -1
regNumber dividendReg = tree->gtGetOp1()->gtRegNum;
// At this point the divisor is known to be -1
//
// Issue the 'adds zr, dividendReg, dividendReg' instruction
// this will set both the Z and V flags only when dividendReg is MinInt
//
emit->emitIns_R_R_R(INS_adds, size, REG_ZR, dividendReg, dividendReg);
inst_JMP(jmpNotEqual, sdivLabel); // goto sdiv if the Z flag is clear
genJumpToThrowHlpBlk(EJ_vs, SCK_ARITH_EXCPN); // if the V flags is set throw
// ArithmeticException
genDefineTempLabel(sdivLabel);
}
genCodeForBinary(tree); // Generate the sdiv instruction
}
else // (tree->gtOper == GT_UDIV)
{
// Only one possible exception
// (AnyVal / 0) => DivideByZeroException
//
// Note that division by the constant 0 was already checked for above by the
// op2->IsIntegralConst(0) check
//
if (!divisorOp->IsCnsIntOrI())
{
// divisorOp is not a constant, so it could be zero
//
emit->emitIns_R_I(INS_cmp, size, divisorReg, 0);
emitJumpKind jmpEqual = genJumpKindForOper(GT_EQ, CK_SIGNED);
genJumpToThrowHlpBlk(jmpEqual, SCK_DIV_BY_ZERO);
}
genCodeForBinary(tree);
}
}
}
}
// Generate code for InitBlk by performing a loop unroll
// Preconditions:
// a) Both the size and fill byte value are integer constants.
// b) The size of the struct to initialize is smaller than INITBLK_UNROLL_LIMIT bytes.
void CodeGen::genCodeForInitBlkUnroll(GenTreeBlk* initBlkNode)
{
// Make sure we got the arguments of the initblk/initobj operation in the right registers
unsigned size = initBlkNode->Size();
GenTree* dstAddr = initBlkNode->Addr();
GenTree* initVal = initBlkNode->Data();
if (initVal->OperIsInitVal())
{
initVal = initVal->gtGetOp1();
}
assert(dstAddr->isUsedFromReg());
assert(initVal->isUsedFromReg() && !initVal->IsIntegralConst(0) || initVal->IsIntegralConst(0));
assert(size != 0);
assert(size <= INITBLK_UNROLL_LIMIT);
emitter* emit = getEmitter();
genConsumeOperands(initBlkNode);
if (initBlkNode->gtFlags & GTF_BLK_VOLATILE)
{
// issue a full memory barrier before a volatile initBlockUnroll operation
instGen_MemoryBarrier();
}
regNumber valReg = initVal->IsIntegralConst(0) ? REG_ZR : initVal->gtRegNum;
assert(!initVal->IsIntegralConst(0) || (valReg == REG_ZR));
unsigned offset = 0;
// Perform an unroll using stp.
if (size >= 2 * REGSIZE_BYTES)
{
// Determine how many 16 byte slots
size_t slots = size / (2 * REGSIZE_BYTES);
while (slots-- > 0)
{
emit->emitIns_R_R_R_I(INS_stp, EA_8BYTE, valReg, valReg, dstAddr->gtRegNum, offset);
offset += (2 * REGSIZE_BYTES);
}
}
// Fill the remainder (15 bytes or less) if there's any.
if ((size & 0xf) != 0)
{
if ((size & 8) != 0)
{
emit->emitIns_R_R_I(INS_str, EA_8BYTE, valReg, dstAddr->gtRegNum, offset);
offset += 8;
}
if ((size & 4) != 0)
{
emit->emitIns_R_R_I(INS_str, EA_4BYTE, valReg, dstAddr->gtRegNum, offset);
offset += 4;
}
if ((size & 2) != 0)
{
emit->emitIns_R_R_I(INS_strh, EA_2BYTE, valReg, dstAddr->gtRegNum, offset);
offset += 2;
}
if ((size & 1) != 0)
{
emit->emitIns_R_R_I(INS_strb, EA_1BYTE, valReg, dstAddr->gtRegNum, offset);
}
}
}
// Generate code for a load pair from some address + offset
// base: tree node which can be either a local address or arbitrary node
// offset: distance from the base from which to load
void CodeGen::genCodeForLoadPairOffset(regNumber dst, regNumber dst2, GenTree* base, unsigned offset)
{
emitter* emit = getEmitter();
if (base->OperIsLocalAddr())
{
if (base->gtOper == GT_LCL_FLD_ADDR)
offset += base->gtLclFld.gtLclOffs;
emit->emitIns_R_R_S_S(INS_ldp, EA_8BYTE, EA_8BYTE, dst, dst2, base->gtLclVarCommon.gtLclNum, offset);
}
else
{
emit->emitIns_R_R_R_I(INS_ldp, EA_8BYTE, dst, dst2, base->gtRegNum, offset);
}
}
// Generate code for a store pair to some address + offset
// base: tree node which can be either a local address or arbitrary node
// offset: distance from the base from which to load
void CodeGen::genCodeForStorePairOffset(regNumber src, regNumber src2, GenTree* base, unsigned offset)
{
emitter* emit = getEmitter();
if (base->OperIsLocalAddr())
{
if (base->gtOper == GT_LCL_FLD_ADDR)
offset += base->gtLclFld.gtLclOffs;
emit->emitIns_S_S_R_R(INS_stp, EA_8BYTE, EA_8BYTE, src, src2, base->gtLclVarCommon.gtLclNum, offset);
}
else
{
emit->emitIns_R_R_R_I(INS_stp, EA_8BYTE, src, src2, base->gtRegNum, offset);
}
}
// Generate code for CpObj nodes wich copy structs that have interleaved
// GC pointers.
// For this case we'll generate a sequence of loads/stores in the case of struct
// slots that don't contain GC pointers. The generated code will look like:
// ldr tempReg, [R13, #8]
// str tempReg, [R14, #8]
//
// In the case of a GC-Pointer we'll call the ByRef write barrier helper
// who happens to use the same registers as the previous call to maintain
// the same register requirements and register killsets:
// bl CORINFO_HELP_ASSIGN_BYREF
//
// So finally an example would look like this:
// ldr tempReg, [R13, #8]
// str tempReg, [R14, #8]
// bl CORINFO_HELP_ASSIGN_BYREF
// ldr tempReg, [R13, #8]
// str tempReg, [R14, #8]
// bl CORINFO_HELP_ASSIGN_BYREF
// ldr tempReg, [R13, #8]
// str tempReg, [R14, #8]
void CodeGen::genCodeForCpObj(GenTreeObj* cpObjNode)
{
GenTree* dstAddr = cpObjNode->Addr();
GenTree* source = cpObjNode->Data();
var_types srcAddrType = TYP_BYREF;
bool sourceIsLocal = false;
assert(source->isContained());
if (source->gtOper == GT_IND)
{
GenTree* srcAddr = source->gtGetOp1();
assert(!srcAddr->isContained());
srcAddrType = srcAddr->TypeGet();
}
else
{
noway_assert(source->IsLocal());
sourceIsLocal = true;
}
bool dstOnStack = dstAddr->OperIsLocalAddr();
#ifdef DEBUG
assert(!dstAddr->isContained());
// This GenTree node has data about GC pointers, this means we're dealing
// with CpObj.
assert(cpObjNode->gtGcPtrCount > 0);
#endif // DEBUG
// Consume the operands and get them into the right registers.
// They may now contain gc pointers (depending on their type; gcMarkRegPtrVal will "do the right thing").
genConsumeBlockOp(cpObjNode, REG_WRITE_BARRIER_DST_BYREF, REG_WRITE_BARRIER_SRC_BYREF, REG_NA);
gcInfo.gcMarkRegPtrVal(REG_WRITE_BARRIER_SRC_BYREF, srcAddrType);
gcInfo.gcMarkRegPtrVal(REG_WRITE_BARRIER_DST_BYREF, dstAddr->TypeGet());
unsigned slots = cpObjNode->gtSlots;
// Temp register(s) used to perform the sequence of loads and stores.
regNumber tmpReg = cpObjNode->ExtractTempReg();
regNumber tmpReg2 = REG_NA;
assert(genIsValidIntReg(tmpReg));
assert(tmpReg != REG_WRITE_BARRIER_SRC_BYREF);
assert(tmpReg != REG_WRITE_BARRIER_DST_BYREF);
if (slots > 1)
{
tmpReg2 = cpObjNode->GetSingleTempReg();
assert(tmpReg2 != tmpReg);
assert(genIsValidIntReg(tmpReg2));
assert(tmpReg2 != REG_WRITE_BARRIER_DST_BYREF);
assert(tmpReg2 != REG_WRITE_BARRIER_SRC_BYREF);
}
if (cpObjNode->gtFlags & GTF_BLK_VOLATILE)
{
// issue a full memory barrier before a volatile CpObj operation
instGen_MemoryBarrier();
}
emitter* emit = getEmitter();
BYTE* gcPtrs = cpObjNode->gtGcPtrs;
// If we can prove it's on the stack we don't need to use the write barrier.
if (dstOnStack)
{
unsigned i = 0;
// Check if two or more remaining slots and use a ldp/stp sequence
while (i < slots - 1)
{
emitAttr attr0 = emitTypeSize(compiler->getJitGCType(gcPtrs[i + 0]));
emitAttr attr1 = emitTypeSize(compiler->getJitGCType(gcPtrs[i + 1]));
emit->emitIns_R_R_R_I(INS_ldp, attr0, tmpReg, tmpReg2, REG_WRITE_BARRIER_SRC_BYREF, 2 * TARGET_POINTER_SIZE,
INS_OPTS_POST_INDEX, attr1);
emit->emitIns_R_R_R_I(INS_stp, attr0, tmpReg, tmpReg2, REG_WRITE_BARRIER_DST_BYREF, 2 * TARGET_POINTER_SIZE,
INS_OPTS_POST_INDEX, attr1);
i += 2;
}
// Use a ldr/str sequence for the last remainder
if (i < slots)
{
emitAttr attr0 = emitTypeSize(compiler->getJitGCType(gcPtrs[i + 0]));
emit->emitIns_R_R_I(INS_ldr, attr0, tmpReg, REG_WRITE_BARRIER_SRC_BYREF, TARGET_POINTER_SIZE,
INS_OPTS_POST_INDEX);
emit->emitIns_R_R_I(INS_str, attr0, tmpReg, REG_WRITE_BARRIER_DST_BYREF, TARGET_POINTER_SIZE,
INS_OPTS_POST_INDEX);
}
}
else
{
unsigned gcPtrCount = cpObjNode->gtGcPtrCount;
unsigned i = 0;
while (i < slots)
{
switch (gcPtrs[i])
{
case TYPE_GC_NONE:
// Check if the next slot's type is also TYP_GC_NONE and use ldp/stp
if ((i + 1 < slots) && (gcPtrs[i + 1] == TYPE_GC_NONE))
{
emit->emitIns_R_R_R_I(INS_ldp, EA_8BYTE, tmpReg, tmpReg2, REG_WRITE_BARRIER_SRC_BYREF,
2 * TARGET_POINTER_SIZE, INS_OPTS_POST_INDEX);
emit->emitIns_R_R_R_I(INS_stp, EA_8BYTE, tmpReg, tmpReg2, REG_WRITE_BARRIER_DST_BYREF,
2 * TARGET_POINTER_SIZE, INS_OPTS_POST_INDEX);
++i; // extra increment of i, since we are copying two items
}
else
{
emit->emitIns_R_R_I(INS_ldr, EA_8BYTE, tmpReg, REG_WRITE_BARRIER_SRC_BYREF, TARGET_POINTER_SIZE,
INS_OPTS_POST_INDEX);
emit->emitIns_R_R_I(INS_str, EA_8BYTE, tmpReg, REG_WRITE_BARRIER_DST_BYREF, TARGET_POINTER_SIZE,
INS_OPTS_POST_INDEX);
}
break;
default:
// In the case of a GC-Pointer we'll call the ByRef write barrier helper
genEmitHelperCall(CORINFO_HELP_ASSIGN_BYREF, 0, EA_PTRSIZE);
gcPtrCount--;
break;
}
++i;
}
assert(gcPtrCount == 0);
}
if (cpObjNode->gtFlags & GTF_BLK_VOLATILE)
{
// issue a INS_BARRIER_ISHLD after a volatile CpObj operation
instGen_MemoryBarrier(INS_BARRIER_ISHLD);
}
// Clear the gcInfo for REG_WRITE_BARRIER_SRC_BYREF and REG_WRITE_BARRIER_DST_BYREF.
// While we normally update GC info prior to the last instruction that uses them,
// these actually live into the helper call.
gcInfo.gcMarkRegSetNpt(RBM_WRITE_BARRIER_SRC_BYREF | RBM_WRITE_BARRIER_DST_BYREF);
}
// generate code do a switch statement based on a table of ip-relative offsets
void CodeGen::genTableBasedSwitch(GenTree* treeNode)
{
genConsumeOperands(treeNode->AsOp());
regNumber idxReg = treeNode->gtOp.gtOp1->gtRegNum;
regNumber baseReg = treeNode->gtOp.gtOp2->gtRegNum;
regNumber tmpReg = treeNode->GetSingleTempReg();
// load the ip-relative offset (which is relative to start of fgFirstBB)
getEmitter()->emitIns_R_R_R(INS_ldr, EA_4BYTE, baseReg, baseReg, idxReg, INS_OPTS_LSL);
// add it to the absolute address of fgFirstBB
compiler->fgFirstBB->bbFlags |= BBF_JMP_TARGET;
getEmitter()->emitIns_R_L(INS_adr, EA_PTRSIZE, compiler->fgFirstBB, tmpReg);
getEmitter()->emitIns_R_R_R(INS_add, EA_PTRSIZE, baseReg, baseReg, tmpReg);
// br baseReg
getEmitter()->emitIns_R(INS_br, emitActualTypeSize(TYP_I_IMPL), baseReg);
}
// emits the table and an instruction to get the address of the first element
void CodeGen::genJumpTable(GenTree* treeNode)
{
noway_assert(compiler->compCurBB->bbJumpKind == BBJ_SWITCH);
assert(treeNode->OperGet() == GT_JMPTABLE);
unsigned jumpCount = compiler->compCurBB->bbJumpSwt->bbsCount;
BasicBlock** jumpTable = compiler->compCurBB->bbJumpSwt->bbsDstTab;
unsigned jmpTabOffs;
unsigned jmpTabBase;
jmpTabBase = getEmitter()->emitBBTableDataGenBeg(jumpCount, true);
jmpTabOffs = 0;
JITDUMP("\n J_M%03u_DS%02u LABEL DWORD\n", Compiler::s_compMethodsCount, jmpTabBase);
for (unsigned i = 0; i < jumpCount; i++)
{
BasicBlock* target = *jumpTable++;
noway_assert(target->bbFlags & BBF_JMP_TARGET);
JITDUMP(" DD L_M%03u_BB%02u\n", Compiler::s_compMethodsCount, target->bbNum);
getEmitter()->emitDataGenData(i, target);
};
getEmitter()->emitDataGenEnd();
// Access to inline data is 'abstracted' by a special type of static member
// (produced by eeFindJitDataOffs) which the emitter recognizes as being a reference
// to constant data, not a real static field.
getEmitter()->emitIns_R_C(INS_adr, emitActualTypeSize(TYP_I_IMPL), treeNode->gtRegNum, REG_NA,
compiler->eeFindJitDataOffs(jmpTabBase), 0);
genProduceReg(treeNode);
}
// generate code for the locked operations:
// GT_LOCKADD, GT_XCHG, GT_XADD
void CodeGen::genLockedInstructions(GenTreeOp* treeNode)
{
GenTree* data = treeNode->gtOp.gtOp2;
GenTree* addr = treeNode->gtOp.gtOp1;
regNumber targetReg = treeNode->gtRegNum;
regNumber dataReg = data->gtRegNum;
regNumber addrReg = addr->gtRegNum;
regNumber exResultReg = treeNode->ExtractTempReg(RBM_ALLINT);
regNumber storeDataReg = (treeNode->OperGet() == GT_XCHG) ? dataReg : treeNode->ExtractTempReg(RBM_ALLINT);
regNumber loadReg = (targetReg != REG_NA) ? targetReg : storeDataReg;
// Check allocator assumptions
//
// The register allocator should have extended the lifetimes of all input and internal registers so that
// none interfere with the target.
noway_assert(addrReg != targetReg);
noway_assert(addrReg != loadReg);
noway_assert(dataReg != loadReg);
noway_assert(addrReg != storeDataReg);
noway_assert((treeNode->OperGet() == GT_XCHG) || (addrReg != dataReg));
assert(addr->isUsedFromReg());
noway_assert(exResultReg != REG_NA);
noway_assert(exResultReg != targetReg);
noway_assert((targetReg != REG_NA) || (treeNode->OperGet() != GT_XCHG));
// Store exclusive unpredictable cases must be avoided
noway_assert(exResultReg != storeDataReg);
noway_assert(exResultReg != addrReg);
genConsumeAddress(addr);
genConsumeRegs(data);
// NOTE: `genConsumeAddress` marks the consumed register as not a GC pointer, as it assumes that the input registers
// die at the first instruction generated by the node. This is not the case for these atomics as the input
// registers are multiply-used. As such, we need to mark the addr register as containing a GC pointer until
// we are finished generating the code for this node.
gcInfo.gcMarkRegPtrVal(addrReg, addr->TypeGet());
// TODO-ARM64-CQ Use ARMv8.1 atomics if available
// https://github.com/dotnet/coreclr/issues/11881
// Emit code like this:
// retry:
// ldxr loadReg, [addrReg]
// add storeDataReg, loadReg, dataReg # Only for GT_XADD & GT_LOCKADD
// # GT_XCHG storeDataReg === dataReg
// stxr exResult, storeDataReg, [addrReg]
// cbnz exResult, retry
BasicBlock* labelRetry = genCreateTempLabel();
genDefineTempLabel(labelRetry);
emitAttr dataSize = emitActualTypeSize(data);
// The following instruction includes a acquire half barrier
// TODO-ARM64-CQ Evaluate whether this is necessary
// https://github.com/dotnet/coreclr/issues/14346
getEmitter()->emitIns_R_R(INS_ldaxr, dataSize, loadReg, addrReg);
switch (treeNode->OperGet())
{
case GT_XADD:
case GT_LOCKADD:
if (data->isContainedIntOrIImmed())
{
// Even though INS_add is specified here, the encoder will choose either
// an INS_add or an INS_sub and encode the immediate as a positive value
genInstrWithConstant(INS_add, dataSize, storeDataReg, loadReg, data->AsIntConCommon()->IconValue(),
REG_NA);
}
else
{
getEmitter()->emitIns_R_R_R(INS_add, dataSize, storeDataReg, loadReg, dataReg);
}
break;
case GT_XCHG:
assert(!data->isContained());
storeDataReg = dataReg;
break;
default:
unreached();
}
// The following instruction includes a release half barrier
// TODO-ARM64-CQ Evaluate whether this is necessary
// https://github.com/dotnet/coreclr/issues/14346
getEmitter()->emitIns_R_R_R(INS_stlxr, dataSize, exResultReg, storeDataReg, addrReg);
getEmitter()->emitIns_J_R(INS_cbnz, EA_4BYTE, labelRetry, exResultReg);
gcInfo.gcMarkRegSetNpt(addr->gtGetRegMask());
if (treeNode->gtRegNum != REG_NA)
{
genProduceReg(treeNode);
}
}
//------------------------------------------------------------------------
// genCodeForSwap: Produce code for a GT_CMPXCHG node.
//
// Arguments:
// tree - the GT_CMPXCHG node
//
void CodeGen::genCodeForCmpXchg(GenTreeCmpXchg* treeNode)
{
assert(treeNode->OperIs(GT_CMPXCHG));
GenTree* addr = treeNode->gtOpLocation; // arg1
GenTree* data = treeNode->gtOpValue; // arg2
GenTree* comparand = treeNode->gtOpComparand; // arg3
regNumber targetReg = treeNode->gtRegNum;
regNumber dataReg = data->gtRegNum;
regNumber addrReg = addr->gtRegNum;
regNumber comparandReg = comparand->gtRegNum;
regNumber exResultReg = treeNode->ExtractTempReg(RBM_ALLINT);
// Check allocator assumptions
//
// The register allocator should have extended the lifetimes of all input and internal registers so that
// none interfere with the target.
noway_assert(addrReg != targetReg);
noway_assert(dataReg != targetReg);
noway_assert(comparandReg != targetReg);
noway_assert(addrReg != dataReg);
noway_assert(targetReg != REG_NA);
noway_assert(exResultReg != REG_NA);
noway_assert(exResultReg != targetReg);
assert(addr->isUsedFromReg());
assert(data->isUsedFromReg());
assert(!comparand->isUsedFromMemory());
// Store exclusive unpredictable cases must be avoided
noway_assert(exResultReg != dataReg);
noway_assert(exResultReg != addrReg);
genConsumeAddress(addr);
genConsumeRegs(data);
genConsumeRegs(comparand);
// NOTE: `genConsumeAddress` marks the consumed register as not a GC pointer, as it assumes that the input registers
// die at the first instruction generated by the node. This is not the case for these atomics as the input
// registers are multiply-used. As such, we need to mark the addr register as containing a GC pointer until
// we are finished generating the code for this node.
gcInfo.gcMarkRegPtrVal(addrReg, addr->TypeGet());
// TODO-ARM64-CQ Use ARMv8.1 atomics if available
// https://github.com/dotnet/coreclr/issues/11881
// Emit code like this:
// retry:
// ldxr targetReg, [addrReg]
// cmp targetReg, comparandReg
// bne compareFail
// stxr exResult, dataReg, [addrReg]
// cbnz exResult, retry
// compareFail:
BasicBlock* labelRetry = genCreateTempLabel();
BasicBlock* labelCompareFail = genCreateTempLabel();
genDefineTempLabel(labelRetry);
// The following instruction includes a acquire half barrier
// TODO-ARM64-CQ Evaluate whether this is necessary
// https://github.com/dotnet/coreclr/issues/14346
getEmitter()->emitIns_R_R(INS_ldaxr, emitTypeSize(treeNode), targetReg, addrReg);
if (comparand->isContainedIntOrIImmed())
{
if (comparand->IsIntegralConst(0))
{
getEmitter()->emitIns_J_R(INS_cbnz, emitActualTypeSize(treeNode), labelCompareFail, targetReg);
}
else
{
getEmitter()->emitIns_R_I(INS_cmp, emitActualTypeSize(treeNode), targetReg,
comparand->AsIntConCommon()->IconValue());
getEmitter()->emitIns_J(INS_bne, labelCompareFail);
}
}
else
{
getEmitter()->emitIns_R_R(INS_cmp, emitActualTypeSize(treeNode), targetReg, comparandReg);
getEmitter()->emitIns_J(INS_bne, labelCompareFail);
}
// The following instruction includes a release half barrier
// TODO-ARM64-CQ Evaluate whether this is necessary
// https://github.com/dotnet/coreclr/issues/14346
getEmitter()->emitIns_R_R_R(INS_stlxr, emitTypeSize(treeNode), exResultReg, dataReg, addrReg);
getEmitter()->emitIns_J_R(INS_cbnz, EA_4BYTE, labelRetry, exResultReg);
genDefineTempLabel(labelCompareFail);
gcInfo.gcMarkRegSetNpt(addr->gtGetRegMask());
genProduceReg(treeNode);
}
instruction CodeGen::genGetInsForOper(genTreeOps oper, var_types type)
{
instruction ins = INS_brk;
if (varTypeIsFloating(type))
{
switch (oper)
{
case GT_ADD:
ins = INS_fadd;
break;
case GT_SUB:
ins = INS_fsub;
break;
case GT_MUL:
ins = INS_fmul;
break;
case GT_DIV:
ins = INS_fdiv;
break;
case GT_NEG:
ins = INS_fneg;
break;
default:
NYI("Unhandled oper in genGetInsForOper() - float");
unreached();
break;
}
}
else
{
switch (oper)
{
case GT_ADD:
ins = INS_add;
break;
case GT_AND:
ins = INS_and;
break;
case GT_DIV:
ins = INS_sdiv;
break;
case GT_UDIV:
ins = INS_udiv;
break;
case GT_MUL:
ins = INS_mul;
break;
case GT_LSH:
ins = INS_lsl;
break;
case GT_NEG:
ins = INS_neg;
break;
case GT_NOT:
ins = INS_mvn;
break;
case GT_OR:
ins = INS_orr;
break;
case GT_ROR:
ins = INS_ror;
break;
case GT_RSH:
ins = INS_asr;
break;
case GT_RSZ:
ins = INS_lsr;
break;
case GT_SUB:
ins = INS_sub;
break;
case GT_XOR:
ins = INS_eor;
break;
default:
NYI("Unhandled oper in genGetInsForOper() - integer");
unreached();
break;
}
}
return ins;
}
//------------------------------------------------------------------------
// genCodeForReturnTrap: Produce code for a GT_RETURNTRAP node.
//
// Arguments:
// tree - the GT_RETURNTRAP node
//
void CodeGen::genCodeForReturnTrap(GenTreeOp* tree)
{
assert(tree->OperGet() == GT_RETURNTRAP);
// this is nothing but a conditional call to CORINFO_HELP_STOP_FOR_GC
// based on the contents of 'data'
GenTree* data = tree->gtOp1;
genConsumeRegs(data);
getEmitter()->emitIns_R_I(INS_cmp, EA_4BYTE, data->gtRegNum, 0);
BasicBlock* skipLabel = genCreateTempLabel();
emitJumpKind jmpEqual = genJumpKindForOper(GT_EQ, CK_SIGNED);
inst_JMP(jmpEqual, skipLabel);
// emit the call to the EE-helper that stops for GC (or other reasons)
genEmitHelperCall(CORINFO_HELP_STOP_FOR_GC, 0, EA_UNKNOWN);
genDefineTempLabel(skipLabel);
}
//------------------------------------------------------------------------
// genCodeForStoreInd: Produce code for a GT_STOREIND node.
//
// Arguments:
// tree - the GT_STOREIND node
//
void CodeGen::genCodeForStoreInd(GenTreeStoreInd* tree)
{
GenTree* data = tree->Data();
GenTree* addr = tree->Addr();
var_types targetType = tree->TypeGet();
emitter* emit = getEmitter();
emitAttr attr = emitTypeSize(tree);
instruction ins = ins_Store(targetType);
#ifdef FEATURE_SIMD
// Storing Vector3 of size 12 bytes through indirection
if (tree->TypeGet() == TYP_SIMD12)
{
genStoreIndTypeSIMD12(tree);
return;
}
#endif // FEATURE_SIMD
GCInfo::WriteBarrierForm writeBarrierForm = gcInfo.gcIsWriteBarrierCandidate(tree, data);
if (writeBarrierForm != GCInfo::WBF_NoBarrier)
{
// data and addr must be in registers.
// Consume both registers so that any copies of interfering
// registers are taken care of.
genConsumeOperands(tree);
#if NOGC_WRITE_BARRIERS
// At this point, we should not have any interference.
// That is, 'data' must not be in REG_WRITE_BARRIER_DST_BYREF,
// as that is where 'addr' must go.
noway_assert(data->gtRegNum != REG_WRITE_BARRIER_DST_BYREF);
// 'addr' goes into x14 (REG_WRITE_BARRIER_DST_BYREF)
if (addr->gtRegNum != REG_WRITE_BARRIER_DST_BYREF)
{
inst_RV_RV(INS_mov, REG_WRITE_BARRIER_DST_BYREF, addr->gtRegNum, addr->TypeGet());
}
// 'data' goes into x15 (REG_WRITE_BARRIER)
if (data->gtRegNum != REG_WRITE_BARRIER)
{
inst_RV_RV(INS_mov, REG_WRITE_BARRIER, data->gtRegNum, data->TypeGet());
}
#else
// At this point, we should not have any interference.
// That is, 'data' must not be in REG_ARG_0,
// as that is where 'addr' must go.
noway_assert(data->gtRegNum != REG_ARG_0);
// addr goes in REG_ARG_0
if (addr->gtRegNum != REG_ARG_0)
{
inst_RV_RV(INS_mov, REG_ARG_0, addr->gtRegNum, addr->TypeGet());
}
// data goes in REG_ARG_1
if (data->gtRegNum != REG_ARG_1)
{
inst_RV_RV(INS_mov, REG_ARG_1, data->gtRegNum, data->TypeGet());
}
#endif // NOGC_WRITE_BARRIERS
genGCWriteBarrier(tree, writeBarrierForm);
}
else // A normal store, not a WriteBarrier store
{
bool dataIsUnary = false;
GenTree* nonRMWsrc = nullptr;
// We must consume the operands in the proper execution order,
// so that liveness is updated appropriately.
genConsumeAddress(addr);
if (!data->isContained())
{
genConsumeRegs(data);
}
regNumber dataReg = REG_NA;
if (data->isContainedIntOrIImmed())
{
assert(data->IsIntegralConst(0));
dataReg = REG_ZR;
}
else // data is not contained, so evaluate it into a register
{
assert(!data->isContained());
dataReg = data->gtRegNum;
}
assert((attr != EA_1BYTE) || !(tree->gtFlags & GTF_IND_UNALIGNED));
if (tree->gtFlags & GTF_IND_VOLATILE)
{
bool useStoreRelease =
genIsValidIntReg(dataReg) && !addr->isContained() && !(tree->gtFlags & GTF_IND_UNALIGNED);
if (useStoreRelease)
{
switch (EA_SIZE(attr))
{
case EA_1BYTE:
assert(ins == INS_strb);
ins = INS_stlrb;
break;
case EA_2BYTE:
assert(ins == INS_strh);
ins = INS_stlrh;
break;
case EA_4BYTE:
case EA_8BYTE:
assert(ins == INS_str);
ins = INS_stlr;
break;
default:
assert(false); // We should not get here
}
}
else
{
// issue a full memory barrier before a volatile StInd
instGen_MemoryBarrier();
}
}
emit->emitInsLoadStoreOp(ins, attr, dataReg, tree);
}
}
//------------------------------------------------------------------------
// genCodeForSwap: Produce code for a GT_SWAP node.
//
// Arguments:
// tree - the GT_SWAP node
//
void CodeGen::genCodeForSwap(GenTreeOp* tree)
{
// Swap is only supported for lclVar operands that are enregistered
// We do not consume or produce any registers. Both operands remain enregistered.
// However, the gc-ness may change.
assert(genIsRegCandidateLocal(tree->gtOp1) && genIsRegCandidateLocal(tree->gtOp2));
GenTreeLclVarCommon* lcl1 = tree->gtOp1->AsLclVarCommon();
LclVarDsc* varDsc1 = &(compiler->lvaTable[lcl1->gtLclNum]);
var_types type1 = varDsc1->TypeGet();
GenTreeLclVarCommon* lcl2 = tree->gtOp2->AsLclVarCommon();
LclVarDsc* varDsc2 = &(compiler->lvaTable[lcl2->gtLclNum]);
var_types type2 = varDsc2->TypeGet();
// We must have both int or both fp regs
assert(!varTypeIsFloating(type1) || varTypeIsFloating(type2));
// FP swap is not yet implemented (and should have NYI'd in LSRA)
assert(!varTypeIsFloating(type1));
regNumber oldOp1Reg = lcl1->gtRegNum;
regMaskTP oldOp1RegMask = genRegMask(oldOp1Reg);
regNumber oldOp2Reg = lcl2->gtRegNum;
regMaskTP oldOp2RegMask = genRegMask(oldOp2Reg);
// We don't call genUpdateVarReg because we don't have a tree node with the new register.
varDsc1->lvRegNum = oldOp2Reg;
varDsc2->lvRegNum = oldOp1Reg;
// Do the xchg
emitAttr size = EA_PTRSIZE;
if (varTypeGCtype(type1) != varTypeGCtype(type2))
{
// If the type specified to the emitter is a GC type, it will swap the GC-ness of the registers.
// Otherwise it will leave them alone, which is correct if they have the same GC-ness.
size = EA_GCREF;
}
NYI("register swap");
// inst_RV_RV(INS_xchg, oldOp1Reg, oldOp2Reg, TYP_I_IMPL, size);
// Update the gcInfo.
// Manually remove these regs for the gc sets (mostly to avoid confusing duplicative dump output)
gcInfo.gcRegByrefSetCur &= ~(oldOp1RegMask | oldOp2RegMask);
gcInfo.gcRegGCrefSetCur &= ~(oldOp1RegMask | oldOp2RegMask);
// gcMarkRegPtrVal will do the appropriate thing for non-gc types.
// It will also dump the updates.
gcInfo.gcMarkRegPtrVal(oldOp2Reg, type1);
gcInfo.gcMarkRegPtrVal(oldOp1Reg, type2);
}
//-------------------------------------------------------------------------------------------
// genSetRegToCond: Set a register 'dstReg' to the appropriate one or zero value
// corresponding to a binary Relational operator result.
//
// Arguments:
// dstReg - The target register to set to 1 or 0
// tree - The GenTree Relop node that was used to set the Condition codes
//
// Return Value: none
//
// Notes:
// A full 64-bit value of either 1 or 0 is setup in the 'dstReg'
//-------------------------------------------------------------------------------------------
void CodeGen::genSetRegToCond(regNumber dstReg, GenTree* tree)
{
emitJumpKind jumpKind[2];
bool branchToTrueLabel[2];
genJumpKindsForTree(tree, jumpKind, branchToTrueLabel);
assert(jumpKind[0] != EJ_NONE);
// Set the reg according to the flags
inst_SET(jumpKind[0], dstReg);
// Do we need to use two operation to set the flags?
//
if (jumpKind[1] != EJ_NONE)
{
emitter* emit = getEmitter();
bool ordered = ((tree->gtFlags & GTF_RELOP_NAN_UN) == 0);
insCond secondCond;
// The only ones that require two operations are the
// floating point compare operations of BEQ or BNE.UN
//
if (tree->gtOper == GT_EQ)
{
// This must be an ordered comparison.
assert(ordered);
assert(jumpKind[1] == EJ_vs); // We complement this value
secondCond = INS_COND_VC; // for the secondCond
}
else // gtOper == GT_NE
{
// This must be BNE.UN (unordered comparison)
assert((tree->gtOper == GT_NE) && !ordered);
assert(jumpKind[1] == EJ_lo); // We complement this value
secondCond = INS_COND_HS; // for the secondCond
}
// The second instruction is a 'csinc' instruction that either selects the previous dstReg
// or increments the ZR register, which produces a 1 result.
emit->emitIns_R_R_R_COND(INS_csinc, EA_8BYTE, dstReg, dstReg, REG_ZR, secondCond);
}
}
//------------------------------------------------------------------------
// genIntToFloatCast: Generate code to cast an int/long to float/double
//
// Arguments:
// treeNode - The GT_CAST node
//
// Return Value:
// None.
//
// Assumptions:
// Cast is a non-overflow conversion.
// The treeNode must have an assigned register.
// SrcType= int32/uint32/int64/uint64 and DstType=float/double.
//
void CodeGen::genIntToFloatCast(GenTree* treeNode)
{
// int type --> float/double conversions are always non-overflow ones
assert(treeNode->OperGet() == GT_CAST);
assert(!treeNode->gtOverflow());
regNumber targetReg = treeNode->gtRegNum;
assert(genIsValidFloatReg(targetReg));
GenTree* op1 = treeNode->gtOp.gtOp1;
assert(!op1->isContained()); // Cannot be contained
assert(genIsValidIntReg(op1->gtRegNum)); // Must be a valid int reg.
var_types dstType = treeNode->CastToType();
var_types srcType = genActualType(op1->TypeGet());
assert(!varTypeIsFloating(srcType) && varTypeIsFloating(dstType));
// force the srcType to unsigned if GT_UNSIGNED flag is set
if (treeNode->gtFlags & GTF_UNSIGNED)
{
srcType = genUnsignedType(srcType);
}
// We should never see a srcType whose size is neither EA_4BYTE or EA_8BYTE
emitAttr srcSize = EA_ATTR(genTypeSize(srcType));
noway_assert((srcSize == EA_4BYTE) || (srcSize == EA_8BYTE));
instruction ins = varTypeIsUnsigned(srcType) ? INS_ucvtf : INS_scvtf;
insOpts cvtOption = INS_OPTS_NONE; // invalid value
if (dstType == TYP_DOUBLE)
{
if (srcSize == EA_4BYTE)
{
cvtOption = INS_OPTS_4BYTE_TO_D;
}
else
{
assert(srcSize == EA_8BYTE);
cvtOption = INS_OPTS_8BYTE_TO_D;
}
}
else
{
assert(dstType == TYP_FLOAT);
if (srcSize == EA_4BYTE)
{
cvtOption = INS_OPTS_4BYTE_TO_S;
}
else
{
assert(srcSize == EA_8BYTE);
cvtOption = INS_OPTS_8BYTE_TO_S;
}
}
genConsumeOperands(treeNode->AsOp());
getEmitter()->emitIns_R_R(ins, emitActualTypeSize(dstType), treeNode->gtRegNum, op1->gtRegNum, cvtOption);
genProduceReg(treeNode);
}
//------------------------------------------------------------------------
// genFloatToIntCast: Generate code to cast float/double to int/long
//
// Arguments:
// treeNode - The GT_CAST node
//
// Return Value:
// None.
//
// Assumptions:
// Cast is a non-overflow conversion.
// The treeNode must have an assigned register.
// SrcType=float/double and DstType= int32/uint32/int64/uint64
//
void CodeGen::genFloatToIntCast(GenTree* treeNode)
{
// we don't expect to see overflow detecting float/double --> int type conversions here
// as they should have been converted into helper calls by front-end.
assert(treeNode->OperGet() == GT_CAST);
assert(!treeNode->gtOverflow());
regNumber targetReg = treeNode->gtRegNum;
assert(genIsValidIntReg(targetReg)); // Must be a valid int reg.
GenTree* op1 = treeNode->gtOp.gtOp1;
assert(!op1->isContained()); // Cannot be contained
assert(genIsValidFloatReg(op1->gtRegNum)); // Must be a valid float reg.
var_types dstType = treeNode->CastToType();
var_types srcType = op1->TypeGet();
assert(varTypeIsFloating(srcType) && !varTypeIsFloating(dstType));
// We should never see a dstType whose size is neither EA_4BYTE or EA_8BYTE
// For conversions to small types (byte/sbyte/int16/uint16) from float/double,
// we expect the front-end or lowering phase to have generated two levels of cast.
//
emitAttr dstSize = EA_ATTR(genTypeSize(dstType));
noway_assert((dstSize == EA_4BYTE) || (dstSize == EA_8BYTE));
instruction ins = INS_fcvtzs; // default to sign converts
insOpts cvtOption = INS_OPTS_NONE; // invalid value
if (varTypeIsUnsigned(dstType))
{
ins = INS_fcvtzu; // use unsigned converts
}
if (srcType == TYP_DOUBLE)
{
if (dstSize == EA_4BYTE)
{
cvtOption = INS_OPTS_D_TO_4BYTE;
}
else
{
assert(dstSize == EA_8BYTE);
cvtOption = INS_OPTS_D_TO_8BYTE;
}
}
else
{
assert(srcType == TYP_FLOAT);
if (dstSize == EA_4BYTE)
{
cvtOption = INS_OPTS_S_TO_4BYTE;
}
else
{
assert(dstSize == EA_8BYTE);
cvtOption = INS_OPTS_S_TO_8BYTE;
}
}
genConsumeOperands(treeNode->AsOp());
getEmitter()->emitIns_R_R(ins, dstSize, treeNode->gtRegNum, op1->gtRegNum, cvtOption);
genProduceReg(treeNode);
}
//------------------------------------------------------------------------
// genCkfinite: Generate code for ckfinite opcode.
//
// Arguments:
// treeNode - The GT_CKFINITE node
//
// Return Value:
// None.
//
// Assumptions:
// GT_CKFINITE node has reserved an internal register.
//
void CodeGen::genCkfinite(GenTree* treeNode)
{
assert(treeNode->OperGet() == GT_CKFINITE);
GenTree* op1 = treeNode->gtOp.gtOp1;
var_types targetType = treeNode->TypeGet();
int expMask = (targetType == TYP_FLOAT) ? 0x7F8 : 0x7FF; // Bit mask to extract exponent.
int shiftAmount = targetType == TYP_FLOAT ? 20 : 52;
emitter* emit = getEmitter();
// Extract exponent into a register.
regNumber intReg = treeNode->GetSingleTempReg();
regNumber fpReg = genConsumeReg(op1);
emit->emitIns_R_R(ins_Copy(targetType), emitActualTypeSize(treeNode), intReg, fpReg);
emit->emitIns_R_R_I(INS_lsr, emitActualTypeSize(targetType), intReg, intReg, shiftAmount);
// Mask of exponent with all 1's and check if the exponent is all 1's
emit->emitIns_R_R_I(INS_and, EA_4BYTE, intReg, intReg, expMask);
emit->emitIns_R_I(INS_cmp, EA_4BYTE, intReg, expMask);
// If exponent is all 1's, throw ArithmeticException
emitJumpKind jmpEqual = genJumpKindForOper(GT_EQ, CK_SIGNED);
genJumpToThrowHlpBlk(jmpEqual, SCK_ARITH_EXCPN);
// if it is a finite value copy it to targetReg
if (treeNode->gtRegNum != fpReg)
{
emit->emitIns_R_R(ins_Copy(targetType), emitActualTypeSize(treeNode), treeNode->gtRegNum, fpReg);
}
genProduceReg(treeNode);
}
//------------------------------------------------------------------------
// genCodeForCompare: Produce code for a GT_EQ/GT_NE/GT_LT/GT_LE/GT_GE/GT_GT/GT_TEST_EQ/GT_TEST_NE node.
//
// Arguments:
// tree - the node
//
void CodeGen::genCodeForCompare(GenTreeOp* tree)
{
regNumber targetReg = tree->gtRegNum;
emitter* emit = getEmitter();
GenTree* op1 = tree->gtOp1;
GenTree* op2 = tree->gtOp2;
var_types op1Type = genActualType(op1->TypeGet());
var_types op2Type = genActualType(op2->TypeGet());
assert(!op1->isUsedFromMemory());
assert(!op2->isUsedFromMemory());
genConsumeOperands(tree);
emitAttr cmpSize = EA_ATTR(genTypeSize(op1Type));
assert(genTypeSize(op1Type) == genTypeSize(op2Type));
if (varTypeIsFloating(op1Type))
{
assert(varTypeIsFloating(op2Type));
assert(!op1->isContained());
assert(op1Type == op2Type);
if (op2->IsIntegralConst(0))
{
assert(op2->isContained());
emit->emitIns_R_F(INS_fcmp, cmpSize, op1->gtRegNum, 0.0);
}
else
{
assert(!op2->isContained());
emit->emitIns_R_R(INS_fcmp, cmpSize, op1->gtRegNum, op2->gtRegNum);
}
}
else
{
assert(!varTypeIsFloating(op2Type));
// We don't support swapping op1 and op2 to generate cmp reg, imm
assert(!op1->isContainedIntOrIImmed());
instruction ins = tree->OperIs(GT_TEST_EQ, GT_TEST_NE) ? INS_tst : INS_cmp;
if (op2->isContainedIntOrIImmed())
{
GenTreeIntConCommon* intConst = op2->AsIntConCommon();
emit->emitIns_R_I(ins, cmpSize, op1->gtRegNum, intConst->IconValue());
}
else
{
emit->emitIns_R_R(ins, cmpSize, op1->gtRegNum, op2->gtRegNum);
}
}
// Are we evaluating this into a register?
if (targetReg != REG_NA)
{
genSetRegToCond(targetReg, tree);
genProduceReg(tree);
}
}
//------------------------------------------------------------------------
// genCodeForJumpCompare: Generates code for jmpCompare statement.
//
// A GT_JCMP node is created when a comparison and conditional branch
// can be executed in a single instruction.
//
// Arm64 has a few instructions with this behavior.
// - cbz/cbnz -- Compare and branch register zero/not zero
// - tbz/tbnz -- Test and branch register bit zero/not zero
//
// The cbz/cbnz supports the normal +/- 1MB branch range for conditional branches
// The tbz/tbnz supports a smaller +/- 32KB branch range
//
// A GT_JCMP cbz/cbnz node is created when there is a GT_EQ or GT_NE
// integer/unsigned comparison against #0 which is used by a GT_JTRUE
// condition jump node.
//
// A GT_JCMP tbz/tbnz node is created when there is a GT_TEST_EQ or GT_TEST_NE
// integer/unsigned comparison against against a mask with a single bit set
// which is used by a GT_JTRUE condition jump node.
//
// This node is repsonsible for consuming the register, and emitting the
// appropriate fused compare/test and branch instruction
//
// Two flags guide code generation
// GTF_JCMP_TST -- Set if this is a tbz/tbnz rather than cbz/cbnz
// GTF_JCMP_EQ -- Set if this is cbz/tbz rather than cbnz/tbnz
//
// Arguments:
// tree - The GT_JCMP tree node.
//
// Return Value:
// None
//
void CodeGen::genCodeForJumpCompare(GenTreeOp* tree)
{
assert(compiler->compCurBB->bbJumpKind == BBJ_COND);
GenTree* op1 = tree->gtGetOp1();
GenTree* op2 = tree->gtGetOp2();
assert(tree->OperIs(GT_JCMP));
assert(!varTypeIsFloating(tree));
assert(!op1->isUsedFromMemory());
assert(!op2->isUsedFromMemory());
assert(op2->IsCnsIntOrI());
assert(op2->isContained());
genConsumeOperands(tree);
regNumber reg = op1->gtRegNum;
emitAttr attr = emitActualTypeSize(op1->TypeGet());
if (tree->gtFlags & GTF_JCMP_TST)
{
ssize_t compareImm = op2->gtIntCon.IconValue();
assert(isPow2(compareImm));
instruction ins = (tree->gtFlags & GTF_JCMP_EQ) ? INS_tbz : INS_tbnz;
int imm = genLog2((size_t)compareImm);
getEmitter()->emitIns_J_R_I(ins, attr, compiler->compCurBB->bbJumpDest, reg, imm);
}
else
{
assert(op2->IsIntegralConst(0));
instruction ins = (tree->gtFlags & GTF_JCMP_EQ) ? INS_cbz : INS_cbnz;
getEmitter()->emitIns_J_R(ins, attr, compiler->compCurBB->bbJumpDest, reg);
}
}
int CodeGenInterface::genSPtoFPdelta()
{
int delta;
// We place the saved frame pointer immediately above the outgoing argument space.
delta = (int)compiler->lvaOutgoingArgSpaceSize;
assert(delta >= 0);
return delta;
}
//---------------------------------------------------------------------
// genTotalFrameSize - return the total size of the stack frame, including local size,
// callee-saved register size, etc.
//
// Return value:
// Total frame size
//
int CodeGenInterface::genTotalFrameSize()
{
// For varargs functions, we home all the incoming register arguments. They are not
// included in the compCalleeRegsPushed count. This is like prespill on ARM32, but
// since we don't use "push" instructions to save them, we don't have to do the
// save of these varargs register arguments as the first thing in the prolog.
assert(!IsUninitialized(compiler->compCalleeRegsPushed));
int totalFrameSize = (compiler->info.compIsVarArgs ? MAX_REG_ARG * REGSIZE_BYTES : 0) +
compiler->compCalleeRegsPushed * REGSIZE_BYTES + compiler->compLclFrameSize;
assert(totalFrameSize >= 0);
return totalFrameSize;
}
//---------------------------------------------------------------------
// genCallerSPtoFPdelta - return the offset from Caller-SP to the frame pointer.
// This number is going to be negative, since the Caller-SP is at a higher
// address than the frame pointer.
//
// There must be a frame pointer to call this function!
int CodeGenInterface::genCallerSPtoFPdelta()
{
assert(isFramePointerUsed());
int callerSPtoFPdelta;
callerSPtoFPdelta = genCallerSPtoInitialSPdelta() + genSPtoFPdelta();
assert(callerSPtoFPdelta <= 0);
return callerSPtoFPdelta;
}
//---------------------------------------------------------------------
// genCallerSPtoInitialSPdelta - return the offset from Caller-SP to Initial SP.
//
// This number will be negative.
int CodeGenInterface::genCallerSPtoInitialSPdelta()
{
int callerSPtoSPdelta = 0;
callerSPtoSPdelta -= genTotalFrameSize();
assert(callerSPtoSPdelta <= 0);
return callerSPtoSPdelta;
}
/*****************************************************************************
* Emit a call to a helper function.
*
*/
void CodeGen::genEmitHelperCall(unsigned helper, int argSize, emitAttr retSize, regNumber callTargetReg /*= REG_NA */)
{
void* addr = nullptr;
void* pAddr = nullptr;
emitter::EmitCallType callType = emitter::EC_FUNC_TOKEN;
addr = compiler->compGetHelperFtn((CorInfoHelpFunc)helper, &pAddr);
regNumber callTarget = REG_NA;
if (addr == nullptr)
{
// This is call to a runtime helper.
// adrp x, [reloc:rel page addr]
// add x, x, [reloc:page offset]
// ldr x, [x]
// br x
if (callTargetReg == REG_NA)
{
// If a callTargetReg has not been explicitly provided, we will use REG_DEFAULT_HELPER_CALL_TARGET, but
// this is only a valid assumption if the helper call is known to kill REG_DEFAULT_HELPER_CALL_TARGET.
callTargetReg = REG_DEFAULT_HELPER_CALL_TARGET;
}
regMaskTP callTargetMask = genRegMask(callTargetReg);
regMaskTP callKillSet = compiler->compHelperCallKillSet((CorInfoHelpFunc)helper);
// assert that all registers in callTargetMask are in the callKillSet
noway_assert((callTargetMask & callKillSet) == callTargetMask);
callTarget = callTargetReg;
// adrp + add with relocations will be emitted
getEmitter()->emitIns_R_AI(INS_adrp, EA_PTR_DSP_RELOC, callTarget, (ssize_t)pAddr);
getEmitter()->emitIns_R_R(INS_ldr, EA_PTRSIZE, callTarget, callTarget);
callType = emitter::EC_INDIR_R;
}
getEmitter()->emitIns_Call(callType, compiler->eeFindHelper(helper), INDEBUG_LDISASM_COMMA(nullptr) addr, argSize,
retSize, EA_UNKNOWN, gcInfo.gcVarPtrSetCur, gcInfo.gcRegGCrefSetCur,
gcInfo.gcRegByrefSetCur, BAD_IL_OFFSET, /* IL offset */
callTarget, /* ireg */
REG_NA, 0, 0, /* xreg, xmul, disp */
false, /* isJump */
emitter::emitNoGChelper(helper));
regMaskTP killMask = compiler->compHelperCallKillSet((CorInfoHelpFunc)helper);
regTracker.rsTrashRegSet(killMask);
}
#ifdef FEATURE_SIMD
//------------------------------------------------------------------------
// genSIMDIntrinsic: Generate code for a SIMD Intrinsic. This is the main
// routine which in turn calls apropriate genSIMDIntrinsicXXX() routine.
//
// Arguments:
// simdNode - The GT_SIMD node
//
// Return Value:
// None.
//
// Notes:
// Currently, we only recognize SIMDVector<float> and SIMDVector<int>, and
// a limited set of methods.
//
// TODO-CLEANUP Merge all versions of this function and move to new file simdcodegencommon.cpp.
void CodeGen::genSIMDIntrinsic(GenTreeSIMD* simdNode)
{
// NYI for unsupported base types
if (simdNode->gtSIMDBaseType != TYP_INT && simdNode->gtSIMDBaseType != TYP_LONG &&
simdNode->gtSIMDBaseType != TYP_FLOAT && simdNode->gtSIMDBaseType != TYP_DOUBLE &&
simdNode->gtSIMDBaseType != TYP_USHORT && simdNode->gtSIMDBaseType != TYP_UBYTE &&
simdNode->gtSIMDBaseType != TYP_SHORT && simdNode->gtSIMDBaseType != TYP_BYTE &&
simdNode->gtSIMDBaseType != TYP_UINT && simdNode->gtSIMDBaseType != TYP_ULONG)
{
noway_assert(!"SIMD intrinsic with unsupported base type.");
}
switch (simdNode->gtSIMDIntrinsicID)
{
case SIMDIntrinsicInit:
genSIMDIntrinsicInit(simdNode);
break;
case SIMDIntrinsicInitN:
genSIMDIntrinsicInitN(simdNode);
break;
case SIMDIntrinsicSqrt:
case SIMDIntrinsicAbs:
case SIMDIntrinsicCast:
case SIMDIntrinsicConvertToSingle:
case SIMDIntrinsicConvertToInt32:
case SIMDIntrinsicConvertToDouble:
case SIMDIntrinsicConvertToInt64:
genSIMDIntrinsicUnOp(simdNode);
break;
case SIMDIntrinsicWidenLo:
case SIMDIntrinsicWidenHi:
genSIMDIntrinsicWiden(simdNode);
break;
case SIMDIntrinsicNarrow:
genSIMDIntrinsicNarrow(simdNode);
break;
case SIMDIntrinsicAdd:
case SIMDIntrinsicSub:
case SIMDIntrinsicMul:
case SIMDIntrinsicDiv:
case SIMDIntrinsicBitwiseAnd:
case SIMDIntrinsicBitwiseAndNot:
case SIMDIntrinsicBitwiseOr:
case SIMDIntrinsicBitwiseXor:
case SIMDIntrinsicMin:
case SIMDIntrinsicMax:
case SIMDIntrinsicEqual:
case SIMDIntrinsicLessThan:
case SIMDIntrinsicGreaterThan:
case SIMDIntrinsicLessThanOrEqual:
case SIMDIntrinsicGreaterThanOrEqual:
genSIMDIntrinsicBinOp(simdNode);
break;
case SIMDIntrinsicOpEquality:
case SIMDIntrinsicOpInEquality:
genSIMDIntrinsicRelOp(simdNode);
break;
case SIMDIntrinsicDotProduct:
genSIMDIntrinsicDotProduct(simdNode);
break;
case SIMDIntrinsicGetItem:
genSIMDIntrinsicGetItem(simdNode);
break;
case SIMDIntrinsicSetX:
case SIMDIntrinsicSetY:
case SIMDIntrinsicSetZ:
case SIMDIntrinsicSetW:
genSIMDIntrinsicSetItem(simdNode);
break;
case SIMDIntrinsicUpperSave:
genSIMDIntrinsicUpperSave(simdNode);
break;
case SIMDIntrinsicUpperRestore:
genSIMDIntrinsicUpperRestore(simdNode);
break;
case SIMDIntrinsicSelect:
NYI("SIMDIntrinsicSelect lowered during import to (a & sel) | (b & ~sel)");
break;
default:
noway_assert(!"Unimplemented SIMD intrinsic.");
unreached();
}
}
insOpts CodeGen::genGetSimdInsOpt(emitAttr size, var_types elementType)
{
assert((size == EA_16BYTE) || (size == EA_8BYTE));
insOpts result = INS_OPTS_NONE;
switch (elementType)
{
case TYP_DOUBLE:
case TYP_ULONG:
case TYP_LONG:
result = (size == EA_16BYTE) ? INS_OPTS_2D : INS_OPTS_1D;
break;
case TYP_FLOAT:
case TYP_UINT:
case TYP_INT:
result = (size == EA_16BYTE) ? INS_OPTS_4S : INS_OPTS_2S;
break;
case TYP_USHORT:
case TYP_SHORT:
result = (size == EA_16BYTE) ? INS_OPTS_8H : INS_OPTS_4H;
break;
case TYP_UBYTE:
case TYP_BYTE:
result = (size == EA_16BYTE) ? INS_OPTS_16B : INS_OPTS_8B;
break;
default:
assert(!"Unsupported element type");
unreached();
}
return result;
}
// getOpForSIMDIntrinsic: return the opcode for the given SIMD Intrinsic
//
// Arguments:
// intrinsicId - SIMD intrinsic Id
// baseType - Base type of the SIMD vector
// immed - Out param. Any immediate byte operand that needs to be passed to SSE2 opcode
//
//
// Return Value:
// Instruction (op) to be used, and immed is set if instruction requires an immediate operand.
//
instruction CodeGen::getOpForSIMDIntrinsic(SIMDIntrinsicID intrinsicId, var_types baseType, unsigned* ival /*=nullptr*/)
{
instruction result = INS_invalid;
if (varTypeIsFloating(baseType))
{
switch (intrinsicId)
{
case SIMDIntrinsicAbs:
result = INS_fabs;
break;
case SIMDIntrinsicAdd:
result = INS_fadd;
break;
case SIMDIntrinsicBitwiseAnd:
result = INS_and;
break;
case SIMDIntrinsicBitwiseAndNot:
result = INS_bic;
break;
case SIMDIntrinsicBitwiseOr:
result = INS_orr;
break;
case SIMDIntrinsicBitwiseXor:
result = INS_eor;
break;
case SIMDIntrinsicCast:
result = INS_mov;
break;
case SIMDIntrinsicConvertToInt32:
case SIMDIntrinsicConvertToInt64:
result = INS_fcvtns;
break;
case SIMDIntrinsicDiv:
result = INS_fdiv;
break;
case SIMDIntrinsicEqual:
result = INS_fcmeq;
break;
case SIMDIntrinsicGreaterThan:
result = INS_fcmgt;
break;
case SIMDIntrinsicGreaterThanOrEqual:
result = INS_fcmge;
break;
case SIMDIntrinsicLessThan:
result = INS_fcmlt;
break;
case SIMDIntrinsicLessThanOrEqual:
result = INS_fcmle;
break;
case SIMDIntrinsicMax:
result = INS_fmax;
break;
case SIMDIntrinsicMin:
result = INS_fmin;
break;
case SIMDIntrinsicMul:
result = INS_fmul;
break;
case SIMDIntrinsicNarrow:
// Use INS_fcvtn lower bytes of result followed by INS_fcvtn2 for upper bytes
// Return lower bytes instruction here
result = INS_fcvtn;
break;
case SIMDIntrinsicSelect:
result = INS_bsl;
break;
case SIMDIntrinsicSqrt:
result = INS_fsqrt;
break;
case SIMDIntrinsicSub:
result = INS_fsub;
break;
case SIMDIntrinsicWidenLo:
result = INS_fcvtl;
break;
case SIMDIntrinsicWidenHi:
result = INS_fcvtl2;
break;
default:
assert(!"Unsupported SIMD intrinsic");
unreached();
}
}
else
{
bool isUnsigned = varTypeIsUnsigned(baseType);
switch (intrinsicId)
{
case SIMDIntrinsicAbs:
assert(!isUnsigned);
result = INS_abs;
break;
case SIMDIntrinsicAdd:
result = INS_add;
break;
case SIMDIntrinsicBitwiseAnd:
result = INS_and;
break;
case SIMDIntrinsicBitwiseAndNot:
result = INS_bic;
break;
case SIMDIntrinsicBitwiseOr:
result = INS_orr;
break;
case SIMDIntrinsicBitwiseXor:
result = INS_eor;
break;
case SIMDIntrinsicCast:
result = INS_mov;
break;
case SIMDIntrinsicConvertToDouble:
case SIMDIntrinsicConvertToSingle:
result = isUnsigned ? INS_ucvtf : INS_scvtf;
break;
case SIMDIntrinsicEqual:
result = INS_cmeq;
break;
case SIMDIntrinsicGreaterThan:
result = isUnsigned ? INS_cmhi : INS_cmgt;
break;
case SIMDIntrinsicGreaterThanOrEqual:
result = isUnsigned ? INS_cmhs : INS_cmge;
break;
case SIMDIntrinsicLessThan:
assert(!isUnsigned);
result = INS_cmlt;
break;
case SIMDIntrinsicLessThanOrEqual:
assert(!isUnsigned);
result = INS_cmle;
break;
case SIMDIntrinsicMax:
result = isUnsigned ? INS_umax : INS_smax;
break;
case SIMDIntrinsicMin:
result = isUnsigned ? INS_umin : INS_smin;
break;
case SIMDIntrinsicMul:
result = INS_mul;
break;
case SIMDIntrinsicNarrow:
// Use INS_xtn lower bytes of result followed by INS_xtn2 for upper bytes
// Return lower bytes instruction here
result = INS_xtn;
break;
case SIMDIntrinsicSelect:
result = INS_bsl;
break;
case SIMDIntrinsicSub:
result = INS_sub;
break;
case SIMDIntrinsicWidenLo:
result = isUnsigned ? INS_uxtl : INS_sxtl;
break;
case SIMDIntrinsicWidenHi:
result = isUnsigned ? INS_uxtl2 : INS_sxtl2;
break;
default:
assert(!"Unsupported SIMD intrinsic");
unreached();
}
}
noway_assert(result != INS_invalid);
return result;
}
//------------------------------------------------------------------------
// genSIMDIntrinsicInit: Generate code for SIMD Intrinsic Initialize.
//
// Arguments:
// simdNode - The GT_SIMD node
//
// Return Value:
// None.
//
void CodeGen::genSIMDIntrinsicInit(GenTreeSIMD* simdNode)
{
assert(simdNode->gtSIMDIntrinsicID == SIMDIntrinsicInit);
GenTree* op1 = simdNode->gtGetOp1();
var_types baseType = simdNode->gtSIMDBaseType;
regNumber targetReg = simdNode->gtRegNum;
assert(targetReg != REG_NA);
var_types targetType = simdNode->TypeGet();
genConsumeOperands(simdNode);
regNumber op1Reg = op1->IsIntegralConst(0) ? REG_ZR : op1->gtRegNum;
// TODO-ARM64-CQ Add LD1R to allow SIMDIntrinsicInit from contained memory
// TODO-ARM64-CQ Add MOVI to allow SIMDIntrinsicInit from contained immediate small constants
assert(op1->isContained() == op1->IsIntegralConst(0));
assert(!op1->isUsedFromMemory());
assert(genIsValidFloatReg(targetReg));
assert(genIsValidIntReg(op1Reg) || genIsValidFloatReg(op1Reg));
emitAttr attr = (simdNode->gtSIMDSize > 8) ? EA_16BYTE : EA_8BYTE;
insOpts opt = genGetSimdInsOpt(attr, baseType);
if (genIsValidIntReg(op1Reg))
{
getEmitter()->emitIns_R_R(INS_dup, attr, targetReg, op1Reg, opt);
}
else
{
getEmitter()->emitIns_R_R_I(INS_dup, attr, targetReg, op1Reg, 0, opt);
}
genProduceReg(simdNode);
}
//-------------------------------------------------------------------------------------------
// genSIMDIntrinsicInitN: Generate code for SIMD Intrinsic Initialize for the form that takes
// a number of arguments equal to the length of the Vector.
//
// Arguments:
// simdNode - The GT_SIMD node
//
// Return Value:
// None.
//
void CodeGen::genSIMDIntrinsicInitN(GenTreeSIMD* simdNode)
{
assert(simdNode->gtSIMDIntrinsicID == SIMDIntrinsicInitN);
regNumber targetReg = simdNode->gtRegNum;
assert(targetReg != REG_NA);
var_types targetType = simdNode->TypeGet();
var_types baseType = simdNode->gtSIMDBaseType;
regNumber vectorReg = targetReg;
if (varTypeIsFloating(baseType))
{
// Note that we cannot use targetReg before consuming all float source operands.
// Therefore use an internal temp register
vectorReg = simdNode->GetSingleTempReg(RBM_ALLFLOAT);
}
emitAttr baseTypeSize = emitTypeSize(baseType);
// We will first consume the list items in execution (left to right) order,
// and record the registers.
regNumber operandRegs[FP_REGSIZE_BYTES];
unsigned initCount = 0;
for (GenTree* list = simdNode->gtGetOp1(); list != nullptr; list = list->gtGetOp2())
{
assert(list->OperGet() == GT_LIST);
GenTree* listItem = list->gtGetOp1();
assert(listItem->TypeGet() == baseType);
assert(!listItem->isContained());
regNumber operandReg = genConsumeReg(listItem);
operandRegs[initCount] = operandReg;
initCount++;
}
assert((initCount * baseTypeSize) <= simdNode->gtSIMDSize);
if (initCount * baseTypeSize < EA_16BYTE)
{
getEmitter()->emitIns_R_I(INS_movi, EA_16BYTE, vectorReg, 0x00, INS_OPTS_16B);
}
if (varTypeIsIntegral(baseType))
{
for (unsigned i = 0; i < initCount; i++)
{
getEmitter()->emitIns_R_R_I(INS_ins, baseTypeSize, vectorReg, operandRegs[i], i);
}
}
else
{
for (unsigned i = 0; i < initCount; i++)
{
getEmitter()->emitIns_R_R_I_I(INS_ins, baseTypeSize, vectorReg, operandRegs[i], i, 0);
}
}
// Load the initialized value.
if (targetReg != vectorReg)
{
getEmitter()->emitIns_R_R(INS_mov, EA_16BYTE, targetReg, vectorReg);
}
genProduceReg(simdNode);
}
//----------------------------------------------------------------------------------
// genSIMDIntrinsicUnOp: Generate code for SIMD Intrinsic unary operations like sqrt.
//
// Arguments:
// simdNode - The GT_SIMD node
//
// Return Value:
// None.
//
void CodeGen::genSIMDIntrinsicUnOp(GenTreeSIMD* simdNode)
{
assert(simdNode->gtSIMDIntrinsicID == SIMDIntrinsicSqrt || simdNode->gtSIMDIntrinsicID == SIMDIntrinsicCast ||
simdNode->gtSIMDIntrinsicID == SIMDIntrinsicAbs ||
simdNode->gtSIMDIntrinsicID == SIMDIntrinsicConvertToSingle ||
simdNode->gtSIMDIntrinsicID == SIMDIntrinsicConvertToInt32 ||
simdNode->gtSIMDIntrinsicID == SIMDIntrinsicConvertToDouble ||
simdNode->gtSIMDIntrinsicID == SIMDIntrinsicConvertToInt64);
GenTree* op1 = simdNode->gtGetOp1();
var_types baseType = simdNode->gtSIMDBaseType;
regNumber targetReg = simdNode->gtRegNum;
assert(targetReg != REG_NA);
var_types targetType = simdNode->TypeGet();
genConsumeOperands(simdNode);
regNumber op1Reg = op1->gtRegNum;
assert(genIsValidFloatReg(op1Reg));
assert(genIsValidFloatReg(targetReg));
instruction ins = getOpForSIMDIntrinsic(simdNode->gtSIMDIntrinsicID, baseType);
emitAttr attr = (simdNode->gtSIMDSize > 8) ? EA_16BYTE : EA_8BYTE;
insOpts opt = (ins == INS_mov) ? INS_OPTS_NONE : genGetSimdInsOpt(attr, baseType);
getEmitter()->emitIns_R_R(ins, attr, targetReg, op1Reg, opt);
genProduceReg(simdNode);
}
//--------------------------------------------------------------------------------
// genSIMDIntrinsicWiden: Generate code for SIMD Intrinsic Widen operations
//
// Arguments:
// simdNode - The GT_SIMD node
//
// Notes:
// The Widen intrinsics are broken into separate intrinsics for the two results.
//
void CodeGen::genSIMDIntrinsicWiden(GenTreeSIMD* simdNode)
{
assert((simdNode->gtSIMDIntrinsicID == SIMDIntrinsicWidenLo) ||
(simdNode->gtSIMDIntrinsicID == SIMDIntrinsicWidenHi));
GenTree* op1 = simdNode->gtGetOp1();
var_types baseType = simdNode->gtSIMDBaseType;
regNumber targetReg = simdNode->gtRegNum;
assert(targetReg != REG_NA);
var_types simdType = simdNode->TypeGet();
genConsumeOperands(simdNode);
regNumber op1Reg = op1->gtRegNum;
regNumber srcReg = op1Reg;
emitAttr emitSize = emitActualTypeSize(simdType);
instruction ins = getOpForSIMDIntrinsic(simdNode->gtSIMDIntrinsicID, baseType);
if (varTypeIsFloating(baseType))
{
getEmitter()->emitIns_R_R(ins, EA_8BYTE, targetReg, op1Reg);
}
else
{
emitAttr attr = (simdNode->gtSIMDIntrinsicID == SIMDIntrinsicWidenHi) ? EA_16BYTE : EA_8BYTE;
insOpts opt = genGetSimdInsOpt(attr, baseType);
getEmitter()->emitIns_R_R(ins, attr, targetReg, op1Reg, opt);
}
genProduceReg(simdNode);
}
//--------------------------------------------------------------------------------
// genSIMDIntrinsicNarrow: Generate code for SIMD Intrinsic Narrow operations
//
// Arguments:
// simdNode - The GT_SIMD node
//
// Notes:
// This intrinsic takes two arguments. The first operand is narrowed to produce the
// lower elements of the results, and the second operand produces the high elements.
//
void CodeGen::genSIMDIntrinsicNarrow(GenTreeSIMD* simdNode)
{
assert(simdNode->gtSIMDIntrinsicID == SIMDIntrinsicNarrow);
GenTree* op1 = simdNode->gtGetOp1();
GenTree* op2 = simdNode->gtGetOp2();
var_types baseType = simdNode->gtSIMDBaseType;
regNumber targetReg = simdNode->gtRegNum;
assert(targetReg != REG_NA);
var_types simdType = simdNode->TypeGet();
emitAttr emitSize = emitTypeSize(simdType);
genConsumeOperands(simdNode);
regNumber op1Reg = op1->gtRegNum;
regNumber op2Reg = op2->gtRegNum;
assert(genIsValidFloatReg(op1Reg));
assert(genIsValidFloatReg(op2Reg));
assert(genIsValidFloatReg(targetReg));
assert(op2Reg != targetReg);
assert(simdNode->gtSIMDSize == 16);
instruction ins = getOpForSIMDIntrinsic(simdNode->gtSIMDIntrinsicID, baseType);
assert((ins == INS_fcvtn) || (ins == INS_xtn));
if (ins == INS_fcvtn)
{
getEmitter()->emitIns_R_R(INS_fcvtn, EA_8BYTE, targetReg, op1Reg);
getEmitter()->emitIns_R_R(INS_fcvtn2, EA_8BYTE, targetReg, op2Reg);
}
else
{
insOpts opt = INS_OPTS_NONE;
insOpts opt2 = INS_OPTS_NONE;
// This is not the same as genGetSimdInsOpt()
// Basetype is the soure operand type
// However encoding is based on the destination operand type which is 1/2 the basetype.
switch (baseType)
{
case TYP_ULONG:
case TYP_LONG:
opt = INS_OPTS_2S;
opt2 = INS_OPTS_4S;
break;
case TYP_UINT:
case TYP_INT:
opt = INS_OPTS_4H;
opt2 = INS_OPTS_8H;
break;
case TYP_USHORT:
case TYP_SHORT:
opt = INS_OPTS_8B;
opt2 = INS_OPTS_16B;
break;
default:
assert(!"Unsupported narrowing element type");
unreached();
}
getEmitter()->emitIns_R_R(INS_xtn, EA_8BYTE, targetReg, op1Reg, opt);
getEmitter()->emitIns_R_R(INS_xtn2, EA_16BYTE, targetReg, op2Reg, opt2);
}
genProduceReg(simdNode);
}
//--------------------------------------------------------------------------------
// genSIMDIntrinsicBinOp: Generate code for SIMD Intrinsic binary operations
// add, sub, mul, bit-wise And, AndNot and Or.
//
// Arguments:
// simdNode - The GT_SIMD node
//
// Return Value:
// None.
//
void CodeGen::genSIMDIntrinsicBinOp(GenTreeSIMD* simdNode)
{
assert(simdNode->gtSIMDIntrinsicID == SIMDIntrinsicAdd || simdNode->gtSIMDIntrinsicID == SIMDIntrinsicSub ||
simdNode->gtSIMDIntrinsicID == SIMDIntrinsicMul || simdNode->gtSIMDIntrinsicID == SIMDIntrinsicDiv ||
simdNode->gtSIMDIntrinsicID == SIMDIntrinsicBitwiseAnd ||
simdNode->gtSIMDIntrinsicID == SIMDIntrinsicBitwiseAndNot ||
simdNode->gtSIMDIntrinsicID == SIMDIntrinsicBitwiseOr ||
simdNode->gtSIMDIntrinsicID == SIMDIntrinsicBitwiseXor || simdNode->gtSIMDIntrinsicID == SIMDIntrinsicMin ||
simdNode->gtSIMDIntrinsicID == SIMDIntrinsicMax || simdNode->gtSIMDIntrinsicID == SIMDIntrinsicEqual ||
simdNode->gtSIMDIntrinsicID == SIMDIntrinsicLessThan ||
simdNode->gtSIMDIntrinsicID == SIMDIntrinsicGreaterThan ||
simdNode->gtSIMDIntrinsicID == SIMDIntrinsicLessThanOrEqual ||
simdNode->gtSIMDIntrinsicID == SIMDIntrinsicGreaterThanOrEqual);
GenTree* op1 = simdNode->gtGetOp1();
GenTree* op2 = simdNode->gtGetOp2();
var_types baseType = simdNode->gtSIMDBaseType;
regNumber targetReg = simdNode->gtRegNum;
assert(targetReg != REG_NA);
var_types targetType = simdNode->TypeGet();
genConsumeOperands(simdNode);
regNumber op1Reg = op1->gtRegNum;
regNumber op2Reg = op2->gtRegNum;
assert(genIsValidFloatReg(op1Reg));
assert(genIsValidFloatReg(op2Reg));
assert(genIsValidFloatReg(targetReg));
// TODO-ARM64-CQ Contain integer constants where posible
instruction ins = getOpForSIMDIntrinsic(simdNode->gtSIMDIntrinsicID, baseType);
emitAttr attr = (simdNode->gtSIMDSize > 8) ? EA_16BYTE : EA_8BYTE;
insOpts opt = genGetSimdInsOpt(attr, baseType);
getEmitter()->emitIns_R_R_R(ins, attr, targetReg, op1Reg, op2Reg, opt);
genProduceReg(simdNode);
}
//--------------------------------------------------------------------------------
// genSIMDIntrinsicRelOp: Generate code for a SIMD Intrinsic relational operater
// == and !=
//
// Arguments:
// simdNode - The GT_SIMD node
//
// Return Value:
// None.
//
void CodeGen::genSIMDIntrinsicRelOp(GenTreeSIMD* simdNode)
{
assert(simdNode->gtSIMDIntrinsicID == SIMDIntrinsicOpEquality ||
simdNode->gtSIMDIntrinsicID == SIMDIntrinsicOpInEquality);
GenTree* op1 = simdNode->gtGetOp1();
GenTree* op2 = simdNode->gtGetOp2();
var_types baseType = simdNode->gtSIMDBaseType;
regNumber targetReg = simdNode->gtRegNum;
var_types targetType = simdNode->TypeGet();
genConsumeOperands(simdNode);
regNumber op1Reg = op1->gtRegNum;
regNumber op2Reg = op2->gtRegNum;
regNumber otherReg = op2Reg;
instruction ins = getOpForSIMDIntrinsic(SIMDIntrinsicEqual, baseType);
emitAttr attr = (simdNode->gtSIMDSize > 8) ? EA_16BYTE : EA_8BYTE;
insOpts opt = genGetSimdInsOpt(attr, baseType);
// TODO-ARM64-CQ Contain integer constants where posible
regNumber tmpFloatReg = simdNode->GetSingleTempReg(RBM_ALLFLOAT);
getEmitter()->emitIns_R_R_R(ins, attr, tmpFloatReg, op1Reg, op2Reg, opt);
if ((simdNode->gtFlags & GTF_SIMD12_OP) != 0)
{
// For 12Byte vectors we must set upper bits to get correct comparison
// We do not assume upper bits are zero.
instGen_Set_Reg_To_Imm(EA_4BYTE, targetReg, -1);
getEmitter()->emitIns_R_R_I(INS_ins, EA_4BYTE, tmpFloatReg, targetReg, 3);
}
getEmitter()->emitIns_R_R(INS_uminv, attr, tmpFloatReg, tmpFloatReg,
(simdNode->gtSIMDSize > 8) ? INS_OPTS_16B : INS_OPTS_8B);
getEmitter()->emitIns_R_R_I(INS_mov, EA_1BYTE, targetReg, tmpFloatReg, 0);
if (simdNode->gtSIMDIntrinsicID == SIMDIntrinsicOpInEquality)
{
getEmitter()->emitIns_R_R_I(INS_eor, EA_4BYTE, targetReg, targetReg, 0x1);
}
getEmitter()->emitIns_R_R_I(INS_and, EA_4BYTE, targetReg, targetReg, 0x1);
genProduceReg(simdNode);
}
//--------------------------------------------------------------------------------
// genSIMDIntrinsicDotProduct: Generate code for SIMD Intrinsic Dot Product.
//
// Arguments:
// simdNode - The GT_SIMD node
//
// Return Value:
// None.
//
void CodeGen::genSIMDIntrinsicDotProduct(GenTreeSIMD* simdNode)
{
assert(simdNode->gtSIMDIntrinsicID == SIMDIntrinsicDotProduct);
GenTree* op1 = simdNode->gtGetOp1();
GenTree* op2 = simdNode->gtGetOp2();
var_types baseType = simdNode->gtSIMDBaseType;
var_types simdType = op1->TypeGet();
regNumber targetReg = simdNode->gtRegNum;
assert(targetReg != REG_NA);
var_types targetType = simdNode->TypeGet();
assert(targetType == baseType);
genConsumeOperands(simdNode);
regNumber op1Reg = op1->gtRegNum;
regNumber op2Reg = op2->gtRegNum;
regNumber tmpReg = targetReg;
if (!varTypeIsFloating(baseType))
{
tmpReg = simdNode->GetSingleTempReg(RBM_ALLFLOAT);
}
instruction ins = getOpForSIMDIntrinsic(SIMDIntrinsicMul, baseType);
emitAttr attr = (simdNode->gtSIMDSize > 8) ? EA_16BYTE : EA_8BYTE;
insOpts opt = genGetSimdInsOpt(attr, baseType);
// Vector multiply
getEmitter()->emitIns_R_R_R(ins, attr, tmpReg, op1Reg, op2Reg, opt);
if ((simdNode->gtFlags & GTF_SIMD12_OP) != 0)
{
// For 12Byte vectors we must zero upper bits to get correct dot product
// We do not assume upper bits are zero.
getEmitter()->emitIns_R_R_I(INS_ins, EA_4BYTE, tmpReg, REG_ZR, 3);
}
// Vector add horizontal
if (varTypeIsFloating(baseType))
{
if (baseType == TYP_FLOAT)
{
if (opt == INS_OPTS_4S)
{
getEmitter()->emitIns_R_R_R(INS_faddp, attr, tmpReg, tmpReg, tmpReg, INS_OPTS_4S);
}
getEmitter()->emitIns_R_R(INS_faddp, EA_4BYTE, targetReg, tmpReg);
}
else
{
getEmitter()->emitIns_R_R(INS_faddp, EA_8BYTE, targetReg, tmpReg);
}
}
else
{
ins = varTypeIsUnsigned(baseType) ? INS_uaddlv : INS_saddlv;
getEmitter()->emitIns_R_R(ins, attr, tmpReg, tmpReg, opt);
// Mov to integer register
if (varTypeIsUnsigned(baseType) || (genTypeSize(baseType) < 4))
{
getEmitter()->emitIns_R_R_I(INS_mov, emitTypeSize(baseType), targetReg, tmpReg, 0);
}
else
{
getEmitter()->emitIns_R_R_I(INS_smov, emitActualTypeSize(baseType), targetReg, tmpReg, 0);
}
}
genProduceReg(simdNode);
}
//------------------------------------------------------------------------------------
// genSIMDIntrinsicGetItem: Generate code for SIMD Intrinsic get element at index i.
//
// Arguments:
// simdNode - The GT_SIMD node
//
// Return Value:
// None.
//
void CodeGen::genSIMDIntrinsicGetItem(GenTreeSIMD* simdNode)
{
assert(simdNode->gtSIMDIntrinsicID == SIMDIntrinsicGetItem);
GenTree* op1 = simdNode->gtGetOp1();
GenTree* op2 = simdNode->gtGetOp2();
var_types simdType = op1->TypeGet();
assert(varTypeIsSIMD(simdType));
// op1 of TYP_SIMD12 should be considered as TYP_SIMD16
if (simdType == TYP_SIMD12)
{
simdType = TYP_SIMD16;
}
var_types baseType = simdNode->gtSIMDBaseType;
regNumber targetReg = simdNode->gtRegNum;
assert(targetReg != REG_NA);
var_types targetType = simdNode->TypeGet();
assert(targetType == genActualType(baseType));
// GetItem has 2 operands:
// - the source of SIMD type (op1)
// - the index of the value to be returned.
genConsumeOperands(simdNode);
emitAttr baseTypeSize = emitTypeSize(baseType);
unsigned baseTypeScale = genLog2(EA_SIZE_IN_BYTES(baseTypeSize));
if (op2->IsCnsIntOrI())
{
assert(op2->isContained());
ssize_t index = op2->gtIntCon.gtIconVal;
// We only need to generate code for the get if the index is valid
// If the index is invalid, previously generated for the range check will throw
if (getEmitter()->isValidVectorIndex(emitTypeSize(simdType), baseTypeSize, index))
{
if (op1->isContained())
{
int offset = (int)index * genTypeSize(baseType);
instruction ins = ins_Load(baseType);
baseTypeSize = varTypeIsFloating(baseType)
? baseTypeSize
: getEmitter()->emitInsAdjustLoadStoreAttr(ins, baseTypeSize);
assert(!op1->isUsedFromReg());
if (op1->OperIsLocal())
{
unsigned varNum = op1->gtLclVarCommon.gtLclNum;
getEmitter()->emitIns_R_S(ins, baseTypeSize, targetReg, varNum, offset);
}
else
{
assert(op1->OperGet() == GT_IND);
GenTree* addr = op1->AsIndir()->Addr();
assert(!addr->isContained());
regNumber baseReg = addr->gtRegNum;
// ldr targetReg, [baseReg, #offset]
getEmitter()->emitIns_R_R_I(ins, baseTypeSize, targetReg, baseReg, offset);
}
}
else
{
assert(op1->isUsedFromReg());
regNumber srcReg = op1->gtRegNum;
// mov targetReg, srcReg[#index]
getEmitter()->emitIns_R_R_I(INS_mov, baseTypeSize, targetReg, srcReg, index);
}
}
}
else
{
assert(!op2->isContained());
regNumber baseReg = REG_NA;
regNumber indexReg = op2->gtRegNum;
if (op1->isContained())
{
// Optimize the case of op1 is in memory and trying to access ith element.
assert(!op1->isUsedFromReg());
if (op1->OperIsLocal())
{
unsigned varNum = op1->gtLclVarCommon.gtLclNum;
baseReg = simdNode->ExtractTempReg();
// Load the address of varNum
getEmitter()->emitIns_R_S(INS_lea, EA_PTRSIZE, baseReg, varNum, 0);
}
else
{
// Require GT_IND addr to be not contained.
assert(op1->OperGet() == GT_IND);
GenTree* addr = op1->AsIndir()->Addr();
assert(!addr->isContained());
baseReg = addr->gtRegNum;
}
}
else
{
assert(op1->isUsedFromReg());
regNumber srcReg = op1->gtRegNum;
unsigned simdInitTempVarNum = compiler->lvaSIMDInitTempVarNum;
noway_assert(compiler->lvaSIMDInitTempVarNum != BAD_VAR_NUM);
baseReg = simdNode->ExtractTempReg();
// Load the address of simdInitTempVarNum
getEmitter()->emitIns_R_S(INS_lea, EA_PTRSIZE, baseReg, simdInitTempVarNum, 0);
// Store the vector to simdInitTempVarNum
getEmitter()->emitIns_R_R(INS_str, emitTypeSize(simdType), srcReg, baseReg);
}
assert(genIsValidIntReg(indexReg));
assert(genIsValidIntReg(baseReg));
assert(baseReg != indexReg);
// Load item at baseReg[index]
getEmitter()->emitIns_R_R_R_Ext(ins_Load(baseType), baseTypeSize, targetReg, baseReg, indexReg, INS_OPTS_LSL,
baseTypeScale);
}
genProduceReg(simdNode);
}
//------------------------------------------------------------------------------------
// genSIMDIntrinsicSetItem: Generate code for SIMD Intrinsic set element at index i.
//
// Arguments:
// simdNode - The GT_SIMD node
//
// Return Value:
// None.
//
void CodeGen::genSIMDIntrinsicSetItem(GenTreeSIMD* simdNode)
{
// Determine index based on intrinsic ID
int index = -1;
switch (simdNode->gtSIMDIntrinsicID)
{
case SIMDIntrinsicSetX:
index = 0;
break;
case SIMDIntrinsicSetY:
index = 1;
break;
case SIMDIntrinsicSetZ:
index = 2;
break;
case SIMDIntrinsicSetW:
index = 3;
break;
default:
unreached();
}
assert(index != -1);
// op1 is the SIMD vector
// op2 is the value to be set
GenTree* op1 = simdNode->gtGetOp1();
GenTree* op2 = simdNode->gtGetOp2();
var_types baseType = simdNode->gtSIMDBaseType;
regNumber targetReg = simdNode->gtRegNum;
assert(targetReg != REG_NA);
var_types targetType = simdNode->TypeGet();
assert(varTypeIsSIMD(targetType));
assert(op2->TypeGet() == baseType);
assert(simdNode->gtSIMDSize >= ((index + 1) * genTypeSize(baseType)));
genConsumeOperands(simdNode);
regNumber op1Reg = op1->gtRegNum;
regNumber op2Reg = op2->gtRegNum;
assert(genIsValidFloatReg(targetReg));
assert(genIsValidFloatReg(op1Reg));
assert(genIsValidIntReg(op2Reg) || genIsValidFloatReg(op2Reg));
assert(targetReg != op2Reg);
emitAttr attr = emitTypeSize(baseType);
// Insert mov if register assignment requires it
getEmitter()->emitIns_R_R(INS_mov, EA_16BYTE, targetReg, op1Reg);
if (genIsValidIntReg(op2Reg))
{
getEmitter()->emitIns_R_R_I(INS_ins, attr, targetReg, op2Reg, index);
}
else
{
getEmitter()->emitIns_R_R_I_I(INS_ins, attr, targetReg, op2Reg, index, 0);
}
genProduceReg(simdNode);
}
//-----------------------------------------------------------------------------
// genSIMDIntrinsicUpperSave: save the upper half of a TYP_SIMD16 vector to
// the given register, if any, or to memory.
//
// Arguments:
// simdNode - The GT_SIMD node
//
// Return Value:
// None.
//
// Notes:
// The upper half of all SIMD registers are volatile, even the callee-save registers.
// When a 16-byte SIMD value is live across a call, the register allocator will use this intrinsic
// to cause the upper half to be saved. It will first attempt to find another, unused, callee-save
// register. If such a register cannot be found, it will save it to an available caller-save register.
// In that case, this node will be marked GTF_SPILL, which will cause genProduceReg to save the 8 byte
// value to the stack. (Note that if there are no caller-save registers available, the entire 16 byte
// value will be spilled to the stack.)
//
void CodeGen::genSIMDIntrinsicUpperSave(GenTreeSIMD* simdNode)
{
assert(simdNode->gtSIMDIntrinsicID == SIMDIntrinsicUpperSave);
GenTree* op1 = simdNode->gtGetOp1();
assert(op1->IsLocal());
assert(emitTypeSize(op1->TypeGet()) == 16);
regNumber targetReg = simdNode->gtRegNum;
regNumber op1Reg = genConsumeReg(op1);
assert(op1Reg != REG_NA);
assert(targetReg != REG_NA);
getEmitter()->emitIns_R_R_I_I(INS_mov, EA_8BYTE, targetReg, op1Reg, 0, 1);
genProduceReg(simdNode);
}
//-----------------------------------------------------------------------------
// genSIMDIntrinsicUpperRestore: Restore the upper half of a TYP_SIMD16 vector to
// the given register, if any, or to memory.
//
// Arguments:
// simdNode - The GT_SIMD node
//
// Return Value:
// None.
//
// Notes:
// For consistency with genSIMDIntrinsicUpperSave, and to ensure that lclVar nodes always
// have their home register, this node has its targetReg on the lclVar child, and its source
// on the simdNode.
// Regarding spill, please see the note above on genSIMDIntrinsicUpperSave. If we have spilled
// an upper-half to a caller save register, this node will be marked GTF_SPILLED. However, unlike
// most spill scenarios, the saved tree will be different from the restored tree, but the spill
// restore logic, which is triggered by the call to genConsumeReg, requires us to provide the
// spilled tree (saveNode) in order to perform the reload. We can easily find that tree,
// as it is in the spill descriptor for the register from which it was saved.
//
void CodeGen::genSIMDIntrinsicUpperRestore(GenTreeSIMD* simdNode)
{
assert(simdNode->gtSIMDIntrinsicID == SIMDIntrinsicUpperRestore);
GenTree* op1 = simdNode->gtGetOp1();
assert(op1->IsLocal());
assert(emitTypeSize(op1->TypeGet()) == 16);
regNumber srcReg = simdNode->gtRegNum;
regNumber lclVarReg = genConsumeReg(op1);
unsigned varNum = op1->AsLclVarCommon()->gtLclNum;
assert(lclVarReg != REG_NA);
assert(srcReg != REG_NA);
if (simdNode->gtFlags & GTF_SPILLED)
{
GenTree* saveNode = regSet.rsSpillDesc[srcReg]->spillTree;
noway_assert(saveNode != nullptr && (saveNode->gtRegNum == srcReg));
genConsumeReg(saveNode);
}
getEmitter()->emitIns_R_R_I_I(INS_mov, EA_8BYTE, lclVarReg, srcReg, 1, 0);
}
//-----------------------------------------------------------------------------
// genStoreIndTypeSIMD12: store indirect a TYP_SIMD12 (i.e. Vector3) to memory.
// Since Vector3 is not a hardware supported write size, it is performed
// as two writes: 8 byte followed by 4-byte.
//
// Arguments:
// treeNode - tree node that is attempting to store indirect
//
//
// Return Value:
// None.
//
void CodeGen::genStoreIndTypeSIMD12(GenTree* treeNode)
{
assert(treeNode->OperGet() == GT_STOREIND);
GenTree* addr = treeNode->gtOp.gtOp1;
GenTree* data = treeNode->gtOp.gtOp2;
// addr and data should not be contained.
assert(!data->isContained());
assert(!addr->isContained());
#ifdef DEBUG
// Should not require a write barrier
GCInfo::WriteBarrierForm writeBarrierForm = gcInfo.gcIsWriteBarrierCandidate(treeNode, data);
assert(writeBarrierForm == GCInfo::WBF_NoBarrier);
#endif
genConsumeOperands(treeNode->AsOp());
// Need an addtional integer register to extract upper 4 bytes from data.
regNumber tmpReg = treeNode->GetSingleTempReg();
assert(tmpReg != addr->gtRegNum);
// 8-byte write
getEmitter()->emitIns_R_R(ins_Store(TYP_DOUBLE), EA_8BYTE, data->gtRegNum, addr->gtRegNum);
// Extract upper 4-bytes from data
getEmitter()->emitIns_R_R_I(INS_mov, EA_4BYTE, tmpReg, data->gtRegNum, 2);
// 4-byte write
getEmitter()->emitIns_R_R_I(INS_str, EA_4BYTE, tmpReg, addr->gtRegNum, 8);
}
//-----------------------------------------------------------------------------
// genLoadIndTypeSIMD12: load indirect a TYP_SIMD12 (i.e. Vector3) value.
// Since Vector3 is not a hardware supported write size, it is performed
// as two loads: 8 byte followed by 4-byte.
//
// Arguments:
// treeNode - tree node of GT_IND
//
//
// Return Value:
// None.
//
void CodeGen::genLoadIndTypeSIMD12(GenTree* treeNode)
{
assert(treeNode->OperGet() == GT_IND);
GenTree* addr = treeNode->gtOp.gtOp1;
regNumber targetReg = treeNode->gtRegNum;
assert(!addr->isContained());
regNumber operandReg = genConsumeReg(addr);
// Need an addtional int register to read upper 4 bytes, which is different from targetReg
regNumber tmpReg = treeNode->GetSingleTempReg();
// 8-byte read
getEmitter()->emitIns_R_R(ins_Load(TYP_DOUBLE), EA_8BYTE, targetReg, addr->gtRegNum);
// 4-byte read
getEmitter()->emitIns_R_R_I(INS_ldr, EA_4BYTE, tmpReg, addr->gtRegNum, 8);
// Insert upper 4-bytes into data
getEmitter()->emitIns_R_R_I(INS_mov, EA_4BYTE, targetReg, tmpReg, 2);
genProduceReg(treeNode);
}
//-----------------------------------------------------------------------------
// genStoreLclTypeSIMD12: store a TYP_SIMD12 (i.e. Vector3) type field.
// Since Vector3 is not a hardware supported write size, it is performed
// as two stores: 8 byte followed by 4-byte.
//
// Arguments:
// treeNode - tree node that is attempting to store TYP_SIMD12 field
//
// Return Value:
// None.
//
void CodeGen::genStoreLclTypeSIMD12(GenTree* treeNode)
{
assert((treeNode->OperGet() == GT_STORE_LCL_FLD) || (treeNode->OperGet() == GT_STORE_LCL_VAR));
unsigned offs = 0;
unsigned varNum = treeNode->gtLclVarCommon.gtLclNum;
assert(varNum < compiler->lvaCount);
if (treeNode->OperGet() == GT_LCL_FLD)
{
offs = treeNode->gtLclFld.gtLclOffs;
}
GenTree* op1 = treeNode->gtOp.gtOp1;
assert(!op1->isContained());
regNumber operandReg = genConsumeReg(op1);
// Need an addtional integer register to extract upper 4 bytes from data.
regNumber tmpReg = treeNode->GetSingleTempReg();
// store lower 8 bytes
getEmitter()->emitIns_S_R(ins_Store(TYP_DOUBLE), EA_8BYTE, operandReg, varNum, offs);
// Extract upper 4-bytes from data
getEmitter()->emitIns_R_R_I(INS_mov, EA_4BYTE, tmpReg, operandReg, 2);
// 4-byte write
getEmitter()->emitIns_S_R(INS_str, EA_4BYTE, tmpReg, varNum, offs + 8);
}
#endif // FEATURE_SIMD
#ifdef FEATURE_HW_INTRINSICS
#include "hwintrinsicArm64.h"
instruction CodeGen::getOpForHWIntrinsic(GenTreeHWIntrinsic* node, var_types instrType)
{
NamedIntrinsic intrinsicID = node->gtHWIntrinsicId;
unsigned int instrTypeIndex = varTypeIsFloating(instrType) ? 0 : varTypeIsUnsigned(instrType) ? 2 : 1;
instruction ins = compiler->getHWIntrinsicInfo(intrinsicID).instrs[instrTypeIndex];
assert(ins != INS_invalid);
return ins;
}
//------------------------------------------------------------------------
// genHWIntrinsic: Produce code for a GT_HWIntrinsic node.
//
// This is the main routine which in turn calls the genHWIntrinsicXXX() routines.
//
// Arguments:
// node - the GT_HWIntrinsic node
//
// Return Value:
// None.
//
void CodeGen::genHWIntrinsic(GenTreeHWIntrinsic* node)
{
NamedIntrinsic intrinsicID = node->gtHWIntrinsicId;
switch (compiler->getHWIntrinsicInfo(intrinsicID).form)
{
case HWIntrinsicInfo::UnaryOp:
genHWIntrinsicUnaryOp(node);
break;
case HWIntrinsicInfo::CrcOp:
genHWIntrinsicCrcOp(node);
break;
case HWIntrinsicInfo::SimdBinaryOp:
genHWIntrinsicSimdBinaryOp(node);
break;
case HWIntrinsicInfo::SimdExtractOp:
genHWIntrinsicSimdExtractOp(node);
break;
case HWIntrinsicInfo::SimdInsertOp:
genHWIntrinsicSimdInsertOp(node);
break;
case HWIntrinsicInfo::SimdSelectOp:
genHWIntrinsicSimdSelectOp(node);
break;
case HWIntrinsicInfo::SimdSetAllOp:
genHWIntrinsicSimdSetAllOp(node);
break;
case HWIntrinsicInfo::SimdUnaryOp:
genHWIntrinsicSimdUnaryOp(node);
break;
case HWIntrinsicInfo::SimdBinaryRMWOp:
genHWIntrinsicSimdBinaryRMWOp(node);
break;
case HWIntrinsicInfo::SimdTernaryRMWOp:
genHWIntrinsicSimdTernaryRMWOp(node);
break;
case HWIntrinsicInfo::Sha1HashOp:
genHWIntrinsicShaHashOp(node);
break;
case HWIntrinsicInfo::Sha1RotateOp:
genHWIntrinsicShaRotateOp(node);
break;
default:
NYI("HWIntrinsic form not implemented");
}
}
//------------------------------------------------------------------------
// genHWIntrinsicUnaryOp:
//
// Produce code for a GT_HWIntrinsic node with form UnaryOp.
//
// Consumes one scalar operand produces a scalar
//
// Arguments:
// node - the GT_HWIntrinsic node
//
// Return Value:
// None.
//
void CodeGen::genHWIntrinsicUnaryOp(GenTreeHWIntrinsic* node)
{
GenTree* op1 = node->gtGetOp1();
regNumber targetReg = node->gtRegNum;
emitAttr attr = emitActualTypeSize(node);
assert(targetReg != REG_NA);
var_types targetType = node->TypeGet();
genConsumeOperands(node);
regNumber op1Reg = op1->gtRegNum;
instruction ins = getOpForHWIntrinsic(node, node->TypeGet());
getEmitter()->emitIns_R_R(ins, attr, targetReg, op1Reg);
genProduceReg(node);
}
//------------------------------------------------------------------------
// genHWIntrinsicCrcOp:
//
// Produce code for a GT_HWIntrinsic node with form CrcOp.
//
// Consumes two scalar operands and produces a scalar result
//
// This form differs from BinaryOp because the attr depends on the size of op2
//
// Arguments:
// node - the GT_HWIntrinsic node
//
// Return Value:
// None.
//
void CodeGen::genHWIntrinsicCrcOp(GenTreeHWIntrinsic* node)
{
NYI("genHWIntrinsicCrcOp not implemented");
}
//------------------------------------------------------------------------
// genHWIntrinsicSimdBinaryOp:
//
// Produce code for a GT_HWIntrinsic node with form SimdBinaryOp.
//
// Consumes two SIMD operands and produces a SIMD result
//
// Arguments:
// node - the GT_HWIntrinsic node
//
// Return Value:
// None.
//
void CodeGen::genHWIntrinsicSimdBinaryOp(GenTreeHWIntrinsic* node)
{
GenTree* op1 = node->gtGetOp1();
GenTree* op2 = node->gtGetOp2();
var_types baseType = node->gtSIMDBaseType;
regNumber targetReg = node->gtRegNum;
assert(targetReg != REG_NA);
var_types targetType = node->TypeGet();
genConsumeOperands(node);
regNumber op1Reg = op1->gtRegNum;
regNumber op2Reg = op2->gtRegNum;
assert(genIsValidFloatReg(op1Reg));
assert(genIsValidFloatReg(op2Reg));
assert(genIsValidFloatReg(targetReg));
instruction ins = getOpForHWIntrinsic(node, baseType);
emitAttr attr = (node->gtSIMDSize > 8) ? EA_16BYTE : EA_8BYTE;
insOpts opt = genGetSimdInsOpt(attr, baseType);
getEmitter()->emitIns_R_R_R(ins, attr, targetReg, op1Reg, op2Reg, opt);
genProduceReg(node);
}
//------------------------------------------------------------------------
// genHWIntrinsicSwitchTable:
//
// Generate code for an immediate switch table
//
// In cases where an instruction only supports const immediate operands, we
// need to generate functionally correct code when the operand is not constant
//
// This is required by the HW Intrinsic design to handle indirect calls, such as:
// debugger calls
// reflection
// call backs
//
// Generated code implements a switch of this form
//
// switch (swReg)
// {
// case 0:
// ins0; // emitSwCase(0)
// break;
// case 1:
// ins1; // emitSwCase(1)
// break;
// ...
// ...
// ...
// case swMax - 1:
// insLast; // emitSwCase(swMax - 1)
// break;
// default:
// throw ArgumentOutOfRangeException
// }
//
// Generated code looks like:
//
// cmp swReg, #swMax
// b.hs ThrowArgumentOutOfRangeExceptionHelper
// adr tmpReg, labelFirst
// add tmpReg, tmpReg, swReg, LSL #3
// b [tmpReg]
// labelFirst:
// ins0
// b labelBreakTarget
// ins1
// b labelBreakTarget
// ...
// ...
// ...
// insLast
// b labelBreakTarget
// labelBreakTarget:
//
//
// Arguments:
// swReg - register containing the switch case to execute
// tmpReg - temporary integer register for calculating the switch indirect branch target
// swMax - the number of switch cases. If swReg >= swMax throw SCK_ARG_RNG_EXCPN
// emitSwCase - function like argument taking an immediate value and emitting one instruction
//
// Return Value:
// None.
//
template <typename HWIntrinsicSwitchCaseBody>
void CodeGen::genHWIntrinsicSwitchTable(regNumber swReg,
regNumber tmpReg,
int swMax,
HWIntrinsicSwitchCaseBody emitSwCase)
{
assert(swMax > 0);
assert(swMax <= 256);
assert(genIsValidIntReg(tmpReg));
assert(genIsValidIntReg(swReg));
BasicBlock* labelFirst = genCreateTempLabel();
BasicBlock* labelBreakTarget = genCreateTempLabel();
// Detect and throw out of range exception
getEmitter()->emitIns_R_I(INS_cmp, EA_4BYTE, swReg, swMax);
emitJumpKind jmpGEU = genJumpKindForOper(GT_GE, CK_UNSIGNED);
genJumpToThrowHlpBlk(jmpGEU, SCK_ARG_RNG_EXCPN);
// Calculate switch target
labelFirst->bbFlags |= BBF_JMP_TARGET;
// tmpReg = labelFirst
getEmitter()->emitIns_R_L(INS_adr, EA_PTRSIZE, labelFirst, tmpReg);
// tmpReg = labelFirst + swReg * 8
getEmitter()->emitIns_R_R_R_I(INS_add, EA_PTRSIZE, tmpReg, tmpReg, swReg, 3, INS_OPTS_LSL);
// br tmpReg
getEmitter()->emitIns_R(INS_br, EA_PTRSIZE, tmpReg);
genDefineTempLabel(labelFirst);
for (int i = 0; i < swMax; ++i)
{
unsigned prevInsCount = getEmitter()->emitInsCount;
emitSwCase(i);
assert(getEmitter()->emitInsCount == prevInsCount + 1);
inst_JMP(EJ_jmp, labelBreakTarget);
assert(getEmitter()->emitInsCount == prevInsCount + 2);
}
genDefineTempLabel(labelBreakTarget);
}
//------------------------------------------------------------------------
// genHWIntrinsicSimdExtractOp:
//
// Produce code for a GT_HWIntrinsic node with form SimdExtractOp.
//
// Consumes one SIMD operand and one scalar
//
// The element index operand is typically a const immediate
// When it is not, a switch table is generated
//
// See genHWIntrinsicSwitchTable comments
//
// Arguments:
// node - the GT_HWIntrinsic node
//
// Return Value:
// None.
//
void CodeGen::genHWIntrinsicSimdExtractOp(GenTreeHWIntrinsic* node)
{
GenTree* op1 = node->gtGetOp1();
GenTree* op2 = node->gtGetOp2();
var_types simdType = op1->TypeGet();
var_types targetType = node->TypeGet();
regNumber targetReg = node->gtRegNum;
assert(targetReg != REG_NA);
genConsumeOperands(node);
regNumber op1Reg = op1->gtRegNum;
assert(genIsValidFloatReg(op1Reg));
emitAttr baseTypeSize = emitTypeSize(targetType);
int elements = emitTypeSize(simdType) / baseTypeSize;
auto emitSwCase = [&](int element) {
assert(element >= 0);
assert(element < elements);
if (varTypeIsFloating(targetType))
{
assert(genIsValidFloatReg(targetReg));
getEmitter()->emitIns_R_R_I_I(INS_mov, baseTypeSize, targetReg, op1Reg, 0, element);
}
else if (varTypeIsUnsigned(targetType) || (baseTypeSize == EA_8BYTE))
{
assert(genIsValidIntReg(targetReg));
getEmitter()->emitIns_R_R_I(INS_umov, baseTypeSize, targetReg, op1Reg, element);
}
else
{
assert(genIsValidIntReg(targetReg));
getEmitter()->emitIns_R_R_I(INS_smov, baseTypeSize, targetReg, op1Reg, element);
}
};
if (op2->isContainedIntOrIImmed())
{
int element = (int)op2->AsIntConCommon()->IconValue();
emitSwCase(element);
}
else
{
regNumber elementReg = op2->gtRegNum;
regNumber tmpReg = node->GetSingleTempReg();
genHWIntrinsicSwitchTable(elementReg, tmpReg, elements, emitSwCase);
}
genProduceReg(node);
}
//------------------------------------------------------------------------
// genHWIntrinsicSimdInsertOp:
//
// Produce code for a GT_HWIntrinsic node with form SimdInsertOp.
//
// Consumes one SIMD operand and two scalars
//
// The element index operand is typically a const immediate
// When it is not, a switch table is generated
//
// See genHWIntrinsicSwitchTable comments
//
// Arguments:
// node - the GT_HWIntrinsic node
//
// Return Value:
// None.
//
void CodeGen::genHWIntrinsicSimdInsertOp(GenTreeHWIntrinsic* node)
{
GenTreeArgList* argList = node->gtGetOp1()->AsArgList();
GenTree* op1 = argList->Current();
GenTree* op2 = argList->Rest()->Current();
GenTree* op3 = argList->Rest()->Rest()->Current();
var_types simdType = op1->TypeGet();
var_types baseType = node->gtSIMDBaseType;
regNumber targetReg = node->gtRegNum;
assert(targetReg != REG_NA);
genConsumeRegs(op1);
genConsumeRegs(op2);
genConsumeRegs(op3);
regNumber op1Reg = op1->gtRegNum;
assert(genIsValidFloatReg(targetReg));
assert(genIsValidFloatReg(op1Reg));
emitAttr baseTypeSize = emitTypeSize(baseType);
int elements = emitTypeSize(simdType) / baseTypeSize;
if (targetReg != op1Reg)
{
getEmitter()->emitIns_R_R(INS_mov, baseTypeSize, targetReg, op1Reg);
}
if (op3->isContained())
{
// Handle vector element to vector element case
//
// If op3 is contained this is because lowering found an opportunity to contain a Simd.Extract in a Simd.Insert
//
regNumber op3Reg = op3->gtGetOp1()->gtRegNum;
assert(genIsValidFloatReg(op3Reg));
// op3 containment currently only occurs when
// + op3 is a Simd.Extract() (gtHWIntrinsicId == NI_ARM64_SIMD_GetItem)
// + element & srcLane are immediate constants
assert(op2->isContainedIntOrIImmed());
assert(op3->OperIs(GT_HWIntrinsic));
assert(op3->AsHWIntrinsic()->gtHWIntrinsicId == NI_ARM64_SIMD_GetItem);
assert(op3->gtGetOp2()->isContainedIntOrIImmed());
int element = (int)op2->AsIntConCommon()->IconValue();
int srcLane = (int)op3->gtGetOp2()->AsIntConCommon()->IconValue();
// Emit mov targetReg[element], op3Reg[srcLane]
getEmitter()->emitIns_R_R_I_I(INS_mov, baseTypeSize, targetReg, op3Reg, element, srcLane);
}
else
{
// Handle scalar to vector element case
// TODO-ARM64-CQ handle containing op3 scalar const where possible
regNumber op3Reg = op3->gtRegNum;
auto emitSwCase = [&](int element) {
assert(element >= 0);
assert(element < elements);
if (varTypeIsFloating(baseType))
{
assert(genIsValidFloatReg(op3Reg));
getEmitter()->emitIns_R_R_I_I(INS_mov, baseTypeSize, targetReg, op3Reg, element, 0);
}
else
{
assert(genIsValidIntReg(op3Reg));
getEmitter()->emitIns_R_R_I(INS_mov, baseTypeSize, targetReg, op3Reg, element);
}
};
if (op2->isContainedIntOrIImmed())
{
int element = (int)op2->AsIntConCommon()->IconValue();
emitSwCase(element);
}
else
{
regNumber elementReg = op2->gtRegNum;
regNumber tmpReg = node->GetSingleTempReg();
genHWIntrinsicSwitchTable(elementReg, tmpReg, elements, emitSwCase);
}
}
genProduceReg(node);
}
//------------------------------------------------------------------------
// genHWIntrinsicSimdSelectOp:
//
// Produce code for a GT_HWIntrinsic node with form SimdSelectOp.
//
// Consumes three SIMD operands and produces a SIMD result
//
// This intrinsic form requires one of the source registers to be the
// destination register. Inserts a INS_mov if this requirement is not met.
//
// Arguments:
// node - the GT_HWIntrinsic node
//
// Return Value:
// None.
//
void CodeGen::genHWIntrinsicSimdSelectOp(GenTreeHWIntrinsic* node)
{
GenTreeArgList* argList = node->gtGetOp1()->AsArgList();
GenTree* op1 = argList->Current();
GenTree* op2 = argList->Rest()->Current();
GenTree* op3 = argList->Rest()->Rest()->Current();
var_types baseType = node->gtSIMDBaseType;
regNumber targetReg = node->gtRegNum;
assert(targetReg != REG_NA);
var_types targetType = node->TypeGet();
genConsumeRegs(op1);
genConsumeRegs(op2);
genConsumeRegs(op3);
regNumber op1Reg = op1->gtRegNum;
regNumber op2Reg = op2->gtRegNum;
regNumber op3Reg = op3->gtRegNum;
assert(genIsValidFloatReg(op1Reg));
assert(genIsValidFloatReg(op2Reg));
assert(genIsValidFloatReg(op3Reg));
assert(genIsValidFloatReg(targetReg));
emitAttr attr = (node->gtSIMDSize > 8) ? EA_16BYTE : EA_8BYTE;
// Arm64 has three bit select forms; each uses three source registers
// One of the sources is also the destination
if (targetReg == op3Reg)
{
// op3 is target use bit insert if true
// op3 = op3 ^ (op1 & (op2 ^ op3))
getEmitter()->emitIns_R_R_R(INS_bit, attr, op3Reg, op2Reg, op1Reg);
}
else if (targetReg == op2Reg)
{
// op2 is target use bit insert if false
// op2 = op2 ^ (~op1 & (op2 ^ op3))
getEmitter()->emitIns_R_R_R(INS_bif, attr, op2Reg, op3Reg, op1Reg);
}
else
{
if (targetReg != op1Reg)
{
// target is not one of the sources, copy op1 to use bit select form
getEmitter()->emitIns_R_R(INS_mov, attr, targetReg, op1Reg);
}
// use bit select
// targetReg = op3 ^ (targetReg & (op2 ^ op3))
getEmitter()->emitIns_R_R_R(INS_bsl, attr, targetReg, op2Reg, op3Reg);
}
genProduceReg(node);
}
//------------------------------------------------------------------------
// genHWIntrinsicSimdSetAllOp:
//
// Produce code for a GT_HWIntrinsic node with form SimdSetAllOp.
//
// Consumes single scalar operand and produces a SIMD result
//
// Arguments:
// node - the GT_HWIntrinsic node
//
// Return Value:
// None.
//
void CodeGen::genHWIntrinsicSimdSetAllOp(GenTreeHWIntrinsic* node)
{
GenTree* op1 = node->gtGetOp1();
var_types baseType = node->gtSIMDBaseType;
regNumber targetReg = node->gtRegNum;
assert(targetReg != REG_NA);
var_types targetType = node->TypeGet();
genConsumeOperands(node);
regNumber op1Reg = op1->gtRegNum;
assert(genIsValidFloatReg(targetReg));
assert(genIsValidIntReg(op1Reg) || genIsValidFloatReg(op1Reg));
instruction ins = getOpForHWIntrinsic(node, baseType);
emitAttr attr = (node->gtSIMDSize > 8) ? EA_16BYTE : EA_8BYTE;
insOpts opt = genGetSimdInsOpt(attr, baseType);
// TODO-ARM64-CQ Support contained immediate cases
if (genIsValidIntReg(op1Reg))
{
getEmitter()->emitIns_R_R(ins, attr, targetReg, op1Reg, opt);
}
else
{
getEmitter()->emitIns_R_R_I(ins, attr, targetReg, op1Reg, 0, opt);
}
genProduceReg(node);
}
//------------------------------------------------------------------------
// genHWIntrinsicSimdUnaryOp:
//
// Produce code for a GT_HWIntrinsic node with form SimdUnaryOp.
//
// Consumes single SIMD operand and produces a SIMD result
//
// Arguments:
// node - the GT_HWIntrinsic node
//
// Return Value:
// None.
//
void CodeGen::genHWIntrinsicSimdUnaryOp(GenTreeHWIntrinsic* node)
{
GenTree* op1 = node->gtGetOp1();
var_types baseType = node->gtSIMDBaseType;
regNumber targetReg = node->gtRegNum;
assert(targetReg != REG_NA);
var_types targetType = node->TypeGet();
genConsumeOperands(node);
regNumber op1Reg = op1->gtRegNum;
assert(genIsValidFloatReg(op1Reg));
assert(genIsValidFloatReg(targetReg));
instruction ins = getOpForHWIntrinsic(node, baseType);
emitAttr attr = (node->gtSIMDSize > 8) ? EA_16BYTE : EA_8BYTE;
insOpts opt = genGetSimdInsOpt(attr, baseType);
getEmitter()->emitIns_R_R(ins, attr, targetReg, op1Reg, opt);
genProduceReg(node);
}
//------------------------------------------------------------------------
// genHWIntrinsicSimdBinaryRMWOp:
//
// Produce code for a GT_HWIntrinsic node with form SimdBinaryRMWOp.
//
// Consumes two SIMD operands and produces a SIMD result.
// First operand is both source and destination.
//
// Arguments:
// node - the GT_HWIntrinsic node
//
// Return Value:
// None.
//
void CodeGen::genHWIntrinsicSimdBinaryRMWOp(GenTreeHWIntrinsic* node)
{
GenTree* op1 = node->gtGetOp1();
GenTree* op2 = node->gtGetOp2();
var_types baseType = node->gtSIMDBaseType;
regNumber targetReg = node->gtRegNum;
assert(targetReg != REG_NA);
genConsumeOperands(node);
regNumber op1Reg = op1->gtRegNum;
regNumber op2Reg = op2->gtRegNum;
assert(genIsValidFloatReg(op1Reg));
assert(genIsValidFloatReg(op2Reg));
assert(genIsValidFloatReg(targetReg));
instruction ins = getOpForHWIntrinsic(node, baseType);
emitAttr attr = (node->gtSIMDSize > 8) ? EA_16BYTE : EA_8BYTE;
insOpts opt = genGetSimdInsOpt(attr, baseType);
if (targetReg != op1Reg)
{
getEmitter()->emitIns_R_R(INS_mov, attr, targetReg, op1Reg);
}
getEmitter()->emitIns_R_R(ins, attr, targetReg, op2Reg, opt);
genProduceReg(node);
}
//------------------------------------------------------------------------
// genHWIntrinsicSimdTernaryRMWOp:
//
// Produce code for a GT_HWIntrinsic node with form SimdTernaryRMWOp
//
// Consumes three SIMD operands and produces a SIMD result.
// First operand is both source and destination.
//
// Arguments:
// node - the GT_HWIntrinsic node
//
// Return Value:
// None.
//
void CodeGen::genHWIntrinsicSimdTernaryRMWOp(GenTreeHWIntrinsic* node)
{
GenTreeArgList* argList = node->gtGetOp1()->AsArgList();
GenTree* op1 = argList->Current();
GenTree* op2 = argList->Rest()->Current();
GenTree* op3 = argList->Rest()->Rest()->Current();
var_types baseType = node->gtSIMDBaseType;
regNumber targetReg = node->gtRegNum;
assert(targetReg != REG_NA);
var_types targetType = node->TypeGet();
genConsumeRegs(op1);
genConsumeRegs(op2);
genConsumeRegs(op3);
regNumber op1Reg = op1->gtRegNum;
regNumber op2Reg = op2->gtRegNum;
regNumber op3Reg = op3->gtRegNum;
assert(genIsValidFloatReg(op1Reg));
assert(genIsValidFloatReg(op2Reg));
assert(genIsValidFloatReg(op3Reg));
assert(genIsValidFloatReg(targetReg));
assert(targetReg != op2Reg);
assert(targetReg != op3Reg);
instruction ins = getOpForHWIntrinsic(node, baseType);
emitAttr attr = (node->gtSIMDSize > 8) ? EA_16BYTE : EA_8BYTE;
if (targetReg != op1Reg)
{
getEmitter()->emitIns_R_R(INS_mov, attr, targetReg, op1Reg);
}
getEmitter()->emitIns_R_R_R(ins, attr, targetReg, op2Reg, op3Reg);
genProduceReg(node);
}
//------------------------------------------------------------------------
// genHWIntrinsicShaHashOp:
//
// Produce code for a GT_HWIntrinsic node with form Sha1HashOp.
// Used in Arm64 SHA1 Hash operations.
//
// Consumes three operands and returns a Simd result.
// First Simd operand is both source and destination.
// Second Operand is an unsigned int.
// Third operand is a simd operand.
// Arguments:
// node - the GT_HWIntrinsic node
//
// Return Value:
// None.
//
void CodeGen::genHWIntrinsicShaHashOp(GenTreeHWIntrinsic* node)
{
GenTreeArgList* argList = node->gtGetOp1()->AsArgList();
GenTree* op1 = argList->Current();
GenTree* op2 = argList->Rest()->Current();
GenTree* op3 = argList->Rest()->Rest()->Current();
var_types baseType = node->gtSIMDBaseType;
regNumber targetReg = node->gtRegNum;
assert(targetReg != REG_NA);
var_types targetType = node->TypeGet();
genConsumeRegs(op1);
genConsumeRegs(op2);
genConsumeRegs(op3);
regNumber op1Reg = op1->gtRegNum;
regNumber op2Reg = op2->gtRegNum;
regNumber op3Reg = op3->gtRegNum;
assert(genIsValidFloatReg(op1Reg));
assert(genIsValidFloatReg(op3Reg));
assert(targetReg != op2Reg);
assert(targetReg != op3Reg);
instruction ins = getOpForHWIntrinsic(node, baseType);
emitAttr attr = (node->gtSIMDSize > 8) ? EA_16BYTE : EA_8BYTE;
assert(genIsValidIntReg(op2Reg));
regNumber elementReg = op2->gtRegNum;
regNumber tmpReg = node->GetSingleTempReg(RBM_ALLFLOAT);
getEmitter()->emitIns_R_R(INS_fmov, EA_4BYTE, tmpReg, elementReg);
if (targetReg != op1Reg)
{
getEmitter()->emitIns_R_R(INS_mov, attr, targetReg, op1Reg);
}
getEmitter()->emitIns_R_R_R(ins, attr, targetReg, tmpReg, op3Reg);
genProduceReg(node);
}
//------------------------------------------------------------------------
// genHWIntrinsicShaRotateOp:
//
// Produce code for a GT_HWIntrinsic node with form Sha1RotateOp.
// Used in Arm64 SHA1 Rotate operations.
//
// Consumes one integer operand and returns unsigned int result.
//
// Arguments:
// node - the GT_HWIntrinsic node
//
// Return Value:
// None.
//
void CodeGen::genHWIntrinsicShaRotateOp(GenTreeHWIntrinsic* node)
{
GenTree* op1 = node->gtGetOp1();
regNumber targetReg = node->gtRegNum;
emitAttr attr = emitActualTypeSize(node);
assert(targetReg != REG_NA);
var_types targetType = node->TypeGet();
genConsumeOperands(node);
instruction ins = getOpForHWIntrinsic(node, node->TypeGet());
regNumber elementReg = op1->gtRegNum;
regNumber tmpReg = node->GetSingleTempReg(RBM_ALLFLOAT);
getEmitter()->emitIns_R_R(INS_fmov, EA_4BYTE, tmpReg, elementReg);
getEmitter()->emitIns_R_R(ins, EA_4BYTE, tmpReg, tmpReg);
getEmitter()->emitIns_R_R(INS_fmov, attr, targetReg, tmpReg);
genProduceReg(node);
}
#endif // FEATURE_HW_INTRINSICS
/*****************************************************************************
* Unit testing of the ARM64 emitter: generate a bunch of instructions into the prolog
* (it's as good a place as any), then use COMPlus_JitLateDisasm=* to see if the late
* disassembler thinks the instructions as the same as we do.
*/
// Uncomment "#define ALL_ARM64_EMITTER_UNIT_TESTS" to run all the unit tests here.
// After adding a unit test, and verifying it works, put it under this #ifdef, so we don't see it run every time.
//#define ALL_ARM64_EMITTER_UNIT_TESTS
#if defined(DEBUG)
void CodeGen::genArm64EmitterUnitTests()
{
if (!verbose)
{
return;
}
if (!compiler->opts.altJit)
{
// No point doing this in a "real" JIT.
return;
}
// Mark the "fake" instructions in the output.
printf("*************** In genArm64EmitterUnitTests()\n");
emitter* theEmitter = getEmitter();
#ifdef ALL_ARM64_EMITTER_UNIT_TESTS
// We use this:
// genDefineTempLabel(genCreateTempLabel());
// to create artificial labels to help separate groups of tests.
//
// Loads/Stores basic general register
//
genDefineTempLabel(genCreateTempLabel());
// ldr/str Xt, [reg]
theEmitter->emitIns_R_R(INS_ldr, EA_8BYTE, REG_R8, REG_R9);
theEmitter->emitIns_R_R(INS_ldrb, EA_1BYTE, REG_R8, REG_R9);
theEmitter->emitIns_R_R(INS_ldrh, EA_2BYTE, REG_R8, REG_R9);
theEmitter->emitIns_R_R(INS_str, EA_8BYTE, REG_R8, REG_R9);
theEmitter->emitIns_R_R(INS_strb, EA_1BYTE, REG_R8, REG_R9);
theEmitter->emitIns_R_R(INS_strh, EA_2BYTE, REG_R8, REG_R9);
// ldr/str Wt, [reg]
theEmitter->emitIns_R_R(INS_ldr, EA_4BYTE, REG_R8, REG_R9);
theEmitter->emitIns_R_R(INS_ldrb, EA_1BYTE, REG_R8, REG_R9);
theEmitter->emitIns_R_R(INS_ldrh, EA_2BYTE, REG_R8, REG_R9);
theEmitter->emitIns_R_R(INS_str, EA_4BYTE, REG_R8, REG_R9);
theEmitter->emitIns_R_R(INS_strb, EA_1BYTE, REG_R8, REG_R9);
theEmitter->emitIns_R_R(INS_strh, EA_2BYTE, REG_R8, REG_R9);
theEmitter->emitIns_R_R(INS_ldrsb, EA_4BYTE, REG_R8, REG_R9); // target Wt
theEmitter->emitIns_R_R(INS_ldrsh, EA_4BYTE, REG_R8, REG_R9); // target Wt
theEmitter->emitIns_R_R(INS_ldrsb, EA_8BYTE, REG_R8, REG_R9); // target Xt
theEmitter->emitIns_R_R(INS_ldrsh, EA_8BYTE, REG_R8, REG_R9); // target Xt
theEmitter->emitIns_R_R(INS_ldrsw, EA_8BYTE, REG_R8, REG_R9); // target Xt
theEmitter->emitIns_R_R_I(INS_ldurb, EA_4BYTE, REG_R8, REG_R9, 1);
theEmitter->emitIns_R_R_I(INS_ldurh, EA_4BYTE, REG_R8, REG_R9, 1);
theEmitter->emitIns_R_R_I(INS_sturb, EA_4BYTE, REG_R8, REG_R9, 1);
theEmitter->emitIns_R_R_I(INS_sturh, EA_4BYTE, REG_R8, REG_R9, 1);
theEmitter->emitIns_R_R_I(INS_ldursb, EA_4BYTE, REG_R8, REG_R9, 1);
theEmitter->emitIns_R_R_I(INS_ldursb, EA_8BYTE, REG_R8, REG_R9, 1);
theEmitter->emitIns_R_R_I(INS_ldursh, EA_4BYTE, REG_R8, REG_R9, 1);
theEmitter->emitIns_R_R_I(INS_ldursh, EA_8BYTE, REG_R8, REG_R9, 1);
theEmitter->emitIns_R_R_I(INS_ldur, EA_8BYTE, REG_R8, REG_R9, 1);
theEmitter->emitIns_R_R_I(INS_ldur, EA_4BYTE, REG_R8, REG_R9, 1);
theEmitter->emitIns_R_R_I(INS_stur, EA_4BYTE, REG_R8, REG_R9, 1);
theEmitter->emitIns_R_R_I(INS_stur, EA_8BYTE, REG_R8, REG_R9, 1);
theEmitter->emitIns_R_R_I(INS_ldursw, EA_8BYTE, REG_R8, REG_R9, 1);
// SP and ZR tests
theEmitter->emitIns_R_R_I(INS_ldur, EA_8BYTE, REG_R8, REG_SP, 1);
theEmitter->emitIns_R_R_I(INS_ldurb, EA_8BYTE, REG_ZR, REG_R9, 1);
theEmitter->emitIns_R_R_I(INS_ldurh, EA_8BYTE, REG_ZR, REG_SP, 1);
// scaled
theEmitter->emitIns_R_R_I(INS_ldrb, EA_1BYTE, REG_R8, REG_R9, 1);
theEmitter->emitIns_R_R_I(INS_ldrh, EA_2BYTE, REG_R8, REG_R9, 2);
theEmitter->emitIns_R_R_I(INS_ldr, EA_4BYTE, REG_R8, REG_R9, 4);
theEmitter->emitIns_R_R_I(INS_ldr, EA_8BYTE, REG_R8, REG_R9, 8);
// pre-/post-indexed (unscaled)
theEmitter->emitIns_R_R_I(INS_ldr, EA_4BYTE, REG_R8, REG_R9, 1, INS_OPTS_POST_INDEX);
theEmitter->emitIns_R_R_I(INS_ldr, EA_4BYTE, REG_R8, REG_R9, 1, INS_OPTS_PRE_INDEX);
theEmitter->emitIns_R_R_I(INS_ldr, EA_8BYTE, REG_R8, REG_R9, 1, INS_OPTS_POST_INDEX);
theEmitter->emitIns_R_R_I(INS_ldr, EA_8BYTE, REG_R8, REG_R9, 1, INS_OPTS_PRE_INDEX);
// ldar/stlr Rt, [reg]
theEmitter->emitIns_R_R(INS_ldar, EA_8BYTE, REG_R9, REG_R8);
theEmitter->emitIns_R_R(INS_ldar, EA_4BYTE, REG_R7, REG_R10);
theEmitter->emitIns_R_R(INS_ldarb, EA_4BYTE, REG_R5, REG_R11);
theEmitter->emitIns_R_R(INS_ldarh, EA_4BYTE, REG_R5, REG_R12);
theEmitter->emitIns_R_R(INS_stlr, EA_8BYTE, REG_R9, REG_R8);
theEmitter->emitIns_R_R(INS_stlr, EA_4BYTE, REG_R7, REG_R13);
theEmitter->emitIns_R_R(INS_stlrb, EA_4BYTE, REG_R5, REG_R14);
theEmitter->emitIns_R_R(INS_stlrh, EA_4BYTE, REG_R3, REG_R15);
// ldaxr Rt, [reg]
theEmitter->emitIns_R_R(INS_ldaxr, EA_8BYTE, REG_R9, REG_R8);
theEmitter->emitIns_R_R(INS_ldaxr, EA_4BYTE, REG_R7, REG_R10);
theEmitter->emitIns_R_R(INS_ldaxrb, EA_4BYTE, REG_R5, REG_R11);
theEmitter->emitIns_R_R(INS_ldaxrh, EA_4BYTE, REG_R5, REG_R12);
// ldxr Rt, [reg]
theEmitter->emitIns_R_R(INS_ldxr, EA_8BYTE, REG_R9, REG_R8);
theEmitter->emitIns_R_R(INS_ldxr, EA_4BYTE, REG_R7, REG_R10);
theEmitter->emitIns_R_R(INS_ldxrb, EA_4BYTE, REG_R5, REG_R11);
theEmitter->emitIns_R_R(INS_ldxrh, EA_4BYTE, REG_R5, REG_R12);
// stxr Ws, Rt, [reg]
theEmitter->emitIns_R_R_R(INS_stxr, EA_8BYTE, REG_R1, REG_R9, REG_R8);
theEmitter->emitIns_R_R_R(INS_stxr, EA_4BYTE, REG_R3, REG_R7, REG_R13);
theEmitter->emitIns_R_R_R(INS_stxrb, EA_4BYTE, REG_R8, REG_R5, REG_R14);
theEmitter->emitIns_R_R_R(INS_stxrh, EA_4BYTE, REG_R12, REG_R3, REG_R15);
// stlxr Ws, Rt, [reg]
theEmitter->emitIns_R_R_R(INS_stlxr, EA_8BYTE, REG_R1, REG_R9, REG_R8);
theEmitter->emitIns_R_R_R(INS_stlxr, EA_4BYTE, REG_R3, REG_R7, REG_R13);
theEmitter->emitIns_R_R_R(INS_stlxrb, EA_4BYTE, REG_R8, REG_R5, REG_R14);
theEmitter->emitIns_R_R_R(INS_stlxrh, EA_4BYTE, REG_R12, REG_R3, REG_R15);
#endif // ALL_ARM64_EMITTER_UNIT_TESTS
#ifdef ALL_ARM64_EMITTER_UNIT_TESTS
//
// Compares
//
genDefineTempLabel(genCreateTempLabel());
// cmp reg, reg
theEmitter->emitIns_R_R(INS_cmp, EA_8BYTE, REG_R8, REG_R9);
theEmitter->emitIns_R_R(INS_cmn, EA_8BYTE, REG_R8, REG_R9);
// cmp reg, imm
theEmitter->emitIns_R_I(INS_cmp, EA_8BYTE, REG_R8, 0);
theEmitter->emitIns_R_I(INS_cmp, EA_8BYTE, REG_R8, 4095);
theEmitter->emitIns_R_I(INS_cmp, EA_8BYTE, REG_R8, 1 << 12);
theEmitter->emitIns_R_I(INS_cmp, EA_8BYTE, REG_R8, 4095 << 12);
theEmitter->emitIns_R_I(INS_cmn, EA_8BYTE, REG_R8, 0);
theEmitter->emitIns_R_I(INS_cmn, EA_8BYTE, REG_R8, 4095);
theEmitter->emitIns_R_I(INS_cmn, EA_8BYTE, REG_R8, 1 << 12);
theEmitter->emitIns_R_I(INS_cmn, EA_8BYTE, REG_R8, 4095 << 12);
theEmitter->emitIns_R_I(INS_cmp, EA_8BYTE, REG_R8, -1);
theEmitter->emitIns_R_I(INS_cmp, EA_8BYTE, REG_R8, -0xfff);
theEmitter->emitIns_R_I(INS_cmp, EA_8BYTE, REG_R8, 0xfffffffffffff000LL);
theEmitter->emitIns_R_I(INS_cmp, EA_8BYTE, REG_R8, 0xffffffffff800000LL);
theEmitter->emitIns_R_I(INS_cmn, EA_8BYTE, REG_R8, -1);
theEmitter->emitIns_R_I(INS_cmn, EA_8BYTE, REG_R8, -0xfff);
theEmitter->emitIns_R_I(INS_cmn, EA_8BYTE, REG_R8, 0xfffffffffffff000LL);
theEmitter->emitIns_R_I(INS_cmn, EA_8BYTE, REG_R8, 0xffffffffff800000LL);
#endif // ALL_ARM64_EMITTER_UNIT_TESTS
#ifdef ALL_ARM64_EMITTER_UNIT_TESTS
// R_R
//
genDefineTempLabel(genCreateTempLabel());
theEmitter->emitIns_R_R(INS_cls, EA_8BYTE, REG_R1, REG_R12);
theEmitter->emitIns_R_R(INS_clz, EA_8BYTE, REG_R2, REG_R13);
theEmitter->emitIns_R_R(INS_rbit, EA_8BYTE, REG_R3, REG_R14);
theEmitter->emitIns_R_R(INS_rev, EA_8BYTE, REG_R4, REG_R15);
theEmitter->emitIns_R_R(INS_rev16, EA_8BYTE, REG_R5, REG_R0);
theEmitter->emitIns_R_R(INS_rev32, EA_8BYTE, REG_R6, REG_R1);
theEmitter->emitIns_R_R(INS_cls, EA_4BYTE, REG_R7, REG_R2);
theEmitter->emitIns_R_R(INS_clz, EA_4BYTE, REG_R8, REG_R3);
theEmitter->emitIns_R_R(INS_rbit, EA_4BYTE, REG_R9, REG_R4);
theEmitter->emitIns_R_R(INS_rev, EA_4BYTE, REG_R10, REG_R5);
theEmitter->emitIns_R_R(INS_rev16, EA_4BYTE, REG_R11, REG_R6);
#endif // ALL_ARM64_EMITTER_UNIT_TESTS
#ifdef ALL_ARM64_EMITTER_UNIT_TESTS
//
// R_I
//
genDefineTempLabel(genCreateTempLabel());
// mov reg, imm(i16,hw)
theEmitter->emitIns_R_I(INS_mov, EA_8BYTE, REG_R8, 0x0000000000001234);
theEmitter->emitIns_R_I(INS_mov, EA_8BYTE, REG_R8, 0x0000000043210000);
theEmitter->emitIns_R_I(INS_mov, EA_8BYTE, REG_R8, 0x0000567800000000);
theEmitter->emitIns_R_I(INS_mov, EA_8BYTE, REG_R8, 0x8765000000000000);
theEmitter->emitIns_R_I(INS_mov, EA_8BYTE, REG_R8, 0xFFFFFFFFFFFF1234);
theEmitter->emitIns_R_I(INS_mov, EA_8BYTE, REG_R8, 0xFFFFFFFF4321FFFF);
theEmitter->emitIns_R_I(INS_mov, EA_8BYTE, REG_R8, 0xFFFF5678FFFFFFFF);
theEmitter->emitIns_R_I(INS_mov, EA_8BYTE, REG_R8, 0x8765FFFFFFFFFFFF);
theEmitter->emitIns_R_I(INS_mov, EA_4BYTE, REG_R8, 0x00001234);
theEmitter->emitIns_R_I(INS_mov, EA_4BYTE, REG_R8, 0x87650000);
theEmitter->emitIns_R_I(INS_mov, EA_4BYTE, REG_R8, 0xFFFF1234);
theEmitter->emitIns_R_I(INS_mov, EA_4BYTE, REG_R8, 0x4567FFFF);
// mov reg, imm(N,r,s)
theEmitter->emitIns_R_I(INS_mov, EA_8BYTE, REG_R8, 0x00FFFFF000000000);
theEmitter->emitIns_R_I(INS_mov, EA_8BYTE, REG_R8, 0x6666666666666666);
theEmitter->emitIns_R_I(INS_mov, EA_8BYTE, REG_SP, 0x7FFF00007FFF0000);
theEmitter->emitIns_R_I(INS_mov, EA_8BYTE, REG_R8, 0x5555555555555555);
theEmitter->emitIns_R_I(INS_mov, EA_8BYTE, REG_R8, 0xE003E003E003E003);
theEmitter->emitIns_R_I(INS_mov, EA_8BYTE, REG_R8, 0x0707070707070707);
theEmitter->emitIns_R_I(INS_mov, EA_4BYTE, REG_R8, 0x00FFFFF0);
theEmitter->emitIns_R_I(INS_mov, EA_4BYTE, REG_R8, 0x66666666);
theEmitter->emitIns_R_I(INS_mov, EA_4BYTE, REG_R8, 0x03FFC000);
theEmitter->emitIns_R_I(INS_mov, EA_4BYTE, REG_R8, 0x55555555);
theEmitter->emitIns_R_I(INS_mov, EA_4BYTE, REG_R8, 0xE003E003);
theEmitter->emitIns_R_I(INS_mov, EA_4BYTE, REG_R8, 0x07070707);
theEmitter->emitIns_R_I(INS_tst, EA_8BYTE, REG_R8, 0xE003E003E003E003);
theEmitter->emitIns_R_I(INS_tst, EA_8BYTE, REG_R8, 0x00FFFFF000000000);
theEmitter->emitIns_R_I(INS_tst, EA_8BYTE, REG_R8, 0x6666666666666666);
theEmitter->emitIns_R_I(INS_tst, EA_8BYTE, REG_R8, 0x0707070707070707);
theEmitter->emitIns_R_I(INS_tst, EA_8BYTE, REG_R8, 0x7FFF00007FFF0000);
theEmitter->emitIns_R_I(INS_tst, EA_8BYTE, REG_R8, 0x5555555555555555);
theEmitter->emitIns_R_I(INS_tst, EA_4BYTE, REG_R8, 0xE003E003);
theEmitter->emitIns_R_I(INS_tst, EA_4BYTE, REG_R8, 0x00FFFFF0);
theEmitter->emitIns_R_I(INS_tst, EA_4BYTE, REG_R8, 0x66666666);
theEmitter->emitIns_R_I(INS_tst, EA_4BYTE, REG_R8, 0x07070707);
theEmitter->emitIns_R_I(INS_tst, EA_4BYTE, REG_R8, 0xFFF00000);
theEmitter->emitIns_R_I(INS_tst, EA_4BYTE, REG_R8, 0x55555555);
#endif // ALL_ARM64_EMITTER_UNIT_TESTS
#ifdef ALL_ARM64_EMITTER_UNIT_TESTS
//
// R_R
//
genDefineTempLabel(genCreateTempLabel());
// tst reg, reg
theEmitter->emitIns_R_R(INS_tst, EA_8BYTE, REG_R7, REG_R10);
// mov reg, reg
theEmitter->emitIns_R_R(INS_mov, EA_8BYTE, REG_R7, REG_R10);
theEmitter->emitIns_R_R(INS_mov, EA_8BYTE, REG_R8, REG_SP);
theEmitter->emitIns_R_R(INS_mov, EA_8BYTE, REG_SP, REG_R9);
theEmitter->emitIns_R_R(INS_mvn, EA_8BYTE, REG_R5, REG_R11);
theEmitter->emitIns_R_R(INS_neg, EA_8BYTE, REG_R4, REG_R12);
theEmitter->emitIns_R_R(INS_negs, EA_8BYTE, REG_R3, REG_R13);
theEmitter->emitIns_R_R(INS_mov, EA_4BYTE, REG_R7, REG_R10);
theEmitter->emitIns_R_R(INS_mvn, EA_4BYTE, REG_R5, REG_R11);
theEmitter->emitIns_R_R(INS_neg, EA_4BYTE, REG_R4, REG_R12);
theEmitter->emitIns_R_R(INS_negs, EA_4BYTE, REG_R3, REG_R13);
theEmitter->emitIns_R_R(INS_sxtb, EA_8BYTE, REG_R7, REG_R10);
theEmitter->emitIns_R_R(INS_sxth, EA_8BYTE, REG_R5, REG_R11);
theEmitter->emitIns_R_R(INS_sxtw, EA_8BYTE, REG_R4, REG_R12);
theEmitter->emitIns_R_R(INS_uxtb, EA_8BYTE, REG_R3, REG_R13); // map to Wt
theEmitter->emitIns_R_R(INS_uxth, EA_8BYTE, REG_R2, REG_R14); // map to Wt
theEmitter->emitIns_R_R(INS_sxtb, EA_4BYTE, REG_R7, REG_R10);
theEmitter->emitIns_R_R(INS_sxth, EA_4BYTE, REG_R5, REG_R11);
theEmitter->emitIns_R_R(INS_uxtb, EA_4BYTE, REG_R3, REG_R13);
theEmitter->emitIns_R_R(INS_uxth, EA_4BYTE, REG_R2, REG_R14);
#endif // ALL_ARM64_EMITTER_UNIT_TESTS
#ifdef ALL_ARM64_EMITTER_UNIT_TESTS
//
// R_I_I
//
genDefineTempLabel(genCreateTempLabel());
// mov reg, imm(i16,hw)
theEmitter->emitIns_R_I_I(INS_mov, EA_8BYTE, REG_R8, 0x1234, 0, INS_OPTS_LSL);
theEmitter->emitIns_R_I_I(INS_mov, EA_8BYTE, REG_R8, 0x4321, 16, INS_OPTS_LSL);
theEmitter->emitIns_R_I_I(INS_movk, EA_8BYTE, REG_R8, 0x4321, 16, INS_OPTS_LSL);
theEmitter->emitIns_R_I_I(INS_movn, EA_8BYTE, REG_R8, 0x5678, 32, INS_OPTS_LSL);
theEmitter->emitIns_R_I_I(INS_movz, EA_8BYTE, REG_R8, 0x8765, 48, INS_OPTS_LSL);
theEmitter->emitIns_R_I_I(INS_movk, EA_4BYTE, REG_R8, 0x4321, 16, INS_OPTS_LSL);
theEmitter->emitIns_R_I_I(INS_movn, EA_4BYTE, REG_R8, 0x5678, 16, INS_OPTS_LSL);
theEmitter->emitIns_R_I_I(INS_movz, EA_4BYTE, REG_R8, 0x8765, 16, INS_OPTS_LSL);
#endif // ALL_ARM64_EMITTER_UNIT_TESTS
#ifdef ALL_ARM64_EMITTER_UNIT_TESTS
//
// R_R_I
//
genDefineTempLabel(genCreateTempLabel());
theEmitter->emitIns_R_R_I(INS_lsl, EA_8BYTE, REG_R0, REG_R0, 1);
theEmitter->emitIns_R_R_I(INS_lsl, EA_4BYTE, REG_R9, REG_R3, 18);
theEmitter->emitIns_R_R_I(INS_lsr, EA_8BYTE, REG_R7, REG_R0, 37);
theEmitter->emitIns_R_R_I(INS_lsr, EA_4BYTE, REG_R0, REG_R1, 2);
theEmitter->emitIns_R_R_I(INS_asr, EA_8BYTE, REG_R2, REG_R3, 53);
theEmitter->emitIns_R_R_I(INS_asr, EA_4BYTE, REG_R9, REG_R3, 18);
theEmitter->emitIns_R_R_I(INS_and, EA_8BYTE, REG_R2, REG_R3, 0x5555555555555555);
theEmitter->emitIns_R_R_I(INS_ands, EA_8BYTE, REG_R1, REG_R5, 0x6666666666666666);
theEmitter->emitIns_R_R_I(INS_eor, EA_8BYTE, REG_R8, REG_R9, 0x0707070707070707);
theEmitter->emitIns_R_R_I(INS_orr, EA_8BYTE, REG_SP, REG_R3, 0xFFFC000000000000);
theEmitter->emitIns_R_R_I(INS_ands, EA_4BYTE, REG_R8, REG_R9, 0xE003E003);
theEmitter->emitIns_R_R_I(INS_ror, EA_8BYTE, REG_R8, REG_R9, 1);
theEmitter->emitIns_R_R_I(INS_ror, EA_8BYTE, REG_R8, REG_R9, 31);
theEmitter->emitIns_R_R_I(INS_ror, EA_8BYTE, REG_R8, REG_R9, 32);
theEmitter->emitIns_R_R_I(INS_ror, EA_8BYTE, REG_R8, REG_R9, 63);
theEmitter->emitIns_R_R_I(INS_ror, EA_4BYTE, REG_R8, REG_R9, 1);
theEmitter->emitIns_R_R_I(INS_ror, EA_4BYTE, REG_R8, REG_R9, 31);
theEmitter->emitIns_R_R_I(INS_add, EA_8BYTE, REG_R8, REG_R9, 0); // == mov
theEmitter->emitIns_R_R_I(INS_add, EA_8BYTE, REG_R8, REG_R9, 1);
theEmitter->emitIns_R_R_I(INS_add, EA_8BYTE, REG_R8, REG_R9, -1);
theEmitter->emitIns_R_R_I(INS_add, EA_8BYTE, REG_R8, REG_R9, 0xfff);
theEmitter->emitIns_R_R_I(INS_add, EA_8BYTE, REG_R8, REG_R9, -0xfff);
theEmitter->emitIns_R_R_I(INS_add, EA_8BYTE, REG_R8, REG_R9, 0x1000);
theEmitter->emitIns_R_R_I(INS_add, EA_8BYTE, REG_R8, REG_R9, 0xfff000);
theEmitter->emitIns_R_R_I(INS_add, EA_8BYTE, REG_R8, REG_R9, 0xfffffffffffff000LL);
theEmitter->emitIns_R_R_I(INS_add, EA_8BYTE, REG_R8, REG_R9, 0xffffffffff800000LL);
theEmitter->emitIns_R_R_I(INS_add, EA_4BYTE, REG_R8, REG_R9, 0); // == mov
theEmitter->emitIns_R_R_I(INS_add, EA_4BYTE, REG_R8, REG_R9, 1);
theEmitter->emitIns_R_R_I(INS_add, EA_4BYTE, REG_R8, REG_R9, -1);
theEmitter->emitIns_R_R_I(INS_add, EA_4BYTE, REG_R8, REG_R9, 0xfff);
theEmitter->emitIns_R_R_I(INS_add, EA_4BYTE, REG_R8, REG_R9, -0xfff);
theEmitter->emitIns_R_R_I(INS_add, EA_4BYTE, REG_R8, REG_R9, 0x1000);
theEmitter->emitIns_R_R_I(INS_add, EA_4BYTE, REG_R8, REG_R9, 0xfff000);
theEmitter->emitIns_R_R_I(INS_add, EA_4BYTE, REG_R8, REG_R9, 0xfffffffffffff000LL);
theEmitter->emitIns_R_R_I(INS_add, EA_4BYTE, REG_R8, REG_R9, 0xffffffffff800000LL);
theEmitter->emitIns_R_R_I(INS_sub, EA_8BYTE, REG_R8, REG_R9, 0); // == mov
theEmitter->emitIns_R_R_I(INS_sub, EA_8BYTE, REG_R8, REG_R9, 1);
theEmitter->emitIns_R_R_I(INS_sub, EA_8BYTE, REG_R8, REG_R9, -1);
theEmitter->emitIns_R_R_I(INS_sub, EA_8BYTE, REG_R8, REG_R9, 0xfff);
theEmitter->emitIns_R_R_I(INS_sub, EA_8BYTE, REG_R8, REG_R9, -0xfff);
theEmitter->emitIns_R_R_I(INS_sub, EA_8BYTE, REG_R8, REG_R9, 0x1000);
theEmitter->emitIns_R_R_I(INS_sub, EA_8BYTE, REG_R8, REG_R9, 0xfff000);
theEmitter->emitIns_R_R_I(INS_sub, EA_8BYTE, REG_R8, REG_R9, 0xfffffffffffff000LL);
theEmitter->emitIns_R_R_I(INS_sub, EA_8BYTE, REG_R8, REG_R9, 0xffffffffff800000LL);
theEmitter->emitIns_R_R_I(INS_sub, EA_4BYTE, REG_R8, REG_R9, 0); // == mov
theEmitter->emitIns_R_R_I(INS_sub, EA_4BYTE, REG_R8, REG_R9, 1);
theEmitter->emitIns_R_R_I(INS_sub, EA_4BYTE, REG_R8, REG_R9, -1);
theEmitter->emitIns_R_R_I(INS_sub, EA_4BYTE, REG_R8, REG_R9, 0xfff);
theEmitter->emitIns_R_R_I(INS_sub, EA_4BYTE, REG_R8, REG_R9, -0xfff);
theEmitter->emitIns_R_R_I(INS_sub, EA_4BYTE, REG_R8, REG_R9, 0x1000);
theEmitter->emitIns_R_R_I(INS_sub, EA_4BYTE, REG_R8, REG_R9, 0xfff000);
theEmitter->emitIns_R_R_I(INS_sub, EA_4BYTE, REG_R8, REG_R9, 0xfffffffffffff000LL);
theEmitter->emitIns_R_R_I(INS_sub, EA_4BYTE, REG_R8, REG_R9, 0xffffffffff800000LL);
theEmitter->emitIns_R_R_I(INS_adds, EA_8BYTE, REG_R8, REG_R9, 0); // == mov
theEmitter->emitIns_R_R_I(INS_adds, EA_8BYTE, REG_R8, REG_R9, 1);
theEmitter->emitIns_R_R_I(INS_adds, EA_8BYTE, REG_R8, REG_R9, -1);
theEmitter->emitIns_R_R_I(INS_adds, EA_8BYTE, REG_R8, REG_R9, 0xfff);
theEmitter->emitIns_R_R_I(INS_adds, EA_8BYTE, REG_R8, REG_R9, -0xfff);
theEmitter->emitIns_R_R_I(INS_adds, EA_8BYTE, REG_R8, REG_R9, 0x1000);
theEmitter->emitIns_R_R_I(INS_adds, EA_8BYTE, REG_R8, REG_R9, 0xfff000);
theEmitter->emitIns_R_R_I(INS_adds, EA_8BYTE, REG_R8, REG_R9, 0xfffffffffffff000LL);
theEmitter->emitIns_R_R_I(INS_adds, EA_8BYTE, REG_R8, REG_R9, 0xffffffffff800000LL);
theEmitter->emitIns_R_R_I(INS_adds, EA_4BYTE, REG_R8, REG_R9, 0); // == mov
theEmitter->emitIns_R_R_I(INS_adds, EA_4BYTE, REG_R8, REG_R9, 1);
theEmitter->emitIns_R_R_I(INS_adds, EA_4BYTE, REG_R8, REG_R9, -1);
theEmitter->emitIns_R_R_I(INS_adds, EA_4BYTE, REG_R8, REG_R9, 0xfff);
theEmitter->emitIns_R_R_I(INS_adds, EA_4BYTE, REG_R8, REG_R9, -0xfff);
theEmitter->emitIns_R_R_I(INS_adds, EA_4BYTE, REG_R8, REG_R9, 0x1000);
theEmitter->emitIns_R_R_I(INS_adds, EA_4BYTE, REG_R8, REG_R9, 0xfff000);
theEmitter->emitIns_R_R_I(INS_adds, EA_4BYTE, REG_R8, REG_R9, 0xfffffffffffff000LL);
theEmitter->emitIns_R_R_I(INS_adds, EA_4BYTE, REG_R8, REG_R9, 0xffffffffff800000LL);
theEmitter->emitIns_R_R_I(INS_subs, EA_8BYTE, REG_R8, REG_R9, 0); // == mov
theEmitter->emitIns_R_R_I(INS_subs, EA_8BYTE, REG_R8, REG_R9, 1);
theEmitter->emitIns_R_R_I(INS_subs, EA_8BYTE, REG_R8, REG_R9, -1);
theEmitter->emitIns_R_R_I(INS_subs, EA_8BYTE, REG_R8, REG_R9, 0xfff);
theEmitter->emitIns_R_R_I(INS_subs, EA_8BYTE, REG_R8, REG_R9, -0xfff);
theEmitter->emitIns_R_R_I(INS_subs, EA_8BYTE, REG_R8, REG_R9, 0x1000);
theEmitter->emitIns_R_R_I(INS_subs, EA_8BYTE, REG_R8, REG_R9, 0xfff000);
theEmitter->emitIns_R_R_I(INS_subs, EA_8BYTE, REG_R8, REG_R9, 0xfffffffffffff000LL);
theEmitter->emitIns_R_R_I(INS_subs, EA_8BYTE, REG_R8, REG_R9, 0xffffffffff800000LL);
theEmitter->emitIns_R_R_I(INS_subs, EA_4BYTE, REG_R8, REG_R9, 0); // == mov
theEmitter->emitIns_R_R_I(INS_subs, EA_4BYTE, REG_R8, REG_R9, 1);
theEmitter->emitIns_R_R_I(INS_subs, EA_4BYTE, REG_R8, REG_R9, -1);
theEmitter->emitIns_R_R_I(INS_subs, EA_4BYTE, REG_R8, REG_R9, 0xfff);
theEmitter->emitIns_R_R_I(INS_subs, EA_4BYTE, REG_R8, REG_R9, -0xfff);
theEmitter->emitIns_R_R_I(INS_subs, EA_4BYTE, REG_R8, REG_R9, 0x1000);
theEmitter->emitIns_R_R_I(INS_subs, EA_4BYTE, REG_R8, REG_R9, 0xfff000);
theEmitter->emitIns_R_R_I(INS_subs, EA_4BYTE, REG_R8, REG_R9, 0xfffffffffffff000LL);
theEmitter->emitIns_R_R_I(INS_subs, EA_4BYTE, REG_R8, REG_R9, 0xffffffffff800000LL);
#endif // ALL_ARM64_EMITTER_UNIT_TESTS
#ifdef ALL_ARM64_EMITTER_UNIT_TESTS
//
// R_R_I cmp/txt
//
// cmp
theEmitter->emitIns_R_R_I(INS_cmp, EA_8BYTE, REG_R8, REG_R9, 0);
theEmitter->emitIns_R_R_I(INS_cmp, EA_4BYTE, REG_R8, REG_R9, 0);
// CMP (shifted register)
theEmitter->emitIns_R_R_I(INS_cmp, EA_8BYTE, REG_R8, REG_R9, 31, INS_OPTS_LSL);
theEmitter->emitIns_R_R_I(INS_cmp, EA_8BYTE, REG_R8, REG_R9, 32, INS_OPTS_LSR);
theEmitter->emitIns_R_R_I(INS_cmp, EA_8BYTE, REG_R8, REG_R9, 33, INS_OPTS_ASR);
theEmitter->emitIns_R_R_I(INS_cmp, EA_4BYTE, REG_R8, REG_R9, 21, INS_OPTS_LSL);
theEmitter->emitIns_R_R_I(INS_cmp, EA_4BYTE, REG_R8, REG_R9, 22, INS_OPTS_LSR);
theEmitter->emitIns_R_R_I(INS_cmp, EA_4BYTE, REG_R8, REG_R9, 23, INS_OPTS_ASR);
// TST (shifted register)
theEmitter->emitIns_R_R_I(INS_tst, EA_8BYTE, REG_R8, REG_R9, 31, INS_OPTS_LSL);
theEmitter->emitIns_R_R_I(INS_tst, EA_8BYTE, REG_R8, REG_R9, 32, INS_OPTS_LSR);
theEmitter->emitIns_R_R_I(INS_tst, EA_8BYTE, REG_R8, REG_R9, 33, INS_OPTS_ASR);
theEmitter->emitIns_R_R_I(INS_tst, EA_8BYTE, REG_R8, REG_R9, 34, INS_OPTS_ROR);
theEmitter->emitIns_R_R_I(INS_tst, EA_4BYTE, REG_R8, REG_R9, 21, INS_OPTS_LSL);
theEmitter->emitIns_R_R_I(INS_tst, EA_4BYTE, REG_R8, REG_R9, 22, INS_OPTS_LSR);
theEmitter->emitIns_R_R_I(INS_tst, EA_4BYTE, REG_R8, REG_R9, 23, INS_OPTS_ASR);
theEmitter->emitIns_R_R_I(INS_tst, EA_4BYTE, REG_R8, REG_R9, 24, INS_OPTS_ROR);
// CMP (extended register)
theEmitter->emitIns_R_R_I(INS_cmp, EA_8BYTE, REG_R8, REG_R9, 0, INS_OPTS_UXTB);
theEmitter->emitIns_R_R_I(INS_cmp, EA_8BYTE, REG_R8, REG_R9, 0, INS_OPTS_UXTH);
theEmitter->emitIns_R_R_I(INS_cmp, EA_8BYTE, REG_R8, REG_R9, 0, INS_OPTS_UXTW); // "cmp x8, x9, UXTW"; msdis
// disassembles this "cmp x8,x9",
// which looks like an msdis issue.
theEmitter->emitIns_R_R_I(INS_cmp, EA_8BYTE, REG_R8, REG_R9, 0, INS_OPTS_UXTX);
theEmitter->emitIns_R_R_I(INS_cmp, EA_8BYTE, REG_R8, REG_R9, 0, INS_OPTS_SXTB);
theEmitter->emitIns_R_R_I(INS_cmp, EA_8BYTE, REG_R8, REG_R9, 0, INS_OPTS_SXTH);
theEmitter->emitIns_R_R_I(INS_cmp, EA_8BYTE, REG_R8, REG_R9, 0, INS_OPTS_SXTW);
theEmitter->emitIns_R_R_I(INS_cmp, EA_8BYTE, REG_R8, REG_R9, 0, INS_OPTS_SXTX);
// CMP 64-bit (extended register) and left shift
theEmitter->emitIns_R_R_I(INS_cmp, EA_8BYTE, REG_R8, REG_R9, 1, INS_OPTS_UXTB);
theEmitter->emitIns_R_R_I(INS_cmp, EA_8BYTE, REG_R8, REG_R9, 2, INS_OPTS_UXTH);
theEmitter->emitIns_R_R_I(INS_cmp, EA_8BYTE, REG_R8, REG_R9, 3, INS_OPTS_UXTW);
theEmitter->emitIns_R_R_I(INS_cmp, EA_8BYTE, REG_R8, REG_R9, 4, INS_OPTS_UXTX);
theEmitter->emitIns_R_R_I(INS_cmp, EA_8BYTE, REG_R8, REG_R9, 1, INS_OPTS_SXTB);
theEmitter->emitIns_R_R_I(INS_cmp, EA_8BYTE, REG_R8, REG_R9, 2, INS_OPTS_SXTH);
theEmitter->emitIns_R_R_I(INS_cmp, EA_8BYTE, REG_R8, REG_R9, 3, INS_OPTS_SXTW);
theEmitter->emitIns_R_R_I(INS_cmp, EA_8BYTE, REG_R8, REG_R9, 4, INS_OPTS_SXTX);
// CMP 32-bit (extended register) and left shift
theEmitter->emitIns_R_R_I(INS_cmp, EA_4BYTE, REG_R8, REG_R9, 0, INS_OPTS_UXTB);
theEmitter->emitIns_R_R_I(INS_cmp, EA_4BYTE, REG_R8, REG_R9, 2, INS_OPTS_UXTH);
theEmitter->emitIns_R_R_I(INS_cmp, EA_4BYTE, REG_R8, REG_R9, 4, INS_OPTS_UXTW);
theEmitter->emitIns_R_R_I(INS_cmp, EA_4BYTE, REG_R8, REG_R9, 0, INS_OPTS_SXTB);
theEmitter->emitIns_R_R_I(INS_cmp, EA_4BYTE, REG_R8, REG_R9, 2, INS_OPTS_SXTH);
theEmitter->emitIns_R_R_I(INS_cmp, EA_4BYTE, REG_R8, REG_R9, 4, INS_OPTS_SXTW);
#endif // ALL_ARM64_EMITTER_UNIT_TESTS
#ifdef ALL_ARM64_EMITTER_UNIT_TESTS
//
// R_R_R
//
genDefineTempLabel(genCreateTempLabel());
theEmitter->emitIns_R_R_R(INS_lsl, EA_8BYTE, REG_R8, REG_R9, REG_R10);
theEmitter->emitIns_R_R_R(INS_lsr, EA_8BYTE, REG_R8, REG_R9, REG_R10);
theEmitter->emitIns_R_R_R(INS_asr, EA_8BYTE, REG_R8, REG_R9, REG_R10);
theEmitter->emitIns_R_R_R(INS_ror, EA_8BYTE, REG_R8, REG_R9, REG_R10);
theEmitter->emitIns_R_R_R(INS_adc, EA_8BYTE, REG_R8, REG_R9, REG_R10);
theEmitter->emitIns_R_R_R(INS_adcs, EA_8BYTE, REG_R8, REG_R9, REG_R10);
theEmitter->emitIns_R_R_R(INS_sbc, EA_8BYTE, REG_R8, REG_R9, REG_R10);
theEmitter->emitIns_R_R_R(INS_sbcs, EA_8BYTE, REG_R8, REG_R9, REG_R10);
theEmitter->emitIns_R_R_R(INS_udiv, EA_8BYTE, REG_R8, REG_R9, REG_R10);
theEmitter->emitIns_R_R_R(INS_sdiv, EA_8BYTE, REG_R8, REG_R9, REG_R10);
theEmitter->emitIns_R_R_R(INS_mul, EA_8BYTE, REG_R8, REG_R9, REG_R10);
theEmitter->emitIns_R_R_R(INS_mneg, EA_8BYTE, REG_R8, REG_R9, REG_R10);
theEmitter->emitIns_R_R_R(INS_smull, EA_8BYTE, REG_R8, REG_R9, REG_R10);
theEmitter->emitIns_R_R_R(INS_smnegl, EA_8BYTE, REG_R8, REG_R9, REG_R10);
theEmitter->emitIns_R_R_R(INS_smulh, EA_8BYTE, REG_R8, REG_R9, REG_R10);
theEmitter->emitIns_R_R_R(INS_umull, EA_8BYTE, REG_R8, REG_R9, REG_R10);
theEmitter->emitIns_R_R_R(INS_umnegl, EA_8BYTE, REG_R8, REG_R9, REG_R10);
theEmitter->emitIns_R_R_R(INS_umulh, EA_8BYTE, REG_R8, REG_R9, REG_R10);
theEmitter->emitIns_R_R_R(INS_lslv, EA_8BYTE, REG_R8, REG_R9, REG_R10);
theEmitter->emitIns_R_R_R(INS_lsrv, EA_8BYTE, REG_R8, REG_R9, REG_R10);
theEmitter->emitIns_R_R_R(INS_asrv, EA_8BYTE, REG_R8, REG_R9, REG_R10);
theEmitter->emitIns_R_R_R(INS_rorv, EA_8BYTE, REG_R8, REG_R9, REG_R10);
theEmitter->emitIns_R_R_R(INS_lsl, EA_4BYTE, REG_R8, REG_R9, REG_R10);
theEmitter->emitIns_R_R_R(INS_lsr, EA_4BYTE, REG_R8, REG_R9, REG_R10);
theEmitter->emitIns_R_R_R(INS_asr, EA_4BYTE, REG_R8, REG_R9, REG_R10);
theEmitter->emitIns_R_R_R(INS_ror, EA_4BYTE, REG_R8, REG_R9, REG_R10);
theEmitter->emitIns_R_R_R(INS_adc, EA_4BYTE, REG_R8, REG_R9, REG_R10);
theEmitter->emitIns_R_R_R(INS_adcs, EA_4BYTE, REG_R8, REG_R9, REG_R10);
theEmitter->emitIns_R_R_R(INS_sbc, EA_4BYTE, REG_R8, REG_R9, REG_R10);
theEmitter->emitIns_R_R_R(INS_sbcs, EA_4BYTE, REG_R8, REG_R9, REG_R10);
theEmitter->emitIns_R_R_R(INS_udiv, EA_4BYTE, REG_R8, REG_R9, REG_R10);
theEmitter->emitIns_R_R_R(INS_sdiv, EA_4BYTE, REG_R8, REG_R9, REG_R10);
theEmitter->emitIns_R_R_R(INS_mul, EA_4BYTE, REG_R8, REG_R9, REG_R10);
theEmitter->emitIns_R_R_R(INS_mneg, EA_4BYTE, REG_R8, REG_R9, REG_R10);
theEmitter->emitIns_R_R_R(INS_smull, EA_4BYTE, REG_R8, REG_R9, REG_R10);
theEmitter->emitIns_R_R_R(INS_smnegl, EA_4BYTE, REG_R8, REG_R9, REG_R10);
theEmitter->emitIns_R_R_R(INS_smulh, EA_4BYTE, REG_R8, REG_R9, REG_R10);
theEmitter->emitIns_R_R_R(INS_umull, EA_4BYTE, REG_R8, REG_R9, REG_R10);
theEmitter->emitIns_R_R_R(INS_umnegl, EA_4BYTE, REG_R8, REG_R9, REG_R10);
theEmitter->emitIns_R_R_R(INS_umulh, EA_4BYTE, REG_R8, REG_R9, REG_R10);
theEmitter->emitIns_R_R_R(INS_lslv, EA_4BYTE, REG_R8, REG_R9, REG_R10);
theEmitter->emitIns_R_R_R(INS_lsrv, EA_4BYTE, REG_R8, REG_R9, REG_R10);
theEmitter->emitIns_R_R_R(INS_asrv, EA_4BYTE, REG_R8, REG_R9, REG_R10);
theEmitter->emitIns_R_R_R(INS_rorv, EA_4BYTE, REG_R8, REG_R9, REG_R10);
#endif // ALL_ARM64_EMITTER_UNIT_TESTS
#ifdef ALL_ARM64_EMITTER_UNIT_TESTS
//
// R_R_I_I
//
genDefineTempLabel(genCreateTempLabel());
theEmitter->emitIns_R_R_I_I(INS_sbfm, EA_8BYTE, REG_R2, REG_R3, 4, 39);
theEmitter->emitIns_R_R_I_I(INS_bfm, EA_8BYTE, REG_R1, REG_R5, 20, 23);
theEmitter->emitIns_R_R_I_I(INS_ubfm, EA_8BYTE, REG_R8, REG_R9, 36, 7);
theEmitter->emitIns_R_R_I_I(INS_sbfiz, EA_8BYTE, REG_R2, REG_R3, 7, 37);
theEmitter->emitIns_R_R_I_I(INS_bfi, EA_8BYTE, REG_R1, REG_R5, 23, 21);
theEmitter->emitIns_R_R_I_I(INS_ubfiz, EA_8BYTE, REG_R8, REG_R9, 39, 5);
theEmitter->emitIns_R_R_I_I(INS_sbfx, EA_8BYTE, REG_R2, REG_R3, 10, 24);
theEmitter->emitIns_R_R_I_I(INS_bfxil, EA_8BYTE, REG_R1, REG_R5, 26, 16);
theEmitter->emitIns_R_R_I_I(INS_ubfx, EA_8BYTE, REG_R8, REG_R9, 42, 8);
theEmitter->emitIns_R_R_I_I(INS_sbfm, EA_4BYTE, REG_R2, REG_R3, 4, 19);
theEmitter->emitIns_R_R_I_I(INS_bfm, EA_4BYTE, REG_R1, REG_R5, 10, 13);
theEmitter->emitIns_R_R_I_I(INS_ubfm, EA_4BYTE, REG_R8, REG_R9, 16, 7);
theEmitter->emitIns_R_R_I_I(INS_sbfiz, EA_4BYTE, REG_R2, REG_R3, 5, 17);
theEmitter->emitIns_R_R_I_I(INS_bfi, EA_4BYTE, REG_R1, REG_R5, 13, 11);
theEmitter->emitIns_R_R_I_I(INS_ubfiz, EA_4BYTE, REG_R8, REG_R9, 19, 5);
theEmitter->emitIns_R_R_I_I(INS_sbfx, EA_4BYTE, REG_R2, REG_R3, 3, 14);
theEmitter->emitIns_R_R_I_I(INS_bfxil, EA_4BYTE, REG_R1, REG_R5, 11, 9);
theEmitter->emitIns_R_R_I_I(INS_ubfx, EA_4BYTE, REG_R8, REG_R9, 22, 8);
#endif // ALL_ARM64_EMITTER_UNIT_TESTS
#ifdef ALL_ARM64_EMITTER_UNIT_TESTS
//
// R_R_R_I
//
genDefineTempLabel(genCreateTempLabel());
// ADD (extended register)
theEmitter->emitIns_R_R_R_I(INS_add, EA_8BYTE, REG_R8, REG_R9, REG_R10, 0, INS_OPTS_UXTB);
theEmitter->emitIns_R_R_R_I(INS_add, EA_8BYTE, REG_R8, REG_R9, REG_R10, 0, INS_OPTS_UXTH);
theEmitter->emitIns_R_R_R_I(INS_add, EA_8BYTE, REG_R8, REG_R9, REG_R10, 0, INS_OPTS_UXTW);
theEmitter->emitIns_R_R_R_I(INS_add, EA_8BYTE, REG_R8, REG_R9, REG_R10, 0, INS_OPTS_UXTX);
theEmitter->emitIns_R_R_R_I(INS_add, EA_8BYTE, REG_R8, REG_R9, REG_R10, 0, INS_OPTS_SXTB);
theEmitter->emitIns_R_R_R_I(INS_add, EA_8BYTE, REG_R8, REG_R9, REG_R10, 0, INS_OPTS_SXTH);
theEmitter->emitIns_R_R_R_I(INS_add, EA_8BYTE, REG_R8, REG_R9, REG_R10, 0, INS_OPTS_SXTW);
theEmitter->emitIns_R_R_R_I(INS_add, EA_8BYTE, REG_R8, REG_R9, REG_R10, 0, INS_OPTS_SXTX);
// ADD (extended register) and left shift
theEmitter->emitIns_R_R_R_I(INS_add, EA_8BYTE, REG_R8, REG_R9, REG_R10, 4, INS_OPTS_UXTB);
theEmitter->emitIns_R_R_R_I(INS_add, EA_8BYTE, REG_R8, REG_R9, REG_R10, 4, INS_OPTS_UXTH);
theEmitter->emitIns_R_R_R_I(INS_add, EA_8BYTE, REG_R8, REG_R9, REG_R10, 4, INS_OPTS_UXTW);
theEmitter->emitIns_R_R_R_I(INS_add, EA_8BYTE, REG_R8, REG_R9, REG_R10, 4, INS_OPTS_UXTX);
theEmitter->emitIns_R_R_R_I(INS_add, EA_8BYTE, REG_R8, REG_R9, REG_R10, 4, INS_OPTS_SXTB);
theEmitter->emitIns_R_R_R_I(INS_add, EA_8BYTE, REG_R8, REG_R9, REG_R10, 4, INS_OPTS_SXTH);
theEmitter->emitIns_R_R_R_I(INS_add, EA_8BYTE, REG_R8, REG_R9, REG_R10, 4, INS_OPTS_SXTW);
theEmitter->emitIns_R_R_R_I(INS_add, EA_8BYTE, REG_R8, REG_R9, REG_R10, 4, INS_OPTS_SXTX);
// ADD (shifted register)
theEmitter->emitIns_R_R_R_I(INS_add, EA_8BYTE, REG_R8, REG_R9, REG_R10, 0);
theEmitter->emitIns_R_R_R_I(INS_add, EA_8BYTE, REG_R8, REG_R9, REG_R10, 31, INS_OPTS_LSL);
theEmitter->emitIns_R_R_R_I(INS_add, EA_8BYTE, REG_R8, REG_R9, REG_R10, 32, INS_OPTS_LSR);
theEmitter->emitIns_R_R_R_I(INS_add, EA_8BYTE, REG_R8, REG_R9, REG_R10, 33, INS_OPTS_ASR);
// EXTR (extract field from register pair)
theEmitter->emitIns_R_R_R_I(INS_extr, EA_8BYTE, REG_R8, REG_R9, REG_R10, 1);
theEmitter->emitIns_R_R_R_I(INS_extr, EA_8BYTE, REG_R8, REG_R9, REG_R10, 31);
theEmitter->emitIns_R_R_R_I(INS_extr, EA_8BYTE, REG_R8, REG_R9, REG_R10, 32);
theEmitter->emitIns_R_R_R_I(INS_extr, EA_8BYTE, REG_R8, REG_R9, REG_R10, 63);
theEmitter->emitIns_R_R_R_I(INS_extr, EA_4BYTE, REG_R8, REG_R9, REG_R10, 1);
theEmitter->emitIns_R_R_R_I(INS_extr, EA_4BYTE, REG_R8, REG_R9, REG_R10, 31);
// SUB (extended register)
theEmitter->emitIns_R_R_R_I(INS_sub, EA_4BYTE, REG_R8, REG_R9, REG_R10, 0, INS_OPTS_UXTB);
theEmitter->emitIns_R_R_R_I(INS_sub, EA_4BYTE, REG_R8, REG_R9, REG_R10, 0, INS_OPTS_UXTH);
theEmitter->emitIns_R_R_R_I(INS_sub, EA_4BYTE, REG_R8, REG_R9, REG_R10, 0, INS_OPTS_UXTW);
theEmitter->emitIns_R_R_R_I(INS_sub, EA_4BYTE, REG_R8, REG_R9, REG_R10, 0, INS_OPTS_UXTX);
theEmitter->emitIns_R_R_R_I(INS_sub, EA_4BYTE, REG_R8, REG_R9, REG_R10, 0, INS_OPTS_SXTB);
theEmitter->emitIns_R_R_R_I(INS_sub, EA_4BYTE, REG_R8, REG_R9, REG_R10, 0, INS_OPTS_SXTH);
theEmitter->emitIns_R_R_R_I(INS_sub, EA_4BYTE, REG_R8, REG_R9, REG_R10, 0, INS_OPTS_SXTW);
theEmitter->emitIns_R_R_R_I(INS_sub, EA_4BYTE, REG_R8, REG_R9, REG_R10, 0, INS_OPTS_SXTX);
// SUB (extended register) and left shift
theEmitter->emitIns_R_R_R_I(INS_sub, EA_4BYTE, REG_R8, REG_R9, REG_R10, 4, INS_OPTS_UXTB);
theEmitter->emitIns_R_R_R_I(INS_sub, EA_4BYTE, REG_R8, REG_R9, REG_R10, 4, INS_OPTS_UXTH);
theEmitter->emitIns_R_R_R_I(INS_sub, EA_4BYTE, REG_R8, REG_R9, REG_R10, 4, INS_OPTS_UXTW);
theEmitter->emitIns_R_R_R_I(INS_sub, EA_4BYTE, REG_R8, REG_R9, REG_R10, 4, INS_OPTS_UXTX);
theEmitter->emitIns_R_R_R_I(INS_sub, EA_4BYTE, REG_R8, REG_R9, REG_R10, 4, INS_OPTS_SXTB);
theEmitter->emitIns_R_R_R_I(INS_sub, EA_4BYTE, REG_R8, REG_R9, REG_R10, 4, INS_OPTS_SXTH);
theEmitter->emitIns_R_R_R_I(INS_sub, EA_4BYTE, REG_R8, REG_R9, REG_R10, 4, INS_OPTS_SXTW);
theEmitter->emitIns_R_R_R_I(INS_sub, EA_4BYTE, REG_R8, REG_R9, REG_R10, 4, INS_OPTS_SXTX);
// SUB (shifted register)
theEmitter->emitIns_R_R_R_I(INS_sub, EA_4BYTE, REG_R8, REG_R9, REG_R10, 0);
theEmitter->emitIns_R_R_R_I(INS_sub, EA_4BYTE, REG_R8, REG_R9, REG_R10, 27, INS_OPTS_LSL);
theEmitter->emitIns_R_R_R_I(INS_sub, EA_4BYTE, REG_R8, REG_R9, REG_R10, 28, INS_OPTS_LSR);
theEmitter->emitIns_R_R_R_I(INS_sub, EA_4BYTE, REG_R8, REG_R9, REG_R10, 29, INS_OPTS_ASR);
// bit operations
theEmitter->emitIns_R_R_R_I(INS_and, EA_8BYTE, REG_R8, REG_R9, REG_R10, 0);
theEmitter->emitIns_R_R_R_I(INS_ands, EA_8BYTE, REG_R8, REG_R9, REG_R10, 0);
theEmitter->emitIns_R_R_R_I(INS_eor, EA_8BYTE, REG_R8, REG_R9, REG_R10, 0);
theEmitter->emitIns_R_R_R_I(INS_orr, EA_8BYTE, REG_R8, REG_R9, REG_R10, 0);
theEmitter->emitIns_R_R_R_I(INS_bic, EA_8BYTE, REG_R8, REG_R9, REG_R10, 0);
theEmitter->emitIns_R_R_R_I(INS_bics, EA_8BYTE, REG_R8, REG_R9, REG_R10, 0);
theEmitter->emitIns_R_R_R_I(INS_eon, EA_8BYTE, REG_R8, REG_R9, REG_R10, 0);
theEmitter->emitIns_R_R_R_I(INS_orn, EA_8BYTE, REG_R8, REG_R9, REG_R10, 0);
theEmitter->emitIns_R_R_R_I(INS_and, EA_8BYTE, REG_R8, REG_R9, REG_R10, 1, INS_OPTS_LSL);
theEmitter->emitIns_R_R_R_I(INS_ands, EA_8BYTE, REG_R8, REG_R9, REG_R10, 2, INS_OPTS_LSR);
theEmitter->emitIns_R_R_R_I(INS_eor, EA_8BYTE, REG_R8, REG_R9, REG_R10, 3, INS_OPTS_ASR);
theEmitter->emitIns_R_R_R_I(INS_orr, EA_8BYTE, REG_R8, REG_R9, REG_R10, 4, INS_OPTS_ROR);
theEmitter->emitIns_R_R_R_I(INS_bic, EA_8BYTE, REG_R8, REG_R9, REG_R10, 5, INS_OPTS_LSL);
theEmitter->emitIns_R_R_R_I(INS_bics, EA_8BYTE, REG_R8, REG_R9, REG_R10, 6, INS_OPTS_LSR);
theEmitter->emitIns_R_R_R_I(INS_eon, EA_8BYTE, REG_R8, REG_R9, REG_R10, 7, INS_OPTS_ASR);
theEmitter->emitIns_R_R_R_I(INS_orn, EA_8BYTE, REG_R8, REG_R9, REG_R10, 8, INS_OPTS_ROR);
theEmitter->emitIns_R_R_R_I(INS_and, EA_4BYTE, REG_R8, REG_R9, REG_R10, 0);
theEmitter->emitIns_R_R_R_I(INS_ands, EA_4BYTE, REG_R8, REG_R9, REG_R10, 0);
theEmitter->emitIns_R_R_R_I(INS_eor, EA_4BYTE, REG_R8, REG_R9, REG_R10, 0);
theEmitter->emitIns_R_R_R_I(INS_orr, EA_4BYTE, REG_R8, REG_R9, REG_R10, 0);
theEmitter->emitIns_R_R_R_I(INS_bic, EA_4BYTE, REG_R8, REG_R9, REG_R10, 0);
theEmitter->emitIns_R_R_R_I(INS_bics, EA_4BYTE, REG_R8, REG_R9, REG_R10, 0);
theEmitter->emitIns_R_R_R_I(INS_eon, EA_4BYTE, REG_R8, REG_R9, REG_R10, 0);
theEmitter->emitIns_R_R_R_I(INS_orn, EA_4BYTE, REG_R8, REG_R9, REG_R10, 0);
theEmitter->emitIns_R_R_R_I(INS_and, EA_4BYTE, REG_R8, REG_R9, REG_R10, 1, INS_OPTS_LSL);
theEmitter->emitIns_R_R_R_I(INS_ands, EA_4BYTE, REG_R8, REG_R9, REG_R10, 2, INS_OPTS_LSR);
theEmitter->emitIns_R_R_R_I(INS_eor, EA_4BYTE, REG_R8, REG_R9, REG_R10, 3, INS_OPTS_ASR);
theEmitter->emitIns_R_R_R_I(INS_orr, EA_4BYTE, REG_R8, REG_R9, REG_R10, 4, INS_OPTS_ROR);
theEmitter->emitIns_R_R_R_I(INS_bic, EA_4BYTE, REG_R8, REG_R9, REG_R10, 5, INS_OPTS_LSL);
theEmitter->emitIns_R_R_R_I(INS_bics, EA_4BYTE, REG_R8, REG_R9, REG_R10, 6, INS_OPTS_LSR);
theEmitter->emitIns_R_R_R_I(INS_eon, EA_4BYTE, REG_R8, REG_R9, REG_R10, 7, INS_OPTS_ASR);
theEmitter->emitIns_R_R_R_I(INS_orn, EA_4BYTE, REG_R8, REG_R9, REG_R10, 8, INS_OPTS_ROR);
#endif // ALL_ARM64_EMITTER_UNIT_TESTS
#ifdef ALL_ARM64_EMITTER_UNIT_TESTS
//
// R_R_R_I -- load/store pair
//
theEmitter->emitIns_R_R_R_I(INS_ldnp, EA_8BYTE, REG_R8, REG_R9, REG_R10, 0);
theEmitter->emitIns_R_R_R_I(INS_stnp, EA_8BYTE, REG_R8, REG_R9, REG_R10, 0);
theEmitter->emitIns_R_R_R_I(INS_ldnp, EA_8BYTE, REG_R8, REG_R9, REG_R10, 8);
theEmitter->emitIns_R_R_R_I(INS_stnp, EA_8BYTE, REG_R8, REG_R9, REG_R10, 8);
theEmitter->emitIns_R_R_R_I(INS_ldnp, EA_4BYTE, REG_R8, REG_R9, REG_SP, 0);
theEmitter->emitIns_R_R_R_I(INS_stnp, EA_4BYTE, REG_R8, REG_R9, REG_SP, 0);
theEmitter->emitIns_R_R_R_I(INS_ldnp, EA_4BYTE, REG_R8, REG_R9, REG_SP, 8);
theEmitter->emitIns_R_R_R_I(INS_stnp, EA_4BYTE, REG_R8, REG_R9, REG_SP, 8);
theEmitter->emitIns_R_R_R_I(INS_ldp, EA_8BYTE, REG_R8, REG_R9, REG_R10, 0);
theEmitter->emitIns_R_R_R_I(INS_stp, EA_8BYTE, REG_R8, REG_R9, REG_R10, 0);
theEmitter->emitIns_R_R_R_I(INS_ldp, EA_8BYTE, REG_R8, REG_R9, REG_R10, 16);
theEmitter->emitIns_R_R_R_I(INS_stp, EA_8BYTE, REG_R8, REG_R9, REG_R10, 16);
theEmitter->emitIns_R_R_R_I(INS_ldp, EA_8BYTE, REG_R8, REG_R9, REG_R10, 16, INS_OPTS_POST_INDEX);
theEmitter->emitIns_R_R_R_I(INS_stp, EA_8BYTE, REG_R8, REG_R9, REG_R10, 16, INS_OPTS_POST_INDEX);
theEmitter->emitIns_R_R_R_I(INS_ldp, EA_8BYTE, REG_R8, REG_R9, REG_R10, 16, INS_OPTS_PRE_INDEX);
theEmitter->emitIns_R_R_R_I(INS_stp, EA_8BYTE, REG_R8, REG_R9, REG_R10, 16, INS_OPTS_PRE_INDEX);
theEmitter->emitIns_R_R_R_I(INS_ldp, EA_4BYTE, REG_R8, REG_R9, REG_SP, 0);
theEmitter->emitIns_R_R_R_I(INS_stp, EA_4BYTE, REG_R8, REG_R9, REG_SP, 0);
theEmitter->emitIns_R_R_R_I(INS_ldp, EA_4BYTE, REG_R8, REG_R9, REG_SP, 16);
theEmitter->emitIns_R_R_R_I(INS_stp, EA_4BYTE, REG_R8, REG_R9, REG_SP, 16);
theEmitter->emitIns_R_R_R_I(INS_ldp, EA_4BYTE, REG_R8, REG_R9, REG_R10, 16, INS_OPTS_POST_INDEX);
theEmitter->emitIns_R_R_R_I(INS_stp, EA_4BYTE, REG_R8, REG_R9, REG_R10, 16, INS_OPTS_POST_INDEX);
theEmitter->emitIns_R_R_R_I(INS_ldp, EA_4BYTE, REG_R8, REG_R9, REG_R10, 16, INS_OPTS_PRE_INDEX);
theEmitter->emitIns_R_R_R_I(INS_stp, EA_4BYTE, REG_R8, REG_R9, REG_R10, 16, INS_OPTS_PRE_INDEX);
theEmitter->emitIns_R_R_R_I(INS_ldpsw, EA_4BYTE, REG_R8, REG_R9, REG_R10, 0);
theEmitter->emitIns_R_R_R_I(INS_ldpsw, EA_4BYTE, REG_R8, REG_R9, REG_R10, 16);
theEmitter->emitIns_R_R_R_I(INS_ldpsw, EA_4BYTE, REG_R8, REG_R9, REG_R10, 16, INS_OPTS_POST_INDEX);
theEmitter->emitIns_R_R_R_I(INS_ldpsw, EA_4BYTE, REG_R8, REG_R9, REG_R10, 16, INS_OPTS_PRE_INDEX);
// SP and ZR tests
theEmitter->emitIns_R_R_R_I(INS_ldp, EA_8BYTE, REG_ZR, REG_R1, REG_SP, 0);
theEmitter->emitIns_R_R_R_I(INS_ldp, EA_8BYTE, REG_R0, REG_ZR, REG_SP, 16);
theEmitter->emitIns_R_R_R_I(INS_stp, EA_8BYTE, REG_ZR, REG_R1, REG_SP, 0);
theEmitter->emitIns_R_R_R_I(INS_stp, EA_8BYTE, REG_R0, REG_ZR, REG_SP, 16);
theEmitter->emitIns_R_R_R_I(INS_stp, EA_8BYTE, REG_ZR, REG_ZR, REG_SP, 16, INS_OPTS_POST_INDEX);
theEmitter->emitIns_R_R_R_I(INS_stp, EA_8BYTE, REG_ZR, REG_ZR, REG_R8, 16, INS_OPTS_PRE_INDEX);
#endif // ALL_ARM64_EMITTER_UNIT_TESTS
#ifdef ALL_ARM64_EMITTER_UNIT_TESTS
//
// R_R_R_Ext -- load/store shifted/extend
//
genDefineTempLabel(genCreateTempLabel());
// LDR (register)
theEmitter->emitIns_R_R_R_Ext(INS_ldr, EA_8BYTE, REG_R8, REG_SP, REG_R9);
theEmitter->emitIns_R_R_R_Ext(INS_ldr, EA_8BYTE, REG_R8, REG_SP, REG_R9, INS_OPTS_LSL);
theEmitter->emitIns_R_R_R_Ext(INS_ldr, EA_8BYTE, REG_R8, REG_SP, REG_R9, INS_OPTS_LSL, 3);
theEmitter->emitIns_R_R_R_Ext(INS_ldr, EA_8BYTE, REG_R8, REG_SP, REG_R9, INS_OPTS_SXTW);
theEmitter->emitIns_R_R_R_Ext(INS_ldr, EA_8BYTE, REG_R8, REG_SP, REG_R9, INS_OPTS_SXTW, 3);
theEmitter->emitIns_R_R_R_Ext(INS_ldr, EA_8BYTE, REG_R8, REG_SP, REG_R9, INS_OPTS_UXTW);
theEmitter->emitIns_R_R_R_Ext(INS_ldr, EA_8BYTE, REG_R8, REG_SP, REG_R9, INS_OPTS_UXTW, 3);
theEmitter->emitIns_R_R_R_Ext(INS_ldr, EA_8BYTE, REG_R8, REG_SP, REG_R9, INS_OPTS_SXTX);
theEmitter->emitIns_R_R_R_Ext(INS_ldr, EA_8BYTE, REG_R8, REG_SP, REG_R9, INS_OPTS_SXTX, 3);
theEmitter->emitIns_R_R_R_Ext(INS_ldr, EA_8BYTE, REG_R8, REG_SP, REG_R9, INS_OPTS_UXTX);
theEmitter->emitIns_R_R_R_Ext(INS_ldr, EA_8BYTE, REG_R8, REG_SP, REG_R9, INS_OPTS_UXTX, 3);
theEmitter->emitIns_R_R_R_Ext(INS_ldr, EA_4BYTE, REG_R8, REG_SP, REG_R9);
theEmitter->emitIns_R_R_R_Ext(INS_ldr, EA_4BYTE, REG_R8, REG_SP, REG_R9, INS_OPTS_LSL);
theEmitter->emitIns_R_R_R_Ext(INS_ldr, EA_4BYTE, REG_R8, REG_SP, REG_R9, INS_OPTS_LSL, 2);
theEmitter->emitIns_R_R_R_Ext(INS_ldr, EA_4BYTE, REG_R8, REG_SP, REG_R9, INS_OPTS_SXTW);
theEmitter->emitIns_R_R_R_Ext(INS_ldr, EA_4BYTE, REG_R8, REG_SP, REG_R9, INS_OPTS_SXTW, 2);
theEmitter->emitIns_R_R_R_Ext(INS_ldr, EA_4BYTE, REG_R8, REG_SP, REG_R9, INS_OPTS_UXTW);
theEmitter->emitIns_R_R_R_Ext(INS_ldr, EA_4BYTE, REG_R8, REG_SP, REG_R9, INS_OPTS_UXTW, 2);
theEmitter->emitIns_R_R_R_Ext(INS_ldr, EA_4BYTE, REG_R8, REG_SP, REG_R9, INS_OPTS_SXTX);
theEmitter->emitIns_R_R_R_Ext(INS_ldr, EA_4BYTE, REG_R8, REG_SP, REG_R9, INS_OPTS_SXTX, 2);
theEmitter->emitIns_R_R_R_Ext(INS_ldr, EA_4BYTE, REG_R8, REG_SP, REG_R9, INS_OPTS_UXTX);
theEmitter->emitIns_R_R_R_Ext(INS_ldr, EA_4BYTE, REG_R8, REG_SP, REG_R9, INS_OPTS_UXTX, 2);
theEmitter->emitIns_R_R_R_Ext(INS_ldrh, EA_2BYTE, REG_R8, REG_SP, REG_R9);
theEmitter->emitIns_R_R_R_Ext(INS_ldrh, EA_2BYTE, REG_R8, REG_SP, REG_R9, INS_OPTS_LSL);
theEmitter->emitIns_R_R_R_Ext(INS_ldrh, EA_2BYTE, REG_R8, REG_SP, REG_R9, INS_OPTS_LSL, 1);
theEmitter->emitIns_R_R_R_Ext(INS_ldrh, EA_2BYTE, REG_R8, REG_SP, REG_R9, INS_OPTS_SXTW);
theEmitter->emitIns_R_R_R_Ext(INS_ldrh, EA_2BYTE, REG_R8, REG_SP, REG_R9, INS_OPTS_SXTW, 1);
theEmitter->emitIns_R_R_R_Ext(INS_ldrh, EA_2BYTE, REG_R8, REG_SP, REG_R9, INS_OPTS_UXTW);
theEmitter->emitIns_R_R_R_Ext(INS_ldrh, EA_2BYTE, REG_R8, REG_SP, REG_R9, INS_OPTS_UXTW, 1);
theEmitter->emitIns_R_R_R_Ext(INS_ldrh, EA_2BYTE, REG_R8, REG_SP, REG_R9, INS_OPTS_SXTX);
theEmitter->emitIns_R_R_R_Ext(INS_ldrh, EA_2BYTE, REG_R8, REG_SP, REG_R9, INS_OPTS_SXTX, 1);
theEmitter->emitIns_R_R_R_Ext(INS_ldrh, EA_2BYTE, REG_R8, REG_SP, REG_R9, INS_OPTS_UXTX);
theEmitter->emitIns_R_R_R_Ext(INS_ldrh, EA_2BYTE, REG_R8, REG_SP, REG_R9, INS_OPTS_UXTX, 1);
theEmitter->emitIns_R_R_R_Ext(INS_ldrb, EA_1BYTE, REG_R8, REG_SP, REG_R9);
theEmitter->emitIns_R_R_R_Ext(INS_ldrb, EA_1BYTE, REG_R8, REG_SP, REG_R9, INS_OPTS_SXTW);
theEmitter->emitIns_R_R_R_Ext(INS_ldrb, EA_1BYTE, REG_R8, REG_SP, REG_R9, INS_OPTS_UXTW);
theEmitter->emitIns_R_R_R_Ext(INS_ldrb, EA_1BYTE, REG_R8, REG_SP, REG_R9, INS_OPTS_SXTX);
theEmitter->emitIns_R_R_R_Ext(INS_ldrb, EA_1BYTE, REG_R8, REG_SP, REG_R9, INS_OPTS_UXTX);
theEmitter->emitIns_R_R_R_Ext(INS_ldrsw, EA_4BYTE, REG_R8, REG_SP, REG_R9);
theEmitter->emitIns_R_R_R_Ext(INS_ldrsw, EA_4BYTE, REG_R8, REG_SP, REG_R9, INS_OPTS_LSL);
theEmitter->emitIns_R_R_R_Ext(INS_ldrsw, EA_4BYTE, REG_R8, REG_SP, REG_R9, INS_OPTS_LSL, 2);
theEmitter->emitIns_R_R_R_Ext(INS_ldrsw, EA_4BYTE, REG_R8, REG_SP, REG_R9, INS_OPTS_SXTW);
theEmitter->emitIns_R_R_R_Ext(INS_ldrsw, EA_4BYTE, REG_R8, REG_SP, REG_R9, INS_OPTS_SXTW, 2);
theEmitter->emitIns_R_R_R_Ext(INS_ldrsw, EA_4BYTE, REG_R8, REG_SP, REG_R9, INS_OPTS_UXTW);
theEmitter->emitIns_R_R_R_Ext(INS_ldrsw, EA_4BYTE, REG_R8, REG_SP, REG_R9, INS_OPTS_UXTW, 2);
theEmitter->emitIns_R_R_R_Ext(INS_ldrsw, EA_4BYTE, REG_R8, REG_SP, REG_R9, INS_OPTS_SXTX);
theEmitter->emitIns_R_R_R_Ext(INS_ldrsw, EA_4BYTE, REG_R8, REG_SP, REG_R9, INS_OPTS_SXTX, 2);
theEmitter->emitIns_R_R_R_Ext(INS_ldrsw, EA_4BYTE, REG_R8, REG_SP, REG_R9, INS_OPTS_UXTX);
theEmitter->emitIns_R_R_R_Ext(INS_ldrsw, EA_4BYTE, REG_R8, REG_SP, REG_R9, INS_OPTS_UXTX, 2);
theEmitter->emitIns_R_R_R_Ext(INS_ldrsh, EA_4BYTE, REG_R8, REG_SP, REG_R9);
theEmitter->emitIns_R_R_R_Ext(INS_ldrsh, EA_8BYTE, REG_R8, REG_SP, REG_R9);
theEmitter->emitIns_R_R_R_Ext(INS_ldrsh, EA_8BYTE, REG_R8, REG_SP, REG_R9, INS_OPTS_LSL);
theEmitter->emitIns_R_R_R_Ext(INS_ldrsh, EA_4BYTE, REG_R8, REG_SP, REG_R9, INS_OPTS_LSL, 1);
theEmitter->emitIns_R_R_R_Ext(INS_ldrsh, EA_4BYTE, REG_R8, REG_SP, REG_R9, INS_OPTS_SXTW);
theEmitter->emitIns_R_R_R_Ext(INS_ldrsh, EA_8BYTE, REG_R8, REG_SP, REG_R9, INS_OPTS_SXTW, 1);
theEmitter->emitIns_R_R_R_Ext(INS_ldrsh, EA_8BYTE, REG_R8, REG_SP, REG_R9, INS_OPTS_UXTW);
theEmitter->emitIns_R_R_R_Ext(INS_ldrsh, EA_4BYTE, REG_R8, REG_SP, REG_R9, INS_OPTS_UXTW, 1);
theEmitter->emitIns_R_R_R_Ext(INS_ldrsh, EA_4BYTE, REG_R8, REG_SP, REG_R9, INS_OPTS_SXTX);
theEmitter->emitIns_R_R_R_Ext(INS_ldrsh, EA_8BYTE, REG_R8, REG_SP, REG_R9, INS_OPTS_SXTX, 1);
theEmitter->emitIns_R_R_R_Ext(INS_ldrsh, EA_8BYTE, REG_R8, REG_SP, REG_R9, INS_OPTS_UXTX);
theEmitter->emitIns_R_R_R_Ext(INS_ldrsh, EA_4BYTE, REG_R8, REG_SP, REG_R9, INS_OPTS_UXTX, 1);
theEmitter->emitIns_R_R_R_Ext(INS_ldrsb, EA_4BYTE, REG_R8, REG_SP, REG_R9);
theEmitter->emitIns_R_R_R_Ext(INS_ldrsb, EA_8BYTE, REG_R8, REG_SP, REG_R9);
theEmitter->emitIns_R_R_R_Ext(INS_ldrsb, EA_8BYTE, REG_R8, REG_SP, REG_R9, INS_OPTS_SXTW);
theEmitter->emitIns_R_R_R_Ext(INS_ldrsb, EA_4BYTE, REG_R8, REG_SP, REG_R9, INS_OPTS_UXTW);
theEmitter->emitIns_R_R_R_Ext(INS_ldrsb, EA_4BYTE, REG_R8, REG_SP, REG_R9, INS_OPTS_SXTX);
theEmitter->emitIns_R_R_R_Ext(INS_ldrsb, EA_8BYTE, REG_R8, REG_SP, REG_R9, INS_OPTS_UXTX);
// STR (register)
theEmitter->emitIns_R_R_R_Ext(INS_str, EA_8BYTE, REG_R8, REG_SP, REG_R9);
theEmitter->emitIns_R_R_R_Ext(INS_str, EA_8BYTE, REG_R8, REG_SP, REG_R9, INS_OPTS_LSL);
theEmitter->emitIns_R_R_R_Ext(INS_str, EA_8BYTE, REG_R8, REG_SP, REG_R9, INS_OPTS_LSL, 3);
theEmitter->emitIns_R_R_R_Ext(INS_str, EA_8BYTE, REG_R8, REG_SP, REG_R9, INS_OPTS_SXTW);
theEmitter->emitIns_R_R_R_Ext(INS_str, EA_8BYTE, REG_R8, REG_SP, REG_R9, INS_OPTS_SXTW, 3);
theEmitter->emitIns_R_R_R_Ext(INS_str, EA_8BYTE, REG_R8, REG_SP, REG_R9, INS_OPTS_UXTW);
theEmitter->emitIns_R_R_R_Ext(INS_str, EA_8BYTE, REG_R8, REG_SP, REG_R9, INS_OPTS_UXTW, 3);
theEmitter->emitIns_R_R_R_Ext(INS_str, EA_8BYTE, REG_R8, REG_SP, REG_R9, INS_OPTS_SXTX);
theEmitter->emitIns_R_R_R_Ext(INS_str, EA_8BYTE, REG_R8, REG_SP, REG_R9, INS_OPTS_SXTX, 3);
theEmitter->emitIns_R_R_R_Ext(INS_str, EA_8BYTE, REG_R8, REG_SP, REG_R9, INS_OPTS_UXTX);
theEmitter->emitIns_R_R_R_Ext(INS_str, EA_8BYTE, REG_R8, REG_SP, REG_R9, INS_OPTS_UXTX, 3);
theEmitter->emitIns_R_R_R_Ext(INS_str, EA_4BYTE, REG_R8, REG_SP, REG_R9);
theEmitter->emitIns_R_R_R_Ext(INS_str, EA_4BYTE, REG_R8, REG_SP, REG_R9, INS_OPTS_LSL);
theEmitter->emitIns_R_R_R_Ext(INS_str, EA_4BYTE, REG_R8, REG_SP, REG_R9, INS_OPTS_LSL, 2);
theEmitter->emitIns_R_R_R_Ext(INS_str, EA_4BYTE, REG_R8, REG_SP, REG_R9, INS_OPTS_SXTW);
theEmitter->emitIns_R_R_R_Ext(INS_str, EA_4BYTE, REG_R8, REG_SP, REG_R9, INS_OPTS_SXTW, 2);
theEmitter->emitIns_R_R_R_Ext(INS_str, EA_4BYTE, REG_R8, REG_SP, REG_R9, INS_OPTS_UXTW);
theEmitter->emitIns_R_R_R_Ext(INS_str, EA_4BYTE, REG_R8, REG_SP, REG_R9, INS_OPTS_UXTW, 2);
theEmitter->emitIns_R_R_R_Ext(INS_str, EA_4BYTE, REG_R8, REG_SP, REG_R9, INS_OPTS_SXTX);
theEmitter->emitIns_R_R_R_Ext(INS_str, EA_4BYTE, REG_R8, REG_SP, REG_R9, INS_OPTS_SXTX, 2);
theEmitter->emitIns_R_R_R_Ext(INS_str, EA_4BYTE, REG_R8, REG_SP, REG_R9, INS_OPTS_UXTX);
theEmitter->emitIns_R_R_R_Ext(INS_str, EA_4BYTE, REG_R8, REG_SP, REG_R9, INS_OPTS_UXTX, 2);
theEmitter->emitIns_R_R_R_Ext(INS_strh, EA_2BYTE, REG_R8, REG_SP, REG_R9);
theEmitter->emitIns_R_R_R_Ext(INS_strh, EA_2BYTE, REG_R8, REG_SP, REG_R9, INS_OPTS_LSL);
theEmitter->emitIns_R_R_R_Ext(INS_strh, EA_2BYTE, REG_R8, REG_SP, REG_R9, INS_OPTS_LSL, 1);
theEmitter->emitIns_R_R_R_Ext(INS_strh, EA_2BYTE, REG_R8, REG_SP, REG_R9, INS_OPTS_SXTW);
theEmitter->emitIns_R_R_R_Ext(INS_strh, EA_2BYTE, REG_R8, REG_SP, REG_R9, INS_OPTS_SXTW, 1);
theEmitter->emitIns_R_R_R_Ext(INS_strh, EA_2BYTE, REG_R8, REG_SP, REG_R9, INS_OPTS_UXTW);
theEmitter->emitIns_R_R_R_Ext(INS_strh, EA_2BYTE, REG_R8, REG_SP, REG_R9, INS_OPTS_UXTW, 1);
theEmitter->emitIns_R_R_R_Ext(INS_strh, EA_2BYTE, REG_R8, REG_SP, REG_R9, INS_OPTS_SXTX);
theEmitter->emitIns_R_R_R_Ext(INS_strh, EA_2BYTE, REG_R8, REG_SP, REG_R9, INS_OPTS_SXTX, 1);
theEmitter->emitIns_R_R_R_Ext(INS_strh, EA_2BYTE, REG_R8, REG_SP, REG_R9, INS_OPTS_UXTX);
theEmitter->emitIns_R_R_R_Ext(INS_strh, EA_2BYTE, REG_R8, REG_SP, REG_R9, INS_OPTS_UXTX, 1);
theEmitter->emitIns_R_R_R_Ext(INS_strb, EA_1BYTE, REG_R8, REG_SP, REG_R9);
theEmitter->emitIns_R_R_R_Ext(INS_strb, EA_1BYTE, REG_R8, REG_SP, REG_R9, INS_OPTS_SXTW);
theEmitter->emitIns_R_R_R_Ext(INS_strb, EA_1BYTE, REG_R8, REG_SP, REG_R9, INS_OPTS_UXTW);
theEmitter->emitIns_R_R_R_Ext(INS_strb, EA_1BYTE, REG_R8, REG_SP, REG_R9, INS_OPTS_SXTX);
theEmitter->emitIns_R_R_R_Ext(INS_strb, EA_1BYTE, REG_R8, REG_SP, REG_R9, INS_OPTS_UXTX);
#endif // ALL_ARM64_EMITTER_UNIT_TESTS
#ifdef ALL_ARM64_EMITTER_UNIT_TESTS
//
// R_R_R_R
//
genDefineTempLabel(genCreateTempLabel());
theEmitter->emitIns_R_R_R_R(INS_madd, EA_4BYTE, REG_R0, REG_R12, REG_R27, REG_R10);
theEmitter->emitIns_R_R_R_R(INS_msub, EA_4BYTE, REG_R1, REG_R13, REG_R28, REG_R11);
theEmitter->emitIns_R_R_R_R(INS_smaddl, EA_4BYTE, REG_R2, REG_R14, REG_R0, REG_R12);
theEmitter->emitIns_R_R_R_R(INS_smsubl, EA_4BYTE, REG_R3, REG_R15, REG_R1, REG_R13);
theEmitter->emitIns_R_R_R_R(INS_umaddl, EA_4BYTE, REG_R4, REG_R19, REG_R2, REG_R14);
theEmitter->emitIns_R_R_R_R(INS_umsubl, EA_4BYTE, REG_R5, REG_R20, REG_R3, REG_R15);
theEmitter->emitIns_R_R_R_R(INS_madd, EA_8BYTE, REG_R6, REG_R21, REG_R4, REG_R19);
theEmitter->emitIns_R_R_R_R(INS_msub, EA_8BYTE, REG_R7, REG_R22, REG_R5, REG_R20);
theEmitter->emitIns_R_R_R_R(INS_smaddl, EA_8BYTE, REG_R8, REG_R23, REG_R6, REG_R21);
theEmitter->emitIns_R_R_R_R(INS_smsubl, EA_8BYTE, REG_R9, REG_R24, REG_R7, REG_R22);
theEmitter->emitIns_R_R_R_R(INS_umaddl, EA_8BYTE, REG_R10, REG_R25, REG_R8, REG_R23);
theEmitter->emitIns_R_R_R_R(INS_umsubl, EA_8BYTE, REG_R11, REG_R26, REG_R9, REG_R24);
#endif // ALL_ARM64_EMITTER_UNIT_TESTS
#ifdef ALL_ARM64_EMITTER_UNIT_TESTS
// R_COND
//
// cset reg, cond
theEmitter->emitIns_R_COND(INS_cset, EA_8BYTE, REG_R9, INS_COND_EQ); // eq
theEmitter->emitIns_R_COND(INS_cset, EA_4BYTE, REG_R8, INS_COND_NE); // ne
theEmitter->emitIns_R_COND(INS_cset, EA_4BYTE, REG_R7, INS_COND_HS); // hs
theEmitter->emitIns_R_COND(INS_cset, EA_8BYTE, REG_R6, INS_COND_LO); // lo
theEmitter->emitIns_R_COND(INS_cset, EA_8BYTE, REG_R5, INS_COND_MI); // mi
theEmitter->emitIns_R_COND(INS_cset, EA_4BYTE, REG_R4, INS_COND_PL); // pl
theEmitter->emitIns_R_COND(INS_cset, EA_4BYTE, REG_R3, INS_COND_VS); // vs
theEmitter->emitIns_R_COND(INS_cset, EA_8BYTE, REG_R2, INS_COND_VC); // vc
theEmitter->emitIns_R_COND(INS_cset, EA_8BYTE, REG_R1, INS_COND_HI); // hi
theEmitter->emitIns_R_COND(INS_cset, EA_4BYTE, REG_R0, INS_COND_LS); // ls
theEmitter->emitIns_R_COND(INS_cset, EA_4BYTE, REG_R9, INS_COND_GE); // ge
theEmitter->emitIns_R_COND(INS_cset, EA_8BYTE, REG_R8, INS_COND_LT); // lt
theEmitter->emitIns_R_COND(INS_cset, EA_8BYTE, REG_R7, INS_COND_GT); // gt
theEmitter->emitIns_R_COND(INS_cset, EA_4BYTE, REG_R6, INS_COND_LE); // le
// csetm reg, cond
theEmitter->emitIns_R_COND(INS_csetm, EA_4BYTE, REG_R9, INS_COND_EQ); // eq
theEmitter->emitIns_R_COND(INS_csetm, EA_8BYTE, REG_R8, INS_COND_NE); // ne
theEmitter->emitIns_R_COND(INS_csetm, EA_8BYTE, REG_R7, INS_COND_HS); // hs
theEmitter->emitIns_R_COND(INS_csetm, EA_4BYTE, REG_R6, INS_COND_LO); // lo
theEmitter->emitIns_R_COND(INS_csetm, EA_4BYTE, REG_R5, INS_COND_MI); // mi
theEmitter->emitIns_R_COND(INS_csetm, EA_8BYTE, REG_R4, INS_COND_PL); // pl
theEmitter->emitIns_R_COND(INS_csetm, EA_8BYTE, REG_R3, INS_COND_VS); // vs
theEmitter->emitIns_R_COND(INS_csetm, EA_4BYTE, REG_R2, INS_COND_VC); // vc
theEmitter->emitIns_R_COND(INS_csetm, EA_4BYTE, REG_R1, INS_COND_HI); // hi
theEmitter->emitIns_R_COND(INS_csetm, EA_8BYTE, REG_R0, INS_COND_LS); // ls
theEmitter->emitIns_R_COND(INS_csetm, EA_8BYTE, REG_R9, INS_COND_GE); // ge
theEmitter->emitIns_R_COND(INS_csetm, EA_4BYTE, REG_R8, INS_COND_LT); // lt
theEmitter->emitIns_R_COND(INS_csetm, EA_4BYTE, REG_R7, INS_COND_GT); // gt
theEmitter->emitIns_R_COND(INS_csetm, EA_8BYTE, REG_R6, INS_COND_LE); // le
#endif // ALL_ARM64_EMITTER_UNIT_TESTS
#ifdef ALL_ARM64_EMITTER_UNIT_TESTS
// R_R_COND
//
// cinc reg, reg, cond
// cinv reg, reg, cond
// cneg reg, reg, cond
theEmitter->emitIns_R_R_COND(INS_cinc, EA_8BYTE, REG_R0, REG_R4, INS_COND_EQ); // eq
theEmitter->emitIns_R_R_COND(INS_cinv, EA_4BYTE, REG_R1, REG_R5, INS_COND_NE); // ne
theEmitter->emitIns_R_R_COND(INS_cneg, EA_4BYTE, REG_R2, REG_R6, INS_COND_HS); // hs
theEmitter->emitIns_R_R_COND(INS_cinc, EA_8BYTE, REG_R3, REG_R7, INS_COND_LO); // lo
theEmitter->emitIns_R_R_COND(INS_cinv, EA_4BYTE, REG_R4, REG_R8, INS_COND_MI); // mi
theEmitter->emitIns_R_R_COND(INS_cneg, EA_8BYTE, REG_R5, REG_R9, INS_COND_PL); // pl
theEmitter->emitIns_R_R_COND(INS_cinc, EA_8BYTE, REG_R6, REG_R0, INS_COND_VS); // vs
theEmitter->emitIns_R_R_COND(INS_cinv, EA_4BYTE, REG_R7, REG_R1, INS_COND_VC); // vc
theEmitter->emitIns_R_R_COND(INS_cneg, EA_8BYTE, REG_R8, REG_R2, INS_COND_HI); // hi
theEmitter->emitIns_R_R_COND(INS_cinc, EA_4BYTE, REG_R9, REG_R3, INS_COND_LS); // ls
theEmitter->emitIns_R_R_COND(INS_cinv, EA_4BYTE, REG_R0, REG_R4, INS_COND_GE); // ge
theEmitter->emitIns_R_R_COND(INS_cneg, EA_8BYTE, REG_R2, REG_R5, INS_COND_LT); // lt
theEmitter->emitIns_R_R_COND(INS_cinc, EA_4BYTE, REG_R2, REG_R6, INS_COND_GT); // gt
theEmitter->emitIns_R_R_COND(INS_cinv, EA_8BYTE, REG_R3, REG_R7, INS_COND_LE); // le
#endif // ALL_ARM64_EMITTER_UNIT_TESTS
#ifdef ALL_ARM64_EMITTER_UNIT_TESTS
// R_R_R_COND
//
// csel reg, reg, reg, cond
// csinc reg, reg, reg, cond
// csinv reg, reg, reg, cond
// csneg reg, reg, reg, cond
theEmitter->emitIns_R_R_R_COND(INS_csel, EA_8BYTE, REG_R0, REG_R4, REG_R8, INS_COND_EQ); // eq
theEmitter->emitIns_R_R_R_COND(INS_csinc, EA_4BYTE, REG_R1, REG_R5, REG_R9, INS_COND_NE); // ne
theEmitter->emitIns_R_R_R_COND(INS_csinv, EA_4BYTE, REG_R2, REG_R6, REG_R0, INS_COND_HS); // hs
theEmitter->emitIns_R_R_R_COND(INS_csneg, EA_8BYTE, REG_R3, REG_R7, REG_R1, INS_COND_LO); // lo
theEmitter->emitIns_R_R_R_COND(INS_csel, EA_4BYTE, REG_R4, REG_R8, REG_R2, INS_COND_MI); // mi
theEmitter->emitIns_R_R_R_COND(INS_csinc, EA_8BYTE, REG_R5, REG_R9, REG_R3, INS_COND_PL); // pl
theEmitter->emitIns_R_R_R_COND(INS_csinv, EA_8BYTE, REG_R6, REG_R0, REG_R4, INS_COND_VS); // vs
theEmitter->emitIns_R_R_R_COND(INS_csneg, EA_4BYTE, REG_R7, REG_R1, REG_R5, INS_COND_VC); // vc
theEmitter->emitIns_R_R_R_COND(INS_csel, EA_8BYTE, REG_R8, REG_R2, REG_R6, INS_COND_HI); // hi
theEmitter->emitIns_R_R_R_COND(INS_csinc, EA_4BYTE, REG_R9, REG_R3, REG_R7, INS_COND_LS); // ls
theEmitter->emitIns_R_R_R_COND(INS_csinv, EA_4BYTE, REG_R0, REG_R4, REG_R8, INS_COND_GE); // ge
theEmitter->emitIns_R_R_R_COND(INS_csneg, EA_8BYTE, REG_R2, REG_R5, REG_R9, INS_COND_LT); // lt
theEmitter->emitIns_R_R_R_COND(INS_csel, EA_4BYTE, REG_R2, REG_R6, REG_R0, INS_COND_GT); // gt
theEmitter->emitIns_R_R_R_COND(INS_csinc, EA_8BYTE, REG_R3, REG_R7, REG_R1, INS_COND_LE); // le
#endif // ALL_ARM64_EMITTER_UNIT_TESTS
#ifdef ALL_ARM64_EMITTER_UNIT_TESTS
// R_R_FLAGS_COND
//
// ccmp reg1, reg2, nzcv, cond
theEmitter->emitIns_R_R_FLAGS_COND(INS_ccmp, EA_8BYTE, REG_R9, REG_R3, INS_FLAGS_V, INS_COND_EQ); // eq
theEmitter->emitIns_R_R_FLAGS_COND(INS_ccmp, EA_4BYTE, REG_R8, REG_R2, INS_FLAGS_C, INS_COND_NE); // ne
theEmitter->emitIns_R_R_FLAGS_COND(INS_ccmp, EA_4BYTE, REG_R7, REG_R1, INS_FLAGS_Z, INS_COND_HS); // hs
theEmitter->emitIns_R_R_FLAGS_COND(INS_ccmp, EA_8BYTE, REG_R6, REG_R0, INS_FLAGS_N, INS_COND_LO); // lo
theEmitter->emitIns_R_R_FLAGS_COND(INS_ccmp, EA_8BYTE, REG_R5, REG_R3, INS_FLAGS_CV, INS_COND_MI); // mi
theEmitter->emitIns_R_R_FLAGS_COND(INS_ccmp, EA_4BYTE, REG_R4, REG_R2, INS_FLAGS_ZV, INS_COND_PL); // pl
theEmitter->emitIns_R_R_FLAGS_COND(INS_ccmp, EA_4BYTE, REG_R3, REG_R1, INS_FLAGS_ZC, INS_COND_VS); // vs
theEmitter->emitIns_R_R_FLAGS_COND(INS_ccmp, EA_8BYTE, REG_R2, REG_R0, INS_FLAGS_NV, INS_COND_VC); // vc
theEmitter->emitIns_R_R_FLAGS_COND(INS_ccmp, EA_8BYTE, REG_R1, REG_R3, INS_FLAGS_NC, INS_COND_HI); // hi
theEmitter->emitIns_R_R_FLAGS_COND(INS_ccmp, EA_4BYTE, REG_R0, REG_R2, INS_FLAGS_NZ, INS_COND_LS); // ls
theEmitter->emitIns_R_R_FLAGS_COND(INS_ccmp, EA_4BYTE, REG_R9, REG_R1, INS_FLAGS_NONE, INS_COND_GE); // ge
theEmitter->emitIns_R_R_FLAGS_COND(INS_ccmp, EA_8BYTE, REG_R8, REG_R0, INS_FLAGS_NZV, INS_COND_LT); // lt
theEmitter->emitIns_R_R_FLAGS_COND(INS_ccmp, EA_8BYTE, REG_R7, REG_R3, INS_FLAGS_NZC, INS_COND_GT); // gt
theEmitter->emitIns_R_R_FLAGS_COND(INS_ccmp, EA_4BYTE, REG_R6, REG_R2, INS_FLAGS_NZCV, INS_COND_LE); // le
// ccmp reg1, imm, nzcv, cond
theEmitter->emitIns_R_I_FLAGS_COND(INS_ccmp, EA_8BYTE, REG_R9, 3, INS_FLAGS_V, INS_COND_EQ); // eq
theEmitter->emitIns_R_I_FLAGS_COND(INS_ccmp, EA_4BYTE, REG_R8, 2, INS_FLAGS_C, INS_COND_NE); // ne
theEmitter->emitIns_R_I_FLAGS_COND(INS_ccmp, EA_4BYTE, REG_R7, 1, INS_FLAGS_Z, INS_COND_HS); // hs
theEmitter->emitIns_R_I_FLAGS_COND(INS_ccmp, EA_8BYTE, REG_R6, 0, INS_FLAGS_N, INS_COND_LO); // lo
theEmitter->emitIns_R_I_FLAGS_COND(INS_ccmp, EA_8BYTE, REG_R5, 31, INS_FLAGS_CV, INS_COND_MI); // mi
theEmitter->emitIns_R_I_FLAGS_COND(INS_ccmp, EA_4BYTE, REG_R4, 28, INS_FLAGS_ZV, INS_COND_PL); // pl
theEmitter->emitIns_R_I_FLAGS_COND(INS_ccmp, EA_4BYTE, REG_R3, 25, INS_FLAGS_ZC, INS_COND_VS); // vs
theEmitter->emitIns_R_I_FLAGS_COND(INS_ccmp, EA_8BYTE, REG_R2, 22, INS_FLAGS_NV, INS_COND_VC); // vc
theEmitter->emitIns_R_I_FLAGS_COND(INS_ccmp, EA_8BYTE, REG_R1, 19, INS_FLAGS_NC, INS_COND_HI); // hi
theEmitter->emitIns_R_I_FLAGS_COND(INS_ccmp, EA_4BYTE, REG_R0, 16, INS_FLAGS_NZ, INS_COND_LS); // ls
theEmitter->emitIns_R_I_FLAGS_COND(INS_ccmp, EA_4BYTE, REG_R9, 13, INS_FLAGS_NONE, INS_COND_GE); // ge
theEmitter->emitIns_R_I_FLAGS_COND(INS_ccmp, EA_8BYTE, REG_R8, 10, INS_FLAGS_NZV, INS_COND_LT); // lt
theEmitter->emitIns_R_I_FLAGS_COND(INS_ccmp, EA_8BYTE, REG_R7, 7, INS_FLAGS_NZC, INS_COND_GT); // gt
theEmitter->emitIns_R_I_FLAGS_COND(INS_ccmp, EA_4BYTE, REG_R6, 4, INS_FLAGS_NZCV, INS_COND_LE); // le
// ccmp reg1, imm, nzcv, cond -- encoded as ccmn
theEmitter->emitIns_R_I_FLAGS_COND(INS_ccmp, EA_8BYTE, REG_R9, -3, INS_FLAGS_V, INS_COND_EQ); // eq
theEmitter->emitIns_R_I_FLAGS_COND(INS_ccmp, EA_4BYTE, REG_R8, -2, INS_FLAGS_C, INS_COND_NE); // ne
theEmitter->emitIns_R_I_FLAGS_COND(INS_ccmp, EA_4BYTE, REG_R7, -1, INS_FLAGS_Z, INS_COND_HS); // hs
theEmitter->emitIns_R_I_FLAGS_COND(INS_ccmp, EA_8BYTE, REG_R6, -5, INS_FLAGS_N, INS_COND_LO); // lo
theEmitter->emitIns_R_I_FLAGS_COND(INS_ccmp, EA_8BYTE, REG_R5, -31, INS_FLAGS_CV, INS_COND_MI); // mi
theEmitter->emitIns_R_I_FLAGS_COND(INS_ccmp, EA_4BYTE, REG_R4, -28, INS_FLAGS_ZV, INS_COND_PL); // pl
theEmitter->emitIns_R_I_FLAGS_COND(INS_ccmp, EA_4BYTE, REG_R3, -25, INS_FLAGS_ZC, INS_COND_VS); // vs
theEmitter->emitIns_R_I_FLAGS_COND(INS_ccmp, EA_8BYTE, REG_R2, -22, INS_FLAGS_NV, INS_COND_VC); // vc
theEmitter->emitIns_R_I_FLAGS_COND(INS_ccmp, EA_8BYTE, REG_R1, -19, INS_FLAGS_NC, INS_COND_HI); // hi
theEmitter->emitIns_R_I_FLAGS_COND(INS_ccmp, EA_4BYTE, REG_R0, -16, INS_FLAGS_NZ, INS_COND_LS); // ls
theEmitter->emitIns_R_I_FLAGS_COND(INS_ccmp, EA_4BYTE, REG_R9, -13, INS_FLAGS_NONE, INS_COND_GE); // ge
theEmitter->emitIns_R_I_FLAGS_COND(INS_ccmp, EA_8BYTE, REG_R8, -10, INS_FLAGS_NZV, INS_COND_LT); // lt
theEmitter->emitIns_R_I_FLAGS_COND(INS_ccmp, EA_8BYTE, REG_R7, -7, INS_FLAGS_NZC, INS_COND_GT); // gt
theEmitter->emitIns_R_I_FLAGS_COND(INS_ccmp, EA_4BYTE, REG_R6, -4, INS_FLAGS_NZCV, INS_COND_LE); // le
// ccmn reg1, reg2, nzcv, cond
theEmitter->emitIns_R_R_FLAGS_COND(INS_ccmn, EA_8BYTE, REG_R9, REG_R3, INS_FLAGS_V, INS_COND_EQ); // eq
theEmitter->emitIns_R_R_FLAGS_COND(INS_ccmn, EA_4BYTE, REG_R8, REG_R2, INS_FLAGS_C, INS_COND_NE); // ne
theEmitter->emitIns_R_R_FLAGS_COND(INS_ccmn, EA_4BYTE, REG_R7, REG_R1, INS_FLAGS_Z, INS_COND_HS); // hs
theEmitter->emitIns_R_R_FLAGS_COND(INS_ccmn, EA_8BYTE, REG_R6, REG_R0, INS_FLAGS_N, INS_COND_LO); // lo
theEmitter->emitIns_R_R_FLAGS_COND(INS_ccmn, EA_8BYTE, REG_R5, REG_R3, INS_FLAGS_CV, INS_COND_MI); // mi
theEmitter->emitIns_R_R_FLAGS_COND(INS_ccmn, EA_4BYTE, REG_R4, REG_R2, INS_FLAGS_ZV, INS_COND_PL); // pl
theEmitter->emitIns_R_R_FLAGS_COND(INS_ccmn, EA_4BYTE, REG_R3, REG_R1, INS_FLAGS_ZC, INS_COND_VS); // vs
theEmitter->emitIns_R_R_FLAGS_COND(INS_ccmn, EA_8BYTE, REG_R2, REG_R0, INS_FLAGS_NV, INS_COND_VC); // vc
theEmitter->emitIns_R_R_FLAGS_COND(INS_ccmn, EA_8BYTE, REG_R1, REG_R3, INS_FLAGS_NC, INS_COND_HI); // hi
theEmitter->emitIns_R_R_FLAGS_COND(INS_ccmn, EA_4BYTE, REG_R0, REG_R2, INS_FLAGS_NZ, INS_COND_LS); // ls
theEmitter->emitIns_R_R_FLAGS_COND(INS_ccmn, EA_4BYTE, REG_R9, REG_R1, INS_FLAGS_NONE, INS_COND_GE); // ge
theEmitter->emitIns_R_R_FLAGS_COND(INS_ccmn, EA_8BYTE, REG_R8, REG_R0, INS_FLAGS_NZV, INS_COND_LT); // lt
theEmitter->emitIns_R_R_FLAGS_COND(INS_ccmn, EA_8BYTE, REG_R7, REG_R3, INS_FLAGS_NZC, INS_COND_GT); // gt
theEmitter->emitIns_R_R_FLAGS_COND(INS_ccmn, EA_4BYTE, REG_R6, REG_R2, INS_FLAGS_NZCV, INS_COND_LE); // le
// ccmn reg1, imm, nzcv, cond
theEmitter->emitIns_R_I_FLAGS_COND(INS_ccmn, EA_8BYTE, REG_R9, 3, INS_FLAGS_V, INS_COND_EQ); // eq
theEmitter->emitIns_R_I_FLAGS_COND(INS_ccmn, EA_4BYTE, REG_R8, 2, INS_FLAGS_C, INS_COND_NE); // ne
theEmitter->emitIns_R_I_FLAGS_COND(INS_ccmn, EA_4BYTE, REG_R7, 1, INS_FLAGS_Z, INS_COND_HS); // hs
theEmitter->emitIns_R_I_FLAGS_COND(INS_ccmn, EA_8BYTE, REG_R6, 0, INS_FLAGS_N, INS_COND_LO); // lo
theEmitter->emitIns_R_I_FLAGS_COND(INS_ccmn, EA_8BYTE, REG_R5, 31, INS_FLAGS_CV, INS_COND_MI); // mi
theEmitter->emitIns_R_I_FLAGS_COND(INS_ccmn, EA_4BYTE, REG_R4, 28, INS_FLAGS_ZV, INS_COND_PL); // pl
theEmitter->emitIns_R_I_FLAGS_COND(INS_ccmn, EA_4BYTE, REG_R3, 25, INS_FLAGS_ZC, INS_COND_VS); // vs
theEmitter->emitIns_R_I_FLAGS_COND(INS_ccmn, EA_8BYTE, REG_R2, 22, INS_FLAGS_NV, INS_COND_VC); // vc
theEmitter->emitIns_R_I_FLAGS_COND(INS_ccmn, EA_8BYTE, REG_R1, 19, INS_FLAGS_NC, INS_COND_HI); // hi
theEmitter->emitIns_R_I_FLAGS_COND(INS_ccmn, EA_4BYTE, REG_R0, 16, INS_FLAGS_NZ, INS_COND_LS); // ls
theEmitter->emitIns_R_I_FLAGS_COND(INS_ccmn, EA_4BYTE, REG_R9, 13, INS_FLAGS_NONE, INS_COND_GE); // ge
theEmitter->emitIns_R_I_FLAGS_COND(INS_ccmn, EA_8BYTE, REG_R8, 10, INS_FLAGS_NZV, INS_COND_LT); // lt
theEmitter->emitIns_R_I_FLAGS_COND(INS_ccmn, EA_8BYTE, REG_R7, 7, INS_FLAGS_NZC, INS_COND_GT); // gt
theEmitter->emitIns_R_I_FLAGS_COND(INS_ccmn, EA_4BYTE, REG_R6, 4, INS_FLAGS_NZCV, INS_COND_LE); // le
#endif // ALL_ARM64_EMITTER_UNIT_TESTS
#ifdef ALL_ARM64_EMITTER_UNIT_TESTS
//
// Branch to register
//
genDefineTempLabel(genCreateTempLabel());
theEmitter->emitIns_R(INS_br, EA_PTRSIZE, REG_R8);
theEmitter->emitIns_R(INS_blr, EA_PTRSIZE, REG_R9);
theEmitter->emitIns_R(INS_ret, EA_PTRSIZE, REG_R8);
theEmitter->emitIns_R(INS_ret, EA_PTRSIZE, REG_LR);
#endif // ALL_ARM64_EMITTER_UNIT_TESTS
#ifdef ALL_ARM64_EMITTER_UNIT_TESTS
//
// Misc
//
genDefineTempLabel(genCreateTempLabel());
theEmitter->emitIns_I(INS_brk, EA_PTRSIZE, 0);
theEmitter->emitIns_I(INS_brk, EA_PTRSIZE, 65535);
theEmitter->emitIns_BARR(INS_dsb, INS_BARRIER_OSHLD);
theEmitter->emitIns_BARR(INS_dmb, INS_BARRIER_OSHST);
theEmitter->emitIns_BARR(INS_isb, INS_BARRIER_OSH);
theEmitter->emitIns_BARR(INS_dmb, INS_BARRIER_NSHLD);
theEmitter->emitIns_BARR(INS_isb, INS_BARRIER_NSHST);
theEmitter->emitIns_BARR(INS_dsb, INS_BARRIER_NSH);
theEmitter->emitIns_BARR(INS_isb, INS_BARRIER_ISHLD);
theEmitter->emitIns_BARR(INS_dsb, INS_BARRIER_ISHST);
theEmitter->emitIns_BARR(INS_dmb, INS_BARRIER_ISH);
theEmitter->emitIns_BARR(INS_dsb, INS_BARRIER_LD);
theEmitter->emitIns_BARR(INS_dmb, INS_BARRIER_ST);
theEmitter->emitIns_BARR(INS_isb, INS_BARRIER_SY);
#endif // ALL_ARM64_EMITTER_UNIT_TESTS
#ifdef ALL_ARM64_EMITTER_UNIT_TESTS
////////////////////////////////////////////////////////////////////////////////
//
// SIMD and Floating point
//
////////////////////////////////////////////////////////////////////////////////
//
// Load/Stores vector register
//
genDefineTempLabel(genCreateTempLabel());
// ldr/str Vt, [reg]
theEmitter->emitIns_R_R(INS_ldr, EA_8BYTE, REG_V1, REG_R9);
theEmitter->emitIns_R_R(INS_str, EA_8BYTE, REG_V2, REG_R8);
theEmitter->emitIns_R_R(INS_ldr, EA_4BYTE, REG_V3, REG_R7);
theEmitter->emitIns_R_R(INS_str, EA_4BYTE, REG_V4, REG_R6);
theEmitter->emitIns_R_R(INS_ldr, EA_2BYTE, REG_V5, REG_R5);
theEmitter->emitIns_R_R(INS_str, EA_2BYTE, REG_V6, REG_R4);
theEmitter->emitIns_R_R(INS_ldr, EA_1BYTE, REG_V7, REG_R3);
theEmitter->emitIns_R_R(INS_str, EA_1BYTE, REG_V8, REG_R2);
theEmitter->emitIns_R_R(INS_ldr, EA_16BYTE, REG_V9, REG_R1);
theEmitter->emitIns_R_R(INS_str, EA_16BYTE, REG_V10, REG_R0);
// ldr/str Vt, [reg+cns] -- scaled
theEmitter->emitIns_R_R_I(INS_ldr, EA_1BYTE, REG_V8, REG_R9, 1);
theEmitter->emitIns_R_R_I(INS_ldr, EA_2BYTE, REG_V8, REG_R9, 2);
theEmitter->emitIns_R_R_I(INS_ldr, EA_4BYTE, REG_V8, REG_R9, 4);
theEmitter->emitIns_R_R_I(INS_ldr, EA_8BYTE, REG_V8, REG_R9, 8);
theEmitter->emitIns_R_R_I(INS_ldr, EA_16BYTE, REG_V8, REG_R9, 16);
theEmitter->emitIns_R_R_I(INS_ldr, EA_1BYTE, REG_V7, REG_R10, 1);
theEmitter->emitIns_R_R_I(INS_ldr, EA_2BYTE, REG_V7, REG_R10, 2);
theEmitter->emitIns_R_R_I(INS_ldr, EA_4BYTE, REG_V7, REG_R10, 4);
theEmitter->emitIns_R_R_I(INS_ldr, EA_8BYTE, REG_V7, REG_R10, 8);
theEmitter->emitIns_R_R_I(INS_ldr, EA_16BYTE, REG_V7, REG_R10, 16);
// ldr/str Vt, [reg],cns -- post-indexed (unscaled)
// ldr/str Vt, [reg+cns]! -- post-indexed (unscaled)
theEmitter->emitIns_R_R_I(INS_ldr, EA_1BYTE, REG_V8, REG_R9, 1, INS_OPTS_POST_INDEX);
theEmitter->emitIns_R_R_I(INS_ldr, EA_2BYTE, REG_V8, REG_R9, 1, INS_OPTS_POST_INDEX);
theEmitter->emitIns_R_R_I(INS_ldr, EA_4BYTE, REG_V8, REG_R9, 1, INS_OPTS_POST_INDEX);
theEmitter->emitIns_R_R_I(INS_ldr, EA_8BYTE, REG_V8, REG_R9, 1, INS_OPTS_POST_INDEX);
theEmitter->emitIns_R_R_I(INS_ldr, EA_16BYTE, REG_V8, REG_R9, 1, INS_OPTS_POST_INDEX);
theEmitter->emitIns_R_R_I(INS_ldr, EA_1BYTE, REG_V8, REG_R9, 1, INS_OPTS_PRE_INDEX);
theEmitter->emitIns_R_R_I(INS_ldr, EA_2BYTE, REG_V8, REG_R9, 1, INS_OPTS_PRE_INDEX);
theEmitter->emitIns_R_R_I(INS_ldr, EA_4BYTE, REG_V8, REG_R9, 1, INS_OPTS_PRE_INDEX);
theEmitter->emitIns_R_R_I(INS_ldr, EA_8BYTE, REG_V8, REG_R9, 1, INS_OPTS_PRE_INDEX);
theEmitter->emitIns_R_R_I(INS_ldr, EA_16BYTE, REG_V8, REG_R9, 1, INS_OPTS_PRE_INDEX);
theEmitter->emitIns_R_R_I(INS_str, EA_1BYTE, REG_V8, REG_R9, 1, INS_OPTS_POST_INDEX);
theEmitter->emitIns_R_R_I(INS_str, EA_2BYTE, REG_V8, REG_R9, 1, INS_OPTS_POST_INDEX);
theEmitter->emitIns_R_R_I(INS_str, EA_4BYTE, REG_V8, REG_R9, 1, INS_OPTS_POST_INDEX);
theEmitter->emitIns_R_R_I(INS_str, EA_8BYTE, REG_V8, REG_R9, 1, INS_OPTS_POST_INDEX);
theEmitter->emitIns_R_R_I(INS_str, EA_16BYTE, REG_V8, REG_R9, 1, INS_OPTS_POST_INDEX);
theEmitter->emitIns_R_R_I(INS_str, EA_1BYTE, REG_V8, REG_R9, 1, INS_OPTS_PRE_INDEX);
theEmitter->emitIns_R_R_I(INS_str, EA_2BYTE, REG_V8, REG_R9, 1, INS_OPTS_PRE_INDEX);
theEmitter->emitIns_R_R_I(INS_str, EA_4BYTE, REG_V8, REG_R9, 1, INS_OPTS_PRE_INDEX);
theEmitter->emitIns_R_R_I(INS_str, EA_8BYTE, REG_V8, REG_R9, 1, INS_OPTS_PRE_INDEX);
theEmitter->emitIns_R_R_I(INS_str, EA_16BYTE, REG_V8, REG_R9, 1, INS_OPTS_PRE_INDEX);
theEmitter->emitIns_R_R_I(INS_ldur, EA_1BYTE, REG_V8, REG_R9, 2);
theEmitter->emitIns_R_R_I(INS_ldur, EA_2BYTE, REG_V8, REG_R9, 3);
theEmitter->emitIns_R_R_I(INS_ldur, EA_4BYTE, REG_V8, REG_R9, 5);
theEmitter->emitIns_R_R_I(INS_ldur, EA_8BYTE, REG_V8, REG_R9, 9);
theEmitter->emitIns_R_R_I(INS_ldur, EA_16BYTE, REG_V8, REG_R9, 17);
theEmitter->emitIns_R_R_I(INS_stur, EA_1BYTE, REG_V7, REG_R10, 2);
theEmitter->emitIns_R_R_I(INS_stur, EA_2BYTE, REG_V7, REG_R10, 3);
theEmitter->emitIns_R_R_I(INS_stur, EA_4BYTE, REG_V7, REG_R10, 5);
theEmitter->emitIns_R_R_I(INS_stur, EA_8BYTE, REG_V7, REG_R10, 9);
theEmitter->emitIns_R_R_I(INS_stur, EA_16BYTE, REG_V7, REG_R10, 17);
// load/store pair
theEmitter->emitIns_R_R_R(INS_ldnp, EA_8BYTE, REG_V0, REG_V1, REG_R10);
theEmitter->emitIns_R_R_R_I(INS_stnp, EA_8BYTE, REG_V1, REG_V2, REG_R10, 0);
theEmitter->emitIns_R_R_R_I(INS_ldnp, EA_8BYTE, REG_V2, REG_V3, REG_R10, 8);
theEmitter->emitIns_R_R_R_I(INS_stnp, EA_8BYTE, REG_V3, REG_V4, REG_R10, 24);
theEmitter->emitIns_R_R_R(INS_ldnp, EA_4BYTE, REG_V4, REG_V5, REG_SP);
theEmitter->emitIns_R_R_R_I(INS_stnp, EA_4BYTE, REG_V5, REG_V6, REG_SP, 0);
theEmitter->emitIns_R_R_R_I(INS_ldnp, EA_4BYTE, REG_V6, REG_V7, REG_SP, 4);
theEmitter->emitIns_R_R_R_I(INS_stnp, EA_4BYTE, REG_V7, REG_V8, REG_SP, 12);
theEmitter->emitIns_R_R_R(INS_ldnp, EA_16BYTE, REG_V8, REG_V9, REG_R10);
theEmitter->emitIns_R_R_R_I(INS_stnp, EA_16BYTE, REG_V9, REG_V10, REG_R10, 0);
theEmitter->emitIns_R_R_R_I(INS_ldnp, EA_16BYTE, REG_V10, REG_V11, REG_R10, 16);
theEmitter->emitIns_R_R_R_I(INS_stnp, EA_16BYTE, REG_V11, REG_V12, REG_R10, 48);
theEmitter->emitIns_R_R_R(INS_ldp, EA_8BYTE, REG_V0, REG_V1, REG_R10);
theEmitter->emitIns_R_R_R_I(INS_stp, EA_8BYTE, REG_V1, REG_V2, REG_SP, 0);
theEmitter->emitIns_R_R_R_I(INS_ldp, EA_8BYTE, REG_V2, REG_V3, REG_SP, 8);
theEmitter->emitIns_R_R_R_I(INS_stp, EA_8BYTE, REG_V3, REG_V4, REG_R10, 16);
theEmitter->emitIns_R_R_R_I(INS_ldp, EA_8BYTE, REG_V4, REG_V5, REG_R10, 24, INS_OPTS_POST_INDEX);
theEmitter->emitIns_R_R_R_I(INS_stp, EA_8BYTE, REG_V5, REG_V6, REG_SP, 32, INS_OPTS_POST_INDEX);
theEmitter->emitIns_R_R_R_I(INS_ldp, EA_8BYTE, REG_V6, REG_V7, REG_SP, 40, INS_OPTS_PRE_INDEX);
theEmitter->emitIns_R_R_R_I(INS_stp, EA_8BYTE, REG_V7, REG_V8, REG_R10, 48, INS_OPTS_PRE_INDEX);
theEmitter->emitIns_R_R_R(INS_ldp, EA_4BYTE, REG_V0, REG_V1, REG_R10);
theEmitter->emitIns_R_R_R_I(INS_stp, EA_4BYTE, REG_V1, REG_V2, REG_SP, 0);
theEmitter->emitIns_R_R_R_I(INS_ldp, EA_4BYTE, REG_V2, REG_V3, REG_SP, 4);
theEmitter->emitIns_R_R_R_I(INS_stp, EA_4BYTE, REG_V3, REG_V4, REG_R10, 8);
theEmitter->emitIns_R_R_R_I(INS_ldp, EA_4BYTE, REG_V4, REG_V5, REG_R10, 12, INS_OPTS_POST_INDEX);
theEmitter->emitIns_R_R_R_I(INS_stp, EA_4BYTE, REG_V5, REG_V6, REG_SP, 16, INS_OPTS_POST_INDEX);
theEmitter->emitIns_R_R_R_I(INS_ldp, EA_4BYTE, REG_V6, REG_V7, REG_SP, 20, INS_OPTS_PRE_INDEX);
theEmitter->emitIns_R_R_R_I(INS_stp, EA_4BYTE, REG_V7, REG_V8, REG_R10, 24, INS_OPTS_PRE_INDEX);
theEmitter->emitIns_R_R_R(INS_ldp, EA_16BYTE, REG_V0, REG_V1, REG_R10);
theEmitter->emitIns_R_R_R_I(INS_stp, EA_16BYTE, REG_V1, REG_V2, REG_SP, 0);
theEmitter->emitIns_R_R_R_I(INS_ldp, EA_16BYTE, REG_V2, REG_V3, REG_SP, 16);
theEmitter->emitIns_R_R_R_I(INS_stp, EA_16BYTE, REG_V3, REG_V4, REG_R10, 32);
theEmitter->emitIns_R_R_R_I(INS_ldp, EA_16BYTE, REG_V4, REG_V5, REG_R10, 48, INS_OPTS_POST_INDEX);
theEmitter->emitIns_R_R_R_I(INS_stp, EA_16BYTE, REG_V5, REG_V6, REG_SP, 64, INS_OPTS_POST_INDEX);
theEmitter->emitIns_R_R_R_I(INS_ldp, EA_16BYTE, REG_V6, REG_V7, REG_SP, 80, INS_OPTS_PRE_INDEX);
theEmitter->emitIns_R_R_R_I(INS_stp, EA_16BYTE, REG_V7, REG_V8, REG_R10, 96, INS_OPTS_PRE_INDEX);
// LDR (register)
theEmitter->emitIns_R_R_R_Ext(INS_ldr, EA_8BYTE, REG_V1, REG_SP, REG_R9);
theEmitter->emitIns_R_R_R_Ext(INS_ldr, EA_8BYTE, REG_V2, REG_R7, REG_R9, INS_OPTS_LSL);
theEmitter->emitIns_R_R_R_Ext(INS_ldr, EA_8BYTE, REG_V3, REG_R7, REG_R9, INS_OPTS_LSL, 3);
theEmitter->emitIns_R_R_R_Ext(INS_ldr, EA_8BYTE, REG_V4, REG_R7, REG_R9, INS_OPTS_SXTW);
theEmitter->emitIns_R_R_R_Ext(INS_ldr, EA_8BYTE, REG_V5, REG_R7, REG_R9, INS_OPTS_SXTW, 3);
theEmitter->emitIns_R_R_R_Ext(INS_ldr, EA_8BYTE, REG_V6, REG_SP, REG_R9, INS_OPTS_UXTW);
theEmitter->emitIns_R_R_R_Ext(INS_ldr, EA_8BYTE, REG_V7, REG_R7, REG_R9, INS_OPTS_UXTW, 3);
theEmitter->emitIns_R_R_R_Ext(INS_ldr, EA_8BYTE, REG_V8, REG_R7, REG_R9, INS_OPTS_SXTX);
theEmitter->emitIns_R_R_R_Ext(INS_ldr, EA_8BYTE, REG_V9, REG_R7, REG_R9, INS_OPTS_SXTX, 3);
theEmitter->emitIns_R_R_R_Ext(INS_ldr, EA_8BYTE, REG_V10, REG_R7, REG_R9, INS_OPTS_UXTX);
theEmitter->emitIns_R_R_R_Ext(INS_ldr, EA_8BYTE, REG_V11, REG_SP, REG_R9, INS_OPTS_UXTX, 3);
theEmitter->emitIns_R_R_R_Ext(INS_ldr, EA_4BYTE, REG_V1, REG_SP, REG_R9);
theEmitter->emitIns_R_R_R_Ext(INS_ldr, EA_4BYTE, REG_V2, REG_R7, REG_R9, INS_OPTS_LSL);
theEmitter->emitIns_R_R_R_Ext(INS_ldr, EA_4BYTE, REG_V3, REG_R7, REG_R9, INS_OPTS_LSL, 2);
theEmitter->emitIns_R_R_R_Ext(INS_ldr, EA_4BYTE, REG_V4, REG_R7, REG_R9, INS_OPTS_SXTW);
theEmitter->emitIns_R_R_R_Ext(INS_ldr, EA_4BYTE, REG_V5, REG_R7, REG_R9, INS_OPTS_SXTW, 2);
theEmitter->emitIns_R_R_R_Ext(INS_ldr, EA_4BYTE, REG_V6, REG_SP, REG_R9, INS_OPTS_UXTW);
theEmitter->emitIns_R_R_R_Ext(INS_ldr, EA_4BYTE, REG_V7, REG_R7, REG_R9, INS_OPTS_UXTW, 2);
theEmitter->emitIns_R_R_R_Ext(INS_ldr, EA_4BYTE, REG_V8, REG_R7, REG_R9, INS_OPTS_SXTX);
theEmitter->emitIns_R_R_R_Ext(INS_ldr, EA_4BYTE, REG_V9, REG_R7, REG_R9, INS_OPTS_SXTX, 2);
theEmitter->emitIns_R_R_R_Ext(INS_ldr, EA_4BYTE, REG_V10, REG_R7, REG_R9, INS_OPTS_UXTX);
theEmitter->emitIns_R_R_R_Ext(INS_ldr, EA_4BYTE, REG_V11, REG_SP, REG_R9, INS_OPTS_UXTX, 2);
theEmitter->emitIns_R_R_R_Ext(INS_ldr, EA_16BYTE, REG_V1, REG_SP, REG_R9);
theEmitter->emitIns_R_R_R_Ext(INS_ldr, EA_16BYTE, REG_V2, REG_R7, REG_R9, INS_OPTS_LSL);
theEmitter->emitIns_R_R_R_Ext(INS_ldr, EA_16BYTE, REG_V3, REG_R7, REG_R9, INS_OPTS_LSL, 4);
theEmitter->emitIns_R_R_R_Ext(INS_ldr, EA_16BYTE, REG_V4, REG_R7, REG_R9, INS_OPTS_SXTW);
theEmitter->emitIns_R_R_R_Ext(INS_ldr, EA_16BYTE, REG_V5, REG_R7, REG_R9, INS_OPTS_SXTW, 4);
theEmitter->emitIns_R_R_R_Ext(INS_ldr, EA_16BYTE, REG_V6, REG_SP, REG_R9, INS_OPTS_UXTW);
theEmitter->emitIns_R_R_R_Ext(INS_ldr, EA_16BYTE, REG_V7, REG_R7, REG_R9, INS_OPTS_UXTW, 4);
theEmitter->emitIns_R_R_R_Ext(INS_ldr, EA_16BYTE, REG_V8, REG_R7, REG_R9, INS_OPTS_SXTX);
theEmitter->emitIns_R_R_R_Ext(INS_ldr, EA_16BYTE, REG_V9, REG_R7, REG_R9, INS_OPTS_SXTX, 4);
theEmitter->emitIns_R_R_R_Ext(INS_ldr, EA_16BYTE, REG_V10, REG_R7, REG_R9, INS_OPTS_UXTX);
theEmitter->emitIns_R_R_R_Ext(INS_ldr, EA_16BYTE, REG_V11, REG_SP, REG_R9, INS_OPTS_UXTX, 4);
theEmitter->emitIns_R_R_R_Ext(INS_ldr, EA_2BYTE, REG_V1, REG_SP, REG_R9);
theEmitter->emitIns_R_R_R_Ext(INS_ldr, EA_2BYTE, REG_V2, REG_R7, REG_R9, INS_OPTS_LSL);
theEmitter->emitIns_R_R_R_Ext(INS_ldr, EA_2BYTE, REG_V3, REG_R7, REG_R9, INS_OPTS_LSL, 1);
theEmitter->emitIns_R_R_R_Ext(INS_ldr, EA_2BYTE, REG_V4, REG_R7, REG_R9, INS_OPTS_SXTW);
theEmitter->emitIns_R_R_R_Ext(INS_ldr, EA_2BYTE, REG_V5, REG_R7, REG_R9, INS_OPTS_SXTW, 1);
theEmitter->emitIns_R_R_R_Ext(INS_ldr, EA_2BYTE, REG_V6, REG_SP, REG_R9, INS_OPTS_UXTW);
theEmitter->emitIns_R_R_R_Ext(INS_ldr, EA_2BYTE, REG_V7, REG_R7, REG_R9, INS_OPTS_UXTW, 1);
theEmitter->emitIns_R_R_R_Ext(INS_ldr, EA_2BYTE, REG_V8, REG_R7, REG_R9, INS_OPTS_SXTX);
theEmitter->emitIns_R_R_R_Ext(INS_ldr, EA_2BYTE, REG_V9, REG_R7, REG_R9, INS_OPTS_SXTX, 1);
theEmitter->emitIns_R_R_R_Ext(INS_ldr, EA_2BYTE, REG_V10, REG_R7, REG_R9, INS_OPTS_UXTX);
theEmitter->emitIns_R_R_R_Ext(INS_ldr, EA_2BYTE, REG_V11, REG_SP, REG_R9, INS_OPTS_UXTX, 1);
theEmitter->emitIns_R_R_R_Ext(INS_ldr, EA_1BYTE, REG_V1, REG_R7, REG_R9);
theEmitter->emitIns_R_R_R_Ext(INS_ldr, EA_1BYTE, REG_V2, REG_SP, REG_R9, INS_OPTS_SXTW);
theEmitter->emitIns_R_R_R_Ext(INS_ldr, EA_1BYTE, REG_V3, REG_R7, REG_R9, INS_OPTS_UXTW);
theEmitter->emitIns_R_R_R_Ext(INS_ldr, EA_1BYTE, REG_V4, REG_SP, REG_R9, INS_OPTS_SXTX);
theEmitter->emitIns_R_R_R_Ext(INS_ldr, EA_1BYTE, REG_V5, REG_R7, REG_R9, INS_OPTS_UXTX);
#endif // ALL_ARM64_EMITTER_UNIT_TESTS
#ifdef ALL_ARM64_EMITTER_UNIT_TESTS
//
// R_R mov and aliases for mov
//
// mov vector to vector
theEmitter->emitIns_R_R(INS_mov, EA_8BYTE, REG_V0, REG_V1);
theEmitter->emitIns_R_R(INS_mov, EA_16BYTE, REG_V2, REG_V3);
theEmitter->emitIns_R_R(INS_mov, EA_4BYTE, REG_V12, REG_V13);
theEmitter->emitIns_R_R(INS_mov, EA_2BYTE, REG_V14, REG_V15);
theEmitter->emitIns_R_R(INS_mov, EA_1BYTE, REG_V16, REG_V17);
// mov vector to general
theEmitter->emitIns_R_R(INS_mov, EA_8BYTE, REG_R0, REG_V4);
theEmitter->emitIns_R_R(INS_mov, EA_4BYTE, REG_R1, REG_V5);
theEmitter->emitIns_R_R(INS_mov, EA_2BYTE, REG_R2, REG_V6);
theEmitter->emitIns_R_R(INS_mov, EA_1BYTE, REG_R3, REG_V7);
// mov general to vector
theEmitter->emitIns_R_R(INS_mov, EA_8BYTE, REG_V8, REG_R4);
theEmitter->emitIns_R_R(INS_mov, EA_4BYTE, REG_V9, REG_R5);
theEmitter->emitIns_R_R(INS_mov, EA_2BYTE, REG_V10, REG_R6);
theEmitter->emitIns_R_R(INS_mov, EA_1BYTE, REG_V11, REG_R7);
// mov vector[index] to vector
theEmitter->emitIns_R_R_I(INS_mov, EA_8BYTE, REG_V0, REG_V1, 1);
theEmitter->emitIns_R_R_I(INS_mov, EA_4BYTE, REG_V2, REG_V3, 3);
theEmitter->emitIns_R_R_I(INS_mov, EA_2BYTE, REG_V4, REG_V5, 7);
theEmitter->emitIns_R_R_I(INS_mov, EA_1BYTE, REG_V6, REG_V7, 15);
// mov to general from vector[index]
theEmitter->emitIns_R_R_I(INS_mov, EA_8BYTE, REG_R8, REG_V16, 1);
theEmitter->emitIns_R_R_I(INS_mov, EA_4BYTE, REG_R9, REG_V17, 2);
theEmitter->emitIns_R_R_I(INS_mov, EA_2BYTE, REG_R10, REG_V18, 3);
theEmitter->emitIns_R_R_I(INS_mov, EA_1BYTE, REG_R11, REG_V19, 4);
// mov to vector[index] from general
theEmitter->emitIns_R_R_I(INS_mov, EA_8BYTE, REG_V20, REG_R12, 1);
theEmitter->emitIns_R_R_I(INS_mov, EA_4BYTE, REG_V21, REG_R13, 2);
theEmitter->emitIns_R_R_I(INS_mov, EA_2BYTE, REG_V22, REG_R14, 6);
theEmitter->emitIns_R_R_I(INS_mov, EA_1BYTE, REG_V23, REG_R15, 8);
// mov vector[index] to vector[index2]
theEmitter->emitIns_R_R_I_I(INS_mov, EA_8BYTE, REG_V8, REG_V9, 1, 0);
theEmitter->emitIns_R_R_I_I(INS_mov, EA_4BYTE, REG_V10, REG_V11, 2, 1);
theEmitter->emitIns_R_R_I_I(INS_mov, EA_2BYTE, REG_V12, REG_V13, 5, 2);
theEmitter->emitIns_R_R_I_I(INS_mov, EA_1BYTE, REG_V14, REG_V15, 12, 3);
//////////////////////////////////////////////////////////////////////////////////
// mov/dup scalar
theEmitter->emitIns_R_R_I(INS_dup, EA_8BYTE, REG_V24, REG_V25, 1);
theEmitter->emitIns_R_R_I(INS_dup, EA_4BYTE, REG_V26, REG_V27, 3);
theEmitter->emitIns_R_R_I(INS_dup, EA_2BYTE, REG_V28, REG_V29, 7);
theEmitter->emitIns_R_R_I(INS_dup, EA_1BYTE, REG_V30, REG_V31, 15);
// mov/ins vector element
theEmitter->emitIns_R_R_I_I(INS_ins, EA_8BYTE, REG_V0, REG_V1, 0, 1);
theEmitter->emitIns_R_R_I_I(INS_ins, EA_4BYTE, REG_V2, REG_V3, 2, 2);
theEmitter->emitIns_R_R_I_I(INS_ins, EA_2BYTE, REG_V4, REG_V5, 4, 3);
theEmitter->emitIns_R_R_I_I(INS_ins, EA_1BYTE, REG_V6, REG_V7, 8, 4);
// umov to general from vector element
theEmitter->emitIns_R_R_I(INS_umov, EA_8BYTE, REG_R0, REG_V8, 1);
theEmitter->emitIns_R_R_I(INS_umov, EA_4BYTE, REG_R1, REG_V9, 2);
theEmitter->emitIns_R_R_I(INS_umov, EA_2BYTE, REG_R2, REG_V10, 4);
theEmitter->emitIns_R_R_I(INS_umov, EA_1BYTE, REG_R3, REG_V11, 8);
// ins to vector element from general
theEmitter->emitIns_R_R_I(INS_ins, EA_8BYTE, REG_V12, REG_R4, 1);
theEmitter->emitIns_R_R_I(INS_ins, EA_4BYTE, REG_V13, REG_R5, 3);
theEmitter->emitIns_R_R_I(INS_ins, EA_2BYTE, REG_V14, REG_R6, 7);
theEmitter->emitIns_R_R_I(INS_ins, EA_1BYTE, REG_V15, REG_R7, 15);
// smov to general from vector element
theEmitter->emitIns_R_R_I(INS_smov, EA_4BYTE, REG_R5, REG_V17, 2);
theEmitter->emitIns_R_R_I(INS_smov, EA_2BYTE, REG_R6, REG_V18, 4);
theEmitter->emitIns_R_R_I(INS_smov, EA_1BYTE, REG_R7, REG_V19, 8);
#endif // ALL_ARM64_EMITTER_UNIT_TESTS
#ifdef ALL_ARM64_EMITTER_UNIT_TESTS
//
// R_I movi and mvni
//
// movi imm8 (vector)
theEmitter->emitIns_R_I(INS_movi, EA_8BYTE, REG_V0, 0x00, INS_OPTS_8B);
theEmitter->emitIns_R_I(INS_movi, EA_8BYTE, REG_V1, 0xFF, INS_OPTS_8B);
theEmitter->emitIns_R_I(INS_movi, EA_16BYTE, REG_V2, 0x00, INS_OPTS_16B);
theEmitter->emitIns_R_I(INS_movi, EA_16BYTE, REG_V3, 0xFF, INS_OPTS_16B);
theEmitter->emitIns_R_I(INS_movi, EA_8BYTE, REG_V4, 0x007F, INS_OPTS_4H);
theEmitter->emitIns_R_I(INS_movi, EA_8BYTE, REG_V5, 0x7F00, INS_OPTS_4H); // LSL 8
theEmitter->emitIns_R_I(INS_movi, EA_16BYTE, REG_V6, 0x003F, INS_OPTS_8H);
theEmitter->emitIns_R_I(INS_movi, EA_16BYTE, REG_V7, 0x3F00, INS_OPTS_8H); // LSL 8
theEmitter->emitIns_R_I(INS_movi, EA_8BYTE, REG_V8, 0x1F, INS_OPTS_2S);
theEmitter->emitIns_R_I(INS_movi, EA_8BYTE, REG_V9, 0x1F00, INS_OPTS_2S); // LSL 8
theEmitter->emitIns_R_I(INS_movi, EA_8BYTE, REG_V10, 0x1F0000, INS_OPTS_2S); // LSL 16
theEmitter->emitIns_R_I(INS_movi, EA_8BYTE, REG_V11, 0x1F000000, INS_OPTS_2S); // LSL 24
theEmitter->emitIns_R_I(INS_movi, EA_8BYTE, REG_V12, 0x1FFF, INS_OPTS_2S); // MSL 8
theEmitter->emitIns_R_I(INS_movi, EA_8BYTE, REG_V13, 0x1FFFFF, INS_OPTS_2S); // MSL 16
theEmitter->emitIns_R_I(INS_movi, EA_16BYTE, REG_V14, 0x37, INS_OPTS_4S);
theEmitter->emitIns_R_I(INS_movi, EA_16BYTE, REG_V15, 0x3700, INS_OPTS_4S); // LSL 8
theEmitter->emitIns_R_I(INS_movi, EA_16BYTE, REG_V16, 0x370000, INS_OPTS_4S); // LSL 16
theEmitter->emitIns_R_I(INS_movi, EA_16BYTE, REG_V17, 0x37000000, INS_OPTS_4S); // LSL 24
theEmitter->emitIns_R_I(INS_movi, EA_16BYTE, REG_V18, 0x37FF, INS_OPTS_4S); // MSL 8
theEmitter->emitIns_R_I(INS_movi, EA_16BYTE, REG_V19, 0x37FFFF, INS_OPTS_4S); // MSL 16
theEmitter->emitIns_R_I(INS_movi, EA_8BYTE, REG_V20, 0xFF80, INS_OPTS_4H); // mvni
theEmitter->emitIns_R_I(INS_movi, EA_16BYTE, REG_V21, 0xFFC0, INS_OPTS_8H); // mvni
theEmitter->emitIns_R_I(INS_movi, EA_8BYTE, REG_V22, 0xFFFFFFE0, INS_OPTS_2S); // mvni
theEmitter->emitIns_R_I(INS_movi, EA_16BYTE, REG_V23, 0xFFFFF0FF, INS_OPTS_4S); // mvni LSL 8
theEmitter->emitIns_R_I(INS_movi, EA_8BYTE, REG_V24, 0xFFF8FFFF, INS_OPTS_2S); // mvni LSL 16
theEmitter->emitIns_R_I(INS_movi, EA_16BYTE, REG_V25, 0xFCFFFFFF, INS_OPTS_4S); // mvni LSL 24
theEmitter->emitIns_R_I(INS_movi, EA_8BYTE, REG_V26, 0xFFFFFE00, INS_OPTS_2S); // mvni MSL 8
theEmitter->emitIns_R_I(INS_movi, EA_16BYTE, REG_V27, 0xFFFC0000, INS_OPTS_4S); // mvni MSL 16
theEmitter->emitIns_R_I(INS_movi, EA_8BYTE, REG_V28, 0x00FF00FF00FF00FF, INS_OPTS_1D);
theEmitter->emitIns_R_I(INS_movi, EA_16BYTE, REG_V29, 0x00FFFF0000FFFF00, INS_OPTS_2D);
theEmitter->emitIns_R_I(INS_movi, EA_8BYTE, REG_V30, 0xFF000000FF000000);
theEmitter->emitIns_R_I(INS_movi, EA_16BYTE, REG_V31, 0x0, INS_OPTS_2D);
theEmitter->emitIns_R_I(INS_mvni, EA_8BYTE, REG_V0, 0x0022, INS_OPTS_4H);
theEmitter->emitIns_R_I(INS_mvni, EA_8BYTE, REG_V1, 0x2200, INS_OPTS_4H); // LSL 8
theEmitter->emitIns_R_I(INS_mvni, EA_16BYTE, REG_V2, 0x0033, INS_OPTS_8H);
theEmitter->emitIns_R_I(INS_mvni, EA_16BYTE, REG_V3, 0x3300, INS_OPTS_8H); // LSL 8
theEmitter->emitIns_R_I(INS_mvni, EA_8BYTE, REG_V4, 0x42, INS_OPTS_2S);
theEmitter->emitIns_R_I(INS_mvni, EA_8BYTE, REG_V5, 0x4200, INS_OPTS_2S); // LSL 8
theEmitter->emitIns_R_I(INS_mvni, EA_8BYTE, REG_V6, 0x420000, INS_OPTS_2S); // LSL 16
theEmitter->emitIns_R_I(INS_mvni, EA_8BYTE, REG_V7, 0x42000000, INS_OPTS_2S); // LSL 24
theEmitter->emitIns_R_I(INS_mvni, EA_8BYTE, REG_V8, 0x42FF, INS_OPTS_2S); // MSL 8
theEmitter->emitIns_R_I(INS_mvni, EA_8BYTE, REG_V9, 0x42FFFF, INS_OPTS_2S); // MSL 16
theEmitter->emitIns_R_I(INS_mvni, EA_16BYTE, REG_V10, 0x5D, INS_OPTS_4S);
theEmitter->emitIns_R_I(INS_mvni, EA_16BYTE, REG_V11, 0x5D00, INS_OPTS_4S); // LSL 8
theEmitter->emitIns_R_I(INS_mvni, EA_16BYTE, REG_V12, 0x5D0000, INS_OPTS_4S); // LSL 16
theEmitter->emitIns_R_I(INS_mvni, EA_16BYTE, REG_V13, 0x5D000000, INS_OPTS_4S); // LSL 24
theEmitter->emitIns_R_I(INS_mvni, EA_16BYTE, REG_V14, 0x5DFF, INS_OPTS_4S); // MSL 8
theEmitter->emitIns_R_I(INS_mvni, EA_16BYTE, REG_V15, 0x5DFFFF, INS_OPTS_4S); // MSL 16
#endif // ALL_ARM64_EMITTER_UNIT_TESTS
#ifdef ALL_ARM64_EMITTER_UNIT_TESTS
//
// R_I orr/bic vector immediate
//
theEmitter->emitIns_R_I(INS_orr, EA_8BYTE, REG_V0, 0x0022, INS_OPTS_4H);
theEmitter->emitIns_R_I(INS_orr, EA_8BYTE, REG_V1, 0x2200, INS_OPTS_4H); // LSL 8
theEmitter->emitIns_R_I(INS_orr, EA_16BYTE, REG_V2, 0x0033, INS_OPTS_8H);
theEmitter->emitIns_R_I(INS_orr, EA_16BYTE, REG_V3, 0x3300, INS_OPTS_8H); // LSL 8
theEmitter->emitIns_R_I(INS_orr, EA_8BYTE, REG_V4, 0x42, INS_OPTS_2S);
theEmitter->emitIns_R_I(INS_orr, EA_8BYTE, REG_V5, 0x4200, INS_OPTS_2S); // LSL 8
theEmitter->emitIns_R_I(INS_orr, EA_8BYTE, REG_V6, 0x420000, INS_OPTS_2S); // LSL 16
theEmitter->emitIns_R_I(INS_orr, EA_8BYTE, REG_V7, 0x42000000, INS_OPTS_2S); // LSL 24
theEmitter->emitIns_R_I(INS_orr, EA_16BYTE, REG_V10, 0x5D, INS_OPTS_4S);
theEmitter->emitIns_R_I(INS_orr, EA_16BYTE, REG_V11, 0x5D00, INS_OPTS_4S); // LSL 8
theEmitter->emitIns_R_I(INS_orr, EA_16BYTE, REG_V12, 0x5D0000, INS_OPTS_4S); // LSL 16
theEmitter->emitIns_R_I(INS_orr, EA_16BYTE, REG_V13, 0x5D000000, INS_OPTS_4S); // LSL 24
theEmitter->emitIns_R_I(INS_bic, EA_8BYTE, REG_V0, 0x0022, INS_OPTS_4H);
theEmitter->emitIns_R_I(INS_bic, EA_8BYTE, REG_V1, 0x2200, INS_OPTS_4H); // LSL 8
theEmitter->emitIns_R_I(INS_bic, EA_16BYTE, REG_V2, 0x0033, INS_OPTS_8H);
theEmitter->emitIns_R_I(INS_bic, EA_16BYTE, REG_V3, 0x3300, INS_OPTS_8H); // LSL 8
theEmitter->emitIns_R_I(INS_bic, EA_8BYTE, REG_V4, 0x42, INS_OPTS_2S);
theEmitter->emitIns_R_I(INS_bic, EA_8BYTE, REG_V5, 0x4200, INS_OPTS_2S); // LSL 8
theEmitter->emitIns_R_I(INS_bic, EA_8BYTE, REG_V6, 0x420000, INS_OPTS_2S); // LSL 16
theEmitter->emitIns_R_I(INS_bic, EA_8BYTE, REG_V7, 0x42000000, INS_OPTS_2S); // LSL 24
theEmitter->emitIns_R_I(INS_bic, EA_16BYTE, REG_V10, 0x5D, INS_OPTS_4S);
theEmitter->emitIns_R_I(INS_bic, EA_16BYTE, REG_V11, 0x5D00, INS_OPTS_4S); // LSL 8
theEmitter->emitIns_R_I(INS_bic, EA_16BYTE, REG_V12, 0x5D0000, INS_OPTS_4S); // LSL 16
theEmitter->emitIns_R_I(INS_bic, EA_16BYTE, REG_V13, 0x5D000000, INS_OPTS_4S); // LSL 24
#endif // ALL_ARM64_EMITTER_UNIT_TESTS
#ifdef ALL_ARM64_EMITTER_UNIT_TESTS
//
// R_F cmp/fmov immediate
//
// fmov imm8 (scalar)
theEmitter->emitIns_R_F(INS_fmov, EA_8BYTE, REG_V14, 1.0);
theEmitter->emitIns_R_F(INS_fmov, EA_4BYTE, REG_V15, -1.0);
theEmitter->emitIns_R_F(INS_fmov, EA_4BYTE, REG_V0, 2.0); // encodes imm8 == 0
theEmitter->emitIns_R_F(INS_fmov, EA_4BYTE, REG_V16, 10.0);
theEmitter->emitIns_R_F(INS_fmov, EA_8BYTE, REG_V17, -10.0);
theEmitter->emitIns_R_F(INS_fmov, EA_8BYTE, REG_V18, 31); // Largest encodable value
theEmitter->emitIns_R_F(INS_fmov, EA_4BYTE, REG_V19, -31);
theEmitter->emitIns_R_F(INS_fmov, EA_4BYTE, REG_V20, 1.25);
theEmitter->emitIns_R_F(INS_fmov, EA_8BYTE, REG_V21, -1.25);
theEmitter->emitIns_R_F(INS_fmov, EA_8BYTE, REG_V22, 0.125); // Smallest encodable value
theEmitter->emitIns_R_F(INS_fmov, EA_4BYTE, REG_V23, -0.125);
// fmov imm8 (vector)
theEmitter->emitIns_R_F(INS_fmov, EA_8BYTE, REG_V0, 2.0, INS_OPTS_2S);
theEmitter->emitIns_R_F(INS_fmov, EA_8BYTE, REG_V24, 1.0, INS_OPTS_2S);
theEmitter->emitIns_R_F(INS_fmov, EA_16BYTE, REG_V25, 1.0, INS_OPTS_4S);
theEmitter->emitIns_R_F(INS_fmov, EA_16BYTE, REG_V26, 1.0, INS_OPTS_2D);
theEmitter->emitIns_R_F(INS_fmov, EA_8BYTE, REG_V27, -10.0, INS_OPTS_2S);
theEmitter->emitIns_R_F(INS_fmov, EA_16BYTE, REG_V28, -10.0, INS_OPTS_4S);
theEmitter->emitIns_R_F(INS_fmov, EA_16BYTE, REG_V29, -10.0, INS_OPTS_2D);
theEmitter->emitIns_R_F(INS_fmov, EA_8BYTE, REG_V30, 31.0, INS_OPTS_2S);
theEmitter->emitIns_R_F(INS_fmov, EA_16BYTE, REG_V31, 31.0, INS_OPTS_4S);
theEmitter->emitIns_R_F(INS_fmov, EA_16BYTE, REG_V0, 31.0, INS_OPTS_2D);
theEmitter->emitIns_R_F(INS_fmov, EA_8BYTE, REG_V1, -0.125, INS_OPTS_2S);
theEmitter->emitIns_R_F(INS_fmov, EA_16BYTE, REG_V2, -0.125, INS_OPTS_4S);
theEmitter->emitIns_R_F(INS_fmov, EA_16BYTE, REG_V3, -0.125, INS_OPTS_2D);
// fcmp with 0.0
theEmitter->emitIns_R_F(INS_fcmp, EA_8BYTE, REG_V12, 0.0);
theEmitter->emitIns_R_F(INS_fcmp, EA_4BYTE, REG_V13, 0.0);
theEmitter->emitIns_R_F(INS_fcmpe, EA_8BYTE, REG_V14, 0.0);
theEmitter->emitIns_R_F(INS_fcmpe, EA_4BYTE, REG_V15, 0.0);
#endif // ALL_ARM64_EMITTER_UNIT_TESTS
#ifdef ALL_ARM64_EMITTER_UNIT_TESTS
//
// R_R fmov/fcmp/fcvt
//
// fmov to vector to vector
theEmitter->emitIns_R_R(INS_fmov, EA_8BYTE, REG_V0, REG_V2);
theEmitter->emitIns_R_R(INS_fmov, EA_4BYTE, REG_V1, REG_V3);
// fmov to vector to general
theEmitter->emitIns_R_R(INS_fmov, EA_8BYTE, REG_R0, REG_V4);
theEmitter->emitIns_R_R(INS_fmov, EA_4BYTE, REG_R1, REG_V5);
// using the optional conversion specifier
theEmitter->emitIns_R_R(INS_fmov, EA_8BYTE, REG_R2, REG_V6, INS_OPTS_D_TO_8BYTE);
theEmitter->emitIns_R_R(INS_fmov, EA_4BYTE, REG_R3, REG_V7, INS_OPTS_S_TO_4BYTE);
// fmov to general to vector
theEmitter->emitIns_R_R(INS_fmov, EA_8BYTE, REG_V8, REG_R4);
theEmitter->emitIns_R_R(INS_fmov, EA_4BYTE, REG_V9, REG_R5);
// using the optional conversion specifier
theEmitter->emitIns_R_R(INS_fmov, EA_8BYTE, REG_V10, REG_R6, INS_OPTS_8BYTE_TO_D);
theEmitter->emitIns_R_R(INS_fmov, EA_4BYTE, REG_V11, REG_R7, INS_OPTS_4BYTE_TO_S);
// fcmp/fcmpe
theEmitter->emitIns_R_R(INS_fcmp, EA_8BYTE, REG_V8, REG_V16);
theEmitter->emitIns_R_R(INS_fcmp, EA_4BYTE, REG_V9, REG_V17);
theEmitter->emitIns_R_R(INS_fcmpe, EA_8BYTE, REG_V10, REG_V18);
theEmitter->emitIns_R_R(INS_fcmpe, EA_4BYTE, REG_V11, REG_V19);
// fcvt
theEmitter->emitIns_R_R(INS_fcvt, EA_8BYTE, REG_V24, REG_V25, INS_OPTS_S_TO_D); // Single to Double
theEmitter->emitIns_R_R(INS_fcvt, EA_4BYTE, REG_V26, REG_V27, INS_OPTS_D_TO_S); // Double to Single
theEmitter->emitIns_R_R(INS_fcvt, EA_4BYTE, REG_V1, REG_V2, INS_OPTS_H_TO_S);
theEmitter->emitIns_R_R(INS_fcvt, EA_8BYTE, REG_V3, REG_V4, INS_OPTS_H_TO_D);
theEmitter->emitIns_R_R(INS_fcvt, EA_2BYTE, REG_V5, REG_V6, INS_OPTS_S_TO_H);
theEmitter->emitIns_R_R(INS_fcvt, EA_2BYTE, REG_V7, REG_V8, INS_OPTS_D_TO_H);
#endif // ALL_ARM64_EMITTER_UNIT_TESTS
#ifdef ALL_ARM64_EMITTER_UNIT_TESTS
//
// R_R floating point conversions
//
// fcvtas scalar
theEmitter->emitIns_R_R(INS_fcvtas, EA_4BYTE, REG_V0, REG_V1);
theEmitter->emitIns_R_R(INS_fcvtas, EA_8BYTE, REG_V2, REG_V3);
// fcvtas scalar to general
theEmitter->emitIns_R_R(INS_fcvtas, EA_4BYTE, REG_R0, REG_V4, INS_OPTS_S_TO_4BYTE);
theEmitter->emitIns_R_R(INS_fcvtas, EA_4BYTE, REG_R1, REG_V5, INS_OPTS_D_TO_4BYTE);
theEmitter->emitIns_R_R(INS_fcvtas, EA_8BYTE, REG_R2, REG_V6, INS_OPTS_S_TO_8BYTE);
theEmitter->emitIns_R_R(INS_fcvtas, EA_8BYTE, REG_R3, REG_V7, INS_OPTS_D_TO_8BYTE);
// fcvtas vector
theEmitter->emitIns_R_R(INS_fcvtas, EA_8BYTE, REG_V8, REG_V9, INS_OPTS_2S);
theEmitter->emitIns_R_R(INS_fcvtas, EA_16BYTE, REG_V10, REG_V11, INS_OPTS_4S);
theEmitter->emitIns_R_R(INS_fcvtas, EA_16BYTE, REG_V12, REG_V13, INS_OPTS_2D);
// fcvtau scalar
theEmitter->emitIns_R_R(INS_fcvtau, EA_4BYTE, REG_V0, REG_V1);
theEmitter->emitIns_R_R(INS_fcvtau, EA_8BYTE, REG_V2, REG_V3);
// fcvtau scalar to general
theEmitter->emitIns_R_R(INS_fcvtau, EA_4BYTE, REG_R0, REG_V4, INS_OPTS_S_TO_4BYTE);
theEmitter->emitIns_R_R(INS_fcvtau, EA_4BYTE, REG_R1, REG_V5, INS_OPTS_D_TO_4BYTE);
theEmitter->emitIns_R_R(INS_fcvtau, EA_8BYTE, REG_R2, REG_V6, INS_OPTS_S_TO_8BYTE);
theEmitter->emitIns_R_R(INS_fcvtau, EA_8BYTE, REG_R3, REG_V7, INS_OPTS_D_TO_8BYTE);
// fcvtau vector
theEmitter->emitIns_R_R(INS_fcvtau, EA_8BYTE, REG_V8, REG_V9, INS_OPTS_2S);
theEmitter->emitIns_R_R(INS_fcvtau, EA_16BYTE, REG_V10, REG_V11, INS_OPTS_4S);
theEmitter->emitIns_R_R(INS_fcvtau, EA_16BYTE, REG_V12, REG_V13, INS_OPTS_2D);
////////////////////////////////////////////////////////////////////////////////
// fcvtms scalar
theEmitter->emitIns_R_R(INS_fcvtms, EA_4BYTE, REG_V0, REG_V1);
theEmitter->emitIns_R_R(INS_fcvtms, EA_8BYTE, REG_V2, REG_V3);
// fcvtms scalar to general
theEmitter->emitIns_R_R(INS_fcvtms, EA_4BYTE, REG_R0, REG_V4, INS_OPTS_S_TO_4BYTE);
theEmitter->emitIns_R_R(INS_fcvtms, EA_4BYTE, REG_R1, REG_V5, INS_OPTS_D_TO_4BYTE);
theEmitter->emitIns_R_R(INS_fcvtms, EA_8BYTE, REG_R2, REG_V6, INS_OPTS_S_TO_8BYTE);
theEmitter->emitIns_R_R(INS_fcvtms, EA_8BYTE, REG_R3, REG_V7, INS_OPTS_D_TO_8BYTE);
// fcvtms vector
theEmitter->emitIns_R_R(INS_fcvtms, EA_8BYTE, REG_V8, REG_V9, INS_OPTS_2S);
theEmitter->emitIns_R_R(INS_fcvtms, EA_16BYTE, REG_V10, REG_V11, INS_OPTS_4S);
theEmitter->emitIns_R_R(INS_fcvtms, EA_16BYTE, REG_V12, REG_V13, INS_OPTS_2D);
// fcvtmu scalar
theEmitter->emitIns_R_R(INS_fcvtmu, EA_4BYTE, REG_V0, REG_V1);
theEmitter->emitIns_R_R(INS_fcvtmu, EA_8BYTE, REG_V2, REG_V3);
// fcvtmu scalar to general
theEmitter->emitIns_R_R(INS_fcvtmu, EA_4BYTE, REG_R0, REG_V4, INS_OPTS_S_TO_4BYTE);
theEmitter->emitIns_R_R(INS_fcvtmu, EA_4BYTE, REG_R1, REG_V5, INS_OPTS_D_TO_4BYTE);
theEmitter->emitIns_R_R(INS_fcvtmu, EA_8BYTE, REG_R2, REG_V6, INS_OPTS_S_TO_8BYTE);
theEmitter->emitIns_R_R(INS_fcvtmu, EA_8BYTE, REG_R3, REG_V7, INS_OPTS_D_TO_8BYTE);
// fcvtmu vector
theEmitter->emitIns_R_R(INS_fcvtmu, EA_8BYTE, REG_V8, REG_V9, INS_OPTS_2S);
theEmitter->emitIns_R_R(INS_fcvtmu, EA_16BYTE, REG_V10, REG_V11, INS_OPTS_4S);
theEmitter->emitIns_R_R(INS_fcvtmu, EA_16BYTE, REG_V12, REG_V13, INS_OPTS_2D);
////////////////////////////////////////////////////////////////////////////////
// fcvtns scalar
theEmitter->emitIns_R_R(INS_fcvtns, EA_4BYTE, REG_V0, REG_V1);
theEmitter->emitIns_R_R(INS_fcvtns, EA_8BYTE, REG_V2, REG_V3);
// fcvtns scalar to general
theEmitter->emitIns_R_R(INS_fcvtns, EA_4BYTE, REG_R0, REG_V4, INS_OPTS_S_TO_4BYTE);
theEmitter->emitIns_R_R(INS_fcvtns, EA_4BYTE, REG_R1, REG_V5, INS_OPTS_D_TO_4BYTE);
theEmitter->emitIns_R_R(INS_fcvtns, EA_8BYTE, REG_R2, REG_V6, INS_OPTS_S_TO_8BYTE);
theEmitter->emitIns_R_R(INS_fcvtns, EA_8BYTE, REG_R3, REG_V7, INS_OPTS_D_TO_8BYTE);
// fcvtns vector
theEmitter->emitIns_R_R(INS_fcvtns, EA_8BYTE, REG_V8, REG_V9, INS_OPTS_2S);
theEmitter->emitIns_R_R(INS_fcvtns, EA_16BYTE, REG_V10, REG_V11, INS_OPTS_4S);
theEmitter->emitIns_R_R(INS_fcvtns, EA_16BYTE, REG_V12, REG_V13, INS_OPTS_2D);
// fcvtnu scalar
theEmitter->emitIns_R_R(INS_fcvtnu, EA_4BYTE, REG_V0, REG_V1);
theEmitter->emitIns_R_R(INS_fcvtnu, EA_8BYTE, REG_V2, REG_V3);
// fcvtnu scalar to general
theEmitter->emitIns_R_R(INS_fcvtnu, EA_4BYTE, REG_R0, REG_V4, INS_OPTS_S_TO_4BYTE);
theEmitter->emitIns_R_R(INS_fcvtnu, EA_4BYTE, REG_R1, REG_V5, INS_OPTS_D_TO_4BYTE);
theEmitter->emitIns_R_R(INS_fcvtnu, EA_8BYTE, REG_R2, REG_V6, INS_OPTS_S_TO_8BYTE);
theEmitter->emitIns_R_R(INS_fcvtnu, EA_8BYTE, REG_R3, REG_V7, INS_OPTS_D_TO_8BYTE);
// fcvtnu vector
theEmitter->emitIns_R_R(INS_fcvtnu, EA_8BYTE, REG_V8, REG_V9, INS_OPTS_2S);
theEmitter->emitIns_R_R(INS_fcvtnu, EA_16BYTE, REG_V10, REG_V11, INS_OPTS_4S);
theEmitter->emitIns_R_R(INS_fcvtnu, EA_16BYTE, REG_V12, REG_V13, INS_OPTS_2D);
////////////////////////////////////////////////////////////////////////////////
// fcvtps scalar
theEmitter->emitIns_R_R(INS_fcvtps, EA_4BYTE, REG_V0, REG_V1);
theEmitter->emitIns_R_R(INS_fcvtps, EA_8BYTE, REG_V2, REG_V3);
// fcvtps scalar to general
theEmitter->emitIns_R_R(INS_fcvtps, EA_4BYTE, REG_R0, REG_V4, INS_OPTS_S_TO_4BYTE);
theEmitter->emitIns_R_R(INS_fcvtps, EA_4BYTE, REG_R1, REG_V5, INS_OPTS_D_TO_4BYTE);
theEmitter->emitIns_R_R(INS_fcvtps, EA_8BYTE, REG_R2, REG_V6, INS_OPTS_S_TO_8BYTE);
theEmitter->emitIns_R_R(INS_fcvtps, EA_8BYTE, REG_R3, REG_V7, INS_OPTS_D_TO_8BYTE);
// fcvtps vector
theEmitter->emitIns_R_R(INS_fcvtps, EA_8BYTE, REG_V8, REG_V9, INS_OPTS_2S);
theEmitter->emitIns_R_R(INS_fcvtps, EA_16BYTE, REG_V10, REG_V11, INS_OPTS_4S);
theEmitter->emitIns_R_R(INS_fcvtps, EA_16BYTE, REG_V12, REG_V13, INS_OPTS_2D);
// fcvtpu scalar
theEmitter->emitIns_R_R(INS_fcvtpu, EA_4BYTE, REG_V0, REG_V1);
theEmitter->emitIns_R_R(INS_fcvtpu, EA_8BYTE, REG_V2, REG_V3);
// fcvtpu scalar to general
theEmitter->emitIns_R_R(INS_fcvtpu, EA_4BYTE, REG_R0, REG_V4, INS_OPTS_S_TO_4BYTE);
theEmitter->emitIns_R_R(INS_fcvtpu, EA_4BYTE, REG_R1, REG_V5, INS_OPTS_D_TO_4BYTE);
theEmitter->emitIns_R_R(INS_fcvtpu, EA_8BYTE, REG_R2, REG_V6, INS_OPTS_S_TO_8BYTE);
theEmitter->emitIns_R_R(INS_fcvtpu, EA_8BYTE, REG_R3, REG_V7, INS_OPTS_D_TO_8BYTE);
// fcvtpu vector
theEmitter->emitIns_R_R(INS_fcvtpu, EA_8BYTE, REG_V8, REG_V9, INS_OPTS_2S);
theEmitter->emitIns_R_R(INS_fcvtpu, EA_16BYTE, REG_V10, REG_V11, INS_OPTS_4S);
theEmitter->emitIns_R_R(INS_fcvtpu, EA_16BYTE, REG_V12, REG_V13, INS_OPTS_2D);
////////////////////////////////////////////////////////////////////////////////
// fcvtzs scalar
theEmitter->emitIns_R_R(INS_fcvtzs, EA_4BYTE, REG_V0, REG_V1);
theEmitter->emitIns_R_R(INS_fcvtzs, EA_8BYTE, REG_V2, REG_V3);
// fcvtzs scalar to general
theEmitter->emitIns_R_R(INS_fcvtzs, EA_4BYTE, REG_R0, REG_V4, INS_OPTS_S_TO_4BYTE);
theEmitter->emitIns_R_R(INS_fcvtzs, EA_4BYTE, REG_R1, REG_V5, INS_OPTS_D_TO_4BYTE);
theEmitter->emitIns_R_R(INS_fcvtzs, EA_8BYTE, REG_R2, REG_V6, INS_OPTS_S_TO_8BYTE);
theEmitter->emitIns_R_R(INS_fcvtzs, EA_8BYTE, REG_R3, REG_V7, INS_OPTS_D_TO_8BYTE);
// fcvtzs vector
theEmitter->emitIns_R_R(INS_fcvtzs, EA_8BYTE, REG_V8, REG_V9, INS_OPTS_2S);
theEmitter->emitIns_R_R(INS_fcvtzs, EA_16BYTE, REG_V10, REG_V11, INS_OPTS_4S);
theEmitter->emitIns_R_R(INS_fcvtzs, EA_16BYTE, REG_V12, REG_V13, INS_OPTS_2D);
// fcvtzu scalar
theEmitter->emitIns_R_R(INS_fcvtzu, EA_4BYTE, REG_V0, REG_V1);
theEmitter->emitIns_R_R(INS_fcvtzu, EA_8BYTE, REG_V2, REG_V3);
// fcvtzu scalar to general
theEmitter->emitIns_R_R(INS_fcvtzu, EA_4BYTE, REG_R0, REG_V4, INS_OPTS_S_TO_4BYTE);
theEmitter->emitIns_R_R(INS_fcvtzu, EA_4BYTE, REG_R1, REG_V5, INS_OPTS_D_TO_4BYTE);
theEmitter->emitIns_R_R(INS_fcvtzu, EA_8BYTE, REG_R2, REG_V6, INS_OPTS_S_TO_8BYTE);
theEmitter->emitIns_R_R(INS_fcvtzu, EA_8BYTE, REG_R3, REG_V7, INS_OPTS_D_TO_8BYTE);
// fcvtzu vector
theEmitter->emitIns_R_R(INS_fcvtzu, EA_8BYTE, REG_V8, REG_V9, INS_OPTS_2S);
theEmitter->emitIns_R_R(INS_fcvtzu, EA_16BYTE, REG_V10, REG_V11, INS_OPTS_4S);
theEmitter->emitIns_R_R(INS_fcvtzu, EA_16BYTE, REG_V12, REG_V13, INS_OPTS_2D);
////////////////////////////////////////////////////////////////////////////////
// scvtf scalar
theEmitter->emitIns_R_R(INS_scvtf, EA_4BYTE, REG_V0, REG_V1);
theEmitter->emitIns_R_R(INS_scvtf, EA_8BYTE, REG_V2, REG_V3);
// scvtf scalar from general
theEmitter->emitIns_R_R(INS_scvtf, EA_4BYTE, REG_V4, REG_R0, INS_OPTS_4BYTE_TO_S);
theEmitter->emitIns_R_R(INS_scvtf, EA_4BYTE, REG_V5, REG_R1, INS_OPTS_8BYTE_TO_S);
theEmitter->emitIns_R_R(INS_scvtf, EA_8BYTE, REG_V6, REG_R2, INS_OPTS_4BYTE_TO_D);
theEmitter->emitIns_R_R(INS_scvtf, EA_8BYTE, REG_V7, REG_R3, INS_OPTS_8BYTE_TO_D);
// scvtf vector
theEmitter->emitIns_R_R(INS_scvtf, EA_8BYTE, REG_V8, REG_V9, INS_OPTS_2S);
theEmitter->emitIns_R_R(INS_scvtf, EA_16BYTE, REG_V10, REG_V11, INS_OPTS_4S);
theEmitter->emitIns_R_R(INS_scvtf, EA_16BYTE, REG_V12, REG_V13, INS_OPTS_2D);
// ucvtf scalar
theEmitter->emitIns_R_R(INS_ucvtf, EA_4BYTE, REG_V0, REG_V1);
theEmitter->emitIns_R_R(INS_ucvtf, EA_8BYTE, REG_V2, REG_V3);
// ucvtf scalar from general
theEmitter->emitIns_R_R(INS_ucvtf, EA_4BYTE, REG_V4, REG_R0, INS_OPTS_4BYTE_TO_S);
theEmitter->emitIns_R_R(INS_ucvtf, EA_4BYTE, REG_V5, REG_R1, INS_OPTS_8BYTE_TO_S);
theEmitter->emitIns_R_R(INS_ucvtf, EA_8BYTE, REG_V6, REG_R2, INS_OPTS_4BYTE_TO_D);
theEmitter->emitIns_R_R(INS_ucvtf, EA_8BYTE, REG_V7, REG_R3, INS_OPTS_8BYTE_TO_D);
// ucvtf vector
theEmitter->emitIns_R_R(INS_ucvtf, EA_8BYTE, REG_V8, REG_V9, INS_OPTS_2S);
theEmitter->emitIns_R_R(INS_ucvtf, EA_16BYTE, REG_V10, REG_V11, INS_OPTS_4S);
theEmitter->emitIns_R_R(INS_ucvtf, EA_16BYTE, REG_V12, REG_V13, INS_OPTS_2D);
#endif // ALL_ARM64_EMITTER_UNIT_TESTS
#ifdef ALL_ARM64_EMITTER_UNIT_TESTS
//
// R_R floating point operations, one dest, one source
//
// fabs scalar
theEmitter->emitIns_R_R(INS_fabs, EA_4BYTE, REG_V0, REG_V1);
theEmitter->emitIns_R_R(INS_fabs, EA_8BYTE, REG_V2, REG_V3);
// fabs vector
theEmitter->emitIns_R_R(INS_fabs, EA_8BYTE, REG_V4, REG_V5, INS_OPTS_2S);
theEmitter->emitIns_R_R(INS_fabs, EA_16BYTE, REG_V6, REG_V7, INS_OPTS_4S);
theEmitter->emitIns_R_R(INS_fabs, EA_16BYTE, REG_V8, REG_V9, INS_OPTS_2D);
// fneg scalar
theEmitter->emitIns_R_R(INS_fneg, EA_4BYTE, REG_V0, REG_V1);
theEmitter->emitIns_R_R(INS_fneg, EA_8BYTE, REG_V2, REG_V3);
// fneg vector
theEmitter->emitIns_R_R(INS_fneg, EA_8BYTE, REG_V4, REG_V5, INS_OPTS_2S);
theEmitter->emitIns_R_R(INS_fneg, EA_16BYTE, REG_V6, REG_V7, INS_OPTS_4S);
theEmitter->emitIns_R_R(INS_fneg, EA_16BYTE, REG_V8, REG_V9, INS_OPTS_2D);
// fsqrt scalar
theEmitter->emitIns_R_R(INS_fsqrt, EA_4BYTE, REG_V0, REG_V1);
theEmitter->emitIns_R_R(INS_fsqrt, EA_8BYTE, REG_V2, REG_V3);
// fsqrt vector
theEmitter->emitIns_R_R(INS_fsqrt, EA_8BYTE, REG_V4, REG_V5, INS_OPTS_2S);
theEmitter->emitIns_R_R(INS_fsqrt, EA_16BYTE, REG_V6, REG_V7, INS_OPTS_4S);
theEmitter->emitIns_R_R(INS_fsqrt, EA_16BYTE, REG_V8, REG_V9, INS_OPTS_2D);
genDefineTempLabel(genCreateTempLabel());
// abs scalar
theEmitter->emitIns_R_R(INS_abs, EA_8BYTE, REG_V2, REG_V3);
// abs vector
theEmitter->emitIns_R_R(INS_abs, EA_8BYTE, REG_V4, REG_V5, INS_OPTS_8B);
theEmitter->emitIns_R_R(INS_abs, EA_16BYTE, REG_V6, REG_V7, INS_OPTS_16B);
theEmitter->emitIns_R_R(INS_abs, EA_8BYTE, REG_V8, REG_V9, INS_OPTS_4H);
theEmitter->emitIns_R_R(INS_abs, EA_16BYTE, REG_V10, REG_V11, INS_OPTS_8H);
theEmitter->emitIns_R_R(INS_abs, EA_8BYTE, REG_V12, REG_V13, INS_OPTS_2S);
theEmitter->emitIns_R_R(INS_abs, EA_16BYTE, REG_V14, REG_V15, INS_OPTS_4S);
theEmitter->emitIns_R_R(INS_abs, EA_16BYTE, REG_V16, REG_V17, INS_OPTS_2D);
// neg scalar
theEmitter->emitIns_R_R(INS_neg, EA_8BYTE, REG_V2, REG_V3);
// neg vector
theEmitter->emitIns_R_R(INS_neg, EA_8BYTE, REG_V4, REG_V5, INS_OPTS_8B);
theEmitter->emitIns_R_R(INS_neg, EA_16BYTE, REG_V6, REG_V7, INS_OPTS_16B);
theEmitter->emitIns_R_R(INS_neg, EA_8BYTE, REG_V8, REG_V9, INS_OPTS_4H);
theEmitter->emitIns_R_R(INS_neg, EA_16BYTE, REG_V10, REG_V11, INS_OPTS_8H);
theEmitter->emitIns_R_R(INS_neg, EA_8BYTE, REG_V12, REG_V13, INS_OPTS_2S);
theEmitter->emitIns_R_R(INS_neg, EA_16BYTE, REG_V14, REG_V15, INS_OPTS_4S);
theEmitter->emitIns_R_R(INS_neg, EA_16BYTE, REG_V16, REG_V17, INS_OPTS_2D);
// mvn vector
theEmitter->emitIns_R_R(INS_mvn, EA_8BYTE, REG_V4, REG_V5);
theEmitter->emitIns_R_R(INS_mvn, EA_8BYTE, REG_V6, REG_V7, INS_OPTS_8B);
theEmitter->emitIns_R_R(INS_mvn, EA_16BYTE, REG_V8, REG_V9);
theEmitter->emitIns_R_R(INS_mvn, EA_16BYTE, REG_V10, REG_V11, INS_OPTS_16B);
// cnt vector
theEmitter->emitIns_R_R(INS_cnt, EA_8BYTE, REG_V22, REG_V23, INS_OPTS_8B);
theEmitter->emitIns_R_R(INS_cnt, EA_16BYTE, REG_V24, REG_V25, INS_OPTS_16B);
// not vector (the same encoding as mvn)
theEmitter->emitIns_R_R(INS_not, EA_8BYTE, REG_V12, REG_V13);
theEmitter->emitIns_R_R(INS_not, EA_8BYTE, REG_V14, REG_V15, INS_OPTS_8B);
theEmitter->emitIns_R_R(INS_not, EA_16BYTE, REG_V16, REG_V17);
theEmitter->emitIns_R_R(INS_not, EA_16BYTE, REG_V18, REG_V19, INS_OPTS_16B);
// cls vector
theEmitter->emitIns_R_R(INS_cls, EA_8BYTE, REG_V4, REG_V5, INS_OPTS_8B);
theEmitter->emitIns_R_R(INS_cls, EA_16BYTE, REG_V6, REG_V7, INS_OPTS_16B);
theEmitter->emitIns_R_R(INS_cls, EA_8BYTE, REG_V8, REG_V9, INS_OPTS_4H);
theEmitter->emitIns_R_R(INS_cls, EA_16BYTE, REG_V10, REG_V11, INS_OPTS_8H);
theEmitter->emitIns_R_R(INS_cls, EA_8BYTE, REG_V12, REG_V13, INS_OPTS_2S);
theEmitter->emitIns_R_R(INS_cls, EA_16BYTE, REG_V14, REG_V15, INS_OPTS_4S);
// clz vector
theEmitter->emitIns_R_R(INS_clz, EA_8BYTE, REG_V4, REG_V5, INS_OPTS_8B);
theEmitter->emitIns_R_R(INS_clz, EA_16BYTE, REG_V6, REG_V7, INS_OPTS_16B);
theEmitter->emitIns_R_R(INS_clz, EA_8BYTE, REG_V8, REG_V9, INS_OPTS_4H);
theEmitter->emitIns_R_R(INS_clz, EA_16BYTE, REG_V10, REG_V11, INS_OPTS_8H);
theEmitter->emitIns_R_R(INS_clz, EA_8BYTE, REG_V12, REG_V13, INS_OPTS_2S);
theEmitter->emitIns_R_R(INS_clz, EA_16BYTE, REG_V14, REG_V15, INS_OPTS_4S);
// rbit vector
theEmitter->emitIns_R_R(INS_rbit, EA_8BYTE, REG_V0, REG_V1, INS_OPTS_8B);
theEmitter->emitIns_R_R(INS_rbit, EA_16BYTE, REG_V2, REG_V3, INS_OPTS_16B);
// rev16 vector
theEmitter->emitIns_R_R(INS_rev16, EA_8BYTE, REG_V0, REG_V1, INS_OPTS_8B);
theEmitter->emitIns_R_R(INS_rev16, EA_16BYTE, REG_V2, REG_V3, INS_OPTS_16B);
// rev32 vector
theEmitter->emitIns_R_R(INS_rev32, EA_8BYTE, REG_V4, REG_V5, INS_OPTS_8B);
theEmitter->emitIns_R_R(INS_rev32, EA_16BYTE, REG_V6, REG_V7, INS_OPTS_16B);
theEmitter->emitIns_R_R(INS_rev32, EA_8BYTE, REG_V8, REG_V9, INS_OPTS_4H);
theEmitter->emitIns_R_R(INS_rev32, EA_16BYTE, REG_V10, REG_V11, INS_OPTS_8H);
// rev64 vector
theEmitter->emitIns_R_R(INS_rev64, EA_8BYTE, REG_V4, REG_V5, INS_OPTS_8B);
theEmitter->emitIns_R_R(INS_rev64, EA_16BYTE, REG_V6, REG_V7, INS_OPTS_16B);
theEmitter->emitIns_R_R(INS_rev64, EA_8BYTE, REG_V8, REG_V9, INS_OPTS_4H);
theEmitter->emitIns_R_R(INS_rev64, EA_16BYTE, REG_V10, REG_V11, INS_OPTS_8H);
theEmitter->emitIns_R_R(INS_rev64, EA_8BYTE, REG_V12, REG_V13, INS_OPTS_2S);
theEmitter->emitIns_R_R(INS_rev64, EA_16BYTE, REG_V14, REG_V15, INS_OPTS_4S);
// addv vector
theEmitter->emitIns_R_R(INS_addv, EA_8BYTE, REG_V4, REG_V5, INS_OPTS_8B);
theEmitter->emitIns_R_R(INS_addv, EA_16BYTE, REG_V6, REG_V7, INS_OPTS_16B);
theEmitter->emitIns_R_R(INS_addv, EA_8BYTE, REG_V8, REG_V9, INS_OPTS_4H);
theEmitter->emitIns_R_R(INS_addv, EA_16BYTE, REG_V10, REG_V11, INS_OPTS_8H);
theEmitter->emitIns_R_R(INS_addv, EA_8BYTE, REG_V12, REG_V13, INS_OPTS_2S);
theEmitter->emitIns_R_R(INS_addv, EA_16BYTE, REG_V14, REG_V15, INS_OPTS_4S);
// saddlv vector
theEmitter->emitIns_R_R(INS_saddlv, EA_8BYTE, REG_V4, REG_V5, INS_OPTS_8B);
theEmitter->emitIns_R_R(INS_saddlv, EA_16BYTE, REG_V6, REG_V7, INS_OPTS_16B);
theEmitter->emitIns_R_R(INS_saddlv, EA_8BYTE, REG_V8, REG_V9, INS_OPTS_4H);
theEmitter->emitIns_R_R(INS_saddlv, EA_16BYTE, REG_V10, REG_V11, INS_OPTS_8H);
theEmitter->emitIns_R_R(INS_saddlv, EA_8BYTE, REG_V12, REG_V13, INS_OPTS_2S);
theEmitter->emitIns_R_R(INS_saddlv, EA_16BYTE, REG_V14, REG_V15, INS_OPTS_4S);
// smaxlv vector
theEmitter->emitIns_R_R(INS_smaxlv, EA_8BYTE, REG_V4, REG_V5, INS_OPTS_8B);
theEmitter->emitIns_R_R(INS_smaxlv, EA_16BYTE, REG_V6, REG_V7, INS_OPTS_16B);
theEmitter->emitIns_R_R(INS_smaxlv, EA_8BYTE, REG_V8, REG_V9, INS_OPTS_4H);
theEmitter->emitIns_R_R(INS_smaxlv, EA_16BYTE, REG_V10, REG_V11, INS_OPTS_8H);
theEmitter->emitIns_R_R(INS_smaxlv, EA_8BYTE, REG_V12, REG_V13, INS_OPTS_2S);
theEmitter->emitIns_R_R(INS_smaxlv, EA_16BYTE, REG_V14, REG_V15, INS_OPTS_4S);
// sminlv vector
theEmitter->emitIns_R_R(INS_sminlv, EA_8BYTE, REG_V4, REG_V5, INS_OPTS_8B);
theEmitter->emitIns_R_R(INS_sminlv, EA_16BYTE, REG_V6, REG_V7, INS_OPTS_16B);
theEmitter->emitIns_R_R(INS_sminlv, EA_8BYTE, REG_V8, REG_V9, INS_OPTS_4H);
theEmitter->emitIns_R_R(INS_sminlv, EA_16BYTE, REG_V10, REG_V11, INS_OPTS_8H);
theEmitter->emitIns_R_R(INS_sminlv, EA_8BYTE, REG_V12, REG_V13, INS_OPTS_2S);
theEmitter->emitIns_R_R(INS_sminlv, EA_16BYTE, REG_V14, REG_V15, INS_OPTS_4S);
// uaddlv vector
theEmitter->emitIns_R_R(INS_uaddlv, EA_8BYTE, REG_V4, REG_V5, INS_OPTS_8B);
theEmitter->emitIns_R_R(INS_uaddlv, EA_16BYTE, REG_V6, REG_V7, INS_OPTS_16B);
theEmitter->emitIns_R_R(INS_uaddlv, EA_8BYTE, REG_V8, REG_V9, INS_OPTS_4H);
theEmitter->emitIns_R_R(INS_uaddlv, EA_16BYTE, REG_V10, REG_V11, INS_OPTS_8H);
theEmitter->emitIns_R_R(INS_uaddlv, EA_8BYTE, REG_V12, REG_V13, INS_OPTS_2S);
theEmitter->emitIns_R_R(INS_uaddlv, EA_16BYTE, REG_V14, REG_V15, INS_OPTS_4S);
// umaxlv vector
theEmitter->emitIns_R_R(INS_umaxlv, EA_8BYTE, REG_V4, REG_V5, INS_OPTS_8B);
theEmitter->emitIns_R_R(INS_umaxlv, EA_16BYTE, REG_V6, REG_V7, INS_OPTS_16B);
theEmitter->emitIns_R_R(INS_umaxlv, EA_8BYTE, REG_V8, REG_V9, INS_OPTS_4H);
theEmitter->emitIns_R_R(INS_umaxlv, EA_16BYTE, REG_V10, REG_V11, INS_OPTS_8H);
theEmitter->emitIns_R_R(INS_umaxlv, EA_8BYTE, REG_V12, REG_V13, INS_OPTS_2S);
theEmitter->emitIns_R_R(INS_umaxlv, EA_16BYTE, REG_V14, REG_V15, INS_OPTS_4S);
// uminlv vector
theEmitter->emitIns_R_R(INS_uminlv, EA_8BYTE, REG_V4, REG_V5, INS_OPTS_8B);
theEmitter->emitIns_R_R(INS_uminlv, EA_16BYTE, REG_V6, REG_V7, INS_OPTS_16B);
theEmitter->emitIns_R_R(INS_uminlv, EA_8BYTE, REG_V8, REG_V9, INS_OPTS_4H);
theEmitter->emitIns_R_R(INS_uminlv, EA_16BYTE, REG_V10, REG_V11, INS_OPTS_8H);
theEmitter->emitIns_R_R(INS_uminlv, EA_8BYTE, REG_V12, REG_V13, INS_OPTS_2S);
theEmitter->emitIns_R_R(INS_uminlv, EA_16BYTE, REG_V14, REG_V15, INS_OPTS_4S);
// faddp scalar
theEmitter->emitIns_R_R(INS_faddp, EA_4BYTE, REG_V0, REG_V1);
theEmitter->emitIns_R_R(INS_faddp, EA_8BYTE, REG_V2, REG_V3);
// INS_fcvtl
theEmitter->emitIns_R_R(INS_fcvtl, EA_4BYTE, REG_V0, REG_V1);
// INS_fcvtl2
theEmitter->emitIns_R_R(INS_fcvtl2, EA_4BYTE, REG_V0, REG_V1);
// INS_fcvtn
theEmitter->emitIns_R_R(INS_fcvtn, EA_8BYTE, REG_V0, REG_V1);
// INS_fcvtn2
theEmitter->emitIns_R_R(INS_fcvtn2, EA_8BYTE, REG_V0, REG_V1);
#endif
#ifdef ALL_ARM64_EMITTER_UNIT_TESTS
//
// R_R floating point round to int, one dest, one source
//
// frinta scalar
theEmitter->emitIns_R_R(INS_frinta, EA_4BYTE, REG_V0, REG_V1);
theEmitter->emitIns_R_R(INS_frinta, EA_8BYTE, REG_V2, REG_V3);
// frinta vector
theEmitter->emitIns_R_R(INS_frinta, EA_8BYTE, REG_V4, REG_V5, INS_OPTS_2S);
theEmitter->emitIns_R_R(INS_frinta, EA_16BYTE, REG_V6, REG_V7, INS_OPTS_4S);
theEmitter->emitIns_R_R(INS_frinta, EA_16BYTE, REG_V8, REG_V9, INS_OPTS_2D);
// frinti scalar
theEmitter->emitIns_R_R(INS_frinti, EA_4BYTE, REG_V0, REG_V1);
theEmitter->emitIns_R_R(INS_frinti, EA_8BYTE, REG_V2, REG_V3);
// frinti vector
theEmitter->emitIns_R_R(INS_frinti, EA_8BYTE, REG_V4, REG_V5, INS_OPTS_2S);
theEmitter->emitIns_R_R(INS_frinti, EA_16BYTE, REG_V6, REG_V7, INS_OPTS_4S);
theEmitter->emitIns_R_R(INS_frinti, EA_16BYTE, REG_V8, REG_V9, INS_OPTS_2D);
// frintm scalar
theEmitter->emitIns_R_R(INS_frintm, EA_4BYTE, REG_V0, REG_V1);
theEmitter->emitIns_R_R(INS_frintm, EA_8BYTE, REG_V2, REG_V3);
// frintm vector
theEmitter->emitIns_R_R(INS_frintm, EA_8BYTE, REG_V4, REG_V5, INS_OPTS_2S);
theEmitter->emitIns_R_R(INS_frintm, EA_16BYTE, REG_V6, REG_V7, INS_OPTS_4S);
theEmitter->emitIns_R_R(INS_frintm, EA_16BYTE, REG_V8, REG_V9, INS_OPTS_2D);
// frintn scalar
theEmitter->emitIns_R_R(INS_frintn, EA_4BYTE, REG_V0, REG_V1);
theEmitter->emitIns_R_R(INS_frintn, EA_8BYTE, REG_V2, REG_V3);
// frintn vector
theEmitter->emitIns_R_R(INS_frintn, EA_8BYTE, REG_V4, REG_V5, INS_OPTS_2S);
theEmitter->emitIns_R_R(INS_frintn, EA_16BYTE, REG_V6, REG_V7, INS_OPTS_4S);
theEmitter->emitIns_R_R(INS_frintn, EA_16BYTE, REG_V8, REG_V9, INS_OPTS_2D);
// frintp scalar
theEmitter->emitIns_R_R(INS_frintp, EA_4BYTE, REG_V0, REG_V1);
theEmitter->emitIns_R_R(INS_frintp, EA_8BYTE, REG_V2, REG_V3);
// frintp vector
theEmitter->emitIns_R_R(INS_frintp, EA_8BYTE, REG_V4, REG_V5, INS_OPTS_2S);
theEmitter->emitIns_R_R(INS_frintp, EA_16BYTE, REG_V6, REG_V7, INS_OPTS_4S);
theEmitter->emitIns_R_R(INS_frintp, EA_16BYTE, REG_V8, REG_V9, INS_OPTS_2D);
// frintx scalar
theEmitter->emitIns_R_R(INS_frintx, EA_4BYTE, REG_V0, REG_V1);
theEmitter->emitIns_R_R(INS_frintx, EA_8BYTE, REG_V2, REG_V3);
// frintx vector
theEmitter->emitIns_R_R(INS_frintx, EA_8BYTE, REG_V4, REG_V5, INS_OPTS_2S);
theEmitter->emitIns_R_R(INS_frintx, EA_16BYTE, REG_V6, REG_V7, INS_OPTS_4S);
theEmitter->emitIns_R_R(INS_frintx, EA_16BYTE, REG_V8, REG_V9, INS_OPTS_2D);
// frintz scalar
theEmitter->emitIns_R_R(INS_frintz, EA_4BYTE, REG_V0, REG_V1);
theEmitter->emitIns_R_R(INS_frintz, EA_8BYTE, REG_V2, REG_V3);
// frintz vector
theEmitter->emitIns_R_R(INS_frintz, EA_8BYTE, REG_V4, REG_V5, INS_OPTS_2S);
theEmitter->emitIns_R_R(INS_frintz, EA_16BYTE, REG_V6, REG_V7, INS_OPTS_4S);
theEmitter->emitIns_R_R(INS_frintz, EA_16BYTE, REG_V8, REG_V9, INS_OPTS_2D);
#endif // ALL_ARM64_EMITTER_UNIT_TESTS
#ifdef ALL_ARM64_EMITTER_UNIT_TESTS
//
// R_R_R floating point operations, one dest, two source
//
genDefineTempLabel(genCreateTempLabel());
theEmitter->emitIns_R_R_R(INS_fadd, EA_4BYTE, REG_V0, REG_V1, REG_V2); // scalar 4BYTE
theEmitter->emitIns_R_R_R(INS_fadd, EA_8BYTE, REG_V3, REG_V4, REG_V5); // scalar 8BYTE
theEmitter->emitIns_R_R_R(INS_fadd, EA_8BYTE, REG_V6, REG_V7, REG_V8, INS_OPTS_2S);
theEmitter->emitIns_R_R_R(INS_fadd, EA_16BYTE, REG_V9, REG_V10, REG_V11, INS_OPTS_4S);
theEmitter->emitIns_R_R_R(INS_fadd, EA_16BYTE, REG_V12, REG_V13, REG_V14, INS_OPTS_2D);
theEmitter->emitIns_R_R_R(INS_fsub, EA_4BYTE, REG_V0, REG_V1, REG_V2); // scalar 4BYTE
theEmitter->emitIns_R_R_R(INS_fsub, EA_8BYTE, REG_V3, REG_V4, REG_V5); // scalar 8BYTE
theEmitter->emitIns_R_R_R(INS_fsub, EA_8BYTE, REG_V6, REG_V7, REG_V8, INS_OPTS_2S);
theEmitter->emitIns_R_R_R(INS_fsub, EA_16BYTE, REG_V9, REG_V10, REG_V11, INS_OPTS_4S);
theEmitter->emitIns_R_R_R(INS_fsub, EA_16BYTE, REG_V12, REG_V13, REG_V14, INS_OPTS_2D);
theEmitter->emitIns_R_R_R(INS_fdiv, EA_4BYTE, REG_V0, REG_V1, REG_V2); // scalar 4BYTE
theEmitter->emitIns_R_R_R(INS_fdiv, EA_8BYTE, REG_V3, REG_V4, REG_V5); // scalar 8BYTE
theEmitter->emitIns_R_R_R(INS_fdiv, EA_8BYTE, REG_V6, REG_V7, REG_V8, INS_OPTS_2S);
theEmitter->emitIns_R_R_R(INS_fdiv, EA_16BYTE, REG_V9, REG_V10, REG_V11, INS_OPTS_4S);
theEmitter->emitIns_R_R_R(INS_fdiv, EA_16BYTE, REG_V12, REG_V13, REG_V14, INS_OPTS_2D);
theEmitter->emitIns_R_R_R(INS_fmax, EA_4BYTE, REG_V0, REG_V1, REG_V2); // scalar 4BYTE
theEmitter->emitIns_R_R_R(INS_fmax, EA_8BYTE, REG_V3, REG_V4, REG_V5); // scalar 8BYTE
theEmitter->emitIns_R_R_R(INS_fmax, EA_8BYTE, REG_V6, REG_V7, REG_V8, INS_OPTS_2S);
theEmitter->emitIns_R_R_R(INS_fmax, EA_16BYTE, REG_V9, REG_V10, REG_V11, INS_OPTS_4S);
theEmitter->emitIns_R_R_R(INS_fmax, EA_16BYTE, REG_V12, REG_V13, REG_V14, INS_OPTS_2D);
theEmitter->emitIns_R_R_R(INS_fmin, EA_4BYTE, REG_V0, REG_V1, REG_V2); // scalar 4BYTE
theEmitter->emitIns_R_R_R(INS_fmin, EA_8BYTE, REG_V3, REG_V4, REG_V5); // scalar 8BYTE
theEmitter->emitIns_R_R_R(INS_fmin, EA_8BYTE, REG_V6, REG_V7, REG_V8, INS_OPTS_2S);
theEmitter->emitIns_R_R_R(INS_fmin, EA_16BYTE, REG_V9, REG_V10, REG_V11, INS_OPTS_4S);
theEmitter->emitIns_R_R_R(INS_fmin, EA_16BYTE, REG_V12, REG_V13, REG_V14, INS_OPTS_2D);
// fabd
theEmitter->emitIns_R_R_R(INS_fabd, EA_4BYTE, REG_V0, REG_V1, REG_V2); // scalar 4BYTE
theEmitter->emitIns_R_R_R(INS_fabd, EA_8BYTE, REG_V3, REG_V4, REG_V5); // scalar 8BYTE
theEmitter->emitIns_R_R_R(INS_fabd, EA_8BYTE, REG_V6, REG_V7, REG_V8, INS_OPTS_2S);
theEmitter->emitIns_R_R_R(INS_fabd, EA_16BYTE, REG_V9, REG_V10, REG_V11, INS_OPTS_4S);
theEmitter->emitIns_R_R_R(INS_fabd, EA_16BYTE, REG_V12, REG_V13, REG_V14, INS_OPTS_2D);
genDefineTempLabel(genCreateTempLabel());
theEmitter->emitIns_R_R_R(INS_fmul, EA_4BYTE, REG_V0, REG_V1, REG_V2); // scalar 4BYTE
theEmitter->emitIns_R_R_R(INS_fmul, EA_8BYTE, REG_V3, REG_V4, REG_V5); // scalar 8BYTE
theEmitter->emitIns_R_R_R(INS_fmul, EA_8BYTE, REG_V6, REG_V7, REG_V8, INS_OPTS_2S);
theEmitter->emitIns_R_R_R(INS_fmul, EA_16BYTE, REG_V9, REG_V10, REG_V11, INS_OPTS_4S);
theEmitter->emitIns_R_R_R(INS_fmul, EA_16BYTE, REG_V12, REG_V13, REG_V14, INS_OPTS_2D);
theEmitter->emitIns_R_R_R_I(INS_fmul, EA_4BYTE, REG_V15, REG_V16, REG_V17, 3); // scalar by elem 4BYTE
theEmitter->emitIns_R_R_R_I(INS_fmul, EA_8BYTE, REG_V18, REG_V19, REG_V20, 1); // scalar by elem 8BYTE
theEmitter->emitIns_R_R_R_I(INS_fmul, EA_8BYTE, REG_V21, REG_V22, REG_V23, 0, INS_OPTS_2S);
theEmitter->emitIns_R_R_R_I(INS_fmul, EA_16BYTE, REG_V24, REG_V25, REG_V26, 2, INS_OPTS_4S);
theEmitter->emitIns_R_R_R_I(INS_fmul, EA_16BYTE, REG_V27, REG_V28, REG_V29, 0, INS_OPTS_2D);
theEmitter->emitIns_R_R_R(INS_fmulx, EA_4BYTE, REG_V0, REG_V1, REG_V2); // scalar 4BYTE
theEmitter->emitIns_R_R_R(INS_fmulx, EA_8BYTE, REG_V3, REG_V4, REG_V5); // scalar 8BYTE
theEmitter->emitIns_R_R_R(INS_fmulx, EA_8BYTE, REG_V6, REG_V7, REG_V8, INS_OPTS_2S);
theEmitter->emitIns_R_R_R(INS_fmulx, EA_16BYTE, REG_V9, REG_V10, REG_V11, INS_OPTS_4S);
theEmitter->emitIns_R_R_R(INS_fmulx, EA_16BYTE, REG_V12, REG_V13, REG_V14, INS_OPTS_2D);
theEmitter->emitIns_R_R_R_I(INS_fmulx, EA_4BYTE, REG_V15, REG_V16, REG_V17, 3); // scalar by elem 4BYTE
theEmitter->emitIns_R_R_R_I(INS_fmulx, EA_8BYTE, REG_V18, REG_V19, REG_V20, 1); // scalar by elem 8BYTE
theEmitter->emitIns_R_R_R_I(INS_fmulx, EA_8BYTE, REG_V21, REG_V22, REG_V23, 0, INS_OPTS_2S);
theEmitter->emitIns_R_R_R_I(INS_fmulx, EA_16BYTE, REG_V24, REG_V25, REG_V26, 2, INS_OPTS_4S);
theEmitter->emitIns_R_R_R_I(INS_fmulx, EA_16BYTE, REG_V27, REG_V28, REG_V29, 0, INS_OPTS_2D);
theEmitter->emitIns_R_R_R(INS_fnmul, EA_4BYTE, REG_V0, REG_V1, REG_V2); // scalar 4BYTE
theEmitter->emitIns_R_R_R(INS_fnmul, EA_8BYTE, REG_V3, REG_V4, REG_V5); // scalar 8BYTE
#endif // ALL_ARM64_EMITTER_UNIT_TESTS
#ifdef ALL_ARM64_EMITTER_UNIT_TESTS
//
// R_R_I vector operations, one dest, one source reg, one immed
//
genDefineTempLabel(genCreateTempLabel());
// 'sshr' scalar
theEmitter->emitIns_R_R_I(INS_sshr, EA_8BYTE, REG_V0, REG_V1, 1);
theEmitter->emitIns_R_R_I(INS_sshr, EA_8BYTE, REG_V2, REG_V3, 14);
theEmitter->emitIns_R_R_I(INS_sshr, EA_8BYTE, REG_V4, REG_V5, 27);
theEmitter->emitIns_R_R_I(INS_sshr, EA_8BYTE, REG_V6, REG_V7, 40);
theEmitter->emitIns_R_R_I(INS_sshr, EA_8BYTE, REG_V8, REG_V9, 63);
// 'sshr' vector
theEmitter->emitIns_R_R_I(INS_sshr, EA_8BYTE, REG_V0, REG_V1, 1, INS_OPTS_8B);
theEmitter->emitIns_R_R_I(INS_sshr, EA_16BYTE, REG_V2, REG_V3, 7, INS_OPTS_16B);
theEmitter->emitIns_R_R_I(INS_sshr, EA_8BYTE, REG_V4, REG_V5, 9, INS_OPTS_4H);
theEmitter->emitIns_R_R_I(INS_sshr, EA_16BYTE, REG_V6, REG_V7, 15, INS_OPTS_8H);
theEmitter->emitIns_R_R_I(INS_sshr, EA_8BYTE, REG_V8, REG_V9, 17, INS_OPTS_2S);
theEmitter->emitIns_R_R_I(INS_sshr, EA_16BYTE, REG_V10, REG_V11, 31, INS_OPTS_4S);
theEmitter->emitIns_R_R_I(INS_sshr, EA_16BYTE, REG_V12, REG_V13, 33, INS_OPTS_2D);
theEmitter->emitIns_R_R_I(INS_sshr, EA_16BYTE, REG_V14, REG_V15, 63, INS_OPTS_2D);
// 'ssra' scalar
theEmitter->emitIns_R_R_I(INS_ssra, EA_8BYTE, REG_V0, REG_V1, 1);
theEmitter->emitIns_R_R_I(INS_ssra, EA_8BYTE, REG_V2, REG_V3, 14);
theEmitter->emitIns_R_R_I(INS_ssra, EA_8BYTE, REG_V4, REG_V5, 27);
theEmitter->emitIns_R_R_I(INS_ssra, EA_8BYTE, REG_V6, REG_V7, 40);
theEmitter->emitIns_R_R_I(INS_ssra, EA_8BYTE, REG_V8, REG_V9, 63);
// 'ssra' vector
theEmitter->emitIns_R_R_I(INS_ssra, EA_8BYTE, REG_V0, REG_V1, 1, INS_OPTS_8B);
theEmitter->emitIns_R_R_I(INS_ssra, EA_16BYTE, REG_V2, REG_V3, 7, INS_OPTS_16B);
theEmitter->emitIns_R_R_I(INS_ssra, EA_8BYTE, REG_V4, REG_V5, 9, INS_OPTS_4H);
theEmitter->emitIns_R_R_I(INS_ssra, EA_16BYTE, REG_V6, REG_V7, 15, INS_OPTS_8H);
theEmitter->emitIns_R_R_I(INS_ssra, EA_8BYTE, REG_V8, REG_V9, 17, INS_OPTS_2S);
theEmitter->emitIns_R_R_I(INS_ssra, EA_16BYTE, REG_V10, REG_V11, 31, INS_OPTS_4S);
theEmitter->emitIns_R_R_I(INS_ssra, EA_16BYTE, REG_V12, REG_V13, 33, INS_OPTS_2D);
theEmitter->emitIns_R_R_I(INS_ssra, EA_16BYTE, REG_V14, REG_V15, 63, INS_OPTS_2D);
// 'srshr' scalar
theEmitter->emitIns_R_R_I(INS_srshr, EA_8BYTE, REG_V0, REG_V1, 1);
theEmitter->emitIns_R_R_I(INS_srshr, EA_8BYTE, REG_V2, REG_V3, 14);
theEmitter->emitIns_R_R_I(INS_srshr, EA_8BYTE, REG_V4, REG_V5, 27);
theEmitter->emitIns_R_R_I(INS_srshr, EA_8BYTE, REG_V6, REG_V7, 40);
theEmitter->emitIns_R_R_I(INS_srshr, EA_8BYTE, REG_V8, REG_V9, 63);
// 'srshr' vector
theEmitter->emitIns_R_R_I(INS_srshr, EA_8BYTE, REG_V0, REG_V1, 1, INS_OPTS_8B);
theEmitter->emitIns_R_R_I(INS_srshr, EA_16BYTE, REG_V2, REG_V3, 7, INS_OPTS_16B);
theEmitter->emitIns_R_R_I(INS_srshr, EA_8BYTE, REG_V4, REG_V5, 9, INS_OPTS_4H);
theEmitter->emitIns_R_R_I(INS_srshr, EA_16BYTE, REG_V6, REG_V7, 15, INS_OPTS_8H);
theEmitter->emitIns_R_R_I(INS_srshr, EA_8BYTE, REG_V8, REG_V9, 17, INS_OPTS_2S);
theEmitter->emitIns_R_R_I(INS_srshr, EA_16BYTE, REG_V10, REG_V11, 31, INS_OPTS_4S);
theEmitter->emitIns_R_R_I(INS_srshr, EA_16BYTE, REG_V12, REG_V13, 33, INS_OPTS_2D);
theEmitter->emitIns_R_R_I(INS_srshr, EA_16BYTE, REG_V14, REG_V15, 63, INS_OPTS_2D);
// 'srsra' scalar
theEmitter->emitIns_R_R_I(INS_srsra, EA_8BYTE, REG_V0, REG_V1, 1);
theEmitter->emitIns_R_R_I(INS_srsra, EA_8BYTE, REG_V2, REG_V3, 14);
theEmitter->emitIns_R_R_I(INS_srsra, EA_8BYTE, REG_V4, REG_V5, 27);
theEmitter->emitIns_R_R_I(INS_srsra, EA_8BYTE, REG_V6, REG_V7, 40);
theEmitter->emitIns_R_R_I(INS_srsra, EA_8BYTE, REG_V8, REG_V9, 63);
// 'srsra' vector
theEmitter->emitIns_R_R_I(INS_srsra, EA_8BYTE, REG_V0, REG_V1, 1, INS_OPTS_8B);
theEmitter->emitIns_R_R_I(INS_srsra, EA_16BYTE, REG_V2, REG_V3, 7, INS_OPTS_16B);
theEmitter->emitIns_R_R_I(INS_srsra, EA_8BYTE, REG_V4, REG_V5, 9, INS_OPTS_4H);
theEmitter->emitIns_R_R_I(INS_srsra, EA_16BYTE, REG_V6, REG_V7, 15, INS_OPTS_8H);
theEmitter->emitIns_R_R_I(INS_srsra, EA_8BYTE, REG_V8, REG_V9, 17, INS_OPTS_2S);
theEmitter->emitIns_R_R_I(INS_srsra, EA_16BYTE, REG_V10, REG_V11, 31, INS_OPTS_4S);
theEmitter->emitIns_R_R_I(INS_srsra, EA_16BYTE, REG_V12, REG_V13, 33, INS_OPTS_2D);
theEmitter->emitIns_R_R_I(INS_srsra, EA_16BYTE, REG_V14, REG_V15, 63, INS_OPTS_2D);
// 'shl' scalar
theEmitter->emitIns_R_R_I(INS_shl, EA_8BYTE, REG_V0, REG_V1, 1);
theEmitter->emitIns_R_R_I(INS_shl, EA_8BYTE, REG_V2, REG_V3, 14);
theEmitter->emitIns_R_R_I(INS_shl, EA_8BYTE, REG_V4, REG_V5, 27);
theEmitter->emitIns_R_R_I(INS_shl, EA_8BYTE, REG_V6, REG_V7, 40);
theEmitter->emitIns_R_R_I(INS_shl, EA_8BYTE, REG_V8, REG_V9, 63);
// 'shl' vector
theEmitter->emitIns_R_R_I(INS_shl, EA_8BYTE, REG_V0, REG_V1, 1, INS_OPTS_8B);
theEmitter->emitIns_R_R_I(INS_shl, EA_16BYTE, REG_V2, REG_V3, 7, INS_OPTS_16B);
theEmitter->emitIns_R_R_I(INS_shl, EA_8BYTE, REG_V4, REG_V5, 9, INS_OPTS_4H);
theEmitter->emitIns_R_R_I(INS_shl, EA_16BYTE, REG_V6, REG_V7, 15, INS_OPTS_8H);
theEmitter->emitIns_R_R_I(INS_shl, EA_8BYTE, REG_V8, REG_V9, 17, INS_OPTS_2S);
theEmitter->emitIns_R_R_I(INS_shl, EA_16BYTE, REG_V10, REG_V11, 31, INS_OPTS_4S);
theEmitter->emitIns_R_R_I(INS_shl, EA_16BYTE, REG_V12, REG_V13, 33, INS_OPTS_2D);
theEmitter->emitIns_R_R_I(INS_shl, EA_16BYTE, REG_V14, REG_V15, 63, INS_OPTS_2D);
// 'ushr' scalar
theEmitter->emitIns_R_R_I(INS_ushr, EA_8BYTE, REG_V0, REG_V1, 1);
theEmitter->emitIns_R_R_I(INS_ushr, EA_8BYTE, REG_V2, REG_V3, 14);
theEmitter->emitIns_R_R_I(INS_ushr, EA_8BYTE, REG_V4, REG_V5, 27);
theEmitter->emitIns_R_R_I(INS_ushr, EA_8BYTE, REG_V6, REG_V7, 40);
theEmitter->emitIns_R_R_I(INS_ushr, EA_8BYTE, REG_V8, REG_V9, 63);
// 'ushr' vector
theEmitter->emitIns_R_R_I(INS_ushr, EA_8BYTE, REG_V0, REG_V1, 1, INS_OPTS_8B);
theEmitter->emitIns_R_R_I(INS_ushr, EA_16BYTE, REG_V2, REG_V3, 7, INS_OPTS_16B);
theEmitter->emitIns_R_R_I(INS_ushr, EA_8BYTE, REG_V4, REG_V5, 9, INS_OPTS_4H);
theEmitter->emitIns_R_R_I(INS_ushr, EA_16BYTE, REG_V6, REG_V7, 15, INS_OPTS_8H);
theEmitter->emitIns_R_R_I(INS_ushr, EA_8BYTE, REG_V8, REG_V9, 17, INS_OPTS_2S);
theEmitter->emitIns_R_R_I(INS_ushr, EA_16BYTE, REG_V10, REG_V11, 31, INS_OPTS_4S);
theEmitter->emitIns_R_R_I(INS_ushr, EA_16BYTE, REG_V12, REG_V13, 33, INS_OPTS_2D);
theEmitter->emitIns_R_R_I(INS_ushr, EA_16BYTE, REG_V14, REG_V15, 63, INS_OPTS_2D);
// 'usra' scalar
theEmitter->emitIns_R_R_I(INS_usra, EA_8BYTE, REG_V0, REG_V1, 1);
theEmitter->emitIns_R_R_I(INS_usra, EA_8BYTE, REG_V2, REG_V3, 14);
theEmitter->emitIns_R_R_I(INS_usra, EA_8BYTE, REG_V4, REG_V5, 27);
theEmitter->emitIns_R_R_I(INS_usra, EA_8BYTE, REG_V6, REG_V7, 40);
theEmitter->emitIns_R_R_I(INS_usra, EA_8BYTE, REG_V8, REG_V9, 63);
// 'usra' vector
theEmitter->emitIns_R_R_I(INS_usra, EA_8BYTE, REG_V0, REG_V1, 1, INS_OPTS_8B);
theEmitter->emitIns_R_R_I(INS_usra, EA_16BYTE, REG_V2, REG_V3, 7, INS_OPTS_16B);
theEmitter->emitIns_R_R_I(INS_usra, EA_8BYTE, REG_V4, REG_V5, 9, INS_OPTS_4H);
theEmitter->emitIns_R_R_I(INS_usra, EA_16BYTE, REG_V6, REG_V7, 15, INS_OPTS_8H);
theEmitter->emitIns_R_R_I(INS_usra, EA_8BYTE, REG_V8, REG_V9, 17, INS_OPTS_2S);
theEmitter->emitIns_R_R_I(INS_usra, EA_16BYTE, REG_V10, REG_V11, 31, INS_OPTS_4S);
theEmitter->emitIns_R_R_I(INS_usra, EA_16BYTE, REG_V12, REG_V13, 33, INS_OPTS_2D);
theEmitter->emitIns_R_R_I(INS_usra, EA_16BYTE, REG_V14, REG_V15, 63, INS_OPTS_2D);
// 'urshr' scalar
theEmitter->emitIns_R_R_I(INS_urshr, EA_8BYTE, REG_V0, REG_V1, 1);
theEmitter->emitIns_R_R_I(INS_urshr, EA_8BYTE, REG_V2, REG_V3, 14);
theEmitter->emitIns_R_R_I(INS_urshr, EA_8BYTE, REG_V4, REG_V5, 27);
theEmitter->emitIns_R_R_I(INS_urshr, EA_8BYTE, REG_V6, REG_V7, 40);
theEmitter->emitIns_R_R_I(INS_urshr, EA_8BYTE, REG_V8, REG_V9, 63);
// 'urshr' vector
theEmitter->emitIns_R_R_I(INS_urshr, EA_8BYTE, REG_V0, REG_V1, 1, INS_OPTS_8B);
theEmitter->emitIns_R_R_I(INS_urshr, EA_16BYTE, REG_V2, REG_V3, 7, INS_OPTS_16B);
theEmitter->emitIns_R_R_I(INS_urshr, EA_8BYTE, REG_V4, REG_V5, 9, INS_OPTS_4H);
theEmitter->emitIns_R_R_I(INS_urshr, EA_16BYTE, REG_V6, REG_V7, 15, INS_OPTS_8H);
theEmitter->emitIns_R_R_I(INS_urshr, EA_8BYTE, REG_V8, REG_V9, 17, INS_OPTS_2S);
theEmitter->emitIns_R_R_I(INS_urshr, EA_16BYTE, REG_V10, REG_V11, 31, INS_OPTS_4S);
theEmitter->emitIns_R_R_I(INS_urshr, EA_16BYTE, REG_V12, REG_V13, 33, INS_OPTS_2D);
theEmitter->emitIns_R_R_I(INS_urshr, EA_16BYTE, REG_V14, REG_V15, 63, INS_OPTS_2D);
// 'ursra' scalar
theEmitter->emitIns_R_R_I(INS_ursra, EA_8BYTE, REG_V0, REG_V1, 1);
theEmitter->emitIns_R_R_I(INS_ursra, EA_8BYTE, REG_V2, REG_V3, 14);
theEmitter->emitIns_R_R_I(INS_ursra, EA_8BYTE, REG_V4, REG_V5, 27);
theEmitter->emitIns_R_R_I(INS_ursra, EA_8BYTE, REG_V6, REG_V7, 40);
theEmitter->emitIns_R_R_I(INS_ursra, EA_8BYTE, REG_V8, REG_V9, 63);
// 'srsra' vector
theEmitter->emitIns_R_R_I(INS_ursra, EA_8BYTE, REG_V0, REG_V1, 1, INS_OPTS_8B);
theEmitter->emitIns_R_R_I(INS_ursra, EA_16BYTE, REG_V2, REG_V3, 7, INS_OPTS_16B);
theEmitter->emitIns_R_R_I(INS_ursra, EA_8BYTE, REG_V4, REG_V5, 9, INS_OPTS_4H);
theEmitter->emitIns_R_R_I(INS_ursra, EA_16BYTE, REG_V6, REG_V7, 15, INS_OPTS_8H);
theEmitter->emitIns_R_R_I(INS_ursra, EA_8BYTE, REG_V8, REG_V9, 17, INS_OPTS_2S);
theEmitter->emitIns_R_R_I(INS_ursra, EA_16BYTE, REG_V10, REG_V11, 31, INS_OPTS_4S);
theEmitter->emitIns_R_R_I(INS_ursra, EA_16BYTE, REG_V12, REG_V13, 33, INS_OPTS_2D);
theEmitter->emitIns_R_R_I(INS_ursra, EA_16BYTE, REG_V14, REG_V15, 63, INS_OPTS_2D);
// 'sri' scalar
theEmitter->emitIns_R_R_I(INS_sri, EA_8BYTE, REG_V0, REG_V1, 1);
theEmitter->emitIns_R_R_I(INS_sri, EA_8BYTE, REG_V2, REG_V3, 14);
theEmitter->emitIns_R_R_I(INS_sri, EA_8BYTE, REG_V4, REG_V5, 27);
theEmitter->emitIns_R_R_I(INS_sri, EA_8BYTE, REG_V6, REG_V7, 40);
theEmitter->emitIns_R_R_I(INS_sri, EA_8BYTE, REG_V8, REG_V9, 63);
// 'sri' vector
theEmitter->emitIns_R_R_I(INS_sri, EA_8BYTE, REG_V0, REG_V1, 1, INS_OPTS_8B);
theEmitter->emitIns_R_R_I(INS_sri, EA_16BYTE, REG_V2, REG_V3, 7, INS_OPTS_16B);
theEmitter->emitIns_R_R_I(INS_sri, EA_8BYTE, REG_V4, REG_V5, 9, INS_OPTS_4H);
theEmitter->emitIns_R_R_I(INS_sri, EA_16BYTE, REG_V6, REG_V7, 15, INS_OPTS_8H);
theEmitter->emitIns_R_R_I(INS_sri, EA_8BYTE, REG_V8, REG_V9, 17, INS_OPTS_2S);
theEmitter->emitIns_R_R_I(INS_sri, EA_16BYTE, REG_V10, REG_V11, 31, INS_OPTS_4S);
theEmitter->emitIns_R_R_I(INS_sri, EA_16BYTE, REG_V12, REG_V13, 33, INS_OPTS_2D);
theEmitter->emitIns_R_R_I(INS_sri, EA_16BYTE, REG_V14, REG_V15, 63, INS_OPTS_2D);
// 'sli' scalar
theEmitter->emitIns_R_R_I(INS_sli, EA_8BYTE, REG_V0, REG_V1, 1);
theEmitter->emitIns_R_R_I(INS_sli, EA_8BYTE, REG_V2, REG_V3, 14);
theEmitter->emitIns_R_R_I(INS_sli, EA_8BYTE, REG_V4, REG_V5, 27);
theEmitter->emitIns_R_R_I(INS_sli, EA_8BYTE, REG_V6, REG_V7, 40);
theEmitter->emitIns_R_R_I(INS_sli, EA_8BYTE, REG_V8, REG_V9, 63);
// 'sli' vector
theEmitter->emitIns_R_R_I(INS_sli, EA_8BYTE, REG_V0, REG_V1, 1, INS_OPTS_8B);
theEmitter->emitIns_R_R_I(INS_sli, EA_16BYTE, REG_V2, REG_V3, 7, INS_OPTS_16B);
theEmitter->emitIns_R_R_I(INS_sli, EA_8BYTE, REG_V4, REG_V5, 9, INS_OPTS_4H);
theEmitter->emitIns_R_R_I(INS_sli, EA_16BYTE, REG_V6, REG_V7, 15, INS_OPTS_8H);
theEmitter->emitIns_R_R_I(INS_sli, EA_8BYTE, REG_V8, REG_V9, 17, INS_OPTS_2S);
theEmitter->emitIns_R_R_I(INS_sli, EA_16BYTE, REG_V10, REG_V11, 31, INS_OPTS_4S);
theEmitter->emitIns_R_R_I(INS_sli, EA_16BYTE, REG_V12, REG_V13, 33, INS_OPTS_2D);
theEmitter->emitIns_R_R_I(INS_sli, EA_16BYTE, REG_V14, REG_V15, 63, INS_OPTS_2D);
// 'sshll' vector
theEmitter->emitIns_R_R_I(INS_sshll, EA_8BYTE, REG_V0, REG_V1, 1, INS_OPTS_8B);
theEmitter->emitIns_R_R_I(INS_sshll2, EA_16BYTE, REG_V2, REG_V3, 7, INS_OPTS_16B);
theEmitter->emitIns_R_R_I(INS_sshll, EA_8BYTE, REG_V4, REG_V5, 9, INS_OPTS_4H);
theEmitter->emitIns_R_R_I(INS_sshll2, EA_16BYTE, REG_V6, REG_V7, 15, INS_OPTS_8H);
theEmitter->emitIns_R_R_I(INS_sshll, EA_8BYTE, REG_V8, REG_V9, 17, INS_OPTS_2S);
theEmitter->emitIns_R_R_I(INS_sshll2, EA_16BYTE, REG_V10, REG_V11, 31, INS_OPTS_4S);
// 'ushll' vector
theEmitter->emitIns_R_R_I(INS_ushll, EA_8BYTE, REG_V0, REG_V1, 1, INS_OPTS_8B);
theEmitter->emitIns_R_R_I(INS_ushll2, EA_16BYTE, REG_V2, REG_V3, 7, INS_OPTS_16B);
theEmitter->emitIns_R_R_I(INS_ushll, EA_8BYTE, REG_V4, REG_V5, 9, INS_OPTS_4H);
theEmitter->emitIns_R_R_I(INS_ushll2, EA_16BYTE, REG_V6, REG_V7, 15, INS_OPTS_8H);
theEmitter->emitIns_R_R_I(INS_ushll, EA_8BYTE, REG_V8, REG_V9, 17, INS_OPTS_2S);
theEmitter->emitIns_R_R_I(INS_ushll2, EA_16BYTE, REG_V10, REG_V11, 31, INS_OPTS_4S);
// 'shrn' vector
theEmitter->emitIns_R_R_I(INS_shrn, EA_8BYTE, REG_V0, REG_V1, 1, INS_OPTS_8B);
theEmitter->emitIns_R_R_I(INS_shrn2, EA_16BYTE, REG_V2, REG_V3, 7, INS_OPTS_16B);
theEmitter->emitIns_R_R_I(INS_shrn, EA_8BYTE, REG_V4, REG_V5, 9, INS_OPTS_4H);
theEmitter->emitIns_R_R_I(INS_shrn2, EA_16BYTE, REG_V6, REG_V7, 15, INS_OPTS_8H);
theEmitter->emitIns_R_R_I(INS_shrn, EA_8BYTE, REG_V8, REG_V9, 17, INS_OPTS_2S);
theEmitter->emitIns_R_R_I(INS_shrn2, EA_16BYTE, REG_V10, REG_V11, 31, INS_OPTS_4S);
// 'rshrn' vector
theEmitter->emitIns_R_R_I(INS_rshrn, EA_8BYTE, REG_V0, REG_V1, 1, INS_OPTS_8B);
theEmitter->emitIns_R_R_I(INS_rshrn2, EA_16BYTE, REG_V2, REG_V3, 7, INS_OPTS_16B);
theEmitter->emitIns_R_R_I(INS_rshrn, EA_8BYTE, REG_V4, REG_V5, 9, INS_OPTS_4H);
theEmitter->emitIns_R_R_I(INS_rshrn2, EA_16BYTE, REG_V6, REG_V7, 15, INS_OPTS_8H);
theEmitter->emitIns_R_R_I(INS_rshrn, EA_8BYTE, REG_V8, REG_V9, 17, INS_OPTS_2S);
theEmitter->emitIns_R_R_I(INS_rshrn2, EA_16BYTE, REG_V10, REG_V11, 31, INS_OPTS_4S);
// 'sxtl' vector
theEmitter->emitIns_R_R(INS_sxtl, EA_8BYTE, REG_V0, REG_V1, INS_OPTS_8B);
theEmitter->emitIns_R_R(INS_sxtl2, EA_16BYTE, REG_V2, REG_V3, INS_OPTS_16B);
theEmitter->emitIns_R_R(INS_sxtl, EA_8BYTE, REG_V4, REG_V5, INS_OPTS_4H);
theEmitter->emitIns_R_R(INS_sxtl2, EA_16BYTE, REG_V6, REG_V7, INS_OPTS_8H);
theEmitter->emitIns_R_R(INS_sxtl, EA_8BYTE, REG_V8, REG_V9, INS_OPTS_2S);
theEmitter->emitIns_R_R(INS_sxtl2, EA_16BYTE, REG_V10, REG_V11, INS_OPTS_4S);
// 'uxtl' vector
theEmitter->emitIns_R_R(INS_uxtl, EA_8BYTE, REG_V0, REG_V1, INS_OPTS_8B);
theEmitter->emitIns_R_R(INS_uxtl2, EA_16BYTE, REG_V2, REG_V3, INS_OPTS_16B);
theEmitter->emitIns_R_R(INS_uxtl, EA_8BYTE, REG_V4, REG_V5, INS_OPTS_4H);
theEmitter->emitIns_R_R(INS_uxtl2, EA_16BYTE, REG_V6, REG_V7, INS_OPTS_8H);
theEmitter->emitIns_R_R(INS_uxtl, EA_8BYTE, REG_V8, REG_V9, INS_OPTS_2S);
theEmitter->emitIns_R_R(INS_uxtl2, EA_16BYTE, REG_V10, REG_V11, INS_OPTS_4S);
#endif // ALL_ARM64_EMITTER_UNIT_TESTS
#ifdef ALL_ARM64_EMITTER_UNIT_TESTS
//
// R_R_R vector operations, one dest, two source
//
genDefineTempLabel(genCreateTempLabel());
// Specifying an Arrangement is optional
//
theEmitter->emitIns_R_R_R(INS_and, EA_8BYTE, REG_V6, REG_V7, REG_V8);
theEmitter->emitIns_R_R_R(INS_bic, EA_8BYTE, REG_V9, REG_V10, REG_V11);
theEmitter->emitIns_R_R_R(INS_eor, EA_8BYTE, REG_V12, REG_V13, REG_V14);
theEmitter->emitIns_R_R_R(INS_orr, EA_8BYTE, REG_V15, REG_V16, REG_V17);
theEmitter->emitIns_R_R_R(INS_orn, EA_8BYTE, REG_V18, REG_V19, REG_V20);
theEmitter->emitIns_R_R_R(INS_and, EA_16BYTE, REG_V21, REG_V22, REG_V23);
theEmitter->emitIns_R_R_R(INS_bic, EA_16BYTE, REG_V24, REG_V25, REG_V26);
theEmitter->emitIns_R_R_R(INS_eor, EA_16BYTE, REG_V27, REG_V28, REG_V29);
theEmitter->emitIns_R_R_R(INS_orr, EA_16BYTE, REG_V30, REG_V31, REG_V0);
theEmitter->emitIns_R_R_R(INS_orn, EA_16BYTE, REG_V1, REG_V2, REG_V3);
theEmitter->emitIns_R_R_R(INS_bsl, EA_8BYTE, REG_V4, REG_V5, REG_V6);
theEmitter->emitIns_R_R_R(INS_bit, EA_8BYTE, REG_V7, REG_V8, REG_V9);
theEmitter->emitIns_R_R_R(INS_bif, EA_8BYTE, REG_V10, REG_V11, REG_V12);
theEmitter->emitIns_R_R_R(INS_bsl, EA_16BYTE, REG_V13, REG_V14, REG_V15);
theEmitter->emitIns_R_R_R(INS_bit, EA_16BYTE, REG_V16, REG_V17, REG_V18);
theEmitter->emitIns_R_R_R(INS_bif, EA_16BYTE, REG_V19, REG_V20, REG_V21);
// Default Arrangement as per the ARM64 manual
//
theEmitter->emitIns_R_R_R(INS_and, EA_8BYTE, REG_V6, REG_V7, REG_V8, INS_OPTS_8B);
theEmitter->emitIns_R_R_R(INS_bic, EA_8BYTE, REG_V9, REG_V10, REG_V11, INS_OPTS_8B);
theEmitter->emitIns_R_R_R(INS_eor, EA_8BYTE, REG_V12, REG_V13, REG_V14, INS_OPTS_8B);
theEmitter->emitIns_R_R_R(INS_orr, EA_8BYTE, REG_V15, REG_V16, REG_V17, INS_OPTS_8B);
theEmitter->emitIns_R_R_R(INS_orn, EA_8BYTE, REG_V18, REG_V19, REG_V20, INS_OPTS_8B);
theEmitter->emitIns_R_R_R(INS_and, EA_16BYTE, REG_V21, REG_V22, REG_V23, INS_OPTS_16B);
theEmitter->emitIns_R_R_R(INS_bic, EA_16BYTE, REG_V24, REG_V25, REG_V26, INS_OPTS_16B);
theEmitter->emitIns_R_R_R(INS_eor, EA_16BYTE, REG_V27, REG_V28, REG_V29, INS_OPTS_16B);
theEmitter->emitIns_R_R_R(INS_orr, EA_16BYTE, REG_V30, REG_V31, REG_V0, INS_OPTS_16B);
theEmitter->emitIns_R_R_R(INS_orn, EA_16BYTE, REG_V1, REG_V2, REG_V3, INS_OPTS_16B);
theEmitter->emitIns_R_R_R(INS_bsl, EA_8BYTE, REG_V4, REG_V5, REG_V6, INS_OPTS_8B);
theEmitter->emitIns_R_R_R(INS_bit, EA_8BYTE, REG_V7, REG_V8, REG_V9, INS_OPTS_8B);
theEmitter->emitIns_R_R_R(INS_bif, EA_8BYTE, REG_V10, REG_V11, REG_V12, INS_OPTS_8B);
theEmitter->emitIns_R_R_R(INS_bsl, EA_16BYTE, REG_V13, REG_V14, REG_V15, INS_OPTS_16B);
theEmitter->emitIns_R_R_R(INS_bit, EA_16BYTE, REG_V16, REG_V17, REG_V18, INS_OPTS_16B);
theEmitter->emitIns_R_R_R(INS_bif, EA_16BYTE, REG_V19, REG_V20, REG_V21, INS_OPTS_16B);
genDefineTempLabel(genCreateTempLabel());
theEmitter->emitIns_R_R_R(INS_add, EA_8BYTE, REG_V0, REG_V1, REG_V2); // scalar 8BYTE
theEmitter->emitIns_R_R_R(INS_add, EA_8BYTE, REG_V3, REG_V4, REG_V5, INS_OPTS_8B);
theEmitter->emitIns_R_R_R(INS_add, EA_8BYTE, REG_V6, REG_V7, REG_V8, INS_OPTS_4H);
theEmitter->emitIns_R_R_R(INS_add, EA_8BYTE, REG_V9, REG_V10, REG_V11, INS_OPTS_2S);
theEmitter->emitIns_R_R_R(INS_add, EA_16BYTE, REG_V12, REG_V13, REG_V14, INS_OPTS_16B);
theEmitter->emitIns_R_R_R(INS_add, EA_16BYTE, REG_V15, REG_V16, REG_V17, INS_OPTS_8H);
theEmitter->emitIns_R_R_R(INS_add, EA_16BYTE, REG_V18, REG_V19, REG_V20, INS_OPTS_4S);
theEmitter->emitIns_R_R_R(INS_add, EA_16BYTE, REG_V21, REG_V22, REG_V23, INS_OPTS_2D);
theEmitter->emitIns_R_R_R(INS_sub, EA_8BYTE, REG_V1, REG_V2, REG_V3); // scalar 8BYTE
theEmitter->emitIns_R_R_R(INS_sub, EA_8BYTE, REG_V4, REG_V5, REG_V6, INS_OPTS_8B);
theEmitter->emitIns_R_R_R(INS_sub, EA_8BYTE, REG_V7, REG_V8, REG_V9, INS_OPTS_4H);
theEmitter->emitIns_R_R_R(INS_sub, EA_8BYTE, REG_V10, REG_V11, REG_V12, INS_OPTS_2S);
theEmitter->emitIns_R_R_R(INS_sub, EA_16BYTE, REG_V13, REG_V14, REG_V15, INS_OPTS_16B);
theEmitter->emitIns_R_R_R(INS_sub, EA_16BYTE, REG_V16, REG_V17, REG_V18, INS_OPTS_8H);
theEmitter->emitIns_R_R_R(INS_sub, EA_16BYTE, REG_V19, REG_V20, REG_V21, INS_OPTS_4S);
theEmitter->emitIns_R_R_R(INS_sub, EA_16BYTE, REG_V22, REG_V23, REG_V24, INS_OPTS_2D);
genDefineTempLabel(genCreateTempLabel());
// saba vector
theEmitter->emitIns_R_R_R(INS_saba, EA_8BYTE, REG_V0, REG_V1, REG_V2, INS_OPTS_8B);
theEmitter->emitIns_R_R_R(INS_saba, EA_16BYTE, REG_V3, REG_V4, REG_V5, INS_OPTS_16B);
theEmitter->emitIns_R_R_R(INS_saba, EA_8BYTE, REG_V6, REG_V7, REG_V8, INS_OPTS_4H);
theEmitter->emitIns_R_R_R(INS_saba, EA_16BYTE, REG_V9, REG_V10, REG_V11, INS_OPTS_8H);
theEmitter->emitIns_R_R_R(INS_saba, EA_8BYTE, REG_V12, REG_V13, REG_V14, INS_OPTS_2S);
theEmitter->emitIns_R_R_R(INS_saba, EA_16BYTE, REG_V15, REG_V16, REG_V17, INS_OPTS_4S);
// sabd vector
theEmitter->emitIns_R_R_R(INS_sabd, EA_8BYTE, REG_V0, REG_V1, REG_V2, INS_OPTS_8B);
theEmitter->emitIns_R_R_R(INS_sabd, EA_16BYTE, REG_V3, REG_V4, REG_V5, INS_OPTS_16B);
theEmitter->emitIns_R_R_R(INS_sabd, EA_8BYTE, REG_V6, REG_V7, REG_V8, INS_OPTS_4H);
theEmitter->emitIns_R_R_R(INS_sabd, EA_16BYTE, REG_V9, REG_V10, REG_V11, INS_OPTS_8H);
theEmitter->emitIns_R_R_R(INS_sabd, EA_8BYTE, REG_V12, REG_V13, REG_V14, INS_OPTS_2S);
theEmitter->emitIns_R_R_R(INS_sabd, EA_16BYTE, REG_V15, REG_V16, REG_V17, INS_OPTS_4S);
// uaba vector
theEmitter->emitIns_R_R_R(INS_uaba, EA_8BYTE, REG_V0, REG_V1, REG_V2, INS_OPTS_8B);
theEmitter->emitIns_R_R_R(INS_uaba, EA_16BYTE, REG_V3, REG_V4, REG_V5, INS_OPTS_16B);
theEmitter->emitIns_R_R_R(INS_uaba, EA_8BYTE, REG_V6, REG_V7, REG_V8, INS_OPTS_4H);
theEmitter->emitIns_R_R_R(INS_uaba, EA_16BYTE, REG_V9, REG_V10, REG_V11, INS_OPTS_8H);
theEmitter->emitIns_R_R_R(INS_uaba, EA_8BYTE, REG_V12, REG_V13, REG_V14, INS_OPTS_2S);
theEmitter->emitIns_R_R_R(INS_uaba, EA_16BYTE, REG_V15, REG_V16, REG_V17, INS_OPTS_4S);
// uabd vector
theEmitter->emitIns_R_R_R(INS_uabd, EA_8BYTE, REG_V0, REG_V1, REG_V2, INS_OPTS_8B);
theEmitter->emitIns_R_R_R(INS_uabd, EA_16BYTE, REG_V3, REG_V4, REG_V5, INS_OPTS_16B);
theEmitter->emitIns_R_R_R(INS_uabd, EA_8BYTE, REG_V6, REG_V7, REG_V8, INS_OPTS_4H);
theEmitter->emitIns_R_R_R(INS_uabd, EA_16BYTE, REG_V9, REG_V10, REG_V11, INS_OPTS_8H);
theEmitter->emitIns_R_R_R(INS_uabd, EA_8BYTE, REG_V12, REG_V13, REG_V14, INS_OPTS_2S);
theEmitter->emitIns_R_R_R(INS_uabd, EA_16BYTE, REG_V15, REG_V16, REG_V17, INS_OPTS_4S);
#endif // ALL_ARM64_EMITTER_UNIT_TESTS
#ifdef ALL_ARM64_EMITTER_UNIT_TESTS
// smax vector
theEmitter->emitIns_R_R_R(INS_smax, EA_8BYTE, REG_V0, REG_V1, REG_V2, INS_OPTS_8B);
theEmitter->emitIns_R_R_R(INS_smax, EA_16BYTE, REG_V3, REG_V4, REG_V5, INS_OPTS_16B);
theEmitter->emitIns_R_R_R(INS_smax, EA_8BYTE, REG_V6, REG_V7, REG_V8, INS_OPTS_4H);
theEmitter->emitIns_R_R_R(INS_smax, EA_16BYTE, REG_V9, REG_V10, REG_V11, INS_OPTS_8H);
theEmitter->emitIns_R_R_R(INS_smax, EA_8BYTE, REG_V12, REG_V13, REG_V14, INS_OPTS_2S);
theEmitter->emitIns_R_R_R(INS_smax, EA_16BYTE, REG_V15, REG_V16, REG_V17, INS_OPTS_4S);
// smin vector
theEmitter->emitIns_R_R_R(INS_smin, EA_8BYTE, REG_V0, REG_V1, REG_V2, INS_OPTS_8B);
theEmitter->emitIns_R_R_R(INS_smin, EA_16BYTE, REG_V3, REG_V4, REG_V5, INS_OPTS_16B);
theEmitter->emitIns_R_R_R(INS_smin, EA_8BYTE, REG_V6, REG_V7, REG_V8, INS_OPTS_4H);
theEmitter->emitIns_R_R_R(INS_smin, EA_16BYTE, REG_V9, REG_V10, REG_V11, INS_OPTS_8H);
theEmitter->emitIns_R_R_R(INS_smin, EA_8BYTE, REG_V12, REG_V13, REG_V14, INS_OPTS_2S);
theEmitter->emitIns_R_R_R(INS_smin, EA_16BYTE, REG_V15, REG_V16, REG_V17, INS_OPTS_4S);
// umax vector
theEmitter->emitIns_R_R_R(INS_umax, EA_8BYTE, REG_V0, REG_V1, REG_V2, INS_OPTS_8B);
theEmitter->emitIns_R_R_R(INS_umax, EA_16BYTE, REG_V3, REG_V4, REG_V5, INS_OPTS_16B);
theEmitter->emitIns_R_R_R(INS_umax, EA_8BYTE, REG_V6, REG_V7, REG_V8, INS_OPTS_4H);
theEmitter->emitIns_R_R_R(INS_umax, EA_16BYTE, REG_V9, REG_V10, REG_V11, INS_OPTS_8H);
theEmitter->emitIns_R_R_R(INS_umax, EA_8BYTE, REG_V12, REG_V13, REG_V14, INS_OPTS_2S);
theEmitter->emitIns_R_R_R(INS_umax, EA_16BYTE, REG_V15, REG_V16, REG_V17, INS_OPTS_4S);
// umin vector
theEmitter->emitIns_R_R_R(INS_umin, EA_8BYTE, REG_V0, REG_V1, REG_V2, INS_OPTS_8B);
theEmitter->emitIns_R_R_R(INS_umin, EA_16BYTE, REG_V3, REG_V4, REG_V5, INS_OPTS_16B);
theEmitter->emitIns_R_R_R(INS_umin, EA_8BYTE, REG_V6, REG_V7, REG_V8, INS_OPTS_4H);
theEmitter->emitIns_R_R_R(INS_umin, EA_16BYTE, REG_V9, REG_V10, REG_V11, INS_OPTS_8H);
theEmitter->emitIns_R_R_R(INS_umin, EA_8BYTE, REG_V12, REG_V13, REG_V14, INS_OPTS_2S);
theEmitter->emitIns_R_R_R(INS_umin, EA_16BYTE, REG_V15, REG_V16, REG_V17, INS_OPTS_4S);
// cmeq vector
theEmitter->emitIns_R_R_R(INS_cmeq, EA_8BYTE, REG_V0, REG_V1, REG_V2, INS_OPTS_8B);
theEmitter->emitIns_R_R_R(INS_cmeq, EA_16BYTE, REG_V3, REG_V4, REG_V5, INS_OPTS_16B);
theEmitter->emitIns_R_R_R(INS_cmeq, EA_8BYTE, REG_V6, REG_V7, REG_V8, INS_OPTS_4H);
theEmitter->emitIns_R_R_R(INS_cmeq, EA_16BYTE, REG_V9, REG_V10, REG_V11, INS_OPTS_8H);
theEmitter->emitIns_R_R_R(INS_cmeq, EA_8BYTE, REG_V12, REG_V13, REG_V14, INS_OPTS_2S);
theEmitter->emitIns_R_R_R(INS_cmeq, EA_16BYTE, REG_V15, REG_V16, REG_V17, INS_OPTS_4S);
theEmitter->emitIns_R_R_R(INS_cmeq, EA_8BYTE, REG_V12, REG_V13, REG_V14, INS_OPTS_1D);
theEmitter->emitIns_R_R_R(INS_cmeq, EA_16BYTE, REG_V15, REG_V16, REG_V17, INS_OPTS_2D);
// cmge vector
theEmitter->emitIns_R_R_R(INS_cmge, EA_8BYTE, REG_V0, REG_V1, REG_V2, INS_OPTS_8B);
theEmitter->emitIns_R_R_R(INS_cmge, EA_16BYTE, REG_V3, REG_V4, REG_V5, INS_OPTS_16B);
theEmitter->emitIns_R_R_R(INS_cmge, EA_8BYTE, REG_V6, REG_V7, REG_V8, INS_OPTS_4H);
theEmitter->emitIns_R_R_R(INS_cmge, EA_16BYTE, REG_V9, REG_V10, REG_V11, INS_OPTS_8H);
theEmitter->emitIns_R_R_R(INS_cmge, EA_8BYTE, REG_V12, REG_V13, REG_V14, INS_OPTS_2S);
theEmitter->emitIns_R_R_R(INS_cmge, EA_16BYTE, REG_V15, REG_V16, REG_V17, INS_OPTS_4S);
theEmitter->emitIns_R_R_R(INS_cmge, EA_8BYTE, REG_V12, REG_V13, REG_V14, INS_OPTS_1D);
theEmitter->emitIns_R_R_R(INS_cmge, EA_16BYTE, REG_V15, REG_V16, REG_V17, INS_OPTS_2D);
// cmgt vector
theEmitter->emitIns_R_R_R(INS_cmgt, EA_8BYTE, REG_V0, REG_V1, REG_V2, INS_OPTS_8B);
theEmitter->emitIns_R_R_R(INS_cmgt, EA_16BYTE, REG_V3, REG_V4, REG_V5, INS_OPTS_16B);
theEmitter->emitIns_R_R_R(INS_cmgt, EA_8BYTE, REG_V6, REG_V7, REG_V8, INS_OPTS_4H);
theEmitter->emitIns_R_R_R(INS_cmgt, EA_16BYTE, REG_V9, REG_V10, REG_V11, INS_OPTS_8H);
theEmitter->emitIns_R_R_R(INS_cmgt, EA_8BYTE, REG_V12, REG_V13, REG_V14, INS_OPTS_2S);
theEmitter->emitIns_R_R_R(INS_cmgt, EA_16BYTE, REG_V15, REG_V16, REG_V17, INS_OPTS_4S);
theEmitter->emitIns_R_R_R(INS_cmgt, EA_8BYTE, REG_V12, REG_V13, REG_V14, INS_OPTS_1D);
theEmitter->emitIns_R_R_R(INS_cmgt, EA_16BYTE, REG_V15, REG_V16, REG_V17, INS_OPTS_2D);
// cmhi vector
theEmitter->emitIns_R_R_R(INS_cmhi, EA_8BYTE, REG_V0, REG_V1, REG_V2, INS_OPTS_8B);
theEmitter->emitIns_R_R_R(INS_cmhi, EA_16BYTE, REG_V3, REG_V4, REG_V5, INS_OPTS_16B);
theEmitter->emitIns_R_R_R(INS_cmhi, EA_8BYTE, REG_V6, REG_V7, REG_V8, INS_OPTS_4H);
theEmitter->emitIns_R_R_R(INS_cmhi, EA_16BYTE, REG_V9, REG_V10, REG_V11, INS_OPTS_8H);
theEmitter->emitIns_R_R_R(INS_cmhi, EA_8BYTE, REG_V12, REG_V13, REG_V14, INS_OPTS_2S);
theEmitter->emitIns_R_R_R(INS_cmhi, EA_16BYTE, REG_V15, REG_V16, REG_V17, INS_OPTS_4S);
theEmitter->emitIns_R_R_R(INS_cmhi, EA_8BYTE, REG_V12, REG_V13, REG_V14, INS_OPTS_1D);
theEmitter->emitIns_R_R_R(INS_cmhi, EA_16BYTE, REG_V15, REG_V16, REG_V17, INS_OPTS_2D);
// cmhs vector
theEmitter->emitIns_R_R_R(INS_cmhs, EA_8BYTE, REG_V0, REG_V1, REG_V2, INS_OPTS_8B);
theEmitter->emitIns_R_R_R(INS_cmhs, EA_16BYTE, REG_V3, REG_V4, REG_V5, INS_OPTS_16B);
theEmitter->emitIns_R_R_R(INS_cmhs, EA_8BYTE, REG_V6, REG_V7, REG_V8, INS_OPTS_4H);
theEmitter->emitIns_R_R_R(INS_cmhs, EA_16BYTE, REG_V9, REG_V10, REG_V11, INS_OPTS_8H);
theEmitter->emitIns_R_R_R(INS_cmhs, EA_8BYTE, REG_V12, REG_V13, REG_V14, INS_OPTS_2S);
theEmitter->emitIns_R_R_R(INS_cmhs, EA_16BYTE, REG_V15, REG_V16, REG_V17, INS_OPTS_4S);
theEmitter->emitIns_R_R_R(INS_cmhs, EA_8BYTE, REG_V12, REG_V13, REG_V14, INS_OPTS_1D);
theEmitter->emitIns_R_R_R(INS_cmhs, EA_16BYTE, REG_V15, REG_V16, REG_V17, INS_OPTS_2D);
// ctst vector
theEmitter->emitIns_R_R_R(INS_ctst, EA_8BYTE, REG_V0, REG_V1, REG_V2, INS_OPTS_8B);
theEmitter->emitIns_R_R_R(INS_ctst, EA_16BYTE, REG_V3, REG_V4, REG_V5, INS_OPTS_16B);
theEmitter->emitIns_R_R_R(INS_ctst, EA_8BYTE, REG_V6, REG_V7, REG_V8, INS_OPTS_4H);
theEmitter->emitIns_R_R_R(INS_ctst, EA_16BYTE, REG_V9, REG_V10, REG_V11, INS_OPTS_8H);
theEmitter->emitIns_R_R_R(INS_ctst, EA_8BYTE, REG_V12, REG_V13, REG_V14, INS_OPTS_2S);
theEmitter->emitIns_R_R_R(INS_ctst, EA_16BYTE, REG_V15, REG_V16, REG_V17, INS_OPTS_4S);
theEmitter->emitIns_R_R_R(INS_ctst, EA_8BYTE, REG_V12, REG_V13, REG_V14, INS_OPTS_1D);
theEmitter->emitIns_R_R_R(INS_ctst, EA_16BYTE, REG_V15, REG_V16, REG_V17, INS_OPTS_2D);
// faddp vector
theEmitter->emitIns_R_R_R(INS_faddp, EA_8BYTE, REG_V12, REG_V13, REG_V14, INS_OPTS_2S);
theEmitter->emitIns_R_R_R(INS_faddp, EA_16BYTE, REG_V15, REG_V16, REG_V17, INS_OPTS_4S);
theEmitter->emitIns_R_R_R(INS_faddp, EA_16BYTE, REG_V15, REG_V16, REG_V17, INS_OPTS_2D);
// fcmeq vector
theEmitter->emitIns_R_R_R(INS_fcmeq, EA_8BYTE, REG_V12, REG_V13, REG_V14, INS_OPTS_2S);
theEmitter->emitIns_R_R_R(INS_fcmeq, EA_16BYTE, REG_V15, REG_V16, REG_V17, INS_OPTS_4S);
theEmitter->emitIns_R_R_R(INS_fcmeq, EA_16BYTE, REG_V15, REG_V16, REG_V17, INS_OPTS_2D);
// fcmge vector
theEmitter->emitIns_R_R_R(INS_fcmge, EA_8BYTE, REG_V12, REG_V13, REG_V14, INS_OPTS_2S);
theEmitter->emitIns_R_R_R(INS_fcmge, EA_16BYTE, REG_V15, REG_V16, REG_V17, INS_OPTS_4S);
theEmitter->emitIns_R_R_R(INS_fcmge, EA_16BYTE, REG_V15, REG_V16, REG_V17, INS_OPTS_2D);
// fcmgt vector
theEmitter->emitIns_R_R_R(INS_fcmgt, EA_8BYTE, REG_V12, REG_V13, REG_V14, INS_OPTS_2S);
theEmitter->emitIns_R_R_R(INS_fcmgt, EA_16BYTE, REG_V15, REG_V16, REG_V17, INS_OPTS_4S);
theEmitter->emitIns_R_R_R(INS_fcmgt, EA_16BYTE, REG_V15, REG_V16, REG_V17, INS_OPTS_2D);
#endif // ALL_ARM64_EMITTER_UNIT_TESTS
#ifdef ALL_ARM64_EMITTER_UNIT_TESTS
//
// R_R_R vector multiply
//
genDefineTempLabel(genCreateTempLabel());
theEmitter->emitIns_R_R_R(INS_mul, EA_8BYTE, REG_V0, REG_V1, REG_V2, INS_OPTS_8B);
theEmitter->emitIns_R_R_R(INS_mul, EA_8BYTE, REG_V3, REG_V4, REG_V5, INS_OPTS_4H);
theEmitter->emitIns_R_R_R(INS_mul, EA_8BYTE, REG_V6, REG_V7, REG_V8, INS_OPTS_2S);
theEmitter->emitIns_R_R_R(INS_mul, EA_16BYTE, REG_V9, REG_V10, REG_V11, INS_OPTS_16B);
theEmitter->emitIns_R_R_R(INS_mul, EA_16BYTE, REG_V12, REG_V13, REG_V14, INS_OPTS_8H);
theEmitter->emitIns_R_R_R(INS_mul, EA_16BYTE, REG_V15, REG_V16, REG_V17, INS_OPTS_4S);
theEmitter->emitIns_R_R_R(INS_pmul, EA_8BYTE, REG_V18, REG_V19, REG_V20, INS_OPTS_8B);
theEmitter->emitIns_R_R_R(INS_pmul, EA_16BYTE, REG_V21, REG_V22, REG_V23, INS_OPTS_16B);
// 'mul' vector by elem
theEmitter->emitIns_R_R_R_I(INS_mul, EA_8BYTE, REG_V0, REG_V1, REG_V16, 0, INS_OPTS_2S);
theEmitter->emitIns_R_R_R_I(INS_mul, EA_8BYTE, REG_V2, REG_V3, REG_V15, 1, INS_OPTS_2S);
theEmitter->emitIns_R_R_R_I(INS_mul, EA_8BYTE, REG_V4, REG_V5, REG_V17, 3, INS_OPTS_2S);
theEmitter->emitIns_R_R_R_I(INS_mul, EA_8BYTE, REG_V6, REG_V7, REG_V0, 0, INS_OPTS_4H);
theEmitter->emitIns_R_R_R_I(INS_mul, EA_8BYTE, REG_V8, REG_V9, REG_V1, 3, INS_OPTS_4H);
theEmitter->emitIns_R_R_R_I(INS_mul, EA_8BYTE, REG_V10, REG_V11, REG_V2, 7, INS_OPTS_4H);
theEmitter->emitIns_R_R_R_I(INS_mul, EA_16BYTE, REG_V12, REG_V13, REG_V14, 0, INS_OPTS_4S);
theEmitter->emitIns_R_R_R_I(INS_mul, EA_16BYTE, REG_V14, REG_V15, REG_V18, 1, INS_OPTS_4S);
theEmitter->emitIns_R_R_R_I(INS_mul, EA_16BYTE, REG_V16, REG_V17, REG_V13, 3, INS_OPTS_4S);
theEmitter->emitIns_R_R_R_I(INS_mul, EA_16BYTE, REG_V18, REG_V19, REG_V3, 0, INS_OPTS_8H);
theEmitter->emitIns_R_R_R_I(INS_mul, EA_16BYTE, REG_V20, REG_V21, REG_V4, 3, INS_OPTS_8H);
theEmitter->emitIns_R_R_R_I(INS_mul, EA_16BYTE, REG_V22, REG_V23, REG_V5, 7, INS_OPTS_8H);
// 'mla' vector by elem
theEmitter->emitIns_R_R_R_I(INS_mla, EA_8BYTE, REG_V0, REG_V1, REG_V16, 0, INS_OPTS_2S);
theEmitter->emitIns_R_R_R_I(INS_mla, EA_8BYTE, REG_V2, REG_V3, REG_V15, 1, INS_OPTS_2S);
theEmitter->emitIns_R_R_R_I(INS_mla, EA_8BYTE, REG_V4, REG_V5, REG_V17, 3, INS_OPTS_2S);
theEmitter->emitIns_R_R_R_I(INS_mla, EA_8BYTE, REG_V6, REG_V7, REG_V0, 0, INS_OPTS_4H);
theEmitter->emitIns_R_R_R_I(INS_mla, EA_8BYTE, REG_V8, REG_V9, REG_V1, 3, INS_OPTS_4H);
theEmitter->emitIns_R_R_R_I(INS_mla, EA_8BYTE, REG_V10, REG_V11, REG_V2, 7, INS_OPTS_4H);
theEmitter->emitIns_R_R_R_I(INS_mla, EA_16BYTE, REG_V12, REG_V13, REG_V14, 0, INS_OPTS_4S);
theEmitter->emitIns_R_R_R_I(INS_mla, EA_16BYTE, REG_V14, REG_V15, REG_V18, 1, INS_OPTS_4S);
theEmitter->emitIns_R_R_R_I(INS_mla, EA_16BYTE, REG_V16, REG_V17, REG_V13, 3, INS_OPTS_4S);
theEmitter->emitIns_R_R_R_I(INS_mla, EA_16BYTE, REG_V18, REG_V19, REG_V3, 0, INS_OPTS_8H);
theEmitter->emitIns_R_R_R_I(INS_mla, EA_16BYTE, REG_V20, REG_V21, REG_V4, 3, INS_OPTS_8H);
theEmitter->emitIns_R_R_R_I(INS_mla, EA_16BYTE, REG_V22, REG_V23, REG_V5, 7, INS_OPTS_8H);
// 'mls' vector by elem
theEmitter->emitIns_R_R_R_I(INS_mls, EA_8BYTE, REG_V0, REG_V1, REG_V16, 0, INS_OPTS_2S);
theEmitter->emitIns_R_R_R_I(INS_mls, EA_8BYTE, REG_V2, REG_V3, REG_V15, 1, INS_OPTS_2S);
theEmitter->emitIns_R_R_R_I(INS_mls, EA_8BYTE, REG_V4, REG_V5, REG_V17, 3, INS_OPTS_2S);
theEmitter->emitIns_R_R_R_I(INS_mls, EA_8BYTE, REG_V6, REG_V7, REG_V0, 0, INS_OPTS_4H);
theEmitter->emitIns_R_R_R_I(INS_mls, EA_8BYTE, REG_V8, REG_V9, REG_V1, 3, INS_OPTS_4H);
theEmitter->emitIns_R_R_R_I(INS_mls, EA_8BYTE, REG_V10, REG_V11, REG_V2, 7, INS_OPTS_4H);
theEmitter->emitIns_R_R_R_I(INS_mls, EA_16BYTE, REG_V12, REG_V13, REG_V14, 0, INS_OPTS_4S);
theEmitter->emitIns_R_R_R_I(INS_mls, EA_16BYTE, REG_V14, REG_V15, REG_V18, 1, INS_OPTS_4S);
theEmitter->emitIns_R_R_R_I(INS_mls, EA_16BYTE, REG_V16, REG_V17, REG_V13, 3, INS_OPTS_4S);
theEmitter->emitIns_R_R_R_I(INS_mls, EA_16BYTE, REG_V18, REG_V19, REG_V3, 0, INS_OPTS_8H);
theEmitter->emitIns_R_R_R_I(INS_mls, EA_16BYTE, REG_V20, REG_V21, REG_V4, 3, INS_OPTS_8H);
theEmitter->emitIns_R_R_R_I(INS_mls, EA_16BYTE, REG_V22, REG_V23, REG_V5, 7, INS_OPTS_8H);
#endif // ALL_ARM64_EMITTER_UNIT_TESTS
#ifdef ALL_ARM64_EMITTER_UNIT_TESTS
//
// R_R_R floating point operations, one source/dest, and two source
//
genDefineTempLabel(genCreateTempLabel());
theEmitter->emitIns_R_R_R(INS_fmla, EA_8BYTE, REG_V6, REG_V7, REG_V8, INS_OPTS_2S);
theEmitter->emitIns_R_R_R(INS_fmla, EA_16BYTE, REG_V9, REG_V10, REG_V11, INS_OPTS_4S);
theEmitter->emitIns_R_R_R(INS_fmla, EA_16BYTE, REG_V12, REG_V13, REG_V14, INS_OPTS_2D);
theEmitter->emitIns_R_R_R_I(INS_fmla, EA_4BYTE, REG_V15, REG_V16, REG_V17, 3); // scalar by elem 4BYTE
theEmitter->emitIns_R_R_R_I(INS_fmla, EA_8BYTE, REG_V18, REG_V19, REG_V20, 1); // scalar by elem 8BYTE
theEmitter->emitIns_R_R_R_I(INS_fmla, EA_8BYTE, REG_V21, REG_V22, REG_V23, 0, INS_OPTS_2S);
theEmitter->emitIns_R_R_R_I(INS_fmla, EA_16BYTE, REG_V24, REG_V25, REG_V26, 2, INS_OPTS_4S);
theEmitter->emitIns_R_R_R_I(INS_fmla, EA_16BYTE, REG_V27, REG_V28, REG_V29, 0, INS_OPTS_2D);
theEmitter->emitIns_R_R_R(INS_fmls, EA_8BYTE, REG_V6, REG_V7, REG_V8, INS_OPTS_2S);
theEmitter->emitIns_R_R_R(INS_fmls, EA_16BYTE, REG_V9, REG_V10, REG_V11, INS_OPTS_4S);
theEmitter->emitIns_R_R_R(INS_fmls, EA_16BYTE, REG_V12, REG_V13, REG_V14, INS_OPTS_2D);
theEmitter->emitIns_R_R_R_I(INS_fmls, EA_4BYTE, REG_V15, REG_V16, REG_V17, 3); // scalar by elem 4BYTE
theEmitter->emitIns_R_R_R_I(INS_fmls, EA_8BYTE, REG_V18, REG_V19, REG_V20, 1); // scalar by elem 8BYTE
theEmitter->emitIns_R_R_R_I(INS_fmls, EA_8BYTE, REG_V21, REG_V22, REG_V23, 0, INS_OPTS_2S);
theEmitter->emitIns_R_R_R_I(INS_fmls, EA_16BYTE, REG_V24, REG_V25, REG_V26, 2, INS_OPTS_4S);
theEmitter->emitIns_R_R_R_I(INS_fmls, EA_16BYTE, REG_V27, REG_V28, REG_V29, 0, INS_OPTS_2D);
#endif // ALL_ARM64_EMITTER_UNIT_TESTS
#ifdef ALL_ARM64_EMITTER_UNIT_TESTS
//
// R_R_R_R floating point operations, one dest, and three source
//
theEmitter->emitIns_R_R_R_R(INS_fmadd, EA_4BYTE, REG_V0, REG_V8, REG_V16, REG_V24);
theEmitter->emitIns_R_R_R_R(INS_fmsub, EA_4BYTE, REG_V1, REG_V9, REG_V17, REG_V25);
theEmitter->emitIns_R_R_R_R(INS_fnmadd, EA_4BYTE, REG_V2, REG_V10, REG_V18, REG_V26);
theEmitter->emitIns_R_R_R_R(INS_fnmsub, EA_4BYTE, REG_V3, REG_V11, REG_V19, REG_V27);
theEmitter->emitIns_R_R_R_R(INS_fmadd, EA_8BYTE, REG_V4, REG_V12, REG_V20, REG_V28);
theEmitter->emitIns_R_R_R_R(INS_fmsub, EA_8BYTE, REG_V5, REG_V13, REG_V21, REG_V29);
theEmitter->emitIns_R_R_R_R(INS_fnmadd, EA_8BYTE, REG_V6, REG_V14, REG_V22, REG_V30);
theEmitter->emitIns_R_R_R_R(INS_fnmsub, EA_8BYTE, REG_V7, REG_V15, REG_V23, REG_V31);
#endif
#ifdef ALL_ARM64_EMITTER_UNIT_TESTS
BasicBlock* label = genCreateTempLabel();
genDefineTempLabel(label);
instGen(INS_nop);
instGen(INS_nop);
instGen(INS_nop);
instGen(INS_nop);
theEmitter->emitIns_R_L(INS_adr, EA_4BYTE_DSP_RELOC, label, REG_R0);
#endif // ALL_ARM64_EMITTER_UNIT_TESTS
printf("*************** End of genArm64EmitterUnitTests()\n");
}
#endif // defined(DEBUG)
#endif // _TARGET_ARM64_
#endif // !LEGACY_BACKEND
| {
"content_hash": "9cb76a3de2484c49ce68dc79edb17e10",
"timestamp": "",
"source": "github",
"line_count": 8413,
"max_line_length": 165,
"avg_line_length": 43.59835968144538,
"alnum_prop": 0.6189212989342763,
"repo_name": "ruben-ayrapetyan/coreclr",
"id": "44a5661b3dfe5ccd0586ec0ab2b4e4ba576eb05e",
"size": "366793",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "src/jit/codegenarm64.cpp",
"mode": "33188",
"license": "mit",
"language": [
{
"name": "Assembly",
"bytes": "896839"
},
{
"name": "Awk",
"bytes": "5861"
},
{
"name": "Batchfile",
"bytes": "146529"
},
{
"name": "C",
"bytes": "3479459"
},
{
"name": "C#",
"bytes": "143668538"
},
{
"name": "C++",
"bytes": "69109483"
},
{
"name": "CMake",
"bytes": "649036"
},
{
"name": "Groovy",
"bytes": "229889"
},
{
"name": "Makefile",
"bytes": "2945"
},
{
"name": "Objective-C",
"bytes": "19939"
},
{
"name": "Perl",
"bytes": "23640"
},
{
"name": "PowerShell",
"bytes": "9498"
},
{
"name": "Python",
"bytes": "292151"
},
{
"name": "Roff",
"bytes": "530790"
},
{
"name": "Scala",
"bytes": "4102"
},
{
"name": "Shell",
"bytes": "214322"
},
{
"name": "Smalltalk",
"bytes": "1128426"
},
{
"name": "SuperCollider",
"bytes": "650"
},
{
"name": "XSLT",
"bytes": "1016"
},
{
"name": "Yacc",
"bytes": "157348"
}
],
"symlink_target": ""
} |
//
// CSSingleSelectionItem.h
// clojushop_client_ios
//
// Created by ischuetz on 27/05/2014.
// Copyright (c) 2014 ivanschuetz. All rights reserved.
//
#import <Foundation/Foundation.h>
/**
Wrapper for items which will be displayed using CSSingleSelectionController
*/
@protocol CSSingleSelectionItem <NSObject>
@required
/**
Returns label to be displayed in tableView
*/
- (NSString *)getLabel;
/**
Returns model object corresponding to label. This is used only to be pased back when the item is selected.
*/
- (id)getWrappedItem;
@end
| {
"content_hash": "a150bc1981908d590406bd0ca67b49a7",
"timestamp": "",
"source": "github",
"line_count": 28,
"max_line_length": 107,
"avg_line_length": 19.821428571428573,
"alnum_prop": 0.7297297297297297,
"repo_name": "i-schuetz/clojushop_client_ios",
"id": "6326214ea1693919ef3b50ed466abcc089f36dbf",
"size": "555",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "clojushop_client_ios/CSSingleSelectionItem.h",
"mode": "33188",
"license": "apache-2.0",
"language": [
{
"name": "C",
"bytes": "11947"
},
{
"name": "Objective-C",
"bytes": "648131"
},
{
"name": "Ruby",
"bytes": "93"
},
{
"name": "Shell",
"bytes": "5009"
}
],
"symlink_target": ""
} |
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<!--NewPage-->
<HTML>
<HEAD>
<!-- Generated by javadoc (build 1.6.0_24) on Sun Apr 08 20:51:59 UTC 2012 -->
<META http-equiv="Content-Type" content="text/html; charset=UTF-8">
<TITLE>
Uses of Package org.encog.plugin (Encog Core 3.1.0 API)
</TITLE>
<META NAME="date" CONTENT="2012-04-08">
<LINK REL ="stylesheet" TYPE="text/css" HREF="../../../stylesheet.css" TITLE="Style">
<SCRIPT type="text/javascript">
function windowTitle()
{
if (location.href.indexOf('is-external=true') == -1) {
parent.document.title="Uses of Package org.encog.plugin (Encog Core 3.1.0 API)";
}
}
</SCRIPT>
<NOSCRIPT>
</NOSCRIPT>
</HEAD>
<BODY BGCOLOR="white" onload="windowTitle();">
<HR>
<!-- ========= START OF TOP NAVBAR ======= -->
<A NAME="navbar_top"><!-- --></A>
<A HREF="#skip-navbar_top" title="Skip navigation links"></A>
<TABLE BORDER="0" WIDTH="100%" CELLPADDING="1" CELLSPACING="0" SUMMARY="">
<TR>
<TD COLSPAN=2 BGCOLOR="#EEEEFF" CLASS="NavBarCell1">
<A NAME="navbar_top_firstrow"><!-- --></A>
<TABLE BORDER="0" CELLPADDING="0" CELLSPACING="3" SUMMARY="">
<TR ALIGN="center" VALIGN="top">
<TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="../../../overview-summary.html"><FONT CLASS="NavBarFont1"><B>Overview</B></FONT></A> </TD>
<TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="package-summary.html"><FONT CLASS="NavBarFont1"><B>Package</B></FONT></A> </TD>
<TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <FONT CLASS="NavBarFont1">Class</FONT> </TD>
<TD BGCOLOR="#FFFFFF" CLASS="NavBarCell1Rev"> <FONT CLASS="NavBarFont1Rev"><B>Use</B></FONT> </TD>
<TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="package-tree.html"><FONT CLASS="NavBarFont1"><B>Tree</B></FONT></A> </TD>
<TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="../../../deprecated-list.html"><FONT CLASS="NavBarFont1"><B>Deprecated</B></FONT></A> </TD>
<TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="../../../index-all.html"><FONT CLASS="NavBarFont1"><B>Index</B></FONT></A> </TD>
<TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="../../../help-doc.html"><FONT CLASS="NavBarFont1"><B>Help</B></FONT></A> </TD>
</TR>
</TABLE>
</TD>
<TD ALIGN="right" VALIGN="top" ROWSPAN=3><EM>
</EM>
</TD>
</TR>
<TR>
<TD BGCOLOR="white" CLASS="NavBarCell2"><FONT SIZE="-2">
PREV
NEXT</FONT></TD>
<TD BGCOLOR="white" CLASS="NavBarCell2"><FONT SIZE="-2">
<A HREF="../../../index.html?org/encog/plugin/package-use.html" target="_top"><B>FRAMES</B></A>
<A HREF="package-use.html" target="_top"><B>NO FRAMES</B></A>
<SCRIPT type="text/javascript">
<!--
if(window==top) {
document.writeln('<A HREF="../../../allclasses-noframe.html"><B>All Classes</B></A>');
}
//-->
</SCRIPT>
<NOSCRIPT>
<A HREF="../../../allclasses-noframe.html"><B>All Classes</B></A>
</NOSCRIPT>
</FONT></TD>
</TR>
</TABLE>
<A NAME="skip-navbar_top"></A>
<!-- ========= END OF TOP NAVBAR ========= -->
<HR>
<CENTER>
<H2>
<B>Uses of Package<br>org.encog.plugin</B></H2>
</CENTER>
<TABLE BORDER="1" WIDTH="100%" CELLPADDING="3" CELLSPACING="0" SUMMARY="">
<TR BGCOLOR="#CCCCFF" CLASS="TableHeadingColor">
<TH ALIGN="left" COLSPAN="2"><FONT SIZE="+2">
Packages that use <A HREF="../../../org/encog/plugin/package-summary.html">org.encog.plugin</A></FONT></TH>
</TR>
<TR BGCOLOR="white" CLASS="TableRowColor">
<TD><A HREF="#org.encog"><B>org.encog</B></A></TD>
<TD> </TD>
</TR>
<TR BGCOLOR="white" CLASS="TableRowColor">
<TD><A HREF="#org.encog.plugin"><B>org.encog.plugin</B></A></TD>
<TD> </TD>
</TR>
<TR BGCOLOR="white" CLASS="TableRowColor">
<TD><A HREF="#org.encog.plugin.system"><B>org.encog.plugin.system</B></A></TD>
<TD> </TD>
</TR>
</TABLE>
<P>
<A NAME="org.encog"><!-- --></A>
<TABLE BORDER="1" WIDTH="100%" CELLPADDING="3" CELLSPACING="0" SUMMARY="">
<TR BGCOLOR="#CCCCFF" CLASS="TableHeadingColor">
<TH ALIGN="left" COLSPAN="2"><FONT SIZE="+2">
Classes in <A HREF="../../../org/encog/plugin/package-summary.html">org.encog.plugin</A> used by <A HREF="../../../org/encog/package-summary.html">org.encog</A></FONT></TH>
</TR>
<TR BGCOLOR="white" CLASS="TableRowColor">
<TD><B><A HREF="../../../org/encog/plugin/class-use/EncogPluginBase.html#org.encog"><B>EncogPluginBase</B></A></B>
<BR>
The base plugin for Encog.</TD>
</TR>
<TR BGCOLOR="white" CLASS="TableRowColor">
<TD><B><A HREF="../../../org/encog/plugin/class-use/EncogPluginLogging1.html#org.encog"><B>EncogPluginLogging1</B></A></B>
<BR>
A plugin that supports logging.</TD>
</TR>
</TABLE>
<P>
<A NAME="org.encog.plugin"><!-- --></A>
<TABLE BORDER="1" WIDTH="100%" CELLPADDING="3" CELLSPACING="0" SUMMARY="">
<TR BGCOLOR="#CCCCFF" CLASS="TableHeadingColor">
<TH ALIGN="left" COLSPAN="2"><FONT SIZE="+2">
Classes in <A HREF="../../../org/encog/plugin/package-summary.html">org.encog.plugin</A> used by <A HREF="../../../org/encog/plugin/package-summary.html">org.encog.plugin</A></FONT></TH>
</TR>
<TR BGCOLOR="white" CLASS="TableRowColor">
<TD><B><A HREF="../../../org/encog/plugin/class-use/EncogPluginBase.html#org.encog.plugin"><B>EncogPluginBase</B></A></B>
<BR>
The base plugin for Encog.</TD>
</TR>
</TABLE>
<P>
<A NAME="org.encog.plugin.system"><!-- --></A>
<TABLE BORDER="1" WIDTH="100%" CELLPADDING="3" CELLSPACING="0" SUMMARY="">
<TR BGCOLOR="#CCCCFF" CLASS="TableHeadingColor">
<TH ALIGN="left" COLSPAN="2"><FONT SIZE="+2">
Classes in <A HREF="../../../org/encog/plugin/package-summary.html">org.encog.plugin</A> used by <A HREF="../../../org/encog/plugin/system/package-summary.html">org.encog.plugin.system</A></FONT></TH>
</TR>
<TR BGCOLOR="white" CLASS="TableRowColor">
<TD><B><A HREF="../../../org/encog/plugin/class-use/EncogPluginBase.html#org.encog.plugin.system"><B>EncogPluginBase</B></A></B>
<BR>
The base plugin for Encog.</TD>
</TR>
<TR BGCOLOR="white" CLASS="TableRowColor">
<TD><B><A HREF="../../../org/encog/plugin/class-use/EncogPluginLogging1.html#org.encog.plugin.system"><B>EncogPluginLogging1</B></A></B>
<BR>
A plugin that supports logging.</TD>
</TR>
<TR BGCOLOR="white" CLASS="TableRowColor">
<TD><B><A HREF="../../../org/encog/plugin/class-use/EncogPluginService1.html#org.encog.plugin.system"><B>EncogPluginService1</B></A></B>
<BR>
A service plugin provides services, such as the creation of activation
functions, machine learning methods and training methods.</TD>
</TR>
</TABLE>
<P>
<HR>
<!-- ======= START OF BOTTOM NAVBAR ====== -->
<A NAME="navbar_bottom"><!-- --></A>
<A HREF="#skip-navbar_bottom" title="Skip navigation links"></A>
<TABLE BORDER="0" WIDTH="100%" CELLPADDING="1" CELLSPACING="0" SUMMARY="">
<TR>
<TD COLSPAN=2 BGCOLOR="#EEEEFF" CLASS="NavBarCell1">
<A NAME="navbar_bottom_firstrow"><!-- --></A>
<TABLE BORDER="0" CELLPADDING="0" CELLSPACING="3" SUMMARY="">
<TR ALIGN="center" VALIGN="top">
<TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="../../../overview-summary.html"><FONT CLASS="NavBarFont1"><B>Overview</B></FONT></A> </TD>
<TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="package-summary.html"><FONT CLASS="NavBarFont1"><B>Package</B></FONT></A> </TD>
<TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <FONT CLASS="NavBarFont1">Class</FONT> </TD>
<TD BGCOLOR="#FFFFFF" CLASS="NavBarCell1Rev"> <FONT CLASS="NavBarFont1Rev"><B>Use</B></FONT> </TD>
<TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="package-tree.html"><FONT CLASS="NavBarFont1"><B>Tree</B></FONT></A> </TD>
<TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="../../../deprecated-list.html"><FONT CLASS="NavBarFont1"><B>Deprecated</B></FONT></A> </TD>
<TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="../../../index-all.html"><FONT CLASS="NavBarFont1"><B>Index</B></FONT></A> </TD>
<TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="../../../help-doc.html"><FONT CLASS="NavBarFont1"><B>Help</B></FONT></A> </TD>
</TR>
</TABLE>
</TD>
<TD ALIGN="right" VALIGN="top" ROWSPAN=3><EM>
</EM>
</TD>
</TR>
<TR>
<TD BGCOLOR="white" CLASS="NavBarCell2"><FONT SIZE="-2">
PREV
NEXT</FONT></TD>
<TD BGCOLOR="white" CLASS="NavBarCell2"><FONT SIZE="-2">
<A HREF="../../../index.html?org/encog/plugin/package-use.html" target="_top"><B>FRAMES</B></A>
<A HREF="package-use.html" target="_top"><B>NO FRAMES</B></A>
<SCRIPT type="text/javascript">
<!--
if(window==top) {
document.writeln('<A HREF="../../../allclasses-noframe.html"><B>All Classes</B></A>');
}
//-->
</SCRIPT>
<NOSCRIPT>
<A HREF="../../../allclasses-noframe.html"><B>All Classes</B></A>
</NOSCRIPT>
</FONT></TD>
</TR>
</TABLE>
<A NAME="skip-navbar_bottom"></A>
<!-- ======== END OF BOTTOM NAVBAR ======= -->
<HR>
Copyright © 2012. All Rights Reserved.
</BODY>
</HTML>
| {
"content_hash": "f588f69ab70f99ec425abf40758fb8c6",
"timestamp": "",
"source": "github",
"line_count": 228,
"max_line_length": 200,
"avg_line_length": 40.776315789473685,
"alnum_prop": 0.638162848230612,
"repo_name": "larhoy/SentimentProjectV2",
"id": "6a9d3e2e891b0f4a398860dea9c901d407a7e5cf",
"size": "9297",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "SentimentAnalysisV2/encog-core-3.1.0/apidocs/org/encog/plugin/package-use.html",
"mode": "33188",
"license": "mit",
"language": [
{
"name": "CSS",
"bytes": "2782"
},
{
"name": "Java",
"bytes": "3482181"
}
],
"symlink_target": ""
} |
Decompress `my_file.gz` to `my_file` and delete the original:
gzip my_file.gz
Opposite of [gzip](../gzip/).
| {
"content_hash": "48c54663f62da315cdfc978b680c8254",
"timestamp": "",
"source": "github",
"line_count": 5,
"max_line_length": 61,
"avg_line_length": 22.2,
"alnum_prop": 0.6846846846846847,
"repo_name": "MattMS/shelp",
"id": "5cfe877d1dbfa92ef310b7c6ad8dc2a327de76a4",
"size": "121",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "command/gunzip/README.md",
"mode": "33188",
"license": "mit",
"language": [
{
"name": "JavaScript",
"bytes": "647"
}
],
"symlink_target": ""
} |
require "soundcloud-rails/version"
module Soundcloud
module Rails
require "soundcloud-rails/engine"
end
end
| {
"content_hash": "aeacc198ae1513ccc65f482476ae7a9e",
"timestamp": "",
"source": "github",
"line_count": 7,
"max_line_length": 37,
"avg_line_length": 16.714285714285715,
"alnum_prop": 0.7692307692307693,
"repo_name": "thatdutchguy/soundcloud-rails",
"id": "4ec7074d83106d7b9495211840b3277a73db2b62",
"size": "117",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "lib/soundcloud-rails.rb",
"mode": "33188",
"license": "mit",
"language": [
{
"name": "Ruby",
"bytes": "1257"
}
],
"symlink_target": ""
} |
module Awspec::Generator
module Doc
module Type
class TransferServer < Base
def initialize
super
@type_name = 'TransferServer'
@type = Awspec::Type::TransferServer.new('s-4dc0a424f0154fa89')
@ret = @type.resource_via_client
@matchers = [
Awspec::Type::TransferServer::STATES.map { |state| "be_#{state.downcase.tr('-', '_')}" }.join(', ')
]
@ignore_matchers = Awspec::Type::TransferServer::STATES.map { |state| "be_#{state.downcase.tr('-', '_')}" }
@describes = []
end
end
end
end
end
| {
"content_hash": "8ea2a0e804377af93323eb5d7e1357c2",
"timestamp": "",
"source": "github",
"line_count": 19,
"max_line_length": 117,
"avg_line_length": 32.421052631578945,
"alnum_prop": 0.5454545454545454,
"repo_name": "k1LoW/awspec",
"id": "b704ceece3950514b55183756783a34d0f49703f",
"size": "647",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "lib/awspec/generator/doc/type/transfer_server.rb",
"mode": "33188",
"license": "mit",
"language": [
{
"name": "Ruby",
"bytes": "701938"
},
{
"name": "Shell",
"bytes": "58"
}
],
"symlink_target": ""
} |
package bitops.test;
import java.awt.image.BufferedImage;
import java.util.HashMap;
import java.util.Map;
import java.util.TreeMap;
import bitops.BitOps;
import bitops.ByteStream;
import bitops.ByteStreamReader;
import convert.FrameData;
import convert.VideoData;
import convert.capture.HeaderCapture;
import convert.capture.VideoCapture;
import convert.compression.GlobalLUT;
import convert.compression.VideoDecoder;
import convert.compression.quadtree.VideoQuadtreeDecoder;
import convert.listener.VideoCaptureFrameListener;
import convert.motion.MotionPrediction;
import convert.util.ConvertorUtil;
import convert.util.ValueComparator;
import util.Util;
/*
* Small test suite testing out the different functions for manipulating
* individual bits from a single Byte
*/
public class BitOpsTest implements VideoCaptureFrameListener {
private static int frameCount = 0;
public static void runSingleByteTest() {
int[] testData = new int[] {0, 4, 7};
System.out.println("Running Single Byte Manipulation Test");
System.out.println("---");
byte data = 0;
System.out.println("Printing Empty Byte: \t\t" + BitOps.toBitString(data));
for (int i = 0; i < testData.length; i++) {
data = BitOps.setBit(data, testData[i], true);
System.out.println("Printing Byte POS " + testData[i] + " as SET: \t" + BitOps.toBitString(data));
}
for (int i = 0; i < testData.length; i++) {
data = BitOps.setBit(data, testData[i], false);
System.out.println("Printing Byte POS " + testData[i] + " as UNSET: \t" + BitOps.toBitString(data));
}
System.out.println("---");
}
public static void runMultiByteTest() {
int[] testData = new int[] {0, 7, 8, 10, 15, 16, 23};
System.out.println("Running Multi Byte Manipulation Test");
System.out.println("---");
byte[] data = new byte[3];
System.out.println("Printing Empty Byte Array: \t" + BitOps.toBitString(data));
for (int i = 0; i < testData.length; i++) {
data = BitOps.setBit(data, testData[i], true);
System.out.println("Printing Byte POS " + testData[i] + " as SET: \t" + BitOps.toBitString(data));
}
for (int i = 0; i < testData.length; i++) {
data = BitOps.setBit(data, testData[i], false);
System.out.println("Printing Byte POS " + testData[i] + " as UNSET: \t" + BitOps.toBitString(data));
}
System.out.println("---");
}
public static void runSingleIntTest() {
int[] testData = new int[] {0, 7, 8, 10, 15, 16, 23, 31};
System.out.println("Running Single Integer Manipulation Test");
System.out.println("---");
int data = 0;
System.out.println("Printing Empty Int: \t\t" + BitOps.toBitString(data));
for (int i = 0; i < testData.length; i++) {
data = BitOps.setBit(data, testData[i], true);
System.out.println("Printing Int POS " + testData[i] + " as SET: \t" + BitOps.toBitString(data));
}
for (int i = 0; i < testData.length; i++) {
data = BitOps.setBit(data, testData[i], false);
System.out.println("Printing Int POS " + testData[i] + " as UNSET: \t" + BitOps.toBitString(data));
}
System.out.println("---");
}
public static void runMultiIntTest() {
int[] testData = new int[] {0, 12, 31, 32, 33, 63, 64, 95};
System.out.println("Running Multiple Integer Manipulation Test");
System.out.println("---");
int[] data = new int[3];
System.out.println("Printing Empty Int: \t\t" + BitOps.toBitString(data));
for (int i = 0; i < testData.length; i++) {
data = BitOps.setBit(data, testData[i], true);
System.out.println("Printing Int POS " + testData[i] + " as SET: \t" + BitOps.toBitString(data));
}
for (int i = 0; i < testData.length; i++) {
data = BitOps.setBit(data, testData[i], false);
System.out.println("Printing Int POS " + testData[i] + " as UNSET: \t" + BitOps.toBitString(data));
}
System.out.println("---");
}
public static void runValueExtractTest() {
int[] testData = new int[] {2, 3, 5, 7, 8, 11, 16, 19, 25};
System.out.println("Running Bit Extraction Test");
System.out.println("---");
byte[] data = new byte[4];
System.out.println("Printing Empty Byte Array: \t" + BitOps.toBitString(data));
System.out.print("Setting Bits: \t\t\t");
for (int i = 0; i < testData.length; i++) {
System.out.print(testData[i] + " ");
data = BitOps.setBit(data, testData[i], true);
}
System.out.println();
System.out.println("Printing Bit Info: \t\t" + BitOps.toBitString(data));
final int dataExtract = BitOps.getValue(data, 2, 8);
final byte testByteData = 107;
System.out.println("Extracted Int Bits: \t\t" + BitOps.toBitString(dataExtract) + " Against " + BitOps.toBitString(testByteData));
System.out.println("Extracted Data Index 2 - 8: \t" + dataExtract + " Against " + testByteData);
System.out.println("---");
}
public static void runByteStreamTest() {
System.out.println("Running Byte Stream Test");
System.out.println("---");
final ByteStream stream = new ByteStream();
System.out.println("Printing Empty ByteStream: " + stream.toString());
System.out.println("Writing To Stream");
stream.append(true);
System.out.println("Adding boolean value (true) 1 bit: \t" + stream.toString());
stream.append(true);
System.out.println("Adding boolean value (true) 1 bit: \t" + stream.toString());
stream.append((byte) 57);
System.out.println("Adding byte value (57) 8 bit: \t\t" + stream.toString());
stream.append((byte) 96);
System.out.println("Adding byte value (96) 8 bit: \t\t" + stream.toString());
stream.append(false);
System.out.println("Adding boolean value (false) 1 bit: \t" + stream.toString());
stream.append((int) 95887);
System.out.println("Adding Integer value (95887) 32 bit: \t" + stream.toString());
System.out.println();
System.out.println("Reading From Stream In Order");
final ByteStreamReader reader = stream.getNewReader();
System.out.println("Reading Boolean 1 bit: " + ((reader.getValue(1) == 1) ? "true" : "false"));
System.out.println("Reading Boolean 1 bit: " + ((reader.getValue(1) == 1) ? "true" : "false"));
System.out.println("Reading Byte 8 bit: " + (byte) reader.getValue(8));
System.out.println("Reading Byte 8 bit: " + (byte) reader.getValue(8));
System.out.println("Reading Boolean 1 bit: " + ((reader.getValue(1) == 1) ? "true" : "false"));
System.out.println("Reading Integer 32 bit: " + reader.getValue(32));
System.out.println("---");
}
public static void runVideoCompressionTest(final String fName) {
System.out.println("Running Video Compression Test");
System.out.println("---");
final VideoData video = new VideoData(fName);
final ByteStream stream = new ByteStream();
final VideoCapture capture = new VideoCapture((short) 1, stream, new BitOpsTest());
video.init(capture);
while (video.loopNextFrame()) {
if (frameCount == 3) {
break;
}
}
System.out.println("Decoding Video Frame");
final ByteStreamReader reader = stream.getNewReader();
final int width = reader.getValue(16);
final int height = reader.getValue(16);
final int compression = reader.getValue(16);
final int fc = reader.getValue(16);
System.out.println("Decoded Video Width: " + width);
System.out.println("Decoded Video Height: " + height);
System.out.println("Decoded Video Compression: " + compression);
System.out.println("Decoded Video Frames: " + frameCount);
final VideoDecoder newDecoder = new VideoQuadtreeDecoder(width, height, compression);
final ByteStreamReader newReader = stream.getNewReader().setReadPosition(64);
FrameData previous = null;
for (int i = 0; i < fc; i++) {
final FrameData decodedFrame = newDecoder.decodeFrame(newReader, previous);
Util.saveImage(decodedFrame.getImage(), "decoded_" + i + "_" + compression + "_" + ConvertorUtil.CMP_EQUITY);
previous = decodedFrame;
}
System.out.println("---");
}
public static void runFullVideoCompressionTest(final String fName, short compression) {
frameCount = 0;
System.out.println("Running Video Compression Test");
System.out.println("---");
//final VideoData video = new VideoData(fName);
final ByteStream stream = new ByteStream();
System.out.println("Running Header Stream");
// capture the header data
/*final HeaderCapture hcapture = new HeaderCapture(compression, stream);
video.init(hcapture);
while (video.loopNextFrame()) { }
video.close();*/
GlobalLUT.getInstance().processLUT(stream);
System.out.println("Running Video Stream");
// capture video data
final VideoCapture vcapture = new VideoCapture(compression, stream);
final VideoData cvideo = new VideoData(fName);
cvideo.init(vcapture);
while (cvideo.loopNextFrame()) { }
vcapture.end();
System.out.println("Waiting On Thread Finish");
while (!vcapture.hasEnded()) {
try {
Thread.sleep(100);
}
catch (InterruptedException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
}
System.out.println("Saving Video Frame");
stream.save("myVideo_ " + compression + "_" + ConvertorUtil.CMP_EQUITY + ".pavf");
System.out.println("---");
}
public static void runSortedValueTest() {
System.out.println("Running HashMap Sorting");
System.out.println("---");
final Map<Integer, Integer> unsorted = new HashMap<Integer, Integer>();
unsorted.put(1, 7);
unsorted.put(2, 13);
unsorted.put(3, 9);
unsorted.put(4, 1);
unsorted.put(5, 2);
System.out.println("Printing Unsorted Map (Values)");
for (Map.Entry<Integer,Integer> entry : unsorted.entrySet()) {
final Integer key = entry.getKey();
final Integer value = entry.getValue();
System.out.println(key + " => " + value);
}
final TreeMap<Integer, Integer> sorted = new TreeMap<Integer, Integer>(new ValueComparator(unsorted));
sorted.putAll(unsorted);
unsorted.clear();
System.out.println("Printing Sorted Map (Values)");
for (Map.Entry<Integer,Integer> entry : sorted.entrySet()) {
final Integer key = entry.getKey();
final Integer value = entry.getValue();
System.out.println(key + " => " + value);
}
System.out.println("---");
}
public static void runMotionTest() {
System.out.println("Running Motion Packing Test");
System.out.println("---");
byte motion = 0;
System.out.println("Packing - X: 4 Y: 2");
motion = MotionPrediction.packMotion(4, 2);
System.out.println("Result - " + MotionPrediction.getMotionString(motion));
System.out.println();
System.out.println("Packing - X: 1 Y: 7");
motion = MotionPrediction.packMotion(1, 7);
System.out.println("Result - " + MotionPrediction.getMotionString(motion));
System.out.println();
System.out.println("Packing - X: 3 Y: 0");
motion = MotionPrediction.packMotion(3, 0);
System.out.println("Result - " + MotionPrediction.getMotionString(motion));
System.out.println();
System.out.println("Packing - X: -4 Y: 7");
motion = MotionPrediction.packMotion(-4, 7);
System.out.println("Result - " + MotionPrediction.getMotionString(motion));
System.out.println();
System.out.println("Packing - X: -1 Y: -7");
motion = MotionPrediction.packMotion(-1, -7);
System.out.println("Result - " + MotionPrediction.getMotionString(motion));
System.out.println();
System.out.println("Packing - X: -3 Y: 0");
motion = MotionPrediction.packMotion(-3, 0);
System.out.println("Result - " + MotionPrediction.getMotionString(motion));
System.out.println("---");
}
public static void runAllTests() {
runSingleByteTest();
runMultiByteTest();
runSingleIntTest();
runMultiIntTest();
runValueExtractTest();
runByteStreamTest();
runSortedValueTest();
}
@Override
public void onFrameCapture(final BufferedImage img) {
Util.saveImage(img, "original_" + frameCount);
frameCount++;
}
}
| {
"content_hash": "e931bddeb07afcabd9657d181458cf9f",
"timestamp": "",
"source": "github",
"line_count": 390,
"max_line_length": 132,
"avg_line_length": 30.70769230769231,
"alnum_prop": 0.6668336673346693,
"repo_name": "DavidArayan/EzyVideo",
"id": "77e4afcac85c54b2bd025de6105f846fa22dcec3",
"size": "11976",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "JavaSrc/src/bitops/test/BitOpsTest.java",
"mode": "33188",
"license": "mit",
"language": [
{
"name": "C#",
"bytes": "9057"
},
{
"name": "Java",
"bytes": "66600"
}
],
"symlink_target": ""
} |
// Copyright 2015 The Bazel Authors. All rights reserved.
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
package com.google.devtools.build.lib.skyframe;
import com.google.common.base.Preconditions;
import com.google.common.collect.ImmutableList;
import com.google.devtools.build.lib.concurrent.ThreadSafety.Immutable;
import com.google.devtools.build.lib.concurrent.ThreadSafety.ThreadSafe;
import com.google.devtools.build.lib.skyframe.TargetPatternValue.TargetPatternKey;
import com.google.devtools.build.skyframe.SkyKey;
import com.google.devtools.build.skyframe.SkyValue;
import java.io.Serializable;
import java.util.Objects;
/**
* The value returned by {@link PrepareDepsOfPatternsFunction}. Although that function is
* invoked primarily for its side effect (i.e. ensuring the graph contains targets matching the
* pattern sequence and their transitive dependencies), this value contains the
* {@link TargetPatternKey} arguments of the {@link PrepareDepsOfPatternFunction}s evaluated in
* service of it.
*
* <p>Because the returned value may remain the same when the side-effects of this function
* evaluation change, this value and the {@link PrepareDepsOfPatternsFunction} which computes it
* are incompatible with change pruning. It should only be requested by consumers who do not
* require reevaluation when {@link PrepareDepsOfPatternsFunction} is reevaluated. Safe consumers
* include, e.g., top-level consumers, and other functions which invoke {@link
* PrepareDepsOfPatternsFunction} solely for its side-effects and which do not behave differently
* depending on those side-effects.
*/
@Immutable
@ThreadSafe
public final class PrepareDepsOfPatternsValue implements SkyValue {
private final ImmutableList<TargetPatternKey> targetPatternKeys;
PrepareDepsOfPatternsValue(ImmutableList<TargetPatternKey> targetPatternKeys) {
this.targetPatternKeys = targetPatternKeys;
}
public ImmutableList<TargetPatternKey> getTargetPatternKeys() {
return targetPatternKeys;
}
@ThreadSafe
public static SkyKey key(ImmutableList<String> patterns, String offset) {
return new SkyKey(SkyFunctions.PREPARE_DEPS_OF_PATTERNS,
new TargetPatternSequence(patterns, offset));
}
/** The argument value for {@link SkyKey}s of {@link PrepareDepsOfPatternsFunction}. */
@ThreadSafe
public static class TargetPatternSequence implements Serializable {
private final ImmutableList<String> patterns;
private final String offset;
public TargetPatternSequence(ImmutableList<String> patterns, String offset) {
this.patterns = Preconditions.checkNotNull(patterns);
this.offset = Preconditions.checkNotNull(offset);
}
public ImmutableList<String> getPatterns() {
return patterns;
}
public String getOffset() {
return offset;
}
@Override
public boolean equals(Object o) {
if (this == o) {
return true;
}
if (!(o instanceof TargetPatternSequence)) {
return false;
}
TargetPatternSequence that = (TargetPatternSequence) o;
return Objects.equals(offset, that.offset) && Objects.equals(patterns, that.patterns);
}
@Override
public int hashCode() {
return Objects.hash(patterns, offset);
}
}
}
| {
"content_hash": "fc7bed98322ccfa0b29c2446faf2191f",
"timestamp": "",
"source": "github",
"line_count": 98,
"max_line_length": 97,
"avg_line_length": 38.59183673469388,
"alnum_prop": 0.7580645161290323,
"repo_name": "kamalmarhubi/bazel",
"id": "0cbd48cd94751f27c27f705f53624545c5c53416",
"size": "3782",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "src/main/java/com/google/devtools/build/lib/skyframe/PrepareDepsOfPatternsValue.java",
"mode": "33188",
"license": "apache-2.0",
"language": [
{
"name": "C",
"bytes": "46587"
},
{
"name": "C++",
"bytes": "280090"
},
{
"name": "HTML",
"bytes": "15845"
},
{
"name": "Java",
"bytes": "14233015"
},
{
"name": "Protocol Buffer",
"bytes": "69887"
},
{
"name": "Python",
"bytes": "180479"
},
{
"name": "Shell",
"bytes": "370041"
}
],
"symlink_target": ""
} |
@interface DetailScrollContent : UIView
@end
| {
"content_hash": "75d6e28a063937b2a6a0f3b0b0493aaf",
"timestamp": "",
"source": "github",
"line_count": 3,
"max_line_length": 39,
"avg_line_length": 15.333333333333334,
"alnum_prop": 0.8043478260869565,
"repo_name": "SirArkimedes/WWDC-2015",
"id": "93e21ef2387157cfd47039a487096eb9dab74a49",
"size": "231",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "Andrew Robinson/DetailScrollContent.h",
"mode": "33188",
"license": "mit",
"language": [
{
"name": "C++",
"bytes": "104"
},
{
"name": "Objective-C",
"bytes": "40058"
},
{
"name": "Swift",
"bytes": "4121"
}
],
"symlink_target": ""
} |
from django.contrib import admin
from .models import Badge, CrawledBadge
from guardian.admin import GuardedModelAdmin
# Register your models here.
class BadgeAdmin(GuardedModelAdmin):
list_display = ["name"]
readonly_fields = ('secret_key',)
class CrawledBadgeAdmin(admin.ModelAdmin):
list_display = ["user", "badge", "achieved_at"]
ordering = ['achieved_at']
admin.site.register(Badge,BadgeAdmin)
admin.site.register(CrawledBadge,CrawledBadgeAdmin) | {
"content_hash": "99ded4a38d7f39fb6513140ef7a96e0f",
"timestamp": "",
"source": "github",
"line_count": 15,
"max_line_length": 51,
"avg_line_length": 31.466666666666665,
"alnum_prop": 0.7542372881355932,
"repo_name": "vchrisb/emc_phoenix3",
"id": "67b68b87ede840dc985c1abae546715c271c5a63",
"size": "472",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "boothcrawl/admin.py",
"mode": "33188",
"license": "mit",
"language": [
{
"name": "CSS",
"bytes": "175838"
},
{
"name": "HTML",
"bytes": "60569"
},
{
"name": "JavaScript",
"bytes": "2082"
},
{
"name": "Python",
"bytes": "91711"
},
{
"name": "Shell",
"bytes": "4651"
}
],
"symlink_target": ""
} |
<?php
namespace cascade\modules\core\TypeGrant\widgets;
/**
* DetailList [[@doctodo class_description:cascade\modules\core\TypeGrant\widgets\DetailList]].
*
* @author Jacob Morrison <[email protected]>
*/
class DetailList extends \cascade\components\web\widgets\base\DetailList
{
}
| {
"content_hash": "00a25f6e60fed264f76763f1f1a276a8",
"timestamp": "",
"source": "github",
"line_count": 13,
"max_line_length": 95,
"avg_line_length": 22.23076923076923,
"alnum_prop": 0.7612456747404844,
"repo_name": "PSESD/cascade-core-types",
"id": "aa3c5393dbbb3297d044a3e7efd9b7ac931454fb",
"size": "413",
"binary": false,
"copies": "2",
"ref": "refs/heads/master",
"path": "TypeGrant/widgets/DetailList.php",
"mode": "33188",
"license": "bsd-3-clause",
"language": [
{
"name": "CSS",
"bytes": "270"
},
{
"name": "JavaScript",
"bytes": "250"
},
{
"name": "PHP",
"bytes": "197910"
}
],
"symlink_target": ""
} |
Subsets and Splits