text
stringlengths 1
22.8M
|
|---|
```go
package closer
import (
"errors"
"fmt"
"io"
"os"
"testing"
)
type closerSuccess struct {
}
func (c closerSuccess) Close() (err error) {
return
}
type closerError struct {
}
func (c closerError) Close() (err error) {
err = errors.New("closer error")
return
}
func TestCloser(t *testing.T) {
getStdout := func(obj io.Closer) (out []byte, err error) {
rescueStdout := os.Stdout
defer func() { os.Stdout = rescueStdout }()
r, w, err := os.Pipe()
if err != nil {
return nil, err
}
os.Stdout = w
Closer(obj)
err = w.Close()
if err != nil {
return
}
out, err = io.ReadAll(r)
return
}
cs := closerSuccess{}
ce := closerError{}
type args struct {
body io.Closer
}
type expected struct {
err bool
}
tests := []struct {
name string
args args
want expected
}{
{
name: "success",
args: args{
body: cs,
},
want: expected{
err: false,
},
},
{
name: "error",
args: args{
body: ce,
},
want: expected{
err: true,
},
},
}
for _, tt := range tests {
t.Run(tt.name, func(t *testing.T) {
out, err := getStdout(tt.args.body)
if err != nil {
t.Error(err)
return
}
if (len(out) > 0) != tt.want.err {
fmt.Printf("out: %q\n", string(out))
t.Errorf("closer() unexpected log %q", string(out))
}
})
}
}
```
|
Depths is the fourth studio album by American musical duo Windy & Carl. It was released on March 23, 1998 by the record label Kranky.
Critical reception
Pitchfork ranked Depths as the 36th best ambient album of all time in 2016; in an accompanying essay, Mark Richardson cited it as "a peak" in Windy & Carl's "run of classic drone records" on the Kranky label. Two years later, Pitchfork listed Depths as the 49th best album of 1998.
Track listing
Personnel
Credits are adapted from the album's liner notes.
Windy & Carl (Windy Weber and Carl Hultgren) – music
Jody Helme – front cover and inside back cover photography
Brenda Markovich – back cover photography
Eric Pieti – inside photography
References
External links
1998 albums
Windy & Carl albums
Kranky albums
|
Fairdale High School is a high school located in the Fairdale area of Louisville, Kentucky, United States. It is part of the Jefferson County Public Schools. As of the 2013–14 school year, there were 1,804 students at the school.
Areas of study include Law Enforcement, Fire and Emergency Medical Technology, Medical Office Technology, Radio Electronic Communications, and Heavy Equipment Science/Construction. Students shadow professionals in each field and have the opportunity to work in an internship position at various facilities throughout the Louisville area.
Academics
Fairdale was named a Best High School by U.S. News at the Bronze level in 2013. Fairdale maintains a varsity and junior varsity Quick Recall team.
Athletics
Sports offered at Fairdale include football, baseball, basketball, golf, wrestling, tennis, track and field, cross country, swimming, bowling, and most recently, soccer for boys, and volleyball, softball, basketball, golf, tennis, track and field, cross country, bowling, and cheerleading for girls. There is also a dance team for either sex. Archery is also available.
Fairdale hosts the King of the Bluegrass Basketball and Wrestling Tournament annually. The King of the Bluegrass All-Team Tennis Championships were held from 2008 through 2010, and it is now known as the Decoturf High School Tennis Team Championships. New in 2020, Fairdale hosts King/Queen of the Hill Cross Country course at Horine Park.
Fairdale was Kentucky State Champion in men's basketball in 1990, 1991, and 1994.
See also
Public schools in Louisville, Kentucky
References
External links
Jefferson County Public Schools (Kentucky)
Public high schools in Kentucky
Educational institutions established in 1958
1958 establishments in Kentucky
High schools in Louisville, Kentucky
|
```c
//
// path_to_url
//
// Unless required by applicable law or agreed to in writing, software
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
#include "soc/adc_periph.h"
/* Store IO number corresponding to the ADC channel number. */
const int adc_channel_io_map[SOC_ADC_PERIPH_NUM][SOC_ADC_MAX_CHANNEL_NUM] = {
/* ADC1 */
{ADC1_CHANNEL_0_GPIO_NUM, ADC1_CHANNEL_1_GPIO_NUM, ADC1_CHANNEL_2_GPIO_NUM, ADC1_CHANNEL_3_GPIO_NUM, ADC1_CHANNEL_4_GPIO_NUM,
ADC1_CHANNEL_5_GPIO_NUM, ADC1_CHANNEL_6_GPIO_NUM, ADC1_CHANNEL_7_GPIO_NUM, ADC1_CHANNEL_8_GPIO_NUM, ADC1_CHANNEL_9_GPIO_NUM},
/* ADC2 */
{ADC2_CHANNEL_0_GPIO_NUM, ADC2_CHANNEL_1_GPIO_NUM, ADC2_CHANNEL_2_GPIO_NUM, ADC2_CHANNEL_3_GPIO_NUM, ADC2_CHANNEL_4_GPIO_NUM,
ADC2_CHANNEL_5_GPIO_NUM, ADC2_CHANNEL_6_GPIO_NUM, ADC2_CHANNEL_7_GPIO_NUM, ADC2_CHANNEL_8_GPIO_NUM, ADC2_CHANNEL_9_GPIO_NUM}
};
```
|
Fulvio Croce (6 June 1901 – 28 April 1977) was an Italian lawyer. The president of the Turin Bar Association, he was killed by a terrorist group, the Red Brigades.
Biography
The great-grandson of Costantino Nigra, Croce was born in 1901 in Castelnuovo Nigra, in the Piedmont region. In 1924, he graduated in jurisprudence (). After the Armistice of Cassibile of 8 September 1943, Croce joined the Alpini and the Italian resistance movement. He was elected president of the Turin Bar Association in 1968. In 1977, it began in Turin the trial against some members of the Red Brigades; they were Renato Curcio, Alberto Franceschini, , and Prospero Gallinari. At the first hearing of the trial, something totally new in Italy happened, as all the defendants refused to be defended by a counsellor and threatened death to any lawyer who would have accepted to be appointed as their counsellor by the court.
The defendants contended that the court did not have the authority to judge them. During the first hearing, Ferrari read a statement on behalf of all the defendants. It said that "we proclaim ourselves members of the communist organization Red Brigades. And being communist combatants, we take jointly take the political charge of all the actions of the organization. Given that, we claim there is no legal ground for this trial. The defendants have no reason to defend themselves. On the opposite, the prosecutors have to defend the criminal and anti-proletarian practice of the infamous regime that they represent. ... To be clear, we repeat our counsellors' power of attorneys and we invite them to refuse any possible appointment ex officio ... ." , the presiding judge of the Turin Corte d'Assise (), appointed Croce as counsellor of the defendants, in his capacity of president of the Bar Association. Although Croce was conscious of the serious danger, he accepted the defence and appointed as co-counsellors some other members of the Turin Bar Association Board of Governors; among them was Franzo Grande Stevens, who was charged of the defence of Renato Curcio.
At the hearing of 7 June 1976, Grande Stevens, in accord with Croce, contended that Article 130 of the Italian Code of Criminal Procedure, which compels every defendant, even against his will and one charged of political crimes, to be defended by a counsellor, was unconstitutional. Grande Stevens contended that this article was in conflict with the European Convention on Human Rights, which gives everyone the right "to defend himself in person or through legal assistance of his own choosing" according to Article 6.3. He contended that to be represented by a lawyer is a right, not an obligation. The Court of Assizes rejected this claim of unconstitutionality, perhaps biased by the murder of a district attorney, , by the Red Brigades occurred a few days before. Consequently, Croce and the other co-counsellors kept defending the members of the Red Brigades. On 28 April 1977, Croce was killed. Three men shot at him five times using a Nagant 7.62, which was the same gun used to kill Carlo Casalegno. The Red Brigades revendicated the action through a phone call. In leaflets, they stated: "On 28 April 1977 a commando of the Red Brigades has executed the state servant Fulvio Croce."
Memory
On 5 December 1977, Croce received the Gold Medal Award for Civil Valour (). The book Life of a Lawyer () by Franzo Grande Stevens was published by Cedam in 2000. The Foundation Memorial Fulvio Croce () was established in 2004. In 2007, and the Turin Bar Association produced the documentary film Avvocato! Il processo di Torino al nucleo storico delle Brigate rosse (). During some solemn commitment ceremonies and immediately after the ritual oath, the Council of the Milan Bar Association donated a copy of the film to each young new lawyer. The film was directed by Marino Bronzino.
Since 2010, a courtroom in the criminal hearings of the court of Trento is dedicated to Croce and Giorgio Ambrosoli. Since 2014, a courtroom in the Palace of Justice in Ascoli Piceno is dedicated to Croce, "a perennial remembrance, victim of terrorism". On 9 May 2016, a memorial plaque was affixed to the wall of the house in via Perrone 5, where the fatal attack took place, by the Municipality of Turin.
On the fortieth anniversary of his death in 2018, the Criminal Chamber of western Piedmont remembered him as "a great lawyer who sacrificed his life in the name of the right to defense, an example for all citizens and also for us." A letter sent to its members read: "He was barbarously killed because he did his duty, because he honoured the toga, and served the state, thus implementing the Constitution."
Honours
Gold Medal Award for Civil Valour, 5 December 1977.
References
Bibliography
Further reading
Italian terrorism victims
1901 births
1977 deaths
20th-century Italian lawyers
People from Castelnuovo Nigra
|
The 1923–24 Arkansas Razorbacks men's basketball team represented the University of Arkansas in the 1923–24 college basketball season. They played their home games in Schmidt Gymnasium. Francis Schmidt coached the Hogs in their first ever basketball season. The Razorbacks went 17–11, with a 3–9 record in Southwest Conference play, finishing seventh in the league.
Roster
Schedule and Results
Schedule retrieved from HogStats.com.
References
Arkansas Razorbacks
Arkansas Razorbacks men's basketball seasons
|
```sqlpl
SELECT * FROM (SELECT 1 AS X UNION ALL SELECT 2) ORDER BY X ASC;
```
|
Vermont Route 5A (VT 5A) is a state highway in extreme northeastern Vermont. It is an alternate route of U.S. Route 5 (US 5) that travels along the east shore of Lake Willoughby. VT 5A begins at US 5 in West Burke and ends at US 5 and VT 105 in Derby Center, about south of the Canada–United States border.
VTrans' 2006 Route Log lists the official length of VT 5A to be , with the last milepost reading at VT 105 in Charleston. However, VT 5A continues along a silent concurrency with VT 105 from Charleston to Derby Center. The only mention of a concurrency between VT 5A and VT 105 is from VT 111 at its western terminus.
Route description
VT 5A begins in the south at an intersection with US 5 in the village of West Burke. Both routes connect Burke with Derby, but VT 5A uses a more direct, easterly route than US 5. VT 5A proceeds north into Orleans County and the town of Westmore traversing through the Willoughby State Forest and along the eastern side of Lake Willoughby before intersecting with the eastern end of VT 16.
History
While the designation of VT 5A has changed since its initial construction, its routing and function have not. The entirety of modern VT 5A was first designated as New England Interstate Route 2A (NEI 2A), part of the New England road marking system that existed between 1922 and 1927. NEI 2A was designated as an alternate to NEI 2, a designation which covered the entirety of modern US 5. When the New England Interstate system was supplanted by the United States Numbered Highways, NEI 2 was designated as US 5 in 1926 and NEI 2A was redesignated as a state highway.
Major intersections
See also
List of state highways in Vermont
References
External links
005A
Transportation in Caledonia County, Vermont
Transportation in Orleans County, Vermont
Burke, Vermont
Westmore, Vermont
Brownington, Vermont
Charleston, Vermont
Derby, Vermont
U.S. Route 5
|
```ruby
# frozen_string_literal: true
##
# Test case for creating new plain-text RDoc::Markup formatters. See also
# RDoc::Markup::FormatterTestCase
#
# See test_rdoc_markup_to_rdoc.rb for a complete example.
#
# Example:
#
# class TestRDocMarkupToNewTextFormat < RDoc::Markup::TextFormatterTestCase
#
# add_visitor_tests
# add_text_tests
#
# def setup
# super
#
# @to = RDoc::Markup::ToNewTextFormat.new
# end
#
# def accept_blank_line
# assert_equal :junk, @to.res.join
# end
#
# # ...
#
# end
class RDoc::Markup::TextFormatterTestCase < RDoc::Markup::FormatterTestCase
##
# Adds test cases to the calling TestCase.
def self.add_text_tests
self.class_eval do
##
# Test case that calls <tt>@to.accept_heading</tt>
def test_accept_heading_indent
@to.start_accepting
@to.indent = 3
@to.accept_heading @RM::Heading.new(1, 'Hello')
accept_heading_indent
end
##
# Test case that calls <tt>@to.accept_rule</tt>
def test_accept_rule_indent
@to.start_accepting
@to.indent = 3
@to.accept_rule @RM::Rule.new(1)
accept_rule_indent
end
##
# Test case that calls <tt>@to.accept_verbatim</tt>
def test_accept_verbatim_indent
@to.start_accepting
@to.indent = 2
@to.accept_verbatim @RM::Verbatim.new("hi\n", " world\n")
accept_verbatim_indent
end
##
# Test case that calls <tt>@to.accept_verbatim</tt> with a big indent
def test_accept_verbatim_big_indent
@to.start_accepting
@to.indent = 2
@to.accept_verbatim @RM::Verbatim.new("hi\n", "world\n")
accept_verbatim_big_indent
end
##
# Test case that calls <tt>@to.accept_paragraph</tt> with an indent
def test_accept_paragraph_indent
@to.start_accepting
@to.indent = 3
@to.accept_paragraph @RM::Paragraph.new(('words ' * 30).strip)
accept_paragraph_indent
end
##
# Test case that calls <tt>@to.accept_paragraph</tt> with a long line
def test_accept_paragraph_wrap
@to.start_accepting
@to.accept_paragraph @RM::Paragraph.new(('words ' * 30).strip)
accept_paragraph_wrap
end
##
# Test case that calls <tt>@to.attributes</tt> with an escaped
# cross-reference. If this test doesn't pass something may be very
# wrong.
def test_attributes
assert_equal 'Dog', @to.attributes("\\Dog")
end
end
end
end
```
|
William Henry Richardson (December 5, 1808 – December 14, 1878) was an American physician and politician.
Richardson, only son of Levi and Amelia (Trumbull) Richardson, was born in Chaplin, then a part of Mansfield, Conn., December 5, 1808. At an early age he moved with his parents to North Mansfield, Conn., where he resided much the greater part of his life. He pursued his medical studies, first with Dr. Archibald Welch of Mansfield, subsequently with Dr. Samuel B. Woodward of Wethersfield and Dr. Silas Fuller of Columbia, and at the medical school of Yale College, where he graduated in 1834. On graduating, he returned to Mansfield and immediately, entered on the practice of his profession, which he followed, with assiduity and success, for more than forty years. After three years of impaired health, he died from disease of the brain, December 14, 1878, aged 70 years.
In 1862, he was a member of the Connecticut State Legislature. For many years he served as School Visitor.
He was married in 1853 to Abigail, daughter of Edmund Freeman, Esq., of Mansfield, who with their only son survived him.
References
1808 births
1878 deaths
People from Windham County, Connecticut
Yale School of Medicine alumni
Physicians from Connecticut
Members of the Connecticut General Assembly
19th-century American politicians
|
```xml
<?xml version="1.0" encoding="utf-8"?>
<Project ToolsVersion="4.0" xmlns="path_to_url">
<ItemGroup>
<Filter Include="..">
<UniqueIdentifier>{739DB09A-CC57-A953-A6CF-F64FA08E4FA7}</UniqueIdentifier>
</Filter>
<Filter Include="..\..">
<UniqueIdentifier>{739DB09A-CC57-A953-A6CF-F64FA08E4FA7}</UniqueIdentifier>
</Filter>
<Filter Include="..\..\scripts">
<UniqueIdentifier>{4FDF30BD-A895-58AC-A912-7C70A5371544}</UniqueIdentifier>
</Filter>
</ItemGroup>
<ItemGroup>
<None Include="generated.gyp"/>
<None Include="..\..\scripts\aggregate_generated_bindings.py">
<Filter>..\..\scripts</Filter>
</None>
<None Include="modules_idl_files_list.tmp"/>
</ItemGroup>
</Project>
```
|
```ruby
# frozen_string_literal: true
require "spec_helper"
describe Decidim::Proposals::Permissions do
subject { described_class.new(user, permission_action, context).permissions.allowed? }
let(:user) { proposal.creator_author }
let(:context) do
{
current_component: proposal_component,
current_settings:,
proposal:,
component_settings:,
coauthor:
}
end
let(:coauthor) { nil }
let(:proposal_component) { create(:proposal_component) }
let(:proposal) { create(:proposal, component: proposal_component) }
let(:component_settings) do
double(vote_limit: 2)
end
let(:current_settings) do
double(settings.merge(extra_settings))
end
let(:settings) do
{
creation_enabled?: false
}
end
let(:extra_settings) { {} }
let(:permission_action) { Decidim::PermissionAction.new(**action) }
context "when scope is admin" do
let(:action) do
{ scope: :admin, action: :vote, subject: :proposal }
end
it_behaves_like "delegates permissions to", Decidim::Proposals::Admin::Permissions
end
context "when scope is not public" do
let(:action) do
{ scope: :foo, action: :vote, subject: :proposal }
end
it_behaves_like "permission is not set"
end
context "when subject is not a proposal" do
let(:action) do
{ scope: :public, action: :vote, subject: :foo }
end
it_behaves_like "permission is not set"
end
context "when creating a proposal" do
let(:action) do
{ scope: :public, action: :create, subject: :proposal }
end
context "when creation is disabled" do
let(:extra_settings) { { creation_enabled?: false } }
it { is_expected.to be false }
end
context "when user is authorized" do
let(:extra_settings) { { creation_enabled?: true } }
it { is_expected.to be true }
end
end
context "when editing a proposal" do
let(:action) do
{ scope: :public, action: :edit, subject: :proposal }
end
before do
allow(proposal).to receive(:editable_by?).with(user).and_return(editable)
end
context "when proposal is editable" do
let(:editable) { true }
it { is_expected.to be true }
end
context "when proposal is not editable" do
let(:editable) { false }
it { is_expected.to be false }
end
end
context "when withdrawing a proposal" do
let(:action) do
{ scope: :public, action: :withdraw, subject: :proposal }
end
context "when proposal author is the user trying to withdraw" do
it { is_expected.to be true }
end
context "when trying by another user" do
let(:user) { build(:user) }
it { is_expected.to be false }
end
end
describe "voting" do
let(:action) do
{ scope: :public, action: :vote, subject: :proposal }
end
context "when voting is disabled" do
let(:extra_settings) do
{
votes_enabled?: false,
votes_blocked?: true
}
end
it { is_expected.to be false }
end
context "when votes are blocked" do
let(:extra_settings) do
{
votes_enabled?: true,
votes_blocked?: true
}
end
it { is_expected.to be false }
end
context "when the user has no more remaining votes" do
let(:extra_settings) do
{
votes_enabled?: true,
votes_blocked?: false
}
end
before do
proposals = create_list(:proposal, 2, component: proposal_component)
create(:proposal_vote, author: user, proposal: proposals[0])
create(:proposal_vote, author: user, proposal: proposals[1])
end
it { is_expected.to be false }
end
context "when the user is authorized" do
let(:extra_settings) do
{
votes_enabled?: true,
votes_blocked?: false
}
end
it { is_expected.to be true }
end
end
describe "unvoting" do
let(:action) do
{ scope: :public, action: :unvote, subject: :proposal }
end
context "when voting is disabled" do
let(:extra_settings) do
{
votes_enabled?: false,
votes_blocked?: true
}
end
it { is_expected.to be false }
end
context "when votes are blocked" do
let(:extra_settings) do
{
votes_enabled?: true,
votes_blocked?: true
}
end
it { is_expected.to be false }
end
context "when the user is authorized" do
let(:extra_settings) do
{
votes_enabled?: true,
votes_blocked?: false
}
end
it { is_expected.to be true }
end
end
describe "amend" do
let(:action) do
{ scope: :public, action: :amend, subject: :proposal }
end
context "when amend is disabled" do
let(:extra_settings) do
{
amendments_enabled?: false
}
end
it { is_expected.to be false }
end
context "when the user is authorized" do
let(:extra_settings) do
{
amendments_enabled?: true
}
end
it { is_expected.to be true }
end
end
context "when inviting coauthor" do
let(:action) do
{ scope: :public, action: :invite, subject: :proposal_coauthor_invites }
end
let(:coauthor) { create(:user, :confirmed, organization: user.organization) }
let!(:comment) { create(:comment, commentable: proposal, author: coauthor) }
shared_examples "coauthor is invitable" do
it { is_expected.to be true }
context "when already an author" do
before do
proposal.add_coauthor(coauthor)
end
it { is_expected.to be false }
end
context "when the current user is not the author" do
let(:user) { create(:user, :confirmed, organization: proposal.organization) }
it { is_expected.to be false }
end
context "when no comments" do
let!(:comment) { nil }
it { is_expected.to be false }
end
context "when coauthor not in comments" do
let!(:comment) { create(:comment, commentable: proposal) }
it { is_expected.to be false }
end
context "when coauthor is not confirmed" do
let(:coauthor) { create(:user, organization: user.organization) }
it { is_expected.to be false }
end
context "when coauthor is blocked" do
let(:coauthor) { create(:user, :blocked, organization: user.organization) }
it { is_expected.to be false }
end
context "when coauthor is deleted" do
let(:coauthor) { create(:user, :deleted, organization: user.organization) }
it { is_expected.to be false }
end
end
it_behaves_like "coauthor is invitable"
context "when a notification for the coauthor already exists" do
let!(:notification) { create(:notification, :proposal_coauthor_invite, user: coauthor) }
it { is_expected.to be true }
end
context "when notification exists for the same proposal" do
let!(:notification) { create(:notification, :proposal_coauthor_invite, user: coauthor, resource: proposal) }
it { is_expected.to be false }
end
context "when notification is for another user" do
let!(:notification) { create(:notification, :proposal_coauthor_invite, resource: proposal) }
it { is_expected.to be true }
end
context "when canceling invitation" do
let(:action) do
{ scope: :public, action: :cancel, subject: :proposal_coauthor_invites }
end
let!(:notification) { create(:notification, :proposal_coauthor_invite, resource: proposal, user: coauthor) }
it_behaves_like "coauthor is invitable"
end
end
context "when coauthor is invited" do
let(:action) do
{ scope: :public, action: :accept, subject: :proposal_coauthor_invites }
end
let(:user) { create(:user, :confirmed, organization: proposal.organization) }
let(:coauthor) { user }
let!(:notification) { create(:notification, :proposal_coauthor_invite, resource: proposal, user: coauthor) }
shared_examples "can accept coauthor" do
it { is_expected.to be true }
context "when already an author" do
before do
proposal.add_coauthor(coauthor)
end
it { is_expected.to be false }
end
context "when the user is not the coauthor" do
let(:coauthor) { create(:user, :confirmed, organization: proposal.organization) }
it { is_expected.to be false }
end
context "when no invitation" do
let!(:notification) { nil }
it { is_expected.to be false }
end
context "when notification is not for the same proposal" do
let!(:notification) { create(:notification, :proposal_coauthor_invite, user: coauthor) }
it { is_expected.to be false }
end
context "when notification is for another coauthor" do
let!(:notification) { create(:notification, :proposal_coauthor_invite, resource: proposal) }
it { is_expected.to be false }
end
context "when coauthor is blocked" do
let(:coauthor) { create(:user, :blocked, organization: proposal.organization) }
it { is_expected.to be false }
end
context "when coauthor is deleted" do
let(:coauthor) { create(:user, :deleted, organization: proposal.organization) }
it { is_expected.to be false }
end
context "when coauthor is not confirmed" do
let(:coauthor) { create(:user, organization: proposal.organization) }
it { is_expected.to be false }
end
end
it_behaves_like "can accept coauthor"
context "when declining invitation" do
let(:action) do
{ scope: :public, action: :decline, subject: :proposal_coauthor_invites }
end
it_behaves_like "can accept coauthor"
end
end
end
```
|
```smalltalk
using System.Windows;
using System.Windows.Controls;
using TwitchLeecher.Gui.Interfaces;
namespace TwitchLeecher.Gui.Views
{
public partial class SearchResultView : UserControl
{
#region Fields
private INavigationState _state;
#endregion Fields
#region Constructors
public SearchResultView()
{
InitializeComponent();
scroller.ScrollChanged += Scroller_ScrollChanged;
Loaded += SearchResultView_Loaded;
}
#endregion Constructors
#region EventHandlers
private void Scroller_ScrollChanged(object sender, ScrollChangedEventArgs e)
{
if (_state != null)
{
_state.ScrollPosition = e.VerticalOffset;
}
}
private void SearchResultView_Loaded(object sender, RoutedEventArgs e)
{
_state = DataContext as INavigationState;
if (_state != null)
{
scroller.ScrollToVerticalOffset(_state.ScrollPosition);
}
}
#endregion EventHandlers
}
}
```
|
```c
/**
******************************************************************************
* @file system_stm32f37x.c
* @author MCD Application Team
* @version V4.0.0
* @date 21-January-2013
* @brief CMSIS Cortex-M4 Device Peripheral Access Layer System Source File.
* This file contains the system clock configuration for STM32F37x devices,
* and is generated by the clock configuration tool
* STM32f37x_Clock_Configuration_V1.0.0.xls
*
* 1. This file provides two functions and one global variable to be called from
* user application:
* - SystemInit(): Setups the system clock (System clock source, PLL Multiplier
* and Divider factors, AHB/APBx prescalers and Flash settings),
* depending on the configuration made in the clock xls tool.
* This function is called at startup just after reset and
* before branch to main program. This call is made inside
* the "startup_stm32f37x.s" file.
*
* - SystemCoreClock variable: Contains the core clock (HCLK), it can be used
* by the user application to setup the SysTick
* timer or configure other parameters.
*
* - SystemCoreClockUpdate(): Updates the variable SystemCoreClock and must
* be called whenever the core clock is changed
* during program execution.
*
* 2. After each device reset the HSI (8 MHz Range) is used as system clock source.
* Then SystemInit() function is called, in "startup_stm32f37x.s" file, to
* configure the system clock before to branch to main program.
*
* 3. If the system clock source selected by user fails to startup, the SystemInit()
* function will do nothing and HSI still used as system clock source. User can
* add some code to deal with this issue inside the SetSysClock() function.
*
* 4. The default value of HSE crystal is set to 8MHz, refer to "HSE_VALUE" defined
* in "stm32f37x.h" file. When HSE is used as system clock source, directly or
* through PLL, and you are using different crystal you have to adapt the HSE
* value to your own configuration.
*
* 5. This file configures the system clock as follows:
*=============================================================================
* Supported STM32F37x device
*=============================================================================
* System Clock source | PLL (HSE)
*your_sha256_hash-------------
* SYSCLK(Hz) | 72000000
*your_sha256_hash-------------
* HCLK(Hz) | 72000000
*your_sha256_hash-------------
* AHB Prescaler | 1
*your_sha256_hash-------------
* APB2 Prescaler | 1
*your_sha256_hash-------------
* APB1 Prescaler | 2
*your_sha256_hash-------------
* HSE Frequency(Hz) | 8000000
*your_sha256_hash------------
* PLLMUL | 9
*your_sha256_hash-------------
* PREDIV | 1
*your_sha256_hash-------------
* USB Clock | ENABLE
*your_sha256_hash-------------
* Flash Latency(WS) | 2
*your_sha256_hash-------------
* Prefetch Buffer | ON
*your_sha256_hash-------------
*=============================================================================
******************************************************************************
* @attention
*
* <h2><center>© COPYRIGHT 2013 STMicroelectronics</center></h2>
*
*
* path_to_url
*
* Unless required by applicable law or agreed to in writing, software
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
*
******************************************************************************
*/
/** @addtogroup CMSIS
* @{
*/
/** @addtogroup STM32F37x_System
* @{
*/
/** @addtogroup STM32F37x_System_Private_Includes
* @{
*/
#include "stm32f37x.h"
/**
* @}
*/
/** @addtogroup STM32F37x_System_Private_TypesDefinitions
* @{
*/
/**
* @}
*/
/** @addtogroup STM32F37x_System_Private_Defines
* @{
*/
/*!< Uncomment the following line if you need to relocate your vector Table in
Internal SRAM. */
/* #define VECT_TAB_SRAM */
#define VECT_TAB_OFFSET 0x0 /*!< Vector Table base offset field.
This value must be a multiple of 0x200. */
/**
* @}
*/
/** @addtogroup STM32F37x_System_Private_Macros
* @{
*/
/**
* @}
*/
/** @addtogroup STM32F37x_System_Private_Variables
* @{
*/
uint32_t SystemCoreClock = 72000000;
__I uint8_t AHBPrescTable[16] = {0, 0, 0, 0, 0, 0, 0, 0, 1, 2, 3, 4, 6, 7, 8, 9};
/**
* @}
*/
/** @addtogroup STM32F37x_System_Private_FunctionPrototypes
* @{
*/
static void SetSysClock(void);
/**
* @}
*/
/** @addtogroup STM32F37x_System_Private_Functions
* @{
*/
/**
* @brief Setup the microcontrollers system.
* Initialize the Embedded Flash Interface, the PLL and update the
* SystemCoreClock variable.
* @param None
* @retval None
*/
void SystemInit (void)
{
/* FPU settings ------------------------------------------------------------*/
#if (__FPU_PRESENT == 1) && (__FPU_USED == 1)
SCB->CPACR |= ((3UL << 10*2)|(3UL << 11*2)); /* set CP10 and CP11 Full Access */
#endif
/* Set HSION bit */
RCC->CR |= (uint32_t)0x00000001;
/* Reset SW[1:0], HPRE[3:0], PPRE[2:0], ADCPRE, SDADCPRE and MCOSEL[2:0] bits */
RCC->CFGR &= (uint32_t)0x00FF0000;
/* Reset HSEON, CSSON and PLLON bits */
RCC->CR &= (uint32_t)0xFEF6FFFF;
/* Reset HSEBYP bit */
RCC->CR &= (uint32_t)0xFFFBFFFF;
/* Reset PLLSRC, PLLXTPRE, PLLMUL and USBPRE bits */
RCC->CFGR &= (uint32_t)0xFF80FFFF;
/* Reset PREDIV1[3:0] bits */
RCC->CFGR2 &= (uint32_t)0xFFFFFFF0;
/* Reset USARTSW[1:0], I2CSW and CECSW bits */
RCC->CFGR3 &= (uint32_t)0xFFF0F8C;
/* Disable all interrupts */
RCC->CIR = 0x00000000;
/* Configure the System clock frequency, AHB/APBx prescalers and Flash settings */
SetSysClock();
#ifdef VECT_TAB_SRAM
SCB->VTOR = SRAM_BASE | VECT_TAB_OFFSET; /* Vector Table Relocation in Internal SRAM. */
#else
SCB->VTOR = FLASH_BASE | VECT_TAB_OFFSET; /* Vector Table Relocation in Internal FLASH. */
#endif
}
/**
* @brief Update SystemCoreClock according to Clock Register Values
* The SystemCoreClock variable contains the core clock (HCLK), it can
* be used by the user application to setup the SysTick timer or configure
* other parameters.
*
* @note Each time the core clock (HCLK) changes, this function must be called
* to update SystemCoreClock variable value. Otherwise, any configuration
* based on this variable will be incorrect.
*
* @note - The system frequency computed by this function is not the real
* frequency in the chip. It is calculated based on the predefined
* constant and the selected clock source:
*
* - If SYSCLK source is HSI, SystemCoreClock will contain the HSI_VALUE(*)
*
* - If SYSCLK source is HSE, SystemCoreClock will contain the HSE_VALUE(**)
*
* - If SYSCLK source is PLL, SystemCoreClock will contain the HSE_VALUE(**)
* or HSI_VALUE(*) multiplied/divided by the PLL factors.
*
* (*) HSI_VALUE is a constant defined in stm32f37x.h file (default value
* 8 MHz) but the real value may vary depending on the variations
* in voltage and temperature.
*
* (**) HSE_VALUE is a constant defined in stm32f37x.h file (default value
* 8 MHz), user has to ensure that HSE_VALUE is same as the real
* frequency of the crystal used. Otherwise, this function may
* have wrong result.
*
* - The result of this function could be not correct when using fractional
* value for HSE crystal.
* @param None
* @retval None
*/
void SystemCoreClockUpdate (void)
{
uint32_t tmp = 0, pllmull = 0, pllsource = 0, prediv1factor = 0;
/* Get SYSCLK source -------------------------------------------------------*/
tmp = RCC->CFGR & RCC_CFGR_SWS;
switch (tmp)
{
case 0x00: /* HSI used as system clock */
SystemCoreClock = HSI_VALUE;
break;
case 0x04: /* HSE used as system clock */
SystemCoreClock = HSE_VALUE;
break;
case 0x08: /* PLL used as system clock */
/* Get PLL clock source and multiplication factor ----------------------*/
pllmull = RCC->CFGR & RCC_CFGR_PLLMULL;
pllsource = RCC->CFGR & RCC_CFGR_PLLSRC;
pllmull = ( pllmull >> 18) + 2;
if (pllsource == 0x00)
{
/* HSI oscillator clock divided by 2 selected as PLL clock entry */
SystemCoreClock = (HSI_VALUE >> 1) * pllmull;
}
else
{
prediv1factor = (RCC->CFGR2 & RCC_CFGR2_PREDIV1) + 1;
/* HSE oscillator clock selected as PREDIV1 clock entry */
SystemCoreClock = (HSE_VALUE / prediv1factor) * pllmull;
}
break;
default: /* HSI used as system clock */
SystemCoreClock = HSI_VALUE;
break;
}
/* Compute HCLK clock frequency ----------------*/
/* Get HCLK prescaler */
tmp = AHBPrescTable[((RCC->CFGR & RCC_CFGR_HPRE) >> 4)];
/* HCLK clock frequency */
SystemCoreClock >>= tmp;
}
/**
* @brief Configures the System clock frequency, AHB/APBx prescalers and Flash
* settings.
* @note This function should be called only once the RCC clock configuration
* is reset to the default reset state (done in SystemInit() function).
* @param None
* @retval None
*/
static void SetSysClock(void)
{
__IO uint32_t StartUpCounter = 0, HSEStatus = 0;
/******************************************************************************/
/* PLL (clocked by HSE) used as System clock source */
/******************************************************************************/
/* SYSCLK, HCLK, PCLK2 and PCLK1 configuration -----------*/
/* Enable HSE */
RCC->CR |= ((uint32_t)RCC_CR_HSEON);
/* Wait till HSE is ready and if Time out is reached exit */
do
{
HSEStatus = RCC->CR & RCC_CR_HSERDY;
StartUpCounter++;
} while((HSEStatus == 0) && (StartUpCounter != HSE_STARTUP_TIMEOUT));
if ((RCC->CR & RCC_CR_HSERDY) != RESET)
{
HSEStatus = (uint32_t)0x01;
}
else
{
HSEStatus = (uint32_t)0x00;
}
if (HSEStatus == (uint32_t)0x01)
{
/* Enable Prefetch Buffer and set Flash Latency */
FLASH->ACR = FLASH_ACR_PRFTBE | (uint32_t)FLASH_ACR_LATENCY_1;
/* HCLK = SYSCLK / 1 */
RCC->CFGR |= (uint32_t)RCC_CFGR_HPRE_DIV1;
/* PCLK2 = HCLK / 1 */
RCC->CFGR |= (uint32_t)RCC_CFGR_PPRE2_DIV1;
/* PCLK1 = HCLK / 2 */
RCC->CFGR |= (uint32_t)RCC_CFGR_PPRE1_DIV2;
/* PLL configuration */
RCC->CFGR &= (uint32_t)((uint32_t)~(RCC_CFGR_PLLSRC | RCC_CFGR_PLLXTPRE | RCC_CFGR_PLLMULL));
RCC->CFGR |= (uint32_t)(RCC_CFGR_PLLSRC_PREDIV1 | RCC_CFGR_PLLXTPRE_PREDIV1 | RCC_CFGR_PLLMULL9);
/* Enable PLL */
RCC->CR |= RCC_CR_PLLON;
/* Wait till PLL is ready */
while((RCC->CR & RCC_CR_PLLRDY) == 0)
{
}
/* Select PLL as system clock source */
RCC->CFGR &= (uint32_t)((uint32_t)~(RCC_CFGR_SW));
RCC->CFGR |= (uint32_t)RCC_CFGR_SW_PLL;
/* Wait till PLL is used as system clock source */
while ((RCC->CFGR & (uint32_t)RCC_CFGR_SWS) != (uint32_t)RCC_CFGR_SWS_PLL)
{
}
}
else
{ /* If HSE fails to start-up, the application will have wrong clock
configuration. User can add here some code to deal with this error */
}
}
/**
* @}
*/
/**
* @}
*/
/**
* @}
*/
/************************ (C) COPYRIGHT STMicroelectronics *****END OF FILE****/
```
|
```xml
import type { ChatPostMessageArguments } from '@slack/web-api'
import { channels } from '.botpress'
type Card = channels.channel.card.Card
type CardAction = channels.channel.card.Card['actions'][number]
export function renderCard(payload: Card): ChatPostMessageArguments['blocks'] {
return [
{
type: 'section',
text: {
type: 'mrkdwn',
text: `*${payload.title}*\n${payload.subtitle}`,
},
accessory: payload.imageUrl
? {
type: 'image',
image_url: payload.imageUrl,
alt_text: 'image',
}
: undefined,
},
{
type: 'actions',
elements: payload.actions.map((item) => {
switch (item.action) {
case 'say':
return renderButtonSay(item)
case 'postback':
return renderButtonPostback(item)
case 'url':
return renderButtonUrl(item)
default:
throw Error(`Unknown action type ${item.action}`)
}
}),
},
]
}
function renderButtonUrl(action: CardAction) {
return {
type: 'button',
text: {
type: 'plain_text',
text: action.label,
},
url: action.value,
}
}
function renderButtonPostback(action: CardAction) {
return {
type: 'button',
action_id: 'postback',
text: {
type: 'plain_text',
text: action.label,
},
value: action.value,
}
}
function renderButtonSay(action: CardAction) {
return {
type: 'button',
action_id: 'say',
text: {
type: 'plain_text',
text: action.label,
},
value: action.value,
}
}
```
|
is a Japanese manga series by Yoshimi Sato. It was serialized in Futabasha's seinen manga magazine Monthly Action from May 2016 to September 2021 and has been collected in eight tankōbon volumes. An anime television series adaptation by Ekachi Epilka aired from April to June 2018.
Plot
Our whole life consists of sheer fuss. People all the time somewhere in a hurry, in a hurry, run ... In the dizzy everyday bustle, sometimes we even have no time to take a breath. But there must be a balance in everything. And if we can not stop in time, the city will do it for us. There are traffic lights on which you can slow down and spend a moment in simple waiting. And there are railway crossings, where you will have to stand a little longer, peering into the distance and looking for the silhouette of an approaching train, and also calculate how many cars there are. What thoughts come to their mind when the barrier suddenly blocks them further? For them, every day is a new story, the sounds of which are mixed with the noise of a train passing along the rails.
This story of short stories tells us about everyday life and the conversations of young people, but at the same time different people on various topics, waiting at railway junctions.
Characters
Media
Manga
Crossing Time is written and illustrated by Yoshimi Sato. It was serialized in Futabasha's Monthly Action magazine from May 25, 2016, to September 25, 2021. The first tankōbon volume was released on December 12, 2016. As of December 2021, eight volumes have been released.
Anime
An anime television series adaptation was announced in the March 2018 issue of Monthly Action, published on January 25, 2018. It is produced by Ekachi Epilka and directed by Yoshio Suzuki, with Misuzu Chiba handling the series' scripts, and Kaori Takamura designing the characters. Yuri Komagata performed the opening theme song "Tomare no Susume". It aired on Tokyo MX from April 10 to June 26, 2018. Crunchyroll licensed the series.
Notes
References
External links
Anime series based on manga
Crunchyroll anime
Crunchyroll manga
Ekachi Epilka
Futabasha manga
Seinen manga
Slice of life anime and manga
Tokyo MX original programming
|
The FK Baku 2008-09 season was Baku's 11th Azerbaijan Premier League season, and was their second season with Gjoko Hadžievski as their manager, having replaced Boyukagha Hajiyev in July 2007. They finished the season in 1st place in the league and were knocked out of the
Azerbaijan Cup at the Semi-final stage by Qarabağ.
Squad
Transfers
Summer
In:
Out:
Winter
In:
Out:
Competitions
Azerbaijan Premier League
Results summary
Results
Table
Azerbaijan Cup
Squad statistics
Appearances and goals
|-
|colspan="14"|Players who appeared for Baku who left on loan during the season:
|-
|colspan="14"|Players who appeared for Baku who left during the season:
|}
Goal scorers
Notes
On 31 October 2008, FK NBC Salyan changed their name to FK Mughan.
Qarabağ have played their home games at the Tofiq Bahramov Stadium since 1993 due to the ongoing situation in Quzanlı.
References
FC Baku seasons
Baku
|
The Joe Plaskett Foundation Award also known as "The Plaskett" is an annual Canadian Arts prize, worth $30,000, awarded in partnership with the Royal Canadian Academy of the Arts (RCA) to a recent or current MFA graduate student with a specialization in painting.
The Joseph Plaskett Foundation was established in 2004 by Canadian-born artist Joseph Plaskett, to support a mature Canadian student to travel and make art in Europe for one year in emulation of what Emily Carr allowed Plaskett to do in 1946. The Royal Canadian Academy of Arts partnered with the Joseph Plaskett Foundation in 2009 to support and administer the award process.
Award recipients
Mark Neufeld (2004)
Jennifer Lefort (2005)
Ehryn Torrell (2006)
Todd Tremeer (2007)
Nam Duc Nguyen (2008)
Vitaly Medvedovsky (2009)
Megan Hepburn (2010)
Jessica Groome (2011)
Philip Delisle (2012)
Julie Trudel (2013)
Collin Johanson (2014)
Stanzie Tooth (2015)
Ambera Wellmann (2016)
Caroline Mousseau (2019)
References
Canadian art awards
Awards established in 2004
|
Osceola High School may refer to:
Osceola High School (Arkansas) in Osceola, Arkansas
Osceola High School (Seminole, Florida) in Seminole, Florida
Osceola High School (Kissimmee, Florida) in Kissimmee, Florida
Osceola High School (Nebraska) in Osceola, Nebraska
Osceola High School (Wisconsin) in Osceola, Wisconsin
Osceola High School (Osceola, Missouri) in Osceola, Missouri
|
```c++
//
//
// path_to_url
//
#include "pxr/imaging/hd/rprim.h"
#include "pxr/imaging/hd/changeTracker.h"
#include "pxr/imaging/hd/instancer.h"
#include "pxr/imaging/hd/perfLog.h"
#include "pxr/imaging/hd/renderIndex.h"
PXR_NAMESPACE_OPEN_SCOPE
HdRprim::HdRprim(SdfPath const& id)
: _instancerId()
, _materialId()
, _sharedData(HdDrawingCoord::DefaultNumSlots,
/*visible=*/true)
{
_sharedData.rprimID = id;
}
HdRprim::~HdRprim() = default;
// your_sha256_hash---------- //
/// Rprim Hydra Engine API : Pre-Sync & Sync-Phase
// your_sha256_hash---------- //
bool
HdRprim::CanSkipDirtyBitPropagationAndSync(HdDirtyBits bits) const
{
// For invisible prims, we'd like to avoid syncing data, which involves:
// (a) the scene delegate pulling data post dirty-bit propagation
// (b) the rprim processing its dirty bits and
// (c) the rprim committing resource updates to the GPU
//
// However, the current design adds a draw item for a repr during repr
// initialization (see _InitRepr) even if a prim may be invisible, which
// requires us go through the sync process to avoid tripping other checks.
//
// XXX: We may want to avoid this altogether, or rethink how we approach
// the two workflow scenarios:
// ( i) objects that are always invisible (i.e., never loaded by the user or
// scene)
// (ii) vis-invis'ing objects
//
// For now, we take the hit of first repr initialization (+ sync) and avoid
// time-varying updates to the invisible prim.
//
// Note: If the sync is skipped, the dirty bits in the change tracker
// remain the same.
bool skip = false;
HdDirtyBits mask = (HdChangeTracker::DirtyVisibility |
HdChangeTracker::NewRepr);
if (!IsVisible() && !(bits & mask)) {
// By setting the propagated dirty bits to Clean, we effectively
// disable delegate and rprim sync
skip = true;
HD_PERF_COUNTER_INCR(HdPerfTokens->skipInvisibleRprimSync);
}
return skip;
}
HdDirtyBits
HdRprim::PropagateRprimDirtyBits(HdDirtyBits bits)
{
// If the dependent computations changed - assume all
// primvars are dirty
if (bits & HdChangeTracker::DirtyComputationPrimvarDesc) {
bits |= (HdChangeTracker::DirtyPoints |
HdChangeTracker::DirtyNormals |
HdChangeTracker::DirtyWidths |
HdChangeTracker::DirtyPrimvar);
}
// when refine level changes, topology becomes dirty.
// XXX: can we remove DirtyDisplayStyle then?
if (bits & HdChangeTracker::DirtyDisplayStyle) {
bits |= HdChangeTracker::DirtyTopology;
}
// if topology changes, all dependent bits become dirty.
if (bits & HdChangeTracker::DirtyTopology) {
bits |= (HdChangeTracker::DirtyPoints |
HdChangeTracker::DirtyNormals |
HdChangeTracker::DirtyPrimvar);
}
// Let subclasses propagate bits
return _PropagateDirtyBits(bits);
}
void
HdRprim::InitRepr(HdSceneDelegate* delegate,
TfToken const &reprToken,
HdDirtyBits *dirtyBits)
{
_InitRepr(reprToken, dirtyBits);
}
// your_sha256_hash---------- //
/// Rprim Hydra Engine API : Execute-Phase
// your_sha256_hash---------- //
const HdRepr::DrawItemUniquePtrVector &
HdRprim::GetDrawItems(TfToken const& reprToken) const
{
if (HdReprSharedPtr const repr = _GetRepr(reprToken)) {
return repr->GetDrawItems();
}
static HdRepr::DrawItemUniquePtrVector empty;
TF_CODING_ERROR("Rprim has no draw items for repr %s", reprToken.GetText());
return empty;
}
// your_sha256_hash---------- //
/// Rprim Hydra Engine API : Cleanup
// your_sha256_hash---------- //
void
HdRprim::Finalize(HdRenderParam *renderParam)
{
}
// your_sha256_hash---------- //
/// Rprim Data API
// your_sha256_hash---------- //
void
HdRprim::SetPrimId(int32_t primId)
{
_primId = primId;
// Don't set DirtyPrimID here, to avoid undesired variability tracking.
}
void
HdRprim::SetMaterialId(SdfPath const& materialId)
{
_materialId = materialId;
}
bool
HdRprim::IsDirty(HdChangeTracker &changeTracker) const
{
return changeTracker.IsRprimDirty(GetId());
}
void
HdRprim::UpdateReprSelector(HdSceneDelegate* delegate,
HdDirtyBits *dirtyBits)
{
if (HdChangeTracker::IsReprDirty(*dirtyBits, GetId())) {
_authoredReprSelector = delegate->GetReprSelector(GetId());
*dirtyBits &= ~HdChangeTracker::DirtyRepr;
}
}
void
HdRprim::UpdateRenderTag(HdSceneDelegate *delegate,
HdRenderParam *renderParam)
{
_renderTag = delegate->GetRenderTag(GetId());
}
// your_sha256_hash---------- //
/// Rprim Shared API
// your_sha256_hash---------- //
HdReprSharedPtr const &
HdRprim::_GetRepr(TfToken const &reprToken) const
{
_ReprVector::const_iterator reprIt =
std::find_if(_reprs.begin(), _reprs.end(),
_ReprComparator(reprToken));
if (reprIt == _reprs.end()) {
TF_CODING_ERROR("_InitRepr() should be called for repr %s on prim %s.",
reprToken.GetText(), GetId().GetText());
static const HdReprSharedPtr ERROR_RETURN;
return ERROR_RETURN;
}
return reprIt->second;
}
void
HdRprim::_UpdateVisibility(HdSceneDelegate* delegate,
HdDirtyBits *dirtyBits)
{
if (HdChangeTracker::IsVisibilityDirty(*dirtyBits, GetId())) {
_sharedData.visible = delegate->GetVisible(GetId());
}
}
void
HdRprim::_UpdateInstancer(HdSceneDelegate* delegate,
HdDirtyBits *dirtyBits)
{
if (HdChangeTracker::IsInstancerDirty(*dirtyBits, GetId())) {
SdfPath const& instancerId = delegate->GetInstancerId(GetId());
if (instancerId == _instancerId) {
return;
}
// If we have a new instancer ID, we need to update the dependency
// map and also update the stored instancer ID.
HdChangeTracker &tracker =
delegate->GetRenderIndex().GetChangeTracker();
if (!_instancerId.IsEmpty()) {
tracker.RemoveInstancerRprimDependency(_instancerId, GetId());
}
if (!instancerId.IsEmpty()) {
tracker.AddInstancerRprimDependency(instancerId, GetId());
}
_instancerId = instancerId;
}
}
VtMatrix4dArray
HdRprim::GetInstancerTransforms(HdSceneDelegate* delegate)
{
SdfPath instancerId = _instancerId;
VtMatrix4dArray transforms;
HdRenderIndex &renderIndex = delegate->GetRenderIndex();
while (!instancerId.IsEmpty()) {
transforms.push_back(delegate->GetInstancerTransform(instancerId));
HdInstancer *instancer = renderIndex.GetInstancer(instancerId);
if (instancer) {
instancerId = instancer->GetParentId();
} else {
instancerId = SdfPath();
}
}
return transforms;
}
PXR_NAMESPACE_CLOSE_SCOPE
```
|
Barrier resilience is an algorithmic optimization problem in computational geometry motivated by the design of wireless sensor networks, in which one seeks a path through a collection of barriers (often modeled as unit disks) that passes through as few barriers as possible.
Definitions
The barrier resilience problem was introduced by (using different terminology) to model the ability of wireless sensor networks to detect intruders robustly when some sensors may become faulty.
In this problem, the region under surveillance from each sensor is modeled as a unit disk in the Euclidean plane. An intruder can reach a target region of the plane without detection, if there exists a path in the plane connecting a given start region to the target region without crossing any of the sensor disks. The barrier resilience of a sensor network is defined to be the minimum, over all paths from the start region to the target region, of the number of sensor disks intersected by the path. The barrier resilience problem is the problem of computing this number by finding an optimal path through the barriers.
A simplification of the problem, which encapsulates most of its essential features, makes the target region be the origin of the plane, and the start region be the set of points outside the convex hull of the sensor disks. In this version of the problem, the goal is to connect the origin to points arbitrarily far from the origin by a path through as few sensor disks as possible.
Another variation of the problem counts the number of times a path crosses the boundary of a sensor disk. If a path crosses the same disk multiple times, each crossing counts towards the total. The barrier thickness of a sensor network is the minimum number of crossings of a path from the start region to the target region.
Computational complexity
Barrier thickness may be computed in polynomial time by constructing the arrangement of the barriers (the subdivision of the plane formed by overlaying all barrier boundaries) and computing a shortest path in the dual graph of this subdivision.
The complexity of barrier resilience for unit disk barriers is an open problem. It may be solved by a fixed-parameter tractable algorithm whose time is cubic in the total number of barriers and exponential in the square of the resilience, but it is not known whether it has a fully polynomial time solution.
The corresponding problem for barriers of some other shapes, including unit-length line segments or axis-aligned rectangles of aspect ratio close to 1, is known to be NP-hard.
A variation of the barrier resilience problem, studied by , restricts both the sensors and the escape path to a rectangle in the plane. In this variation, the goal is to find a path from the top side of the rectangle to the bottom side that passes through as few of the sensor disks as possible. By applying Menger's theorem to the unit disk graph defined from the barriers, this minimal number of disks can be shown to equal the maximum number of subsets into which all of the disks can be partitioned, such that each subset contains a chain of disks passing all the way from the left to the right side of the rectangle. As showed, this characterization allows the optimal resilience to be computed in polynomial time by transforming the problem into an instance of the maximum flow problem.
For unit disks with bounded ply (the maximum number of disks that have a common intersection) there exists a polynomial-time approximation scheme for the resilience, that can be generalized to barrier shapes of the same size as each other with bounded aspect ratios. For unit disks without assuming bounded ply, the problem of computing the resilience may be approximated to within a constant factor, using the fact that for this shape of barrier the optimal path can only cross each barrier a constant number of times, so the barrier thickness and barrier resilience are within a constant factor of each other. Similar methods can be generalized to non-uniform sensors of approximately equal size.
Notes
References
.
.
.
.
.
.
Computational geometry
|
```go
// Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file.
package upspin
import (
"encoding/json"
"fmt"
"strings"
)
// ParseEndpoint parses the string representation of an endpoint.
func ParseEndpoint(v string) (*Endpoint, error) {
elems := strings.SplitN(v, ",", 2)
switch elems[0] {
case "inprocess":
return &Endpoint{Transport: InProcess}, nil
case "remote":
if len(elems) < 2 {
return nil, fmt.Errorf("remote endpoint %q requires a netaddr", v)
}
return &Endpoint{Transport: Remote, NetAddr: NetAddr(elems[1])}, nil
case "unassigned":
return &Endpoint{Transport: Unassigned}, nil
}
return nil, fmt.Errorf("unknown transport type in endpoint %q", v)
}
// toString converts an endpoint to a string.
func (ep Endpoint) toString() (string, error) {
switch ep.Transport {
case Remote:
return fmt.Sprintf("%v,%v", ep.Transport, ep.NetAddr), nil
case InProcess, Unassigned:
return ep.Transport.String(), nil
}
// Note: can't use errors here.
return "", fmt.Errorf("unknown transport {%v, %v}", ep.Transport, ep.NetAddr)
}
// String converts an endpoint to a string.
func (ep Endpoint) String() string {
str, err := ep.toString()
if err != nil {
return err.Error()
}
return str
}
// MarshalJSON implements json.Marshaler.
func (ep *Endpoint) MarshalJSON() ([]byte, error) {
str, err := ep.toString()
if err != nil {
return nil, err
}
b, err := json.Marshal(str)
if err != nil {
return nil, fmt.Errorf("Endpoint: %v %#v", err, ep)
}
return b, nil
}
// UnmarshalJSON implements json.Unmarshaler.
func (ep *Endpoint) UnmarshalJSON(data []byte) error {
var str string
err := json.Unmarshal(data, &str)
if err != nil {
return fmt.Errorf("Endpoint: %v %#v", err, ep)
}
p, err := ParseEndpoint(str)
if err != nil {
return err
}
*ep = *p
return nil
}
// MarshalYAML implements yaml.Marshaler.
// See path_to_url#Marshaler.
func (ep Endpoint) MarshalYAML() (interface{}, error) {
s, err := ep.toString()
return s, err
}
// UnmarshalYAML implements yaml.Unmarshaler.
// See path_to_url#Unmarshaler.
func (ep *Endpoint) UnmarshalYAML(unmarshal func(interface{}) error) error {
var s string
if err := unmarshal(&s); err != nil {
return err
}
p, err := ParseEndpoint(s)
if err != nil {
return err
}
*ep = *p
return nil
}
// Unassigned (sic) reports whether the endpoint is nil or has value Unassigned.
func (ep *Endpoint) Unassigned() bool {
return ep == nil || ep.Transport == Unassigned
}
```
|
```c++
/////////1/////////2/////////3/////////4/////////5/////////6/////////7/////////8
// test_simple_class.cpp
// Use, modification and distribution is subject to the Boost Software
// path_to_url
// should pass compilation and execution
#include <fstream>
#include <cstdlib> // for rand()
#include <cstdio> // remove
#include <boost/config.hpp>
#if defined(BOOST_NO_STDC_NAMESPACE)
namespace std{
using ::rand;
using ::remove;
}
#endif
#include "../test/test_tools.hpp"
#include <boost/preprocessor/stringize.hpp>
// #include <boost/preprocessor/cat.hpp>
// the following fails with (only!) gcc 3.4
// #include BOOST_PP_STRINGIZE(BOOST_PP_CAT(../test/,BOOST_ARCHIVE_TEST))
// just copy over the files from the test directory
#include BOOST_PP_STRINGIZE(BOOST_ARCHIVE_TEST)
#include <boost/serialization/nvp.hpp>
#include <boost/serialization/binary_object.hpp>
class A {
friend class boost::serialization::access;
char data[150];
// note: from an aesthetic perspective, I would much prefer to have this
// defined out of line. Unfortunately, this trips a bug in the VC 6.0
// compiler. So hold our nose and put it her to permit running of tests.
template<class Archive>
void serialize(Archive & ar, const unsigned int /* file_version */){
ar & boost::serialization::make_nvp(
"data",
boost::serialization::make_binary_object(data, sizeof(data))
);
}
public:
A();
bool operator==(const A & rhs) const;
};
A::A(){
int i = sizeof(data);
while(i-- > 0)
data[i] = 0xff & std::rand();
}
bool A::operator==(const A & rhs) const {
int i = sizeof(data);
while(i-- > 0)
if(data[i] != rhs.data[i])
return false;
return true;
}
int test_main( int /* argc */, char* /* argv */[] )
{
const char * testfile = boost::archive::tmpnam(NULL);
BOOST_REQUIRE(NULL != testfile);
const A a;
A a1;
const int i = 12345;
int i1 = 34790;
{
test_ostream os(testfile, TEST_STREAM_FLAGS);
test_oarchive oa(os, TEST_ARCHIVE_FLAGS);
oa << BOOST_SERIALIZATION_NVP(a);
// note: add a little bit on the end of the archive to detect
// failure of text mode binary.
oa << BOOST_SERIALIZATION_NVP(i);
}
{
test_istream is(testfile, TEST_STREAM_FLAGS);
test_iarchive ia(is, TEST_ARCHIVE_FLAGS);
ia >> BOOST_SERIALIZATION_NVP(a1);
ia >> BOOST_SERIALIZATION_NVP(i1);
}
BOOST_CHECK(i == i1);
BOOST_CHECK(a == a1);
std::remove(testfile);
return EXIT_SUCCESS;
}
// EOF
```
|
Gordon Rugby Football Club is a rugby union club based on the North Shore of Sydney. The club, known as the Gordon Highlanders, plays out of Chatswood Oval and competes in the New South Wales Rugby Union grade competition.
Club information
Premiership Titles – Shute Shield: 9 (1949, 1952, 1956, 1958, 1976, 1993, 1995, 1998 & 2020)
Club Championships: 13
President: Brad Harrison
1st Grade Head Coach: Brian Melrose
1st Colts Head Coach: Josh Mitchell
General Manager Ace Naati
The original Gordon Rugby Football Club was founded in 1927 on Sydney's North Shore, playing in the Metropolitan Junior Competitions and its home games on Roseville Chase Oval. The club was disbanded in 1930 and the following year, many of its players transferred to the newly formed Roseville Junior Rugby Union Football Club, whose home ground was Chatswood Oval. In the 1935 season, the club won the Metropolitan Junior Club Championship, the Kentwell Cup and its second grade, the Bourke Cup.
Following its success the club was admitted to the Grade Competition in 1936 and changed its name to the Gordon District Rugby Union Football Club, fielding four grade and two junior sides, which participated in the Metropolitan Junior Competition.
By 1939, the 1st XV had won the minor premiership but were defeated in the final by the ultimate premiers. Apart from the 4th grade team winning a premiership in 1946, it was 1949 before Gordon won the Club Championship with its 1st and 4th grade teams, with all four teams playing in the semi-finals.
In 1949, the club adopted a new jersey incorporating the colours of the Gordon tartan and its club song “A Gordon For Me”, emphasising the strong Scottish influence within the club.
First grade premierships were achieved in 1949, 1952, 1956, 1958, 1976, 1993, 1995, 1998 and 2020. Over the years, the lower grade sides have played prominently at or near the top of the competition tables with Gordon winning the Club Championship 13 times.
Many Gordon players have earned representative honours playing for the state and Australia – far too many to list here. Trevor Allan, who has won lasting international acclaim, together with Bob Davidson and Peter Sullivan have all captained Australian touring teams. Stirling Mortlock played 80 Tests for the Wallabies and captained for 29 of them. He was a Gordon Junior and Colt.
In addition to the club's attractive style of play it is renowned for its dedication to the promotion of the game at all levels, its tremendous club spirit, its enthusiastic supporters and an excellent and supportive administration.
Under the banner of Gordon Rugby, the Gordon Rugby Football Club Ltd currently fields four grade and three colts sides, plus reserves and representative junior sides from village clubs Chatswood, Hornsby, Killara-West Pymble, Lane Cove, Lindfield, Roseville, St Ives and Wahroonga
For the 2022 season Gordon has appointed Brian Melrose as 1st Grade Head Coach with Andy Connors as 1st Colts Head Coach.
Current squad
The squad for the 2022 season
International representatives
Rugby Championships
Club Championships: 13 – 1949 1952 1957 1962 1971 1974 1975 1976 1978 1990 1993 1998 2020
1st Grade Premierships: 9 – 1949, 1952, 1956, 1958, 1976, 1993, 1995, 1998 & 2020.
1st Grade Runners Up: 1950, 1955, 1957, 1967, 1969, 1972, 1980, 1992 & 2022.
2nd Grade Premierships: – 1961, 1972, 1974, 1976 & 1981.
2nd Grade Runners Up: 1950, 1952, 1955, 1962, 1968, 1971, 1975, 1980, 2008 & 2009.
3rd Grade Premierships: – 12 – 1959, 1960, 1967, 1970, 1972, 1977, 1983, 1993, 2008, 2009, 2019 & 2020.
3rd Grade Runners Up: – 1948, 1951, 1962, 1966, 1969, 1973, 1974, 1975, 1978, 1981, 1992, 1994, 1999 & 2000.
4th Grade Premierships: 18 – 1949, 1952, 1953,1955, 1958, 1969, 1970, 1972, 1974, 1975, 1980, 1985, 1991, 1992, 1993, 1999, 2000 & 2007.
4th Grade Runners Up: – 1950, 1954, 1959, 1960, 1961, 1973, 1977, 1983, 1987 & 2020
Gordon D.R.U.F.C Veterans (World War II) KIA
Club song
(To the tune of the Scottish folk song of the same name)
References
External links
Gordon RFC home page
Jack Dempsey & Tom Matthews participate in project
Gordon Stags Rugby Site
Rugby union teams in Sydney
Rugby clubs established in 1936
1936 establishments in Australia
Gordon, New South Wales
|
```c++
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
#include "src/objects-inl.h"
#include "test/unittests/compiler/instruction-selector-unittest.h"
namespace v8 {
namespace internal {
namespace compiler {
namespace {
template <typename T>
struct MachInst {
T constructor;
const char* constructor_name;
ArchOpcode arch_opcode;
MachineType machine_type;
};
typedef MachInst<Node* (RawMachineAssembler::*)(Node*)> MachInst1;
typedef MachInst<Node* (RawMachineAssembler::*)(Node*, Node*)> MachInst2;
template <typename T>
std::ostream& operator<<(std::ostream& os, const MachInst<T>& mi) {
return os << mi.constructor_name;
}
struct Shift {
MachInst2 mi;
AddressingMode mode;
};
std::ostream& operator<<(std::ostream& os, const Shift& shift) {
return os << shift.mi;
}
// Helper to build Int32Constant or Int64Constant depending on the given
// machine type.
Node* BuildConstant(InstructionSelectorTest::StreamBuilder& m, MachineType type,
int64_t value) {
switch (type.representation()) {
case MachineRepresentation::kWord32:
return m.Int32Constant(static_cast<int32_t>(value));
break;
case MachineRepresentation::kWord64:
return m.Int64Constant(value);
break;
default:
UNIMPLEMENTED();
}
return NULL;
}
// ARM64 logical instructions.
const MachInst2 kLogicalInstructions[] = {
{&RawMachineAssembler::Word32And, "Word32And", kArm64And32,
MachineType::Int32()},
{&RawMachineAssembler::Word64And, "Word64And", kArm64And,
MachineType::Int64()},
{&RawMachineAssembler::Word32Or, "Word32Or", kArm64Or32,
MachineType::Int32()},
{&RawMachineAssembler::Word64Or, "Word64Or", kArm64Or,
MachineType::Int64()},
{&RawMachineAssembler::Word32Xor, "Word32Xor", kArm64Eor32,
MachineType::Int32()},
{&RawMachineAssembler::Word64Xor, "Word64Xor", kArm64Eor,
MachineType::Int64()}};
// ARM64 logical immediates: contiguous set bits, rotated about a power of two
// sized block. The block is then duplicated across the word. Below is a random
// subset of the 32-bit immediates.
const uint32_t kLogical32Immediates[] = {
0x00000002, 0x00000003, 0x00000070, 0x00000080, 0x00000100, 0x000001C0,
0x00000300, 0x000007E0, 0x00003FFC, 0x00007FC0, 0x0003C000, 0x0003F000,
0x0003FFC0, 0x0003FFF8, 0x0007FF00, 0x0007FFE0, 0x000E0000, 0x001E0000,
0x001FFFFC, 0x003F0000, 0x003F8000, 0x00780000, 0x007FC000, 0x00FF0000,
0x01800000, 0x01800180, 0x01F801F8, 0x03FE0000, 0x03FFFFC0, 0x03FFFFFC,
0x06000000, 0x07FC0000, 0x07FFC000, 0x07FFFFC0, 0x07FFFFE0, 0x0FFE0FFE,
0x0FFFF800, 0x0FFFFFF0, 0x0FFFFFFF, 0x18001800, 0x1F001F00, 0x1F801F80,
0x30303030, 0x3FF03FF0, 0x3FF83FF8, 0x3FFF0000, 0x3FFF8000, 0x3FFFFFC0,
0x70007000, 0x7F7F7F7F, 0x7FC00000, 0x7FFFFFC0, 0x8000001F, 0x800001FF,
0x81818181, 0x9FFF9FFF, 0xC00007FF, 0xC0FFFFFF, 0xDDDDDDDD, 0xE00001FF,
0xE00003FF, 0xE007FFFF, 0xEFFFEFFF, 0xF000003F, 0xF001F001, 0xF3FFF3FF,
0xF800001F, 0xF80FFFFF, 0xF87FF87F, 0xFBFBFBFB, 0xFC00001F, 0xFC0000FF,
0xFC0001FF, 0xFC03FC03, 0xFE0001FF, 0xFF000001, 0xFF03FF03, 0xFF800000,
0xFF800FFF, 0xFF801FFF, 0xFF87FFFF, 0xFFC0003F, 0xFFC007FF, 0xFFCFFFCF,
0xFFE00003, 0xFFE1FFFF, 0xFFF0001F, 0xFFF07FFF, 0xFFF80007, 0xFFF87FFF,
0xFFFC00FF, 0xFFFE07FF, 0xFFFF00FF, 0xFFFFC001, 0xFFFFF007, 0xFFFFF3FF,
0xFFFFF807, 0xFFFFF9FF, 0xFFFFFC0F, 0xFFFFFEFF};
// Random subset of 64-bit logical immediates.
const uint64_t kLogical64Immediates[] = {
0x0000000000000001, 0x0000000000000002, 0x0000000000000003,
0x0000000000000070, 0x0000000000000080, 0x0000000000000100,
0x00000000000001C0, 0x0000000000000300, 0x0000000000000600,
0x00000000000007E0, 0x0000000000003FFC, 0x0000000000007FC0,
0x0000000600000000, 0x0000003FFFFFFFFC, 0x000000F000000000,
0x000001F800000000, 0x0003FC0000000000, 0x0003FC000003FC00,
0x0003FFFFFFC00000, 0x0003FFFFFFFFFFC0, 0x0006000000060000,
0x003FFFFFFFFC0000, 0x0180018001800180, 0x01F801F801F801F8,
0x0600000000000000, 0x1000000010000000, 0x1000100010001000,
0x1010101010101010, 0x1111111111111111, 0x1F001F001F001F00,
0x1F1F1F1F1F1F1F1F, 0x1FFFFFFFFFFFFFFE, 0x3FFC3FFC3FFC3FFC,
0x5555555555555555, 0x7F7F7F7F7F7F7F7F, 0x8000000000000000,
0x8000001F8000001F, 0x8181818181818181, 0x9999999999999999,
0x9FFF9FFF9FFF9FFF, 0xAAAAAAAAAAAAAAAA, 0xDDDDDDDDDDDDDDDD,
0xE0000000000001FF, 0xF800000000000000, 0xF8000000000001FF,
0xF807F807F807F807, 0xFEFEFEFEFEFEFEFE, 0xFFFEFFFEFFFEFFFE,
0xFFFFF807FFFFF807, 0xFFFFF9FFFFFFF9FF, 0xFFFFFC0FFFFFFC0F,
0xFFFFFC0FFFFFFFFF, 0xFFFFFEFFFFFFFEFF, 0xFFFFFEFFFFFFFFFF,
0xFFFFFF8000000000, 0xFFFFFFFEFFFFFFFE, 0xFFFFFFFFEFFFFFFF,
0xFFFFFFFFF9FFFFFF, 0xFFFFFFFFFF800000, 0xFFFFFFFFFFFFC0FF,
0xFFFFFFFFFFFFFFFE};
// ARM64 arithmetic instructions.
struct AddSub {
MachInst2 mi;
ArchOpcode negate_arch_opcode;
};
std::ostream& operator<<(std::ostream& os, const AddSub& op) {
return os << op.mi;
}
const AddSub kAddSubInstructions[] = {
{{&RawMachineAssembler::Int32Add, "Int32Add", kArm64Add32,
MachineType::Int32()},
kArm64Sub32},
{{&RawMachineAssembler::Int64Add, "Int64Add", kArm64Add,
MachineType::Int64()},
kArm64Sub},
{{&RawMachineAssembler::Int32Sub, "Int32Sub", kArm64Sub32,
MachineType::Int32()},
kArm64Add32},
{{&RawMachineAssembler::Int64Sub, "Int64Sub", kArm64Sub,
MachineType::Int64()},
kArm64Add}};
// ARM64 Add/Sub immediates: 12-bit immediate optionally shifted by 12.
// Below is a combination of a random subset and some edge values.
const int32_t kAddSubImmediates[] = {
0, 1, 69, 493, 599, 701, 719,
768, 818, 842, 945, 1246, 1286, 1429,
1669, 2171, 2179, 2182, 2254, 2334, 2338,
2343, 2396, 2449, 2610, 2732, 2855, 2876,
2944, 3377, 3458, 3475, 3476, 3540, 3574,
3601, 3813, 3871, 3917, 4095, 4096, 16384,
364544, 462848, 970752, 1523712, 1863680, 2363392, 3219456,
3280896, 4247552, 4526080, 4575232, 4960256, 5505024, 5894144,
6004736, 6193152, 6385664, 6795264, 7114752, 7233536, 7348224,
7499776, 7573504, 7729152, 8634368, 8937472, 9465856, 10354688,
10682368, 11059200, 11460608, 13168640, 13176832, 14336000, 15028224,
15597568, 15892480, 16773120};
// ARM64 flag setting data processing instructions.
const MachInst2 kDPFlagSetInstructions[] = {
{&RawMachineAssembler::Word32And, "Word32And", kArm64Tst32,
MachineType::Int32()},
{&RawMachineAssembler::Int32Add, "Int32Add", kArm64Cmn32,
MachineType::Int32()},
{&RawMachineAssembler::Int32Sub, "Int32Sub", kArm64Cmp32,
MachineType::Int32()},
{&RawMachineAssembler::Word64And, "Word64And", kArm64Tst,
MachineType::Int64()}};
// ARM64 arithmetic with overflow instructions.
const MachInst2 kOvfAddSubInstructions[] = {
{&RawMachineAssembler::Int32AddWithOverflow, "Int32AddWithOverflow",
kArm64Add32, MachineType::Int32()},
{&RawMachineAssembler::Int32SubWithOverflow, "Int32SubWithOverflow",
kArm64Sub32, MachineType::Int32()},
{&RawMachineAssembler::Int64AddWithOverflow, "Int64AddWithOverflow",
kArm64Add, MachineType::Int64()},
{&RawMachineAssembler::Int64SubWithOverflow, "Int64SubWithOverflow",
kArm64Sub, MachineType::Int64()}};
// ARM64 shift instructions.
const Shift kShiftInstructions[] = {
{{&RawMachineAssembler::Word32Shl, "Word32Shl", kArm64Lsl32,
MachineType::Int32()},
kMode_Operand2_R_LSL_I},
{{&RawMachineAssembler::Word64Shl, "Word64Shl", kArm64Lsl,
MachineType::Int64()},
kMode_Operand2_R_LSL_I},
{{&RawMachineAssembler::Word32Shr, "Word32Shr", kArm64Lsr32,
MachineType::Int32()},
kMode_Operand2_R_LSR_I},
{{&RawMachineAssembler::Word64Shr, "Word64Shr", kArm64Lsr,
MachineType::Int64()},
kMode_Operand2_R_LSR_I},
{{&RawMachineAssembler::Word32Sar, "Word32Sar", kArm64Asr32,
MachineType::Int32()},
kMode_Operand2_R_ASR_I},
{{&RawMachineAssembler::Word64Sar, "Word64Sar", kArm64Asr,
MachineType::Int64()},
kMode_Operand2_R_ASR_I},
{{&RawMachineAssembler::Word32Ror, "Word32Ror", kArm64Ror32,
MachineType::Int32()},
kMode_Operand2_R_ROR_I},
{{&RawMachineAssembler::Word64Ror, "Word64Ror", kArm64Ror,
MachineType::Int64()},
kMode_Operand2_R_ROR_I}};
// ARM64 Mul/Div instructions.
const MachInst2 kMulDivInstructions[] = {
{&RawMachineAssembler::Int32Mul, "Int32Mul", kArm64Mul32,
MachineType::Int32()},
{&RawMachineAssembler::Int64Mul, "Int64Mul", kArm64Mul,
MachineType::Int64()},
{&RawMachineAssembler::Int32Div, "Int32Div", kArm64Idiv32,
MachineType::Int32()},
{&RawMachineAssembler::Int64Div, "Int64Div", kArm64Idiv,
MachineType::Int64()},
{&RawMachineAssembler::Uint32Div, "Uint32Div", kArm64Udiv32,
MachineType::Int32()},
{&RawMachineAssembler::Uint64Div, "Uint64Div", kArm64Udiv,
MachineType::Int64()}};
// ARM64 FP arithmetic instructions.
const MachInst2 kFPArithInstructions[] = {
{&RawMachineAssembler::Float64Add, "Float64Add", kArm64Float64Add,
MachineType::Float64()},
{&RawMachineAssembler::Float64Sub, "Float64Sub", kArm64Float64Sub,
MachineType::Float64()},
{&RawMachineAssembler::Float64Mul, "Float64Mul", kArm64Float64Mul,
MachineType::Float64()},
{&RawMachineAssembler::Float64Div, "Float64Div", kArm64Float64Div,
MachineType::Float64()}};
struct FPCmp {
MachInst2 mi;
FlagsCondition cond;
FlagsCondition commuted_cond;
};
std::ostream& operator<<(std::ostream& os, const FPCmp& cmp) {
return os << cmp.mi;
}
// ARM64 FP comparison instructions.
const FPCmp kFPCmpInstructions[] = {
{{&RawMachineAssembler::Float64Equal, "Float64Equal", kArm64Float64Cmp,
MachineType::Float64()},
kEqual,
kEqual},
{{&RawMachineAssembler::Float64LessThan, "Float64LessThan",
kArm64Float64Cmp, MachineType::Float64()},
kFloatLessThan,
kFloatGreaterThan},
{{&RawMachineAssembler::Float64LessThanOrEqual, "Float64LessThanOrEqual",
kArm64Float64Cmp, MachineType::Float64()},
kFloatLessThanOrEqual,
kFloatGreaterThanOrEqual},
{{&RawMachineAssembler::Float32Equal, "Float32Equal", kArm64Float32Cmp,
MachineType::Float32()},
kEqual,
kEqual},
{{&RawMachineAssembler::Float32LessThan, "Float32LessThan",
kArm64Float32Cmp, MachineType::Float32()},
kFloatLessThan,
kFloatGreaterThan},
{{&RawMachineAssembler::Float32LessThanOrEqual, "Float32LessThanOrEqual",
kArm64Float32Cmp, MachineType::Float32()},
kFloatLessThanOrEqual,
kFloatGreaterThanOrEqual}};
struct Conversion {
// The machine_type field in MachInst1 represents the destination type.
MachInst1 mi;
MachineType src_machine_type;
};
std::ostream& operator<<(std::ostream& os, const Conversion& conv) {
return os << conv.mi;
}
// ARM64 type conversion instructions.
const Conversion kConversionInstructions[] = {
{{&RawMachineAssembler::ChangeFloat32ToFloat64, "ChangeFloat32ToFloat64",
kArm64Float32ToFloat64, MachineType::Float64()},
MachineType::Float32()},
{{&RawMachineAssembler::TruncateFloat64ToFloat32,
"TruncateFloat64ToFloat32", kArm64Float64ToFloat32,
MachineType::Float32()},
MachineType::Float64()},
{{&RawMachineAssembler::ChangeInt32ToInt64, "ChangeInt32ToInt64",
kArm64Sxtw, MachineType::Int64()},
MachineType::Int32()},
{{&RawMachineAssembler::ChangeUint32ToUint64, "ChangeUint32ToUint64",
kArm64Mov32, MachineType::Uint64()},
MachineType::Uint32()},
{{&RawMachineAssembler::TruncateInt64ToInt32, "TruncateInt64ToInt32",
kArchNop, MachineType::Int32()},
MachineType::Int64()},
{{&RawMachineAssembler::ChangeInt32ToFloat64, "ChangeInt32ToFloat64",
kArm64Int32ToFloat64, MachineType::Float64()},
MachineType::Int32()},
{{&RawMachineAssembler::ChangeUint32ToFloat64, "ChangeUint32ToFloat64",
kArm64Uint32ToFloat64, MachineType::Float64()},
MachineType::Uint32()},
{{&RawMachineAssembler::ChangeFloat64ToInt32, "ChangeFloat64ToInt32",
kArm64Float64ToInt32, MachineType::Int32()},
MachineType::Float64()},
{{&RawMachineAssembler::ChangeFloat64ToUint32, "ChangeFloat64ToUint32",
kArm64Float64ToUint32, MachineType::Uint32()},
MachineType::Float64()}};
// ARM64 instructions that clear the top 32 bits of the destination.
const MachInst2 kCanElideChangeUint32ToUint64[] = {
{&RawMachineAssembler::Word32And, "Word32And", kArm64And32,
MachineType::Uint32()},
{&RawMachineAssembler::Word32Or, "Word32Or", kArm64Or32,
MachineType::Uint32()},
{&RawMachineAssembler::Word32Xor, "Word32Xor", kArm64Eor32,
MachineType::Uint32()},
{&RawMachineAssembler::Word32Shl, "Word32Shl", kArm64Lsl32,
MachineType::Uint32()},
{&RawMachineAssembler::Word32Shr, "Word32Shr", kArm64Lsr32,
MachineType::Uint32()},
{&RawMachineAssembler::Word32Sar, "Word32Sar", kArm64Asr32,
MachineType::Uint32()},
{&RawMachineAssembler::Word32Ror, "Word32Ror", kArm64Ror32,
MachineType::Uint32()},
{&RawMachineAssembler::Word32Equal, "Word32Equal", kArm64Cmp32,
MachineType::Uint32()},
{&RawMachineAssembler::Int32Add, "Int32Add", kArm64Add32,
MachineType::Int32()},
{&RawMachineAssembler::Int32AddWithOverflow, "Int32AddWithOverflow",
kArm64Add32, MachineType::Int32()},
{&RawMachineAssembler::Int32Sub, "Int32Sub", kArm64Sub32,
MachineType::Int32()},
{&RawMachineAssembler::Int32SubWithOverflow, "Int32SubWithOverflow",
kArm64Sub32, MachineType::Int32()},
{&RawMachineAssembler::Int32Mul, "Int32Mul", kArm64Mul32,
MachineType::Int32()},
{&RawMachineAssembler::Int32Div, "Int32Div", kArm64Idiv32,
MachineType::Int32()},
{&RawMachineAssembler::Int32Mod, "Int32Mod", kArm64Imod32,
MachineType::Int32()},
{&RawMachineAssembler::Int32LessThan, "Int32LessThan", kArm64Cmp32,
MachineType::Int32()},
{&RawMachineAssembler::Int32LessThanOrEqual, "Int32LessThanOrEqual",
kArm64Cmp32, MachineType::Int32()},
{&RawMachineAssembler::Uint32Div, "Uint32Div", kArm64Udiv32,
MachineType::Uint32()},
{&RawMachineAssembler::Uint32LessThan, "Uint32LessThan", kArm64Cmp32,
MachineType::Uint32()},
{&RawMachineAssembler::Uint32LessThanOrEqual, "Uint32LessThanOrEqual",
kArm64Cmp32, MachineType::Uint32()},
{&RawMachineAssembler::Uint32Mod, "Uint32Mod", kArm64Umod32,
MachineType::Uint32()},
};
} // namespace
// your_sha256_hash-------------
// Logical instructions.
typedef InstructionSelectorTestWithParam<MachInst2>
InstructionSelectorLogicalTest;
TEST_P(InstructionSelectorLogicalTest, Parameter) {
const MachInst2 dpi = GetParam();
const MachineType type = dpi.machine_type;
StreamBuilder m(this, type, type, type);
m.Return((m.*dpi.constructor)(m.Parameter(0), m.Parameter(1)));
Stream s = m.Build();
ASSERT_EQ(1U, s.size());
EXPECT_EQ(dpi.arch_opcode, s[0]->arch_opcode());
EXPECT_EQ(2U, s[0]->InputCount());
EXPECT_EQ(1U, s[0]->OutputCount());
}
TEST_P(InstructionSelectorLogicalTest, Immediate) {
const MachInst2 dpi = GetParam();
const MachineType type = dpi.machine_type;
if (type == MachineType::Int32()) {
// Immediate on the right.
TRACED_FOREACH(int32_t, imm, kLogical32Immediates) {
StreamBuilder m(this, type, type);
m.Return((m.*dpi.constructor)(m.Parameter(0), m.Int32Constant(imm)));
Stream s = m.Build();
ASSERT_EQ(1U, s.size());
EXPECT_EQ(dpi.arch_opcode, s[0]->arch_opcode());
ASSERT_EQ(2U, s[0]->InputCount());
EXPECT_TRUE(s[0]->InputAt(1)->IsImmediate());
EXPECT_EQ(imm, s.ToInt32(s[0]->InputAt(1)));
EXPECT_EQ(1U, s[0]->OutputCount());
}
// Immediate on the left; all logical ops should commute.
TRACED_FOREACH(int32_t, imm, kLogical32Immediates) {
StreamBuilder m(this, type, type);
m.Return((m.*dpi.constructor)(m.Int32Constant(imm), m.Parameter(0)));
Stream s = m.Build();
ASSERT_EQ(1U, s.size());
EXPECT_EQ(dpi.arch_opcode, s[0]->arch_opcode());
ASSERT_EQ(2U, s[0]->InputCount());
EXPECT_TRUE(s[0]->InputAt(1)->IsImmediate());
EXPECT_EQ(imm, s.ToInt32(s[0]->InputAt(1)));
EXPECT_EQ(1U, s[0]->OutputCount());
}
} else if (type == MachineType::Int64()) {
// Immediate on the right.
TRACED_FOREACH(int64_t, imm, kLogical64Immediates) {
StreamBuilder m(this, type, type);
m.Return((m.*dpi.constructor)(m.Parameter(0), m.Int64Constant(imm)));
Stream s = m.Build();
ASSERT_EQ(1U, s.size());
EXPECT_EQ(dpi.arch_opcode, s[0]->arch_opcode());
ASSERT_EQ(2U, s[0]->InputCount());
EXPECT_TRUE(s[0]->InputAt(1)->IsImmediate());
EXPECT_EQ(imm, s.ToInt64(s[0]->InputAt(1)));
EXPECT_EQ(1U, s[0]->OutputCount());
}
// Immediate on the left; all logical ops should commute.
TRACED_FOREACH(int64_t, imm, kLogical64Immediates) {
StreamBuilder m(this, type, type);
m.Return((m.*dpi.constructor)(m.Int64Constant(imm), m.Parameter(0)));
Stream s = m.Build();
ASSERT_EQ(1U, s.size());
EXPECT_EQ(dpi.arch_opcode, s[0]->arch_opcode());
ASSERT_EQ(2U, s[0]->InputCount());
EXPECT_TRUE(s[0]->InputAt(1)->IsImmediate());
EXPECT_EQ(imm, s.ToInt64(s[0]->InputAt(1)));
EXPECT_EQ(1U, s[0]->OutputCount());
}
}
}
TEST_P(InstructionSelectorLogicalTest, ShiftByImmediate) {
const MachInst2 dpi = GetParam();
const MachineType type = dpi.machine_type;
TRACED_FOREACH(Shift, shift, kShiftInstructions) {
// Only test 64-bit shifted operands with 64-bit instructions.
if (shift.mi.machine_type != type) continue;
TRACED_FORRANGE(int, imm, 0, ((type == MachineType::Int32()) ? 31 : 63)) {
StreamBuilder m(this, type, type, type);
m.Return((m.*dpi.constructor)(
m.Parameter(0),
(m.*shift.mi.constructor)(m.Parameter(1),
BuildConstant(m, type, imm))));
Stream s = m.Build();
ASSERT_EQ(1U, s.size());
EXPECT_EQ(dpi.arch_opcode, s[0]->arch_opcode());
EXPECT_EQ(shift.mode, s[0]->addressing_mode());
EXPECT_EQ(3U, s[0]->InputCount());
EXPECT_EQ(imm, s.ToInt64(s[0]->InputAt(2)));
EXPECT_EQ(1U, s[0]->OutputCount());
}
TRACED_FORRANGE(int, imm, 0, ((type == MachineType::Int32()) ? 31 : 63)) {
StreamBuilder m(this, type, type, type);
m.Return((m.*dpi.constructor)(
(m.*shift.mi.constructor)(m.Parameter(1),
BuildConstant(m, type, imm)),
m.Parameter(0)));
Stream s = m.Build();
ASSERT_EQ(1U, s.size());
EXPECT_EQ(dpi.arch_opcode, s[0]->arch_opcode());
EXPECT_EQ(shift.mode, s[0]->addressing_mode());
EXPECT_EQ(3U, s[0]->InputCount());
EXPECT_EQ(imm, s.ToInt64(s[0]->InputAt(2)));
EXPECT_EQ(1U, s[0]->OutputCount());
}
}
}
INSTANTIATE_TEST_CASE_P(InstructionSelectorTest, InstructionSelectorLogicalTest,
::testing::ValuesIn(kLogicalInstructions));
// your_sha256_hash-------------
// Add and Sub instructions.
typedef InstructionSelectorTestWithParam<AddSub> InstructionSelectorAddSubTest;
TEST_P(InstructionSelectorAddSubTest, Parameter) {
const AddSub dpi = GetParam();
const MachineType type = dpi.mi.machine_type;
StreamBuilder m(this, type, type, type);
m.Return((m.*dpi.mi.constructor)(m.Parameter(0), m.Parameter(1)));
Stream s = m.Build();
ASSERT_EQ(1U, s.size());
EXPECT_EQ(dpi.mi.arch_opcode, s[0]->arch_opcode());
EXPECT_EQ(2U, s[0]->InputCount());
EXPECT_EQ(1U, s[0]->OutputCount());
}
TEST_P(InstructionSelectorAddSubTest, ImmediateOnRight) {
const AddSub dpi = GetParam();
const MachineType type = dpi.mi.machine_type;
TRACED_FOREACH(int32_t, imm, kAddSubImmediates) {
StreamBuilder m(this, type, type);
m.Return(
(m.*dpi.mi.constructor)(m.Parameter(0), BuildConstant(m, type, imm)));
Stream s = m.Build();
ASSERT_EQ(1U, s.size());
EXPECT_EQ(dpi.mi.arch_opcode, s[0]->arch_opcode());
ASSERT_EQ(2U, s[0]->InputCount());
EXPECT_TRUE(s[0]->InputAt(1)->IsImmediate());
EXPECT_EQ(imm, s.ToInt64(s[0]->InputAt(1)));
EXPECT_EQ(1U, s[0]->OutputCount());
}
}
TEST_P(InstructionSelectorAddSubTest, NegImmediateOnRight) {
const AddSub dpi = GetParam();
const MachineType type = dpi.mi.machine_type;
TRACED_FOREACH(int32_t, imm, kAddSubImmediates) {
if (imm == 0) continue;
StreamBuilder m(this, type, type);
m.Return(
(m.*dpi.mi.constructor)(m.Parameter(0), BuildConstant(m, type, -imm)));
Stream s = m.Build();
ASSERT_EQ(1U, s.size());
EXPECT_EQ(dpi.negate_arch_opcode, s[0]->arch_opcode());
ASSERT_EQ(2U, s[0]->InputCount());
ASSERT_TRUE(s[0]->InputAt(1)->IsImmediate());
EXPECT_EQ(imm, s.ToInt32(s[0]->InputAt(1)));
EXPECT_EQ(1U, s[0]->OutputCount());
}
}
TEST_P(InstructionSelectorAddSubTest, ShiftByImmediateOnRight) {
const AddSub dpi = GetParam();
const MachineType type = dpi.mi.machine_type;
TRACED_FOREACH(Shift, shift, kShiftInstructions) {
// Only test 64-bit shifted operands with 64-bit instructions.
if (shift.mi.machine_type != type) continue;
if ((shift.mi.arch_opcode == kArm64Ror32) ||
(shift.mi.arch_opcode == kArm64Ror)) {
// Not supported by add/sub instructions.
continue;
}
TRACED_FORRANGE(int, imm, 0, ((type == MachineType::Int32()) ? 31 : 63)) {
StreamBuilder m(this, type, type, type);
m.Return((m.*dpi.mi.constructor)(
m.Parameter(0),
(m.*shift.mi.constructor)(m.Parameter(1),
BuildConstant(m, type, imm))));
Stream s = m.Build();
ASSERT_EQ(1U, s.size());
EXPECT_EQ(dpi.mi.arch_opcode, s[0]->arch_opcode());
EXPECT_EQ(shift.mode, s[0]->addressing_mode());
EXPECT_EQ(3U, s[0]->InputCount());
EXPECT_EQ(imm, s.ToInt64(s[0]->InputAt(2)));
EXPECT_EQ(1U, s[0]->OutputCount());
}
}
}
TEST_P(InstructionSelectorAddSubTest, UnsignedExtendByte) {
const AddSub dpi = GetParam();
const MachineType type = dpi.mi.machine_type;
StreamBuilder m(this, type, type, type);
m.Return((m.*dpi.mi.constructor)(
m.Parameter(0), m.Word32And(m.Parameter(1), m.Int32Constant(0xFF))));
Stream s = m.Build();
ASSERT_EQ(1U, s.size());
EXPECT_EQ(dpi.mi.arch_opcode, s[0]->arch_opcode());
EXPECT_EQ(kMode_Operand2_R_UXTB, s[0]->addressing_mode());
ASSERT_EQ(2U, s[0]->InputCount());
ASSERT_EQ(1U, s[0]->OutputCount());
}
TEST_P(InstructionSelectorAddSubTest, UnsignedExtendHalfword) {
const AddSub dpi = GetParam();
const MachineType type = dpi.mi.machine_type;
StreamBuilder m(this, type, type, type);
m.Return((m.*dpi.mi.constructor)(
m.Parameter(0), m.Word32And(m.Parameter(1), m.Int32Constant(0xFFFF))));
Stream s = m.Build();
ASSERT_EQ(1U, s.size());
EXPECT_EQ(dpi.mi.arch_opcode, s[0]->arch_opcode());
EXPECT_EQ(kMode_Operand2_R_UXTH, s[0]->addressing_mode());
ASSERT_EQ(2U, s[0]->InputCount());
ASSERT_EQ(1U, s[0]->OutputCount());
}
TEST_P(InstructionSelectorAddSubTest, SignedExtendByte) {
const AddSub dpi = GetParam();
const MachineType type = dpi.mi.machine_type;
StreamBuilder m(this, type, type, type);
m.Return((m.*dpi.mi.constructor)(
m.Parameter(0),
m.Word32Sar(m.Word32Shl(m.Parameter(1), m.Int32Constant(24)),
m.Int32Constant(24))));
Stream s = m.Build();
ASSERT_EQ(1U, s.size());
EXPECT_EQ(dpi.mi.arch_opcode, s[0]->arch_opcode());
EXPECT_EQ(kMode_Operand2_R_SXTB, s[0]->addressing_mode());
ASSERT_EQ(2U, s[0]->InputCount());
ASSERT_EQ(1U, s[0]->OutputCount());
}
TEST_P(InstructionSelectorAddSubTest, SignedExtendHalfword) {
const AddSub dpi = GetParam();
const MachineType type = dpi.mi.machine_type;
StreamBuilder m(this, type, type, type);
m.Return((m.*dpi.mi.constructor)(
m.Parameter(0),
m.Word32Sar(m.Word32Shl(m.Parameter(1), m.Int32Constant(16)),
m.Int32Constant(16))));
Stream s = m.Build();
ASSERT_EQ(1U, s.size());
EXPECT_EQ(dpi.mi.arch_opcode, s[0]->arch_opcode());
EXPECT_EQ(kMode_Operand2_R_SXTH, s[0]->addressing_mode());
ASSERT_EQ(2U, s[0]->InputCount());
ASSERT_EQ(1U, s[0]->OutputCount());
}
INSTANTIATE_TEST_CASE_P(InstructionSelectorTest, InstructionSelectorAddSubTest,
::testing::ValuesIn(kAddSubInstructions));
TEST_F(InstructionSelectorTest, AddImmediateOnLeft) {
{
// 32-bit add.
TRACED_FOREACH(int32_t, imm, kAddSubImmediates) {
StreamBuilder m(this, MachineType::Int32(), MachineType::Int32());
m.Return(m.Int32Add(m.Int32Constant(imm), m.Parameter(0)));
Stream s = m.Build();
ASSERT_EQ(1U, s.size());
EXPECT_EQ(kArm64Add32, s[0]->arch_opcode());
ASSERT_EQ(2U, s[0]->InputCount());
EXPECT_TRUE(s[0]->InputAt(1)->IsImmediate());
EXPECT_EQ(imm, s.ToInt32(s[0]->InputAt(1)));
EXPECT_EQ(1U, s[0]->OutputCount());
}
}
{
// 64-bit add.
TRACED_FOREACH(int32_t, imm, kAddSubImmediates) {
StreamBuilder m(this, MachineType::Int64(), MachineType::Int64());
m.Return(m.Int64Add(m.Int64Constant(imm), m.Parameter(0)));
Stream s = m.Build();
ASSERT_EQ(1U, s.size());
EXPECT_EQ(kArm64Add, s[0]->arch_opcode());
ASSERT_EQ(2U, s[0]->InputCount());
EXPECT_TRUE(s[0]->InputAt(1)->IsImmediate());
EXPECT_EQ(imm, s.ToInt64(s[0]->InputAt(1)));
EXPECT_EQ(1U, s[0]->OutputCount());
}
}
}
TEST_F(InstructionSelectorTest, SubZeroOnLeft) {
{
// 32-bit subtract.
StreamBuilder m(this, MachineType::Int32(), MachineType::Int32(),
MachineType::Int32());
m.Return(m.Int32Sub(m.Int32Constant(0), m.Parameter(0)));
Stream s = m.Build();
ASSERT_EQ(1U, s.size());
EXPECT_EQ(kArm64Sub32, s[0]->arch_opcode());
ASSERT_EQ(2U, s[0]->InputCount());
EXPECT_TRUE(s[0]->InputAt(0)->IsImmediate());
EXPECT_EQ(0, s.ToInt32(s[0]->InputAt(0)));
EXPECT_EQ(1U, s[0]->OutputCount());
}
{
// 64-bit subtract.
StreamBuilder m(this, MachineType::Int64(), MachineType::Int64(),
MachineType::Int64());
m.Return(m.Int64Sub(m.Int64Constant(0), m.Parameter(0)));
Stream s = m.Build();
ASSERT_EQ(1U, s.size());
EXPECT_EQ(kArm64Sub, s[0]->arch_opcode());
ASSERT_EQ(2U, s[0]->InputCount());
EXPECT_TRUE(s[0]->InputAt(0)->IsImmediate());
EXPECT_EQ(0, s.ToInt64(s[0]->InputAt(0)));
EXPECT_EQ(1U, s[0]->OutputCount());
}
}
TEST_F(InstructionSelectorTest, SubZeroOnLeftWithShift) {
TRACED_FOREACH(Shift, shift, kShiftInstructions) {
{
// Test 32-bit operations. Ignore ROR shifts, as subtract does not
// support them.
if ((shift.mi.machine_type != MachineType::Int32()) ||
(shift.mi.arch_opcode == kArm64Ror32) ||
(shift.mi.arch_opcode == kArm64Ror))
continue;
TRACED_FORRANGE(int, imm, -32, 63) {
StreamBuilder m(this, MachineType::Int32(), MachineType::Int32(),
MachineType::Int32());
m.Return(m.Int32Sub(
m.Int32Constant(0),
(m.*shift.mi.constructor)(m.Parameter(1), m.Int32Constant(imm))));
Stream s = m.Build();
ASSERT_EQ(1U, s.size());
EXPECT_EQ(kArm64Sub32, s[0]->arch_opcode());
ASSERT_EQ(3U, s[0]->InputCount());
EXPECT_TRUE(s[0]->InputAt(0)->IsImmediate());
EXPECT_EQ(0, s.ToInt32(s[0]->InputAt(0)));
EXPECT_EQ(shift.mode, s[0]->addressing_mode());
EXPECT_EQ(0x3F & imm, 0x3F & s.ToInt32(s[0]->InputAt(2)));
EXPECT_EQ(1U, s[0]->OutputCount());
}
}
{
// Test 64-bit operations. Ignore ROR shifts, as subtract does not
// support them.
if ((shift.mi.machine_type != MachineType::Int64()) ||
(shift.mi.arch_opcode == kArm64Ror32) ||
(shift.mi.arch_opcode == kArm64Ror))
continue;
TRACED_FORRANGE(int, imm, -32, 127) {
StreamBuilder m(this, MachineType::Int64(), MachineType::Int64(),
MachineType::Int64());
m.Return(m.Int64Sub(
m.Int64Constant(0),
(m.*shift.mi.constructor)(m.Parameter(1), m.Int64Constant(imm))));
Stream s = m.Build();
ASSERT_EQ(1U, s.size());
EXPECT_EQ(kArm64Sub, s[0]->arch_opcode());
ASSERT_EQ(3U, s[0]->InputCount());
EXPECT_TRUE(s[0]->InputAt(0)->IsImmediate());
EXPECT_EQ(0, s.ToInt32(s[0]->InputAt(0)));
EXPECT_EQ(shift.mode, s[0]->addressing_mode());
EXPECT_EQ(0x3F & imm, 0x3F & s.ToInt32(s[0]->InputAt(2)));
EXPECT_EQ(1U, s[0]->OutputCount());
}
}
}
}
TEST_F(InstructionSelectorTest, AddNegImmediateOnLeft) {
{
// 32-bit add.
TRACED_FOREACH(int32_t, imm, kAddSubImmediates) {
if (imm == 0) continue;
StreamBuilder m(this, MachineType::Int32(), MachineType::Int32());
m.Return(m.Int32Add(m.Int32Constant(-imm), m.Parameter(0)));
Stream s = m.Build();
ASSERT_EQ(1U, s.size());
EXPECT_EQ(kArm64Sub32, s[0]->arch_opcode());
ASSERT_EQ(2U, s[0]->InputCount());
ASSERT_TRUE(s[0]->InputAt(1)->IsImmediate());
EXPECT_EQ(imm, s.ToInt32(s[0]->InputAt(1)));
EXPECT_EQ(1U, s[0]->OutputCount());
}
}
{
// 64-bit add.
TRACED_FOREACH(int32_t, imm, kAddSubImmediates) {
if (imm == 0) continue;
StreamBuilder m(this, MachineType::Int64(), MachineType::Int64());
m.Return(m.Int64Add(m.Int64Constant(-imm), m.Parameter(0)));
Stream s = m.Build();
ASSERT_EQ(1U, s.size());
EXPECT_EQ(kArm64Sub, s[0]->arch_opcode());
ASSERT_EQ(2U, s[0]->InputCount());
ASSERT_TRUE(s[0]->InputAt(1)->IsImmediate());
EXPECT_EQ(imm, s.ToInt64(s[0]->InputAt(1)));
EXPECT_EQ(1U, s[0]->OutputCount());
}
}
}
TEST_F(InstructionSelectorTest, AddShiftByImmediateOnLeft) {
// 32-bit add.
TRACED_FOREACH(Shift, shift, kShiftInstructions) {
// Only test relevant shifted operands.
if (shift.mi.machine_type != MachineType::Int32()) continue;
if (shift.mi.arch_opcode == kArm64Ror32) continue;
// The available shift operand range is `0 <= imm < 32`, but we also test
// that immediates outside this range are handled properly (modulo-32).
TRACED_FORRANGE(int, imm, -32, 63) {
StreamBuilder m(this, MachineType::Int32(), MachineType::Int32(),
MachineType::Int32());
m.Return((m.Int32Add)(
(m.*shift.mi.constructor)(m.Parameter(1), m.Int32Constant(imm)),
m.Parameter(0)));
Stream s = m.Build();
ASSERT_EQ(1U, s.size());
EXPECT_EQ(kArm64Add32, s[0]->arch_opcode());
EXPECT_EQ(shift.mode, s[0]->addressing_mode());
EXPECT_EQ(3U, s[0]->InputCount());
EXPECT_EQ(0x3F & imm, 0x3F & s.ToInt64(s[0]->InputAt(2)));
EXPECT_EQ(1U, s[0]->OutputCount());
}
}
// 64-bit add.
TRACED_FOREACH(Shift, shift, kShiftInstructions) {
// Only test relevant shifted operands.
if (shift.mi.machine_type != MachineType::Int64()) continue;
if (shift.mi.arch_opcode == kArm64Ror) continue;
// The available shift operand range is `0 <= imm < 64`, but we also test
// that immediates outside this range are handled properly (modulo-64).
TRACED_FORRANGE(int, imm, -64, 127) {
StreamBuilder m(this, MachineType::Int64(), MachineType::Int64(),
MachineType::Int64());
m.Return((m.Int64Add)(
(m.*shift.mi.constructor)(m.Parameter(1), m.Int64Constant(imm)),
m.Parameter(0)));
Stream s = m.Build();
ASSERT_EQ(1U, s.size());
EXPECT_EQ(kArm64Add, s[0]->arch_opcode());
EXPECT_EQ(shift.mode, s[0]->addressing_mode());
EXPECT_EQ(3U, s[0]->InputCount());
EXPECT_EQ(0x3F & imm, 0x3F & s.ToInt64(s[0]->InputAt(2)));
EXPECT_EQ(1U, s[0]->OutputCount());
}
}
}
TEST_F(InstructionSelectorTest, AddUnsignedExtendByteOnLeft) {
{
StreamBuilder m(this, MachineType::Int32(), MachineType::Int32(),
MachineType::Int32());
m.Return(m.Int32Add(m.Word32And(m.Parameter(0), m.Int32Constant(0xFF)),
m.Parameter(1)));
Stream s = m.Build();
ASSERT_EQ(1U, s.size());
EXPECT_EQ(kArm64Add32, s[0]->arch_opcode());
EXPECT_EQ(kMode_Operand2_R_UXTB, s[0]->addressing_mode());
ASSERT_EQ(2U, s[0]->InputCount());
ASSERT_EQ(1U, s[0]->OutputCount());
}
{
StreamBuilder m(this, MachineType::Int64(), MachineType::Int32(),
MachineType::Int64());
m.Return(m.Int64Add(m.Word32And(m.Parameter(0), m.Int32Constant(0xFF)),
m.Parameter(1)));
Stream s = m.Build();
ASSERT_EQ(1U, s.size());
EXPECT_EQ(kArm64Add, s[0]->arch_opcode());
EXPECT_EQ(kMode_Operand2_R_UXTB, s[0]->addressing_mode());
ASSERT_EQ(2U, s[0]->InputCount());
ASSERT_EQ(1U, s[0]->OutputCount());
}
}
TEST_F(InstructionSelectorTest, AddUnsignedExtendHalfwordOnLeft) {
{
StreamBuilder m(this, MachineType::Int32(), MachineType::Int32(),
MachineType::Int32());
m.Return(m.Int32Add(m.Word32And(m.Parameter(0), m.Int32Constant(0xFFFF)),
m.Parameter(1)));
Stream s = m.Build();
ASSERT_EQ(1U, s.size());
EXPECT_EQ(kArm64Add32, s[0]->arch_opcode());
EXPECT_EQ(kMode_Operand2_R_UXTH, s[0]->addressing_mode());
ASSERT_EQ(2U, s[0]->InputCount());
ASSERT_EQ(1U, s[0]->OutputCount());
}
{
StreamBuilder m(this, MachineType::Int64(), MachineType::Int32(),
MachineType::Int64());
m.Return(m.Int64Add(m.Word32And(m.Parameter(0), m.Int32Constant(0xFFFF)),
m.Parameter(1)));
Stream s = m.Build();
ASSERT_EQ(1U, s.size());
EXPECT_EQ(kArm64Add, s[0]->arch_opcode());
EXPECT_EQ(kMode_Operand2_R_UXTH, s[0]->addressing_mode());
ASSERT_EQ(2U, s[0]->InputCount());
ASSERT_EQ(1U, s[0]->OutputCount());
}
}
TEST_F(InstructionSelectorTest, AddSignedExtendByteOnLeft) {
{
StreamBuilder m(this, MachineType::Int32(), MachineType::Int32(),
MachineType::Int32());
m.Return(
m.Int32Add(m.Word32Sar(m.Word32Shl(m.Parameter(0), m.Int32Constant(24)),
m.Int32Constant(24)),
m.Parameter(1)));
Stream s = m.Build();
ASSERT_EQ(1U, s.size());
EXPECT_EQ(kArm64Add32, s[0]->arch_opcode());
EXPECT_EQ(kMode_Operand2_R_SXTB, s[0]->addressing_mode());
ASSERT_EQ(2U, s[0]->InputCount());
ASSERT_EQ(1U, s[0]->OutputCount());
}
{
StreamBuilder m(this, MachineType::Int64(), MachineType::Int32(),
MachineType::Int64());
m.Return(
m.Int64Add(m.Word32Sar(m.Word32Shl(m.Parameter(0), m.Int32Constant(24)),
m.Int32Constant(24)),
m.Parameter(1)));
Stream s = m.Build();
ASSERT_EQ(1U, s.size());
EXPECT_EQ(kArm64Add, s[0]->arch_opcode());
EXPECT_EQ(kMode_Operand2_R_SXTB, s[0]->addressing_mode());
ASSERT_EQ(2U, s[0]->InputCount());
ASSERT_EQ(1U, s[0]->OutputCount());
}
}
TEST_F(InstructionSelectorTest, AddSignedExtendHalfwordOnLeft) {
{
StreamBuilder m(this, MachineType::Int32(), MachineType::Int32(),
MachineType::Int32());
m.Return(
m.Int32Add(m.Word32Sar(m.Word32Shl(m.Parameter(0), m.Int32Constant(16)),
m.Int32Constant(16)),
m.Parameter(1)));
Stream s = m.Build();
ASSERT_EQ(1U, s.size());
EXPECT_EQ(kArm64Add32, s[0]->arch_opcode());
EXPECT_EQ(kMode_Operand2_R_SXTH, s[0]->addressing_mode());
ASSERT_EQ(2U, s[0]->InputCount());
ASSERT_EQ(1U, s[0]->OutputCount());
}
{
StreamBuilder m(this, MachineType::Int64(), MachineType::Int32(),
MachineType::Int64());
m.Return(
m.Int64Add(m.Word32Sar(m.Word32Shl(m.Parameter(0), m.Int32Constant(16)),
m.Int32Constant(16)),
m.Parameter(1)));
Stream s = m.Build();
ASSERT_EQ(1U, s.size());
EXPECT_EQ(kArm64Add, s[0]->arch_opcode());
EXPECT_EQ(kMode_Operand2_R_SXTH, s[0]->addressing_mode());
ASSERT_EQ(2U, s[0]->InputCount());
ASSERT_EQ(1U, s[0]->OutputCount());
}
}
// your_sha256_hash-------------
// Data processing controlled branches.
typedef InstructionSelectorTestWithParam<MachInst2>
InstructionSelectorDPFlagSetTest;
TEST_P(InstructionSelectorDPFlagSetTest, BranchWithParameters) {
const MachInst2 dpi = GetParam();
const MachineType type = dpi.machine_type;
StreamBuilder m(this, type, type, type);
RawMachineLabel a, b;
m.Branch((m.*dpi.constructor)(m.Parameter(0), m.Parameter(1)), &a, &b);
m.Bind(&a);
m.Return(m.Int32Constant(1));
m.Bind(&b);
m.Return(m.Int32Constant(0));
Stream s = m.Build();
ASSERT_EQ(1U, s.size());
EXPECT_EQ(dpi.arch_opcode, s[0]->arch_opcode());
EXPECT_EQ(kFlags_branch, s[0]->flags_mode());
EXPECT_EQ(kNotEqual, s[0]->flags_condition());
}
INSTANTIATE_TEST_CASE_P(InstructionSelectorTest,
InstructionSelectorDPFlagSetTest,
::testing::ValuesIn(kDPFlagSetInstructions));
TEST_F(InstructionSelectorTest, Word32AndBranchWithImmediateOnRight) {
TRACED_FOREACH(int32_t, imm, kLogical32Immediates) {
// Skip the cases where the instruction selector would use tbz/tbnz.
if (base::bits::CountPopulation(static_cast<uint32_t>(imm)) == 1) continue;
StreamBuilder m(this, MachineType::Int32(), MachineType::Int32());
RawMachineLabel a, b;
m.Branch(m.Word32And(m.Parameter(0), m.Int32Constant(imm)), &a, &b);
m.Bind(&a);
m.Return(m.Int32Constant(1));
m.Bind(&b);
m.Return(m.Int32Constant(0));
Stream s = m.Build();
ASSERT_EQ(1U, s.size());
EXPECT_EQ(kArm64Tst32, s[0]->arch_opcode());
EXPECT_EQ(4U, s[0]->InputCount());
EXPECT_EQ(InstructionOperand::IMMEDIATE, s[0]->InputAt(1)->kind());
EXPECT_EQ(kFlags_branch, s[0]->flags_mode());
EXPECT_EQ(kNotEqual, s[0]->flags_condition());
}
}
TEST_F(InstructionSelectorTest, Word64AndBranchWithImmediateOnRight) {
TRACED_FOREACH(int64_t, imm, kLogical64Immediates) {
// Skip the cases where the instruction selector would use tbz/tbnz.
if (base::bits::CountPopulation(static_cast<uint64_t>(imm)) == 1) continue;
StreamBuilder m(this, MachineType::Int64(), MachineType::Int64());
RawMachineLabel a, b;
m.Branch(m.Word64And(m.Parameter(0), m.Int64Constant(imm)), &a, &b);
m.Bind(&a);
m.Return(m.Int32Constant(1));
m.Bind(&b);
m.Return(m.Int32Constant(0));
Stream s = m.Build();
ASSERT_EQ(1U, s.size());
EXPECT_EQ(kArm64Tst, s[0]->arch_opcode());
EXPECT_EQ(4U, s[0]->InputCount());
EXPECT_EQ(InstructionOperand::IMMEDIATE, s[0]->InputAt(1)->kind());
EXPECT_EQ(kFlags_branch, s[0]->flags_mode());
EXPECT_EQ(kNotEqual, s[0]->flags_condition());
}
}
TEST_F(InstructionSelectorTest, AddBranchWithImmediateOnRight) {
TRACED_FOREACH(int32_t, imm, kAddSubImmediates) {
StreamBuilder m(this, MachineType::Int32(), MachineType::Int32());
RawMachineLabel a, b;
m.Branch(m.Int32Add(m.Parameter(0), m.Int32Constant(imm)), &a, &b);
m.Bind(&a);
m.Return(m.Int32Constant(1));
m.Bind(&b);
m.Return(m.Int32Constant(0));
Stream s = m.Build();
ASSERT_EQ(1U, s.size());
EXPECT_EQ(kArm64Cmn32, s[0]->arch_opcode());
EXPECT_EQ(kFlags_branch, s[0]->flags_mode());
EXPECT_EQ(kNotEqual, s[0]->flags_condition());
}
}
TEST_F(InstructionSelectorTest, SubBranchWithImmediateOnRight) {
TRACED_FOREACH(int32_t, imm, kAddSubImmediates) {
StreamBuilder m(this, MachineType::Int32(), MachineType::Int32());
RawMachineLabel a, b;
m.Branch(m.Int32Sub(m.Parameter(0), m.Int32Constant(imm)), &a, &b);
m.Bind(&a);
m.Return(m.Int32Constant(1));
m.Bind(&b);
m.Return(m.Int32Constant(0));
Stream s = m.Build();
ASSERT_EQ(1U, s.size());
EXPECT_EQ((imm == 0) ? kArm64CompareAndBranch32 : kArm64Cmp32,
s[0]->arch_opcode());
EXPECT_EQ(kFlags_branch, s[0]->flags_mode());
EXPECT_EQ(kNotEqual, s[0]->flags_condition());
}
}
TEST_F(InstructionSelectorTest, Word32AndBranchWithImmediateOnLeft) {
TRACED_FOREACH(int32_t, imm, kLogical32Immediates) {
// Skip the cases where the instruction selector would use tbz/tbnz.
if (base::bits::CountPopulation(static_cast<uint32_t>(imm)) == 1) continue;
StreamBuilder m(this, MachineType::Int32(), MachineType::Int32());
RawMachineLabel a, b;
m.Branch(m.Word32And(m.Int32Constant(imm), m.Parameter(0)), &a, &b);
m.Bind(&a);
m.Return(m.Int32Constant(1));
m.Bind(&b);
m.Return(m.Int32Constant(0));
Stream s = m.Build();
ASSERT_EQ(1U, s.size());
EXPECT_EQ(kArm64Tst32, s[0]->arch_opcode());
EXPECT_EQ(4U, s[0]->InputCount());
EXPECT_EQ(InstructionOperand::IMMEDIATE, s[0]->InputAt(1)->kind());
ASSERT_LE(1U, s[0]->InputCount());
EXPECT_EQ(kFlags_branch, s[0]->flags_mode());
EXPECT_EQ(kNotEqual, s[0]->flags_condition());
}
}
TEST_F(InstructionSelectorTest, Word64AndBranchWithImmediateOnLeft) {
TRACED_FOREACH(int64_t, imm, kLogical64Immediates) {
// Skip the cases where the instruction selector would use tbz/tbnz.
if (base::bits::CountPopulation(static_cast<uint64_t>(imm)) == 1) continue;
StreamBuilder m(this, MachineType::Int64(), MachineType::Int64());
RawMachineLabel a, b;
m.Branch(m.Word64And(m.Int64Constant(imm), m.Parameter(0)), &a, &b);
m.Bind(&a);
m.Return(m.Int32Constant(1));
m.Bind(&b);
m.Return(m.Int32Constant(0));
Stream s = m.Build();
ASSERT_EQ(1U, s.size());
EXPECT_EQ(kArm64Tst, s[0]->arch_opcode());
EXPECT_EQ(4U, s[0]->InputCount());
EXPECT_EQ(InstructionOperand::IMMEDIATE, s[0]->InputAt(1)->kind());
ASSERT_LE(1U, s[0]->InputCount());
EXPECT_EQ(kFlags_branch, s[0]->flags_mode());
EXPECT_EQ(kNotEqual, s[0]->flags_condition());
}
}
TEST_F(InstructionSelectorTest, AddBranchWithImmediateOnLeft) {
TRACED_FOREACH(int32_t, imm, kAddSubImmediates) {
StreamBuilder m(this, MachineType::Int32(), MachineType::Int32());
RawMachineLabel a, b;
m.Branch(m.Int32Add(m.Int32Constant(imm), m.Parameter(0)), &a, &b);
m.Bind(&a);
m.Return(m.Int32Constant(1));
m.Bind(&b);
m.Return(m.Int32Constant(0));
Stream s = m.Build();
ASSERT_EQ(1U, s.size());
EXPECT_EQ(kArm64Cmn32, s[0]->arch_opcode());
ASSERT_LE(1U, s[0]->InputCount());
EXPECT_EQ(kFlags_branch, s[0]->flags_mode());
EXPECT_EQ(kNotEqual, s[0]->flags_condition());
}
}
struct TestAndBranch {
MachInst<std::function<Node*(InstructionSelectorTest::StreamBuilder&, Node*,
uint32_t mask)>>
mi;
FlagsCondition cond;
};
std::ostream& operator<<(std::ostream& os, const TestAndBranch& tb) {
return os << tb.mi;
}
const TestAndBranch kTestAndBranchMatchers32[] = {
// Branch on the result of Word32And directly.
{{[](InstructionSelectorTest::StreamBuilder& m, Node* x, uint32_t mask)
-> Node* { return m.Word32And(x, m.Int32Constant(mask)); },
"if (x and mask)", kArm64TestAndBranch32, MachineType::Int32()},
kNotEqual},
{{[](InstructionSelectorTest::StreamBuilder& m, Node* x,
uint32_t mask) -> Node* {
return m.Word32BinaryNot(m.Word32And(x, m.Int32Constant(mask)));
},
"if not (x and mask)", kArm64TestAndBranch32, MachineType::Int32()},
kEqual},
{{[](InstructionSelectorTest::StreamBuilder& m, Node* x, uint32_t mask)
-> Node* { return m.Word32And(m.Int32Constant(mask), x); },
"if (mask and x)", kArm64TestAndBranch32, MachineType::Int32()},
kNotEqual},
{{[](InstructionSelectorTest::StreamBuilder& m, Node* x,
uint32_t mask) -> Node* {
return m.Word32BinaryNot(m.Word32And(m.Int32Constant(mask), x));
},
"if not (mask and x)", kArm64TestAndBranch32, MachineType::Int32()},
kEqual},
// Branch on the result of '(x and mask) == mask'. This tests that a bit is
// set rather than cleared which is why conditions are inverted.
{{[](InstructionSelectorTest::StreamBuilder& m, Node* x,
uint32_t mask) -> Node* {
return m.Word32Equal(m.Word32And(x, m.Int32Constant(mask)),
m.Int32Constant(mask));
},
"if ((x and mask) == mask)", kArm64TestAndBranch32, MachineType::Int32()},
kNotEqual},
{{[](InstructionSelectorTest::StreamBuilder& m, Node* x,
uint32_t mask) -> Node* {
return m.Word32BinaryNot(m.Word32Equal(
m.Word32And(x, m.Int32Constant(mask)), m.Int32Constant(mask)));
},
"if ((x and mask) != mask)", kArm64TestAndBranch32, MachineType::Int32()},
kEqual},
{{[](InstructionSelectorTest::StreamBuilder& m, Node* x,
uint32_t mask) -> Node* {
return m.Word32Equal(m.Int32Constant(mask),
m.Word32And(x, m.Int32Constant(mask)));
},
"if (mask == (x and mask))", kArm64TestAndBranch32, MachineType::Int32()},
kNotEqual},
{{[](InstructionSelectorTest::StreamBuilder& m, Node* x,
uint32_t mask) -> Node* {
return m.Word32BinaryNot(m.Word32Equal(
m.Int32Constant(mask), m.Word32And(x, m.Int32Constant(mask))));
},
"if (mask != (x and mask))", kArm64TestAndBranch32, MachineType::Int32()},
kEqual},
// Same as above but swap 'mask' and 'x'.
{{[](InstructionSelectorTest::StreamBuilder& m, Node* x,
uint32_t mask) -> Node* {
return m.Word32Equal(m.Word32And(m.Int32Constant(mask), x),
m.Int32Constant(mask));
},
"if ((mask and x) == mask)", kArm64TestAndBranch32, MachineType::Int32()},
kNotEqual},
{{[](InstructionSelectorTest::StreamBuilder& m, Node* x,
uint32_t mask) -> Node* {
return m.Word32BinaryNot(m.Word32Equal(
m.Word32And(m.Int32Constant(mask), x), m.Int32Constant(mask)));
},
"if ((mask and x) != mask)", kArm64TestAndBranch32, MachineType::Int32()},
kEqual},
{{[](InstructionSelectorTest::StreamBuilder& m, Node* x,
uint32_t mask) -> Node* {
return m.Word32Equal(m.Int32Constant(mask),
m.Word32And(m.Int32Constant(mask), x));
},
"if (mask == (mask and x))", kArm64TestAndBranch32, MachineType::Int32()},
kNotEqual},
{{[](InstructionSelectorTest::StreamBuilder& m, Node* x,
uint32_t mask) -> Node* {
return m.Word32BinaryNot(m.Word32Equal(
m.Int32Constant(mask), m.Word32And(m.Int32Constant(mask), x)));
},
"if (mask != (mask and x))", kArm64TestAndBranch32, MachineType::Int32()},
kEqual}};
typedef InstructionSelectorTestWithParam<TestAndBranch>
InstructionSelectorTestAndBranchTest;
TEST_P(InstructionSelectorTestAndBranchTest, TestAndBranch32) {
const TestAndBranch inst = GetParam();
TRACED_FORRANGE(int, bit, 0, 31) {
uint32_t mask = 1 << bit;
StreamBuilder m(this, MachineType::Int32(), MachineType::Int32());
RawMachineLabel a, b;
m.Branch(inst.mi.constructor(m, m.Parameter(0), mask), &a, &b);
m.Bind(&a);
m.Return(m.Int32Constant(1));
m.Bind(&b);
m.Return(m.Int32Constant(0));
Stream s = m.Build();
ASSERT_EQ(1U, s.size());
EXPECT_EQ(inst.mi.arch_opcode, s[0]->arch_opcode());
EXPECT_EQ(inst.cond, s[0]->flags_condition());
EXPECT_EQ(4U, s[0]->InputCount());
EXPECT_EQ(InstructionOperand::IMMEDIATE, s[0]->InputAt(1)->kind());
EXPECT_EQ(bit, s.ToInt32(s[0]->InputAt(1)));
}
}
INSTANTIATE_TEST_CASE_P(InstructionSelectorTest,
InstructionSelectorTestAndBranchTest,
::testing::ValuesIn(kTestAndBranchMatchers32));
TEST_F(InstructionSelectorTest, Word64AndBranchWithOneBitMaskOnRight) {
TRACED_FORRANGE(int, bit, 0, 63) {
uint64_t mask = 1L << bit;
StreamBuilder m(this, MachineType::Int64(), MachineType::Int64());
RawMachineLabel a, b;
m.Branch(m.Word64And(m.Parameter(0), m.Int64Constant(mask)), &a, &b);
m.Bind(&a);
m.Return(m.Int32Constant(1));
m.Bind(&b);
m.Return(m.Int32Constant(0));
Stream s = m.Build();
ASSERT_EQ(1U, s.size());
EXPECT_EQ(kArm64TestAndBranch, s[0]->arch_opcode());
EXPECT_EQ(kNotEqual, s[0]->flags_condition());
EXPECT_EQ(4U, s[0]->InputCount());
EXPECT_EQ(InstructionOperand::IMMEDIATE, s[0]->InputAt(1)->kind());
EXPECT_EQ(bit, s.ToInt64(s[0]->InputAt(1)));
}
}
TEST_F(InstructionSelectorTest, Word64AndBranchWithOneBitMaskOnLeft) {
TRACED_FORRANGE(int, bit, 0, 63) {
uint64_t mask = 1L << bit;
StreamBuilder m(this, MachineType::Int64(), MachineType::Int64());
RawMachineLabel a, b;
m.Branch(m.Word64And(m.Int64Constant(mask), m.Parameter(0)), &a, &b);
m.Bind(&a);
m.Return(m.Int32Constant(1));
m.Bind(&b);
m.Return(m.Int32Constant(0));
Stream s = m.Build();
ASSERT_EQ(1U, s.size());
EXPECT_EQ(kArm64TestAndBranch, s[0]->arch_opcode());
EXPECT_EQ(kNotEqual, s[0]->flags_condition());
EXPECT_EQ(4U, s[0]->InputCount());
EXPECT_EQ(InstructionOperand::IMMEDIATE, s[0]->InputAt(1)->kind());
EXPECT_EQ(bit, s.ToInt64(s[0]->InputAt(1)));
}
}
TEST_F(InstructionSelectorTest, Word32EqualZeroAndBranchWithOneBitMask) {
TRACED_FORRANGE(int, bit, 0, 31) {
uint32_t mask = 1 << bit;
StreamBuilder m(this, MachineType::Int32(), MachineType::Int32());
RawMachineLabel a, b;
m.Branch(m.Word32Equal(m.Word32And(m.Int32Constant(mask), m.Parameter(0)),
m.Int32Constant(0)),
&a, &b);
m.Bind(&a);
m.Return(m.Int32Constant(1));
m.Bind(&b);
m.Return(m.Int32Constant(0));
Stream s = m.Build();
ASSERT_EQ(1U, s.size());
EXPECT_EQ(kArm64TestAndBranch32, s[0]->arch_opcode());
EXPECT_EQ(kEqual, s[0]->flags_condition());
EXPECT_EQ(4U, s[0]->InputCount());
EXPECT_EQ(InstructionOperand::IMMEDIATE, s[0]->InputAt(1)->kind());
EXPECT_EQ(bit, s.ToInt32(s[0]->InputAt(1)));
}
TRACED_FORRANGE(int, bit, 0, 31) {
uint32_t mask = 1 << bit;
StreamBuilder m(this, MachineType::Int32(), MachineType::Int32());
RawMachineLabel a, b;
m.Branch(
m.Word32NotEqual(m.Word32And(m.Int32Constant(mask), m.Parameter(0)),
m.Int32Constant(0)),
&a, &b);
m.Bind(&a);
m.Return(m.Int32Constant(1));
m.Bind(&b);
m.Return(m.Int32Constant(0));
Stream s = m.Build();
ASSERT_EQ(1U, s.size());
EXPECT_EQ(kArm64TestAndBranch32, s[0]->arch_opcode());
EXPECT_EQ(kNotEqual, s[0]->flags_condition());
EXPECT_EQ(4U, s[0]->InputCount());
EXPECT_EQ(InstructionOperand::IMMEDIATE, s[0]->InputAt(1)->kind());
EXPECT_EQ(bit, s.ToInt32(s[0]->InputAt(1)));
}
}
TEST_F(InstructionSelectorTest, Word64EqualZeroAndBranchWithOneBitMask) {
TRACED_FORRANGE(int, bit, 0, 63) {
uint64_t mask = uint64_t{1} << bit;
StreamBuilder m(this, MachineType::Int64(), MachineType::Int64());
RawMachineLabel a, b;
m.Branch(m.Word64Equal(m.Word64And(m.Int64Constant(mask), m.Parameter(0)),
m.Int64Constant(0)),
&a, &b);
m.Bind(&a);
m.Return(m.Int64Constant(1));
m.Bind(&b);
m.Return(m.Int64Constant(0));
Stream s = m.Build();
ASSERT_EQ(1U, s.size());
EXPECT_EQ(kArm64TestAndBranch, s[0]->arch_opcode());
EXPECT_EQ(kEqual, s[0]->flags_condition());
EXPECT_EQ(4U, s[0]->InputCount());
EXPECT_EQ(InstructionOperand::IMMEDIATE, s[0]->InputAt(1)->kind());
EXPECT_EQ(bit, s.ToInt64(s[0]->InputAt(1)));
}
TRACED_FORRANGE(int, bit, 0, 63) {
uint64_t mask = uint64_t{1} << bit;
StreamBuilder m(this, MachineType::Int64(), MachineType::Int64());
RawMachineLabel a, b;
m.Branch(
m.Word64NotEqual(m.Word64And(m.Int64Constant(mask), m.Parameter(0)),
m.Int64Constant(0)),
&a, &b);
m.Bind(&a);
m.Return(m.Int64Constant(1));
m.Bind(&b);
m.Return(m.Int64Constant(0));
Stream s = m.Build();
ASSERT_EQ(1U, s.size());
EXPECT_EQ(kArm64TestAndBranch, s[0]->arch_opcode());
EXPECT_EQ(kNotEqual, s[0]->flags_condition());
EXPECT_EQ(4U, s[0]->InputCount());
EXPECT_EQ(InstructionOperand::IMMEDIATE, s[0]->InputAt(1)->kind());
EXPECT_EQ(bit, s.ToInt64(s[0]->InputAt(1)));
}
}
TEST_F(InstructionSelectorTest, CompareAgainstZeroAndBranch) {
{
StreamBuilder m(this, MachineType::Int32(), MachineType::Int32());
RawMachineLabel a, b;
Node* p0 = m.Parameter(0);
m.Branch(p0, &a, &b);
m.Bind(&a);
m.Return(m.Int32Constant(1));
m.Bind(&b);
m.Return(m.Int32Constant(0));
Stream s = m.Build();
ASSERT_EQ(1U, s.size());
EXPECT_EQ(kArm64CompareAndBranch32, s[0]->arch_opcode());
EXPECT_EQ(kNotEqual, s[0]->flags_condition());
EXPECT_EQ(3U, s[0]->InputCount());
EXPECT_EQ(s.ToVreg(p0), s.ToVreg(s[0]->InputAt(0)));
}
{
StreamBuilder m(this, MachineType::Int32(), MachineType::Int32());
RawMachineLabel a, b;
Node* p0 = m.Parameter(0);
m.Branch(m.Word32BinaryNot(p0), &a, &b);
m.Bind(&a);
m.Return(m.Int32Constant(1));
m.Bind(&b);
m.Return(m.Int32Constant(0));
Stream s = m.Build();
ASSERT_EQ(1U, s.size());
EXPECT_EQ(kArm64CompareAndBranch32, s[0]->arch_opcode());
EXPECT_EQ(kEqual, s[0]->flags_condition());
EXPECT_EQ(3U, s[0]->InputCount());
EXPECT_EQ(s.ToVreg(p0), s.ToVreg(s[0]->InputAt(0)));
}
}
TEST_F(InstructionSelectorTest, EqualZeroAndBranch) {
{
StreamBuilder m(this, MachineType::Int32(), MachineType::Int32());
RawMachineLabel a, b;
Node* p0 = m.Parameter(0);
m.Branch(m.Word32Equal(p0, m.Int32Constant(0)), &a, &b);
m.Bind(&a);
m.Return(m.Int32Constant(1));
m.Bind(&b);
m.Return(m.Int32Constant(0));
Stream s = m.Build();
ASSERT_EQ(1U, s.size());
EXPECT_EQ(kArm64CompareAndBranch32, s[0]->arch_opcode());
EXPECT_EQ(kEqual, s[0]->flags_condition());
EXPECT_EQ(3U, s[0]->InputCount());
EXPECT_EQ(s.ToVreg(p0), s.ToVreg(s[0]->InputAt(0)));
}
{
StreamBuilder m(this, MachineType::Int32(), MachineType::Int32());
RawMachineLabel a, b;
Node* p0 = m.Parameter(0);
m.Branch(m.Word32NotEqual(p0, m.Int32Constant(0)), &a, &b);
m.Bind(&a);
m.Return(m.Int32Constant(1));
m.Bind(&b);
m.Return(m.Int32Constant(0));
Stream s = m.Build();
ASSERT_EQ(1U, s.size());
EXPECT_EQ(kArm64CompareAndBranch32, s[0]->arch_opcode());
EXPECT_EQ(kNotEqual, s[0]->flags_condition());
EXPECT_EQ(3U, s[0]->InputCount());
EXPECT_EQ(s.ToVreg(p0), s.ToVreg(s[0]->InputAt(0)));
}
{
StreamBuilder m(this, MachineType::Int64(), MachineType::Int64());
RawMachineLabel a, b;
Node* p0 = m.Parameter(0);
m.Branch(m.Word64Equal(p0, m.Int64Constant(0)), &a, &b);
m.Bind(&a);
m.Return(m.Int64Constant(1));
m.Bind(&b);
m.Return(m.Int64Constant(0));
Stream s = m.Build();
ASSERT_EQ(1U, s.size());
EXPECT_EQ(kArm64CompareAndBranch, s[0]->arch_opcode());
EXPECT_EQ(kEqual, s[0]->flags_condition());
EXPECT_EQ(3U, s[0]->InputCount());
EXPECT_EQ(s.ToVreg(p0), s.ToVreg(s[0]->InputAt(0)));
}
{
StreamBuilder m(this, MachineType::Int64(), MachineType::Int64());
RawMachineLabel a, b;
Node* p0 = m.Parameter(0);
m.Branch(m.Word64NotEqual(p0, m.Int64Constant(0)), &a, &b);
m.Bind(&a);
m.Return(m.Int64Constant(1));
m.Bind(&b);
m.Return(m.Int64Constant(0));
Stream s = m.Build();
ASSERT_EQ(1U, s.size());
EXPECT_EQ(kArm64CompareAndBranch, s[0]->arch_opcode());
EXPECT_EQ(kNotEqual, s[0]->flags_condition());
EXPECT_EQ(3U, s[0]->InputCount());
EXPECT_EQ(s.ToVreg(p0), s.ToVreg(s[0]->InputAt(0)));
}
}
// your_sha256_hash-------------
// Add and subtract instructions with overflow.
typedef InstructionSelectorTestWithParam<MachInst2>
InstructionSelectorOvfAddSubTest;
TEST_P(InstructionSelectorOvfAddSubTest, OvfParameter) {
const MachInst2 dpi = GetParam();
const MachineType type = dpi.machine_type;
StreamBuilder m(this, type, type, type);
m.Return(
m.Projection(1, (m.*dpi.constructor)(m.Parameter(0), m.Parameter(1))));
Stream s = m.Build();
ASSERT_EQ(1U, s.size());
EXPECT_EQ(dpi.arch_opcode, s[0]->arch_opcode());
EXPECT_EQ(2U, s[0]->InputCount());
EXPECT_LE(1U, s[0]->OutputCount());
EXPECT_EQ(kFlags_set, s[0]->flags_mode());
EXPECT_EQ(kOverflow, s[0]->flags_condition());
}
TEST_P(InstructionSelectorOvfAddSubTest, OvfImmediateOnRight) {
const MachInst2 dpi = GetParam();
const MachineType type = dpi.machine_type;
TRACED_FOREACH(int32_t, imm, kAddSubImmediates) {
StreamBuilder m(this, type, type);
m.Return(m.Projection(
1, (m.*dpi.constructor)(m.Parameter(0), m.Int32Constant(imm))));
Stream s = m.Build();
ASSERT_EQ(1U, s.size());
EXPECT_EQ(dpi.arch_opcode, s[0]->arch_opcode());
ASSERT_EQ(2U, s[0]->InputCount());
EXPECT_EQ(imm, s.ToInt32(s[0]->InputAt(1)));
EXPECT_LE(1U, s[0]->OutputCount());
EXPECT_EQ(kFlags_set, s[0]->flags_mode());
EXPECT_EQ(kOverflow, s[0]->flags_condition());
}
}
TEST_P(InstructionSelectorOvfAddSubTest, ValParameter) {
const MachInst2 dpi = GetParam();
const MachineType type = dpi.machine_type;
StreamBuilder m(this, type, type, type);
m.Return(
m.Projection(0, (m.*dpi.constructor)(m.Parameter(0), m.Parameter(1))));
Stream s = m.Build();
ASSERT_EQ(1U, s.size());
EXPECT_EQ(dpi.arch_opcode, s[0]->arch_opcode());
EXPECT_EQ(2U, s[0]->InputCount());
EXPECT_LE(1U, s[0]->OutputCount());
EXPECT_EQ(kFlags_none, s[0]->flags_mode());
}
TEST_P(InstructionSelectorOvfAddSubTest, ValImmediateOnRight) {
const MachInst2 dpi = GetParam();
const MachineType type = dpi.machine_type;
TRACED_FOREACH(int32_t, imm, kAddSubImmediates) {
StreamBuilder m(this, type, type);
m.Return(m.Projection(
0, (m.*dpi.constructor)(m.Parameter(0), m.Int32Constant(imm))));
Stream s = m.Build();
ASSERT_EQ(1U, s.size());
EXPECT_EQ(dpi.arch_opcode, s[0]->arch_opcode());
ASSERT_EQ(2U, s[0]->InputCount());
EXPECT_EQ(imm, s.ToInt32(s[0]->InputAt(1)));
EXPECT_LE(1U, s[0]->OutputCount());
EXPECT_EQ(kFlags_none, s[0]->flags_mode());
}
}
TEST_P(InstructionSelectorOvfAddSubTest, BothParameter) {
const MachInst2 dpi = GetParam();
const MachineType type = dpi.machine_type;
StreamBuilder m(this, type, type, type);
Node* n = (m.*dpi.constructor)(m.Parameter(0), m.Parameter(1));
m.Return(m.Word32Equal(m.Projection(0, n), m.Projection(1, n)));
Stream s = m.Build();
ASSERT_LE(1U, s.size());
EXPECT_EQ(dpi.arch_opcode, s[0]->arch_opcode());
EXPECT_EQ(2U, s[0]->InputCount());
EXPECT_EQ(2U, s[0]->OutputCount());
EXPECT_EQ(kFlags_set, s[0]->flags_mode());
EXPECT_EQ(kOverflow, s[0]->flags_condition());
}
TEST_P(InstructionSelectorOvfAddSubTest, BothImmediateOnRight) {
const MachInst2 dpi = GetParam();
const MachineType type = dpi.machine_type;
TRACED_FOREACH(int32_t, imm, kAddSubImmediates) {
StreamBuilder m(this, type, type);
Node* n = (m.*dpi.constructor)(m.Parameter(0), m.Int32Constant(imm));
m.Return(m.Word32Equal(m.Projection(0, n), m.Projection(1, n)));
Stream s = m.Build();
ASSERT_LE(1U, s.size());
EXPECT_EQ(dpi.arch_opcode, s[0]->arch_opcode());
ASSERT_EQ(2U, s[0]->InputCount());
EXPECT_EQ(imm, s.ToInt32(s[0]->InputAt(1)));
EXPECT_EQ(2U, s[0]->OutputCount());
EXPECT_EQ(kFlags_set, s[0]->flags_mode());
EXPECT_EQ(kOverflow, s[0]->flags_condition());
}
}
TEST_P(InstructionSelectorOvfAddSubTest, BranchWithParameters) {
const MachInst2 dpi = GetParam();
const MachineType type = dpi.machine_type;
StreamBuilder m(this, type, type, type);
RawMachineLabel a, b;
Node* n = (m.*dpi.constructor)(m.Parameter(0), m.Parameter(1));
m.Branch(m.Projection(1, n), &a, &b);
m.Bind(&a);
m.Return(m.Int32Constant(0));
m.Bind(&b);
m.Return(m.Projection(0, n));
Stream s = m.Build();
ASSERT_EQ(1U, s.size());
EXPECT_EQ(dpi.arch_opcode, s[0]->arch_opcode());
EXPECT_EQ(4U, s[0]->InputCount());
EXPECT_EQ(1U, s[0]->OutputCount());
EXPECT_EQ(kFlags_branch, s[0]->flags_mode());
EXPECT_EQ(kOverflow, s[0]->flags_condition());
}
TEST_P(InstructionSelectorOvfAddSubTest, BranchWithImmediateOnRight) {
const MachInst2 dpi = GetParam();
const MachineType type = dpi.machine_type;
TRACED_FOREACH(int32_t, imm, kAddSubImmediates) {
StreamBuilder m(this, type, type);
RawMachineLabel a, b;
Node* n = (m.*dpi.constructor)(m.Parameter(0), m.Int32Constant(imm));
m.Branch(m.Projection(1, n), &a, &b);
m.Bind(&a);
m.Return(m.Int32Constant(0));
m.Bind(&b);
m.Return(m.Projection(0, n));
Stream s = m.Build();
ASSERT_EQ(1U, s.size());
EXPECT_EQ(dpi.arch_opcode, s[0]->arch_opcode());
ASSERT_EQ(4U, s[0]->InputCount());
EXPECT_EQ(1U, s[0]->OutputCount());
EXPECT_EQ(kFlags_branch, s[0]->flags_mode());
EXPECT_EQ(kOverflow, s[0]->flags_condition());
}
}
TEST_P(InstructionSelectorOvfAddSubTest, RORShift) {
// ADD and SUB do not support ROR shifts, make sure we do not try
// to merge them into the ADD/SUB instruction.
const MachInst2 dpi = GetParam();
const MachineType type = dpi.machine_type;
auto rotate = &RawMachineAssembler::Word64Ror;
ArchOpcode rotate_opcode = kArm64Ror;
if (type == MachineType::Int32()) {
rotate = &RawMachineAssembler::Word32Ror;
rotate_opcode = kArm64Ror32;
}
TRACED_FORRANGE(int32_t, imm, -32, 63) {
StreamBuilder m(this, type, type, type);
Node* const p0 = m.Parameter(0);
Node* const p1 = m.Parameter(1);
Node* r = (m.*rotate)(p1, m.Int32Constant(imm));
m.Return((m.*dpi.constructor)(p0, r));
Stream s = m.Build();
ASSERT_EQ(2U, s.size());
EXPECT_EQ(rotate_opcode, s[0]->arch_opcode());
EXPECT_EQ(dpi.arch_opcode, s[1]->arch_opcode());
}
}
INSTANTIATE_TEST_CASE_P(InstructionSelectorTest,
InstructionSelectorOvfAddSubTest,
::testing::ValuesIn(kOvfAddSubInstructions));
TEST_F(InstructionSelectorTest, OvfFlagAddImmediateOnLeft) {
TRACED_FOREACH(int32_t, imm, kAddSubImmediates) {
StreamBuilder m(this, MachineType::Int32(), MachineType::Int32());
m.Return(m.Projection(
1, m.Int32AddWithOverflow(m.Int32Constant(imm), m.Parameter(0))));
Stream s = m.Build();
ASSERT_EQ(1U, s.size());
EXPECT_EQ(kArm64Add32, s[0]->arch_opcode());
EXPECT_EQ(2U, s[0]->InputCount());
EXPECT_EQ(imm, s.ToInt32(s[0]->InputAt(1)));
EXPECT_LE(1U, s[0]->OutputCount());
EXPECT_EQ(kFlags_set, s[0]->flags_mode());
EXPECT_EQ(kOverflow, s[0]->flags_condition());
}
}
TEST_F(InstructionSelectorTest, OvfValAddImmediateOnLeft) {
TRACED_FOREACH(int32_t, imm, kAddSubImmediates) {
StreamBuilder m(this, MachineType::Int32(), MachineType::Int32());
m.Return(m.Projection(
0, m.Int32AddWithOverflow(m.Int32Constant(imm), m.Parameter(0))));
Stream s = m.Build();
ASSERT_EQ(1U, s.size());
EXPECT_EQ(kArm64Add32, s[0]->arch_opcode());
ASSERT_EQ(2U, s[0]->InputCount());
EXPECT_EQ(imm, s.ToInt32(s[0]->InputAt(1)));
EXPECT_LE(1U, s[0]->OutputCount());
EXPECT_EQ(kFlags_none, s[0]->flags_mode());
}
}
TEST_F(InstructionSelectorTest, OvfBothAddImmediateOnLeft) {
TRACED_FOREACH(int32_t, imm, kAddSubImmediates) {
StreamBuilder m(this, MachineType::Int32(), MachineType::Int32());
Node* n = m.Int32AddWithOverflow(m.Int32Constant(imm), m.Parameter(0));
m.Return(m.Word32Equal(m.Projection(0, n), m.Projection(1, n)));
Stream s = m.Build();
ASSERT_LE(1U, s.size());
EXPECT_EQ(kArm64Add32, s[0]->arch_opcode());
ASSERT_EQ(2U, s[0]->InputCount());
EXPECT_EQ(imm, s.ToInt32(s[0]->InputAt(1)));
EXPECT_EQ(2U, s[0]->OutputCount());
EXPECT_EQ(kFlags_set, s[0]->flags_mode());
EXPECT_EQ(kOverflow, s[0]->flags_condition());
}
}
TEST_F(InstructionSelectorTest, OvfBranchWithImmediateOnLeft) {
TRACED_FOREACH(int32_t, imm, kAddSubImmediates) {
StreamBuilder m(this, MachineType::Int32(), MachineType::Int32());
RawMachineLabel a, b;
Node* n = m.Int32AddWithOverflow(m.Int32Constant(imm), m.Parameter(0));
m.Branch(m.Projection(1, n), &a, &b);
m.Bind(&a);
m.Return(m.Int32Constant(0));
m.Bind(&b);
m.Return(m.Projection(0, n));
Stream s = m.Build();
ASSERT_EQ(1U, s.size());
EXPECT_EQ(kArm64Add32, s[0]->arch_opcode());
ASSERT_EQ(4U, s[0]->InputCount());
EXPECT_EQ(imm, s.ToInt32(s[0]->InputAt(1)));
EXPECT_EQ(1U, s[0]->OutputCount());
EXPECT_EQ(kFlags_branch, s[0]->flags_mode());
EXPECT_EQ(kOverflow, s[0]->flags_condition());
}
}
// your_sha256_hash-------------
// Shift instructions.
typedef InstructionSelectorTestWithParam<Shift> InstructionSelectorShiftTest;
TEST_P(InstructionSelectorShiftTest, Parameter) {
const Shift shift = GetParam();
const MachineType type = shift.mi.machine_type;
StreamBuilder m(this, type, type, type);
m.Return((m.*shift.mi.constructor)(m.Parameter(0), m.Parameter(1)));
Stream s = m.Build();
ASSERT_EQ(1U, s.size());
EXPECT_EQ(shift.mi.arch_opcode, s[0]->arch_opcode());
EXPECT_EQ(2U, s[0]->InputCount());
EXPECT_EQ(1U, s[0]->OutputCount());
}
TEST_P(InstructionSelectorShiftTest, Immediate) {
const Shift shift = GetParam();
const MachineType type = shift.mi.machine_type;
TRACED_FORRANGE(int32_t, imm, 0,
((1 << ElementSizeLog2Of(type.representation())) * 8) - 1) {
StreamBuilder m(this, type, type);
m.Return((m.*shift.mi.constructor)(m.Parameter(0), m.Int32Constant(imm)));
Stream s = m.Build();
ASSERT_EQ(1U, s.size());
EXPECT_EQ(shift.mi.arch_opcode, s[0]->arch_opcode());
EXPECT_EQ(2U, s[0]->InputCount());
EXPECT_TRUE(s[0]->InputAt(1)->IsImmediate());
EXPECT_EQ(imm, s.ToInt32(s[0]->InputAt(1)));
EXPECT_EQ(1U, s[0]->OutputCount());
}
}
INSTANTIATE_TEST_CASE_P(InstructionSelectorTest, InstructionSelectorShiftTest,
::testing::ValuesIn(kShiftInstructions));
TEST_F(InstructionSelectorTest, Word64ShlWithChangeInt32ToInt64) {
TRACED_FORRANGE(int64_t, x, 32, 63) {
StreamBuilder m(this, MachineType::Int64(), MachineType::Int32());
Node* const p0 = m.Parameter(0);
Node* const n = m.Word64Shl(m.ChangeInt32ToInt64(p0), m.Int64Constant(x));
m.Return(n);
Stream s = m.Build();
ASSERT_EQ(1U, s.size());
EXPECT_EQ(kArm64Lsl, s[0]->arch_opcode());
ASSERT_EQ(2U, s[0]->InputCount());
EXPECT_EQ(s.ToVreg(p0), s.ToVreg(s[0]->InputAt(0)));
EXPECT_EQ(x, s.ToInt64(s[0]->InputAt(1)));
ASSERT_EQ(1U, s[0]->OutputCount());
EXPECT_EQ(s.ToVreg(n), s.ToVreg(s[0]->Output()));
}
}
TEST_F(InstructionSelectorTest, Word64ShlWithChangeUint32ToUint64) {
TRACED_FORRANGE(int64_t, x, 32, 63) {
StreamBuilder m(this, MachineType::Int64(), MachineType::Uint32());
Node* const p0 = m.Parameter(0);
Node* const n = m.Word64Shl(m.ChangeUint32ToUint64(p0), m.Int64Constant(x));
m.Return(n);
Stream s = m.Build();
ASSERT_EQ(1U, s.size());
EXPECT_EQ(kArm64Lsl, s[0]->arch_opcode());
ASSERT_EQ(2U, s[0]->InputCount());
EXPECT_EQ(s.ToVreg(p0), s.ToVreg(s[0]->InputAt(0)));
EXPECT_EQ(x, s.ToInt64(s[0]->InputAt(1)));
ASSERT_EQ(1U, s[0]->OutputCount());
EXPECT_EQ(s.ToVreg(n), s.ToVreg(s[0]->Output()));
}
}
TEST_F(InstructionSelectorTest, TruncateInt64ToInt32WithWord64Sar) {
StreamBuilder m(this, MachineType::Int32(), MachineType::Int64());
Node* const p = m.Parameter(0);
Node* const t = m.TruncateInt64ToInt32(m.Word64Sar(p, m.Int64Constant(32)));
m.Return(t);
Stream s = m.Build();
ASSERT_EQ(1U, s.size());
EXPECT_EQ(kArm64Asr, s[0]->arch_opcode());
ASSERT_EQ(2U, s[0]->InputCount());
EXPECT_EQ(s.ToVreg(p), s.ToVreg(s[0]->InputAt(0)));
EXPECT_EQ(32, s.ToInt64(s[0]->InputAt(1)));
ASSERT_EQ(1U, s[0]->OutputCount());
}
TEST_F(InstructionSelectorTest, TruncateInt64ToInt32WithWord64Shr) {
TRACED_FORRANGE(int64_t, x, 32, 63) {
StreamBuilder m(this, MachineType::Int32(), MachineType::Int64());
Node* const p = m.Parameter(0);
Node* const t = m.TruncateInt64ToInt32(m.Word64Shr(p, m.Int64Constant(x)));
m.Return(t);
Stream s = m.Build();
ASSERT_EQ(1U, s.size());
EXPECT_EQ(kArm64Lsr, s[0]->arch_opcode());
ASSERT_EQ(2U, s[0]->InputCount());
EXPECT_EQ(s.ToVreg(p), s.ToVreg(s[0]->InputAt(0)));
EXPECT_EQ(x, s.ToInt64(s[0]->InputAt(1)));
ASSERT_EQ(1U, s[0]->OutputCount());
}
}
// your_sha256_hash-------------
// Mul and Div instructions.
typedef InstructionSelectorTestWithParam<MachInst2>
InstructionSelectorMulDivTest;
TEST_P(InstructionSelectorMulDivTest, Parameter) {
const MachInst2 dpi = GetParam();
const MachineType type = dpi.machine_type;
StreamBuilder m(this, type, type, type);
m.Return((m.*dpi.constructor)(m.Parameter(0), m.Parameter(1)));
Stream s = m.Build();
ASSERT_EQ(1U, s.size());
EXPECT_EQ(dpi.arch_opcode, s[0]->arch_opcode());
EXPECT_EQ(2U, s[0]->InputCount());
EXPECT_EQ(1U, s[0]->OutputCount());
}
INSTANTIATE_TEST_CASE_P(InstructionSelectorTest, InstructionSelectorMulDivTest,
::testing::ValuesIn(kMulDivInstructions));
namespace {
struct MulDPInst {
const char* mul_constructor_name;
Node* (RawMachineAssembler::*mul_constructor)(Node*, Node*);
Node* (RawMachineAssembler::*add_constructor)(Node*, Node*);
Node* (RawMachineAssembler::*sub_constructor)(Node*, Node*);
ArchOpcode add_arch_opcode;
ArchOpcode sub_arch_opcode;
ArchOpcode neg_arch_opcode;
MachineType machine_type;
};
std::ostream& operator<<(std::ostream& os, const MulDPInst& inst) {
return os << inst.mul_constructor_name;
}
} // namespace
static const MulDPInst kMulDPInstructions[] = {
{"Int32Mul", &RawMachineAssembler::Int32Mul, &RawMachineAssembler::Int32Add,
&RawMachineAssembler::Int32Sub, kArm64Madd32, kArm64Msub32, kArm64Mneg32,
MachineType::Int32()},
{"Int64Mul", &RawMachineAssembler::Int64Mul, &RawMachineAssembler::Int64Add,
&RawMachineAssembler::Int64Sub, kArm64Madd, kArm64Msub, kArm64Mneg,
MachineType::Int64()}};
typedef InstructionSelectorTestWithParam<MulDPInst>
InstructionSelectorIntDPWithIntMulTest;
TEST_P(InstructionSelectorIntDPWithIntMulTest, AddWithMul) {
const MulDPInst mdpi = GetParam();
const MachineType type = mdpi.machine_type;
{
StreamBuilder m(this, type, type, type, type);
Node* n = (m.*mdpi.mul_constructor)(m.Parameter(1), m.Parameter(2));
m.Return((m.*mdpi.add_constructor)(m.Parameter(0), n));
Stream s = m.Build();
ASSERT_EQ(1U, s.size());
EXPECT_EQ(mdpi.add_arch_opcode, s[0]->arch_opcode());
EXPECT_EQ(3U, s[0]->InputCount());
EXPECT_EQ(1U, s[0]->OutputCount());
}
{
StreamBuilder m(this, type, type, type, type);
Node* n = (m.*mdpi.mul_constructor)(m.Parameter(0), m.Parameter(1));
m.Return((m.*mdpi.add_constructor)(n, m.Parameter(2)));
Stream s = m.Build();
ASSERT_EQ(1U, s.size());
EXPECT_EQ(mdpi.add_arch_opcode, s[0]->arch_opcode());
EXPECT_EQ(3U, s[0]->InputCount());
EXPECT_EQ(1U, s[0]->OutputCount());
}
}
TEST_P(InstructionSelectorIntDPWithIntMulTest, SubWithMul) {
const MulDPInst mdpi = GetParam();
const MachineType type = mdpi.machine_type;
{
StreamBuilder m(this, type, type, type, type);
Node* n = (m.*mdpi.mul_constructor)(m.Parameter(1), m.Parameter(2));
m.Return((m.*mdpi.sub_constructor)(m.Parameter(0), n));
Stream s = m.Build();
ASSERT_EQ(1U, s.size());
EXPECT_EQ(mdpi.sub_arch_opcode, s[0]->arch_opcode());
EXPECT_EQ(3U, s[0]->InputCount());
EXPECT_EQ(1U, s[0]->OutputCount());
}
}
TEST_P(InstructionSelectorIntDPWithIntMulTest, NegativeMul) {
const MulDPInst mdpi = GetParam();
const MachineType type = mdpi.machine_type;
{
StreamBuilder m(this, type, type, type);
Node* n =
(m.*mdpi.sub_constructor)(BuildConstant(m, type, 0), m.Parameter(0));
m.Return((m.*mdpi.mul_constructor)(n, m.Parameter(1)));
Stream s = m.Build();
ASSERT_EQ(1U, s.size());
EXPECT_EQ(mdpi.neg_arch_opcode, s[0]->arch_opcode());
EXPECT_EQ(2U, s[0]->InputCount());
EXPECT_EQ(1U, s[0]->OutputCount());
}
{
StreamBuilder m(this, type, type, type);
Node* n =
(m.*mdpi.sub_constructor)(BuildConstant(m, type, 0), m.Parameter(1));
m.Return((m.*mdpi.mul_constructor)(m.Parameter(0), n));
Stream s = m.Build();
ASSERT_EQ(1U, s.size());
EXPECT_EQ(mdpi.neg_arch_opcode, s[0]->arch_opcode());
EXPECT_EQ(2U, s[0]->InputCount());
EXPECT_EQ(1U, s[0]->OutputCount());
}
}
INSTANTIATE_TEST_CASE_P(InstructionSelectorTest,
InstructionSelectorIntDPWithIntMulTest,
::testing::ValuesIn(kMulDPInstructions));
TEST_F(InstructionSelectorTest, Int32MulWithImmediate) {
// x * (2^k + 1) -> x + (x << k)
TRACED_FORRANGE(int32_t, k, 1, 30) {
StreamBuilder m(this, MachineType::Int32(), MachineType::Int32());
m.Return(m.Int32Mul(m.Parameter(0), m.Int32Constant((1 << k) + 1)));
Stream s = m.Build();
ASSERT_EQ(1U, s.size());
EXPECT_EQ(kArm64Add32, s[0]->arch_opcode());
EXPECT_EQ(kMode_Operand2_R_LSL_I, s[0]->addressing_mode());
ASSERT_EQ(3U, s[0]->InputCount());
EXPECT_EQ(s.ToVreg(s[0]->InputAt(0)), s.ToVreg(s[0]->InputAt(1)));
EXPECT_EQ(k, s.ToInt32(s[0]->InputAt(2)));
EXPECT_EQ(1U, s[0]->OutputCount());
}
// (2^k + 1) * x -> x + (x << k)
TRACED_FORRANGE(int32_t, k, 1, 30) {
StreamBuilder m(this, MachineType::Int32(), MachineType::Int32());
m.Return(m.Int32Mul(m.Int32Constant((1 << k) + 1), m.Parameter(0)));
Stream s = m.Build();
ASSERT_EQ(1U, s.size());
EXPECT_EQ(kArm64Add32, s[0]->arch_opcode());
EXPECT_EQ(kMode_Operand2_R_LSL_I, s[0]->addressing_mode());
ASSERT_EQ(3U, s[0]->InputCount());
EXPECT_EQ(s.ToVreg(s[0]->InputAt(0)), s.ToVreg(s[0]->InputAt(1)));
EXPECT_EQ(k, s.ToInt32(s[0]->InputAt(2)));
EXPECT_EQ(1U, s[0]->OutputCount());
}
// x * (2^k + 1) + c -> x + (x << k) + c
TRACED_FORRANGE(int32_t, k, 1, 30) {
StreamBuilder m(this, MachineType::Int32(), MachineType::Int32(),
MachineType::Int32());
m.Return(
m.Int32Add(m.Int32Mul(m.Parameter(0), m.Int32Constant((1 << k) + 1)),
m.Parameter(1)));
Stream s = m.Build();
ASSERT_EQ(2U, s.size());
EXPECT_EQ(kArm64Add32, s[0]->arch_opcode());
EXPECT_EQ(kArm64Add32, s[1]->arch_opcode());
EXPECT_EQ(kMode_Operand2_R_LSL_I, s[0]->addressing_mode());
ASSERT_EQ(3U, s[0]->InputCount());
EXPECT_EQ(s.ToVreg(s[0]->InputAt(0)), s.ToVreg(s[0]->InputAt(1)));
EXPECT_EQ(k, s.ToInt32(s[0]->InputAt(2)));
EXPECT_EQ(1U, s[0]->OutputCount());
}
// (2^k + 1) * x + c -> x + (x << k) + c
TRACED_FORRANGE(int32_t, k, 1, 30) {
StreamBuilder m(this, MachineType::Int32(), MachineType::Int32(),
MachineType::Int32());
m.Return(
m.Int32Add(m.Int32Mul(m.Int32Constant((1 << k) + 1), m.Parameter(0)),
m.Parameter(1)));
Stream s = m.Build();
ASSERT_EQ(2U, s.size());
EXPECT_EQ(kArm64Add32, s[0]->arch_opcode());
EXPECT_EQ(kArm64Add32, s[1]->arch_opcode());
EXPECT_EQ(kMode_Operand2_R_LSL_I, s[0]->addressing_mode());
ASSERT_EQ(3U, s[0]->InputCount());
EXPECT_EQ(s.ToVreg(s[0]->InputAt(0)), s.ToVreg(s[0]->InputAt(1)));
EXPECT_EQ(k, s.ToInt32(s[0]->InputAt(2)));
EXPECT_EQ(1U, s[0]->OutputCount());
}
// c + x * (2^k + 1) -> c + x + (x << k)
TRACED_FORRANGE(int32_t, k, 1, 30) {
StreamBuilder m(this, MachineType::Int32(), MachineType::Int32(),
MachineType::Int32());
m.Return(
m.Int32Add(m.Parameter(0),
m.Int32Mul(m.Parameter(1), m.Int32Constant((1 << k) + 1))));
Stream s = m.Build();
ASSERT_EQ(2U, s.size());
EXPECT_EQ(kArm64Add32, s[0]->arch_opcode());
EXPECT_EQ(kArm64Add32, s[1]->arch_opcode());
EXPECT_EQ(kMode_Operand2_R_LSL_I, s[0]->addressing_mode());
ASSERT_EQ(3U, s[0]->InputCount());
EXPECT_EQ(s.ToVreg(s[0]->InputAt(1)), s.ToVreg(s[0]->InputAt(1)));
EXPECT_EQ(k, s.ToInt32(s[0]->InputAt(2)));
EXPECT_EQ(1U, s[0]->OutputCount());
}
// c + (2^k + 1) * x -> c + x + (x << k)
TRACED_FORRANGE(int32_t, k, 1, 30) {
StreamBuilder m(this, MachineType::Int32(), MachineType::Int32(),
MachineType::Int32());
m.Return(
m.Int32Add(m.Parameter(0),
m.Int32Mul(m.Int32Constant((1 << k) + 1), m.Parameter(1))));
Stream s = m.Build();
ASSERT_EQ(2U, s.size());
EXPECT_EQ(kArm64Add32, s[0]->arch_opcode());
EXPECT_EQ(kArm64Add32, s[1]->arch_opcode());
EXPECT_EQ(kMode_Operand2_R_LSL_I, s[0]->addressing_mode());
ASSERT_EQ(3U, s[0]->InputCount());
EXPECT_EQ(s.ToVreg(s[0]->InputAt(1)), s.ToVreg(s[0]->InputAt(1)));
EXPECT_EQ(k, s.ToInt32(s[0]->InputAt(2)));
EXPECT_EQ(1U, s[0]->OutputCount());
}
// c - x * (2^k + 1) -> c - x + (x << k)
TRACED_FORRANGE(int32_t, k, 1, 30) {
StreamBuilder m(this, MachineType::Int32(), MachineType::Int32(),
MachineType::Int32());
m.Return(
m.Int32Sub(m.Parameter(0),
m.Int32Mul(m.Parameter(1), m.Int32Constant((1 << k) + 1))));
Stream s = m.Build();
ASSERT_EQ(2U, s.size());
EXPECT_EQ(kArm64Add32, s[0]->arch_opcode());
EXPECT_EQ(kArm64Sub32, s[1]->arch_opcode());
EXPECT_EQ(kMode_Operand2_R_LSL_I, s[0]->addressing_mode());
ASSERT_EQ(3U, s[0]->InputCount());
EXPECT_EQ(s.ToVreg(s[0]->InputAt(1)), s.ToVreg(s[0]->InputAt(1)));
EXPECT_EQ(k, s.ToInt32(s[0]->InputAt(2)));
EXPECT_EQ(1U, s[0]->OutputCount());
}
// c - (2^k + 1) * x -> c - x + (x << k)
TRACED_FORRANGE(int32_t, k, 1, 30) {
StreamBuilder m(this, MachineType::Int32(), MachineType::Int32(),
MachineType::Int32());
m.Return(
m.Int32Sub(m.Parameter(0),
m.Int32Mul(m.Int32Constant((1 << k) + 1), m.Parameter(1))));
Stream s = m.Build();
ASSERT_EQ(2U, s.size());
EXPECT_EQ(kArm64Add32, s[0]->arch_opcode());
EXPECT_EQ(kArm64Sub32, s[1]->arch_opcode());
EXPECT_EQ(kMode_Operand2_R_LSL_I, s[0]->addressing_mode());
ASSERT_EQ(3U, s[0]->InputCount());
EXPECT_EQ(s.ToVreg(s[0]->InputAt(1)), s.ToVreg(s[0]->InputAt(1)));
EXPECT_EQ(k, s.ToInt32(s[0]->InputAt(2)));
EXPECT_EQ(1U, s[0]->OutputCount());
}
}
TEST_F(InstructionSelectorTest, Int64MulWithImmediate) {
// x * (2^k + 1) -> x + (x << k)
TRACED_FORRANGE(int64_t, k, 1, 62) {
StreamBuilder m(this, MachineType::Int64(), MachineType::Int64());
m.Return(m.Int64Mul(m.Parameter(0), m.Int64Constant((1L << k) + 1)));
Stream s = m.Build();
ASSERT_EQ(1U, s.size());
EXPECT_EQ(kArm64Add, s[0]->arch_opcode());
EXPECT_EQ(kMode_Operand2_R_LSL_I, s[0]->addressing_mode());
ASSERT_EQ(3U, s[0]->InputCount());
EXPECT_EQ(s.ToVreg(s[0]->InputAt(0)), s.ToVreg(s[0]->InputAt(1)));
EXPECT_EQ(k, s.ToInt64(s[0]->InputAt(2)));
EXPECT_EQ(1U, s[0]->OutputCount());
}
// (2^k + 1) * x -> x + (x << k)
TRACED_FORRANGE(int64_t, k, 1, 62) {
StreamBuilder m(this, MachineType::Int64(), MachineType::Int64());
m.Return(m.Int64Mul(m.Int64Constant((1L << k) + 1), m.Parameter(0)));
Stream s = m.Build();
ASSERT_EQ(1U, s.size());
EXPECT_EQ(kArm64Add, s[0]->arch_opcode());
EXPECT_EQ(kMode_Operand2_R_LSL_I, s[0]->addressing_mode());
ASSERT_EQ(3U, s[0]->InputCount());
EXPECT_EQ(s.ToVreg(s[0]->InputAt(0)), s.ToVreg(s[0]->InputAt(1)));
EXPECT_EQ(k, s.ToInt64(s[0]->InputAt(2)));
EXPECT_EQ(1U, s[0]->OutputCount());
}
// x * (2^k + 1) + c -> x + (x << k) + c
TRACED_FORRANGE(int64_t, k, 1, 62) {
StreamBuilder m(this, MachineType::Int64(), MachineType::Int64(),
MachineType::Int64());
m.Return(
m.Int64Add(m.Int64Mul(m.Parameter(0), m.Int64Constant((1L << k) + 1)),
m.Parameter(1)));
Stream s = m.Build();
ASSERT_EQ(2U, s.size());
EXPECT_EQ(kArm64Add, s[0]->arch_opcode());
EXPECT_EQ(kArm64Add, s[1]->arch_opcode());
EXPECT_EQ(kMode_Operand2_R_LSL_I, s[0]->addressing_mode());
ASSERT_EQ(3U, s[0]->InputCount());
EXPECT_EQ(s.ToVreg(s[0]->InputAt(0)), s.ToVreg(s[0]->InputAt(1)));
EXPECT_EQ(k, s.ToInt64(s[0]->InputAt(2)));
EXPECT_EQ(1U, s[0]->OutputCount());
}
// (2^k + 1) * x + c -> x + (x << k) + c
TRACED_FORRANGE(int64_t, k, 1, 62) {
StreamBuilder m(this, MachineType::Int64(), MachineType::Int64(),
MachineType::Int64());
m.Return(
m.Int64Add(m.Int64Mul(m.Int64Constant((1L << k) + 1), m.Parameter(0)),
m.Parameter(1)));
Stream s = m.Build();
ASSERT_EQ(2U, s.size());
EXPECT_EQ(kArm64Add, s[0]->arch_opcode());
EXPECT_EQ(kArm64Add, s[1]->arch_opcode());
EXPECT_EQ(kMode_Operand2_R_LSL_I, s[0]->addressing_mode());
ASSERT_EQ(3U, s[0]->InputCount());
EXPECT_EQ(s.ToVreg(s[0]->InputAt(0)), s.ToVreg(s[0]->InputAt(1)));
EXPECT_EQ(k, s.ToInt64(s[0]->InputAt(2)));
EXPECT_EQ(1U, s[0]->OutputCount());
}
// c + x * (2^k + 1) -> c + x + (x << k)
TRACED_FORRANGE(int64_t, k, 1, 62) {
StreamBuilder m(this, MachineType::Int64(), MachineType::Int64(),
MachineType::Int64());
m.Return(
m.Int64Add(m.Parameter(0),
m.Int64Mul(m.Parameter(1), m.Int64Constant((1L << k) + 1))));
Stream s = m.Build();
ASSERT_EQ(2U, s.size());
EXPECT_EQ(kArm64Add, s[0]->arch_opcode());
EXPECT_EQ(kArm64Add, s[1]->arch_opcode());
EXPECT_EQ(kMode_Operand2_R_LSL_I, s[0]->addressing_mode());
ASSERT_EQ(3U, s[0]->InputCount());
EXPECT_EQ(s.ToVreg(s[0]->InputAt(0)), s.ToVreg(s[0]->InputAt(1)));
EXPECT_EQ(k, s.ToInt64(s[0]->InputAt(2)));
EXPECT_EQ(1U, s[0]->OutputCount());
}
// c + (2^k + 1) * x -> c + x + (x << k)
TRACED_FORRANGE(int64_t, k, 1, 62) {
StreamBuilder m(this, MachineType::Int64(), MachineType::Int64(),
MachineType::Int64());
m.Return(
m.Int64Add(m.Parameter(0),
m.Int64Mul(m.Int64Constant((1L << k) + 1), m.Parameter(1))));
Stream s = m.Build();
ASSERT_EQ(2U, s.size());
EXPECT_EQ(kArm64Add, s[0]->arch_opcode());
EXPECT_EQ(kArm64Add, s[1]->arch_opcode());
EXPECT_EQ(kMode_Operand2_R_LSL_I, s[0]->addressing_mode());
ASSERT_EQ(3U, s[0]->InputCount());
EXPECT_EQ(s.ToVreg(s[0]->InputAt(0)), s.ToVreg(s[0]->InputAt(1)));
EXPECT_EQ(k, s.ToInt64(s[0]->InputAt(2)));
EXPECT_EQ(1U, s[0]->OutputCount());
}
// c - x * (2^k + 1) -> c - x + (x << k)
TRACED_FORRANGE(int64_t, k, 1, 62) {
StreamBuilder m(this, MachineType::Int64(), MachineType::Int64(),
MachineType::Int64());
m.Return(
m.Int64Sub(m.Parameter(0),
m.Int64Mul(m.Parameter(1), m.Int64Constant((1L << k) + 1))));
Stream s = m.Build();
ASSERT_EQ(2U, s.size());
EXPECT_EQ(kArm64Add, s[0]->arch_opcode());
EXPECT_EQ(kArm64Sub, s[1]->arch_opcode());
EXPECT_EQ(kMode_Operand2_R_LSL_I, s[0]->addressing_mode());
ASSERT_EQ(3U, s[0]->InputCount());
EXPECT_EQ(s.ToVreg(s[0]->InputAt(0)), s.ToVreg(s[0]->InputAt(1)));
EXPECT_EQ(k, s.ToInt64(s[0]->InputAt(2)));
EXPECT_EQ(1U, s[0]->OutputCount());
}
// c - (2^k + 1) * x -> c - x + (x << k)
TRACED_FORRANGE(int64_t, k, 1, 62) {
StreamBuilder m(this, MachineType::Int64(), MachineType::Int64(),
MachineType::Int64());
m.Return(
m.Int64Sub(m.Parameter(0),
m.Int64Mul(m.Int64Constant((1L << k) + 1), m.Parameter(1))));
Stream s = m.Build();
ASSERT_EQ(2U, s.size());
EXPECT_EQ(kArm64Add, s[0]->arch_opcode());
EXPECT_EQ(kArm64Sub, s[1]->arch_opcode());
EXPECT_EQ(kMode_Operand2_R_LSL_I, s[0]->addressing_mode());
ASSERT_EQ(3U, s[0]->InputCount());
EXPECT_EQ(s.ToVreg(s[0]->InputAt(0)), s.ToVreg(s[0]->InputAt(1)));
EXPECT_EQ(k, s.ToInt64(s[0]->InputAt(2)));
EXPECT_EQ(1U, s[0]->OutputCount());
}
}
// your_sha256_hash-------------
// Floating point instructions.
typedef InstructionSelectorTestWithParam<MachInst2>
InstructionSelectorFPArithTest;
TEST_P(InstructionSelectorFPArithTest, Parameter) {
const MachInst2 fpa = GetParam();
StreamBuilder m(this, fpa.machine_type, fpa.machine_type, fpa.machine_type);
m.Return((m.*fpa.constructor)(m.Parameter(0), m.Parameter(1)));
Stream s = m.Build();
ASSERT_EQ(1U, s.size());
EXPECT_EQ(fpa.arch_opcode, s[0]->arch_opcode());
EXPECT_EQ(2U, s[0]->InputCount());
EXPECT_EQ(1U, s[0]->OutputCount());
}
INSTANTIATE_TEST_CASE_P(InstructionSelectorTest, InstructionSelectorFPArithTest,
::testing::ValuesIn(kFPArithInstructions));
typedef InstructionSelectorTestWithParam<FPCmp> InstructionSelectorFPCmpTest;
TEST_P(InstructionSelectorFPCmpTest, Parameter) {
const FPCmp cmp = GetParam();
StreamBuilder m(this, MachineType::Int32(), cmp.mi.machine_type,
cmp.mi.machine_type);
m.Return((m.*cmp.mi.constructor)(m.Parameter(0), m.Parameter(1)));
Stream s = m.Build();
ASSERT_EQ(1U, s.size());
EXPECT_EQ(cmp.mi.arch_opcode, s[0]->arch_opcode());
EXPECT_EQ(2U, s[0]->InputCount());
EXPECT_EQ(1U, s[0]->OutputCount());
EXPECT_EQ(kFlags_set, s[0]->flags_mode());
EXPECT_EQ(cmp.cond, s[0]->flags_condition());
}
TEST_P(InstructionSelectorFPCmpTest, WithImmediateZeroOnRight) {
const FPCmp cmp = GetParam();
StreamBuilder m(this, MachineType::Int32(), cmp.mi.machine_type);
if (cmp.mi.machine_type == MachineType::Float64()) {
m.Return((m.*cmp.mi.constructor)(m.Parameter(0), m.Float64Constant(0.0)));
} else {
m.Return((m.*cmp.mi.constructor)(m.Parameter(0), m.Float32Constant(0.0f)));
}
Stream s = m.Build();
ASSERT_EQ(1U, s.size());
EXPECT_EQ(cmp.mi.arch_opcode, s[0]->arch_opcode());
EXPECT_EQ(2U, s[0]->InputCount());
EXPECT_TRUE(s[0]->InputAt(1)->IsImmediate());
EXPECT_EQ(1U, s[0]->OutputCount());
EXPECT_EQ(kFlags_set, s[0]->flags_mode());
EXPECT_EQ(cmp.cond, s[0]->flags_condition());
}
TEST_P(InstructionSelectorFPCmpTest, WithImmediateZeroOnLeft) {
const FPCmp cmp = GetParam();
StreamBuilder m(this, MachineType::Int32(), cmp.mi.machine_type);
if (cmp.mi.machine_type == MachineType::Float64()) {
m.Return((m.*cmp.mi.constructor)(m.Float64Constant(0.0), m.Parameter(0)));
} else {
m.Return((m.*cmp.mi.constructor)(m.Float32Constant(0.0f), m.Parameter(0)));
}
Stream s = m.Build();
ASSERT_EQ(1U, s.size());
EXPECT_EQ(cmp.mi.arch_opcode, s[0]->arch_opcode());
EXPECT_EQ(2U, s[0]->InputCount());
EXPECT_TRUE(s[0]->InputAt(1)->IsImmediate());
EXPECT_EQ(1U, s[0]->OutputCount());
EXPECT_EQ(kFlags_set, s[0]->flags_mode());
EXPECT_EQ(cmp.commuted_cond, s[0]->flags_condition());
}
INSTANTIATE_TEST_CASE_P(InstructionSelectorTest, InstructionSelectorFPCmpTest,
::testing::ValuesIn(kFPCmpInstructions));
// your_sha256_hash-------------
// Conversions.
typedef InstructionSelectorTestWithParam<Conversion>
InstructionSelectorConversionTest;
TEST_P(InstructionSelectorConversionTest, Parameter) {
const Conversion conv = GetParam();
StreamBuilder m(this, conv.mi.machine_type, conv.src_machine_type);
m.Return((m.*conv.mi.constructor)(m.Parameter(0)));
Stream s = m.Build();
if (conv.mi.arch_opcode == kArchNop) {
ASSERT_EQ(0U, s.size());
return;
}
ASSERT_EQ(1U, s.size());
EXPECT_EQ(conv.mi.arch_opcode, s[0]->arch_opcode());
EXPECT_EQ(1U, s[0]->InputCount());
EXPECT_EQ(1U, s[0]->OutputCount());
}
INSTANTIATE_TEST_CASE_P(InstructionSelectorTest,
InstructionSelectorConversionTest,
::testing::ValuesIn(kConversionInstructions));
typedef InstructionSelectorTestWithParam<MachInst2>
InstructionSelectorElidedChangeUint32ToUint64Test;
TEST_P(InstructionSelectorElidedChangeUint32ToUint64Test, Parameter) {
const MachInst2 binop = GetParam();
StreamBuilder m(this, MachineType::Uint64(), binop.machine_type,
binop.machine_type);
m.Return(m.ChangeUint32ToUint64(
(m.*binop.constructor)(m.Parameter(0), m.Parameter(1))));
Stream s = m.Build();
// Make sure the `ChangeUint32ToUint64` node turned into a no-op.
ASSERT_EQ(1U, s.size());
EXPECT_EQ(binop.arch_opcode, s[0]->arch_opcode());
EXPECT_EQ(2U, s[0]->InputCount());
EXPECT_EQ(1U, s[0]->OutputCount());
}
INSTANTIATE_TEST_CASE_P(InstructionSelectorTest,
InstructionSelectorElidedChangeUint32ToUint64Test,
::testing::ValuesIn(kCanElideChangeUint32ToUint64));
TEST_F(InstructionSelectorTest, ChangeUint32ToUint64AfterLoad) {
// For each case, make sure the `ChangeUint32ToUint64` node turned into a
// no-op.
// Ldrb
{
StreamBuilder m(this, MachineType::Uint64(), MachineType::Pointer(),
MachineType::Int32());
m.Return(m.ChangeUint32ToUint64(
m.Load(MachineType::Uint8(), m.Parameter(0), m.Parameter(1))));
Stream s = m.Build();
ASSERT_EQ(1U, s.size());
EXPECT_EQ(kArm64Ldrb, s[0]->arch_opcode());
EXPECT_EQ(kMode_MRR, s[0]->addressing_mode());
EXPECT_EQ(2U, s[0]->InputCount());
EXPECT_EQ(1U, s[0]->OutputCount());
}
// Ldrh
{
StreamBuilder m(this, MachineType::Uint64(), MachineType::Pointer(),
MachineType::Int32());
m.Return(m.ChangeUint32ToUint64(
m.Load(MachineType::Uint16(), m.Parameter(0), m.Parameter(1))));
Stream s = m.Build();
ASSERT_EQ(1U, s.size());
EXPECT_EQ(kArm64Ldrh, s[0]->arch_opcode());
EXPECT_EQ(kMode_MRR, s[0]->addressing_mode());
EXPECT_EQ(2U, s[0]->InputCount());
EXPECT_EQ(1U, s[0]->OutputCount());
}
// LdrW
{
StreamBuilder m(this, MachineType::Uint64(), MachineType::Pointer(),
MachineType::Int32());
m.Return(m.ChangeUint32ToUint64(
m.Load(MachineType::Uint32(), m.Parameter(0), m.Parameter(1))));
Stream s = m.Build();
ASSERT_EQ(1U, s.size());
EXPECT_EQ(kArm64LdrW, s[0]->arch_opcode());
EXPECT_EQ(kMode_MRR, s[0]->addressing_mode());
EXPECT_EQ(2U, s[0]->InputCount());
EXPECT_EQ(1U, s[0]->OutputCount());
}
}
TEST_F(InstructionSelectorTest, ChangeInt32ToInt64AfterLoad) {
// For each case, test that the conversion is merged into the load
// operation.
// ChangeInt32ToInt64(Load_Uint8) -> Ldrb
{
StreamBuilder m(this, MachineType::Int64(), MachineType::Pointer(),
MachineType::Int32());
m.Return(m.ChangeInt32ToInt64(
m.Load(MachineType::Uint8(), m.Parameter(0), m.Parameter(1))));
Stream s = m.Build();
ASSERT_EQ(1U, s.size());
EXPECT_EQ(kArm64Ldrb, s[0]->arch_opcode());
EXPECT_EQ(kMode_MRR, s[0]->addressing_mode());
EXPECT_EQ(2U, s[0]->InputCount());
EXPECT_EQ(1U, s[0]->OutputCount());
}
// ChangeInt32ToInt64(Load_Int8) -> Ldrsb
{
StreamBuilder m(this, MachineType::Int64(), MachineType::Pointer(),
MachineType::Int32());
m.Return(m.ChangeInt32ToInt64(
m.Load(MachineType::Int8(), m.Parameter(0), m.Parameter(1))));
Stream s = m.Build();
ASSERT_EQ(1U, s.size());
EXPECT_EQ(kArm64Ldrsb, s[0]->arch_opcode());
EXPECT_EQ(kMode_MRR, s[0]->addressing_mode());
EXPECT_EQ(2U, s[0]->InputCount());
EXPECT_EQ(1U, s[0]->OutputCount());
}
// ChangeInt32ToInt64(Load_Uint16) -> Ldrh
{
StreamBuilder m(this, MachineType::Int64(), MachineType::Pointer(),
MachineType::Int32());
m.Return(m.ChangeInt32ToInt64(
m.Load(MachineType::Uint16(), m.Parameter(0), m.Parameter(1))));
Stream s = m.Build();
ASSERT_EQ(1U, s.size());
EXPECT_EQ(kArm64Ldrh, s[0]->arch_opcode());
EXPECT_EQ(kMode_MRR, s[0]->addressing_mode());
EXPECT_EQ(2U, s[0]->InputCount());
EXPECT_EQ(1U, s[0]->OutputCount());
}
// ChangeInt32ToInt64(Load_Int16) -> Ldrsh
{
StreamBuilder m(this, MachineType::Int64(), MachineType::Pointer(),
MachineType::Int32());
m.Return(m.ChangeInt32ToInt64(
m.Load(MachineType::Int16(), m.Parameter(0), m.Parameter(1))));
Stream s = m.Build();
ASSERT_EQ(1U, s.size());
EXPECT_EQ(kArm64Ldrsh, s[0]->arch_opcode());
EXPECT_EQ(kMode_MRR, s[0]->addressing_mode());
EXPECT_EQ(2U, s[0]->InputCount());
EXPECT_EQ(1U, s[0]->OutputCount());
}
// ChangeInt32ToInt64(Load_Uint32) -> Ldrsw
{
StreamBuilder m(this, MachineType::Int64(), MachineType::Pointer(),
MachineType::Int32());
m.Return(m.ChangeInt32ToInt64(
m.Load(MachineType::Uint32(), m.Parameter(0), m.Parameter(1))));
Stream s = m.Build();
ASSERT_EQ(1U, s.size());
EXPECT_EQ(kArm64Ldrsw, s[0]->arch_opcode());
EXPECT_EQ(kMode_MRR, s[0]->addressing_mode());
EXPECT_EQ(2U, s[0]->InputCount());
EXPECT_EQ(1U, s[0]->OutputCount());
}
// ChangeInt32ToInt64(Load_Int32) -> Ldrsw
{
StreamBuilder m(this, MachineType::Int64(), MachineType::Pointer(),
MachineType::Int32());
m.Return(m.ChangeInt32ToInt64(
m.Load(MachineType::Int32(), m.Parameter(0), m.Parameter(1))));
Stream s = m.Build();
ASSERT_EQ(1U, s.size());
EXPECT_EQ(kArm64Ldrsw, s[0]->arch_opcode());
EXPECT_EQ(kMode_MRR, s[0]->addressing_mode());
EXPECT_EQ(2U, s[0]->InputCount());
EXPECT_EQ(1U, s[0]->OutputCount());
}
}
// your_sha256_hash-------------
// Memory access instructions.
namespace {
struct MemoryAccess {
MachineType type;
ArchOpcode ldr_opcode;
ArchOpcode str_opcode;
const int32_t immediates[20];
};
std::ostream& operator<<(std::ostream& os, const MemoryAccess& memacc) {
return os << memacc.type;
}
} // namespace
static const MemoryAccess kMemoryAccesses[] = {
{MachineType::Int8(),
kArm64Ldrsb,
kArm64Strb,
{-256, -255, -3, -2, -1, 0, 1, 2, 3, 255, 256, 257, 258, 1000, 1001, 2121,
2442, 4093, 4094, 4095}},
{MachineType::Uint8(),
kArm64Ldrb,
kArm64Strb,
{-256, -255, -3, -2, -1, 0, 1, 2, 3, 255, 256, 257, 258, 1000, 1001, 2121,
2442, 4093, 4094, 4095}},
{MachineType::Int16(),
kArm64Ldrsh,
kArm64Strh,
{-256, -255, -3, -2, -1, 0, 1, 2, 3, 255, 256, 258, 260, 4096, 4098, 4100,
4242, 6786, 8188, 8190}},
{MachineType::Uint16(),
kArm64Ldrh,
kArm64Strh,
{-256, -255, -3, -2, -1, 0, 1, 2, 3, 255, 256, 258, 260, 4096, 4098, 4100,
4242, 6786, 8188, 8190}},
{MachineType::Int32(),
kArm64LdrW,
kArm64StrW,
{-256, -255, -3, -2, -1, 0, 1, 2, 3, 255, 256, 260, 4096, 4100, 8192, 8196,
3276, 3280, 16376, 16380}},
{MachineType::Uint32(),
kArm64LdrW,
kArm64StrW,
{-256, -255, -3, -2, -1, 0, 1, 2, 3, 255, 256, 260, 4096, 4100, 8192, 8196,
3276, 3280, 16376, 16380}},
{MachineType::Int64(),
kArm64Ldr,
kArm64Str,
{-256, -255, -3, -2, -1, 0, 1, 2, 3, 255, 256, 264, 4096, 4104, 8192, 8200,
16384, 16392, 32752, 32760}},
{MachineType::Uint64(),
kArm64Ldr,
kArm64Str,
{-256, -255, -3, -2, -1, 0, 1, 2, 3, 255, 256, 264, 4096, 4104, 8192, 8200,
16384, 16392, 32752, 32760}},
{MachineType::Float32(),
kArm64LdrS,
kArm64StrS,
{-256, -255, -3, -2, -1, 0, 1, 2, 3, 255, 256, 260, 4096, 4100, 8192, 8196,
3276, 3280, 16376, 16380}},
{MachineType::Float64(),
kArm64LdrD,
kArm64StrD,
{-256, -255, -3, -2, -1, 0, 1, 2, 3, 255, 256, 264, 4096, 4104, 8192, 8200,
16384, 16392, 32752, 32760}}};
typedef InstructionSelectorTestWithParam<MemoryAccess>
InstructionSelectorMemoryAccessTest;
TEST_P(InstructionSelectorMemoryAccessTest, LoadWithParameters) {
const MemoryAccess memacc = GetParam();
StreamBuilder m(this, memacc.type, MachineType::Pointer(),
MachineType::Int32());
m.Return(m.Load(memacc.type, m.Parameter(0), m.Parameter(1)));
Stream s = m.Build();
ASSERT_EQ(1U, s.size());
EXPECT_EQ(memacc.ldr_opcode, s[0]->arch_opcode());
EXPECT_EQ(kMode_MRR, s[0]->addressing_mode());
EXPECT_EQ(2U, s[0]->InputCount());
EXPECT_EQ(1U, s[0]->OutputCount());
}
TEST_P(InstructionSelectorMemoryAccessTest, LoadWithImmediateIndex) {
const MemoryAccess memacc = GetParam();
TRACED_FOREACH(int32_t, index, memacc.immediates) {
StreamBuilder m(this, memacc.type, MachineType::Pointer());
m.Return(m.Load(memacc.type, m.Parameter(0), m.Int32Constant(index)));
Stream s = m.Build();
ASSERT_EQ(1U, s.size());
EXPECT_EQ(memacc.ldr_opcode, s[0]->arch_opcode());
EXPECT_EQ(kMode_MRI, s[0]->addressing_mode());
EXPECT_EQ(2U, s[0]->InputCount());
ASSERT_EQ(InstructionOperand::IMMEDIATE, s[0]->InputAt(1)->kind());
EXPECT_EQ(index, s.ToInt32(s[0]->InputAt(1)));
ASSERT_EQ(1U, s[0]->OutputCount());
}
}
TEST_P(InstructionSelectorMemoryAccessTest, StoreWithParameters) {
const MemoryAccess memacc = GetParam();
StreamBuilder m(this, MachineType::Int32(), MachineType::Pointer(),
MachineType::Int32(), memacc.type);
m.Store(memacc.type.representation(), m.Parameter(0), m.Parameter(1),
m.Parameter(2), kNoWriteBarrier);
m.Return(m.Int32Constant(0));
Stream s = m.Build();
ASSERT_EQ(1U, s.size());
EXPECT_EQ(memacc.str_opcode, s[0]->arch_opcode());
EXPECT_EQ(kMode_MRR, s[0]->addressing_mode());
EXPECT_EQ(3U, s[0]->InputCount());
EXPECT_EQ(0U, s[0]->OutputCount());
}
TEST_P(InstructionSelectorMemoryAccessTest, StoreWithImmediateIndex) {
const MemoryAccess memacc = GetParam();
TRACED_FOREACH(int32_t, index, memacc.immediates) {
StreamBuilder m(this, MachineType::Int32(), MachineType::Pointer(),
memacc.type);
m.Store(memacc.type.representation(), m.Parameter(0),
m.Int32Constant(index), m.Parameter(1), kNoWriteBarrier);
m.Return(m.Int32Constant(0));
Stream s = m.Build();
ASSERT_EQ(1U, s.size());
EXPECT_EQ(memacc.str_opcode, s[0]->arch_opcode());
EXPECT_EQ(kMode_MRI, s[0]->addressing_mode());
ASSERT_EQ(3U, s[0]->InputCount());
ASSERT_EQ(InstructionOperand::IMMEDIATE, s[0]->InputAt(2)->kind());
EXPECT_EQ(index, s.ToInt32(s[0]->InputAt(2)));
EXPECT_EQ(0U, s[0]->OutputCount());
}
}
TEST_P(InstructionSelectorMemoryAccessTest, StoreZero) {
const MemoryAccess memacc = GetParam();
TRACED_FOREACH(int32_t, index, memacc.immediates) {
StreamBuilder m(this, MachineType::Int32(), MachineType::Pointer());
m.Store(memacc.type.representation(), m.Parameter(0),
m.Int32Constant(index), m.Int32Constant(0), kNoWriteBarrier);
m.Return(m.Int32Constant(0));
Stream s = m.Build();
ASSERT_EQ(1U, s.size());
EXPECT_EQ(memacc.str_opcode, s[0]->arch_opcode());
EXPECT_EQ(kMode_MRI, s[0]->addressing_mode());
ASSERT_EQ(3U, s[0]->InputCount());
ASSERT_EQ(InstructionOperand::IMMEDIATE, s[0]->InputAt(2)->kind());
EXPECT_EQ(index, s.ToInt32(s[0]->InputAt(2)));
ASSERT_EQ(InstructionOperand::IMMEDIATE, s[0]->InputAt(0)->kind());
EXPECT_EQ(0, s.ToInt64(s[0]->InputAt(0)));
EXPECT_EQ(0U, s[0]->OutputCount());
}
}
TEST_P(InstructionSelectorMemoryAccessTest, LoadWithShiftedIndex) {
const MemoryAccess memacc = GetParam();
TRACED_FORRANGE(int, immediate_shift, 0, 4) {
// 32 bit shift
{
StreamBuilder m(this, memacc.type, MachineType::Pointer(),
MachineType::Int32());
Node* const index =
m.Word32Shl(m.Parameter(1), m.Int32Constant(immediate_shift));
m.Return(m.Load(memacc.type, m.Parameter(0), index));
Stream s = m.Build();
if (immediate_shift == ElementSizeLog2Of(memacc.type.representation())) {
ASSERT_EQ(1U, s.size());
EXPECT_EQ(memacc.ldr_opcode, s[0]->arch_opcode());
EXPECT_EQ(kMode_Operand2_R_LSL_I, s[0]->addressing_mode());
EXPECT_EQ(3U, s[0]->InputCount());
EXPECT_EQ(1U, s[0]->OutputCount());
} else {
// Make sure we haven't merged the shift into the load instruction.
ASSERT_NE(1U, s.size());
EXPECT_NE(memacc.ldr_opcode, s[0]->arch_opcode());
EXPECT_NE(kMode_Operand2_R_LSL_I, s[0]->addressing_mode());
}
}
// 64 bit shift
{
StreamBuilder m(this, memacc.type, MachineType::Pointer(),
MachineType::Int64());
Node* const index =
m.Word64Shl(m.Parameter(1), m.Int64Constant(immediate_shift));
m.Return(m.Load(memacc.type, m.Parameter(0), index));
Stream s = m.Build();
if (immediate_shift == ElementSizeLog2Of(memacc.type.representation())) {
ASSERT_EQ(1U, s.size());
EXPECT_EQ(memacc.ldr_opcode, s[0]->arch_opcode());
EXPECT_EQ(kMode_Operand2_R_LSL_I, s[0]->addressing_mode());
EXPECT_EQ(3U, s[0]->InputCount());
EXPECT_EQ(1U, s[0]->OutputCount());
} else {
// Make sure we haven't merged the shift into the load instruction.
ASSERT_NE(1U, s.size());
EXPECT_NE(memacc.ldr_opcode, s[0]->arch_opcode());
EXPECT_NE(kMode_Operand2_R_LSL_I, s[0]->addressing_mode());
}
}
}
}
TEST_P(InstructionSelectorMemoryAccessTest, StoreWithShiftedIndex) {
const MemoryAccess memacc = GetParam();
TRACED_FORRANGE(int, immediate_shift, 0, 4) {
// 32 bit shift
{
StreamBuilder m(this, MachineType::Int32(), MachineType::Pointer(),
MachineType::Int32(), memacc.type);
Node* const index =
m.Word32Shl(m.Parameter(1), m.Int32Constant(immediate_shift));
m.Store(memacc.type.representation(), m.Parameter(0), index,
m.Parameter(2), kNoWriteBarrier);
m.Return(m.Int32Constant(0));
Stream s = m.Build();
if (immediate_shift == ElementSizeLog2Of(memacc.type.representation())) {
ASSERT_EQ(1U, s.size());
EXPECT_EQ(memacc.str_opcode, s[0]->arch_opcode());
EXPECT_EQ(kMode_Operand2_R_LSL_I, s[0]->addressing_mode());
EXPECT_EQ(4U, s[0]->InputCount());
EXPECT_EQ(0U, s[0]->OutputCount());
} else {
// Make sure we haven't merged the shift into the store instruction.
ASSERT_NE(1U, s.size());
EXPECT_NE(memacc.str_opcode, s[0]->arch_opcode());
EXPECT_NE(kMode_Operand2_R_LSL_I, s[0]->addressing_mode());
}
}
// 64 bit shift
{
StreamBuilder m(this, MachineType::Int64(), MachineType::Pointer(),
MachineType::Int64(), memacc.type);
Node* const index =
m.Word64Shl(m.Parameter(1), m.Int64Constant(immediate_shift));
m.Store(memacc.type.representation(), m.Parameter(0), index,
m.Parameter(2), kNoWriteBarrier);
m.Return(m.Int64Constant(0));
Stream s = m.Build();
if (immediate_shift == ElementSizeLog2Of(memacc.type.representation())) {
ASSERT_EQ(1U, s.size());
EXPECT_EQ(memacc.str_opcode, s[0]->arch_opcode());
EXPECT_EQ(kMode_Operand2_R_LSL_I, s[0]->addressing_mode());
EXPECT_EQ(4U, s[0]->InputCount());
EXPECT_EQ(0U, s[0]->OutputCount());
} else {
// Make sure we haven't merged the shift into the store instruction.
ASSERT_NE(1U, s.size());
EXPECT_NE(memacc.str_opcode, s[0]->arch_opcode());
EXPECT_NE(kMode_Operand2_R_LSL_I, s[0]->addressing_mode());
}
}
}
}
INSTANTIATE_TEST_CASE_P(InstructionSelectorTest,
InstructionSelectorMemoryAccessTest,
::testing::ValuesIn(kMemoryAccesses));
// your_sha256_hash-------------
// Comparison instructions.
static const MachInst2 kComparisonInstructions[] = {
{&RawMachineAssembler::Word32Equal, "Word32Equal", kArm64Cmp32,
MachineType::Int32()},
{&RawMachineAssembler::Word64Equal, "Word64Equal", kArm64Cmp,
MachineType::Int64()},
};
typedef InstructionSelectorTestWithParam<MachInst2>
InstructionSelectorComparisonTest;
TEST_P(InstructionSelectorComparisonTest, WithParameters) {
const MachInst2 cmp = GetParam();
const MachineType type = cmp.machine_type;
StreamBuilder m(this, type, type, type);
m.Return((m.*cmp.constructor)(m.Parameter(0), m.Parameter(1)));
Stream s = m.Build();
ASSERT_EQ(1U, s.size());
EXPECT_EQ(cmp.arch_opcode, s[0]->arch_opcode());
EXPECT_EQ(2U, s[0]->InputCount());
EXPECT_EQ(1U, s[0]->OutputCount());
EXPECT_EQ(kFlags_set, s[0]->flags_mode());
EXPECT_EQ(kEqual, s[0]->flags_condition());
}
TEST_P(InstructionSelectorComparisonTest, WithImmediate) {
const MachInst2 cmp = GetParam();
const MachineType type = cmp.machine_type;
TRACED_FOREACH(int32_t, imm, kAddSubImmediates) {
// Compare with 0 are turned into tst instruction.
if (imm == 0) continue;
StreamBuilder m(this, type, type);
m.Return((m.*cmp.constructor)(m.Parameter(0), BuildConstant(m, type, imm)));
Stream s = m.Build();
ASSERT_EQ(1U, s.size());
EXPECT_EQ(cmp.arch_opcode, s[0]->arch_opcode());
ASSERT_EQ(2U, s[0]->InputCount());
ASSERT_EQ(InstructionOperand::IMMEDIATE, s[0]->InputAt(1)->kind());
EXPECT_EQ(imm, s.ToInt64(s[0]->InputAt(1)));
EXPECT_EQ(1U, s[0]->OutputCount());
EXPECT_EQ(kFlags_set, s[0]->flags_mode());
EXPECT_EQ(kEqual, s[0]->flags_condition());
}
TRACED_FOREACH(int32_t, imm, kAddSubImmediates) {
// Compare with 0 are turned into tst instruction.
if (imm == 0) continue;
StreamBuilder m(this, type, type);
m.Return((m.*cmp.constructor)(BuildConstant(m, type, imm), m.Parameter(0)));
Stream s = m.Build();
ASSERT_EQ(1U, s.size());
EXPECT_EQ(cmp.arch_opcode, s[0]->arch_opcode());
ASSERT_EQ(2U, s[0]->InputCount());
ASSERT_EQ(InstructionOperand::IMMEDIATE, s[0]->InputAt(1)->kind());
EXPECT_EQ(imm, s.ToInt64(s[0]->InputAt(1)));
EXPECT_EQ(1U, s[0]->OutputCount());
EXPECT_EQ(kFlags_set, s[0]->flags_mode());
EXPECT_EQ(kEqual, s[0]->flags_condition());
}
}
INSTANTIATE_TEST_CASE_P(InstructionSelectorTest,
InstructionSelectorComparisonTest,
::testing::ValuesIn(kComparisonInstructions));
TEST_F(InstructionSelectorTest, Word32EqualWithZero) {
{
StreamBuilder m(this, MachineType::Int32(), MachineType::Int32());
m.Return(m.Word32Equal(m.Parameter(0), m.Int32Constant(0)));
Stream s = m.Build();
ASSERT_EQ(1U, s.size());
EXPECT_EQ(kArm64Tst32, s[0]->arch_opcode());
ASSERT_EQ(2U, s[0]->InputCount());
EXPECT_EQ(s.ToVreg(s[0]->InputAt(0)), s.ToVreg(s[0]->InputAt(1)));
EXPECT_EQ(1U, s[0]->OutputCount());
EXPECT_EQ(kFlags_set, s[0]->flags_mode());
EXPECT_EQ(kEqual, s[0]->flags_condition());
}
{
StreamBuilder m(this, MachineType::Int32(), MachineType::Int32());
m.Return(m.Word32Equal(m.Int32Constant(0), m.Parameter(0)));
Stream s = m.Build();
ASSERT_EQ(1U, s.size());
EXPECT_EQ(kArm64Tst32, s[0]->arch_opcode());
ASSERT_EQ(2U, s[0]->InputCount());
EXPECT_EQ(s.ToVreg(s[0]->InputAt(0)), s.ToVreg(s[0]->InputAt(1)));
EXPECT_EQ(1U, s[0]->OutputCount());
EXPECT_EQ(kFlags_set, s[0]->flags_mode());
EXPECT_EQ(kEqual, s[0]->flags_condition());
}
}
TEST_F(InstructionSelectorTest, Word64EqualWithZero) {
{
StreamBuilder m(this, MachineType::Int64(), MachineType::Int64());
m.Return(m.Word64Equal(m.Parameter(0), m.Int64Constant(0)));
Stream s = m.Build();
ASSERT_EQ(1U, s.size());
EXPECT_EQ(kArm64Tst, s[0]->arch_opcode());
ASSERT_EQ(2U, s[0]->InputCount());
EXPECT_EQ(s.ToVreg(s[0]->InputAt(0)), s.ToVreg(s[0]->InputAt(1)));
EXPECT_EQ(1U, s[0]->OutputCount());
EXPECT_EQ(kFlags_set, s[0]->flags_mode());
EXPECT_EQ(kEqual, s[0]->flags_condition());
}
{
StreamBuilder m(this, MachineType::Int64(), MachineType::Int64());
m.Return(m.Word64Equal(m.Int64Constant(0), m.Parameter(0)));
Stream s = m.Build();
ASSERT_EQ(1U, s.size());
EXPECT_EQ(kArm64Tst, s[0]->arch_opcode());
ASSERT_EQ(2U, s[0]->InputCount());
EXPECT_EQ(s.ToVreg(s[0]->InputAt(0)), s.ToVreg(s[0]->InputAt(1)));
EXPECT_EQ(1U, s[0]->OutputCount());
EXPECT_EQ(kFlags_set, s[0]->flags_mode());
EXPECT_EQ(kEqual, s[0]->flags_condition());
}
}
TEST_F(InstructionSelectorTest, Word32EqualWithWord32Shift) {
TRACED_FOREACH(Shift, shift, kShiftInstructions) {
// Skip non 32-bit shifts or ror operations.
if (shift.mi.machine_type != MachineType::Int32() ||
shift.mi.arch_opcode == kArm64Ror32) {
continue;
}
TRACED_FORRANGE(int32_t, imm, -32, 63) {
StreamBuilder m(this, MachineType::Int32(), MachineType::Int32(),
MachineType::Int32());
Node* const p0 = m.Parameter(0);
Node* const p1 = m.Parameter(1);
Node* r = (m.*shift.mi.constructor)(p1, m.Int32Constant(imm));
m.Return(m.Word32Equal(p0, r));
Stream s = m.Build();
ASSERT_EQ(1U, s.size());
EXPECT_EQ(kArm64Cmp32, s[0]->arch_opcode());
EXPECT_EQ(shift.mode, s[0]->addressing_mode());
ASSERT_EQ(3U, s[0]->InputCount());
EXPECT_EQ(s.ToVreg(p0), s.ToVreg(s[0]->InputAt(0)));
EXPECT_EQ(s.ToVreg(p1), s.ToVreg(s[0]->InputAt(1)));
EXPECT_EQ(0x3F & imm, 0x3F & s.ToInt32(s[0]->InputAt(2)));
ASSERT_EQ(1U, s[0]->OutputCount());
}
TRACED_FORRANGE(int32_t, imm, -32, 63) {
StreamBuilder m(this, MachineType::Int32(), MachineType::Int32(),
MachineType::Int32());
Node* const p0 = m.Parameter(0);
Node* const p1 = m.Parameter(1);
Node* r = (m.*shift.mi.constructor)(p1, m.Int32Constant(imm));
m.Return(m.Word32Equal(r, p0));
Stream s = m.Build();
ASSERT_EQ(1U, s.size());
EXPECT_EQ(kArm64Cmp32, s[0]->arch_opcode());
EXPECT_EQ(shift.mode, s[0]->addressing_mode());
ASSERT_EQ(3U, s[0]->InputCount());
EXPECT_EQ(s.ToVreg(p0), s.ToVreg(s[0]->InputAt(0)));
EXPECT_EQ(s.ToVreg(p1), s.ToVreg(s[0]->InputAt(1)));
EXPECT_EQ(0x3F & imm, 0x3F & s.ToInt32(s[0]->InputAt(2)));
ASSERT_EQ(1U, s[0]->OutputCount());
}
}
}
TEST_F(InstructionSelectorTest, Word32EqualWithUnsignedExtendByte) {
{
StreamBuilder m(this, MachineType::Int32(), MachineType::Int32(),
MachineType::Int32());
Node* const p0 = m.Parameter(0);
Node* const p1 = m.Parameter(1);
Node* r = m.Word32And(p1, m.Int32Constant(0xFF));
m.Return(m.Word32Equal(p0, r));
Stream s = m.Build();
ASSERT_EQ(1U, s.size());
EXPECT_EQ(kArm64Cmp32, s[0]->arch_opcode());
EXPECT_EQ(kMode_Operand2_R_UXTB, s[0]->addressing_mode());
ASSERT_EQ(2U, s[0]->InputCount());
EXPECT_EQ(s.ToVreg(p0), s.ToVreg(s[0]->InputAt(0)));
EXPECT_EQ(s.ToVreg(p1), s.ToVreg(s[0]->InputAt(1)));
ASSERT_EQ(1U, s[0]->OutputCount());
}
{
StreamBuilder m(this, MachineType::Int32(), MachineType::Int32(),
MachineType::Int32());
Node* const p0 = m.Parameter(0);
Node* const p1 = m.Parameter(1);
Node* r = m.Word32And(p1, m.Int32Constant(0xFF));
m.Return(m.Word32Equal(r, p0));
Stream s = m.Build();
ASSERT_EQ(1U, s.size());
EXPECT_EQ(kArm64Cmp32, s[0]->arch_opcode());
EXPECT_EQ(kMode_Operand2_R_UXTB, s[0]->addressing_mode());
ASSERT_EQ(2U, s[0]->InputCount());
EXPECT_EQ(s.ToVreg(p0), s.ToVreg(s[0]->InputAt(0)));
EXPECT_EQ(s.ToVreg(p1), s.ToVreg(s[0]->InputAt(1)));
ASSERT_EQ(1U, s[0]->OutputCount());
}
}
TEST_F(InstructionSelectorTest, Word32EqualWithUnsignedExtendHalfword) {
{
StreamBuilder m(this, MachineType::Int32(), MachineType::Int32(),
MachineType::Int32());
Node* const p0 = m.Parameter(0);
Node* const p1 = m.Parameter(1);
Node* r = m.Word32And(p1, m.Int32Constant(0xFFFF));
m.Return(m.Word32Equal(p0, r));
Stream s = m.Build();
ASSERT_EQ(1U, s.size());
EXPECT_EQ(kArm64Cmp32, s[0]->arch_opcode());
EXPECT_EQ(kMode_Operand2_R_UXTH, s[0]->addressing_mode());
ASSERT_EQ(2U, s[0]->InputCount());
EXPECT_EQ(s.ToVreg(p0), s.ToVreg(s[0]->InputAt(0)));
EXPECT_EQ(s.ToVreg(p1), s.ToVreg(s[0]->InputAt(1)));
ASSERT_EQ(1U, s[0]->OutputCount());
}
{
StreamBuilder m(this, MachineType::Int32(), MachineType::Int32(),
MachineType::Int32());
Node* const p0 = m.Parameter(0);
Node* const p1 = m.Parameter(1);
Node* r = m.Word32And(p1, m.Int32Constant(0xFFFF));
m.Return(m.Word32Equal(r, p0));
Stream s = m.Build();
ASSERT_EQ(1U, s.size());
EXPECT_EQ(kArm64Cmp32, s[0]->arch_opcode());
EXPECT_EQ(kMode_Operand2_R_UXTH, s[0]->addressing_mode());
ASSERT_EQ(2U, s[0]->InputCount());
EXPECT_EQ(s.ToVreg(p0), s.ToVreg(s[0]->InputAt(0)));
EXPECT_EQ(s.ToVreg(p1), s.ToVreg(s[0]->InputAt(1)));
ASSERT_EQ(1U, s[0]->OutputCount());
}
}
TEST_F(InstructionSelectorTest, Word32EqualWithSignedExtendByte) {
{
StreamBuilder m(this, MachineType::Int32(), MachineType::Int32(),
MachineType::Int32());
Node* const p0 = m.Parameter(0);
Node* const p1 = m.Parameter(1);
Node* r =
m.Word32Sar(m.Word32Shl(p1, m.Int32Constant(24)), m.Int32Constant(24));
m.Return(m.Word32Equal(p0, r));
Stream s = m.Build();
ASSERT_EQ(1U, s.size());
EXPECT_EQ(kArm64Cmp32, s[0]->arch_opcode());
EXPECT_EQ(kMode_Operand2_R_SXTB, s[0]->addressing_mode());
ASSERT_EQ(2U, s[0]->InputCount());
EXPECT_EQ(s.ToVreg(p0), s.ToVreg(s[0]->InputAt(0)));
EXPECT_EQ(s.ToVreg(p1), s.ToVreg(s[0]->InputAt(1)));
ASSERT_EQ(1U, s[0]->OutputCount());
}
{
StreamBuilder m(this, MachineType::Int32(), MachineType::Int32(),
MachineType::Int32());
Node* const p0 = m.Parameter(0);
Node* const p1 = m.Parameter(1);
Node* r =
m.Word32Sar(m.Word32Shl(p1, m.Int32Constant(24)), m.Int32Constant(24));
m.Return(m.Word32Equal(r, p0));
Stream s = m.Build();
ASSERT_EQ(1U, s.size());
EXPECT_EQ(kArm64Cmp32, s[0]->arch_opcode());
EXPECT_EQ(kMode_Operand2_R_SXTB, s[0]->addressing_mode());
ASSERT_EQ(2U, s[0]->InputCount());
EXPECT_EQ(s.ToVreg(p0), s.ToVreg(s[0]->InputAt(0)));
EXPECT_EQ(s.ToVreg(p1), s.ToVreg(s[0]->InputAt(1)));
ASSERT_EQ(1U, s[0]->OutputCount());
}
}
TEST_F(InstructionSelectorTest, Word32EqualWithSignedExtendHalfword) {
{
StreamBuilder m(this, MachineType::Int32(), MachineType::Int32(),
MachineType::Int32());
Node* const p0 = m.Parameter(0);
Node* const p1 = m.Parameter(1);
Node* r =
m.Word32Sar(m.Word32Shl(p1, m.Int32Constant(16)), m.Int32Constant(16));
m.Return(m.Word32Equal(p0, r));
Stream s = m.Build();
ASSERT_EQ(1U, s.size());
EXPECT_EQ(kArm64Cmp32, s[0]->arch_opcode());
EXPECT_EQ(kMode_Operand2_R_SXTH, s[0]->addressing_mode());
ASSERT_EQ(2U, s[0]->InputCount());
EXPECT_EQ(s.ToVreg(p0), s.ToVreg(s[0]->InputAt(0)));
EXPECT_EQ(s.ToVreg(p1), s.ToVreg(s[0]->InputAt(1)));
ASSERT_EQ(1U, s[0]->OutputCount());
}
{
StreamBuilder m(this, MachineType::Int32(), MachineType::Int32(),
MachineType::Int32());
Node* const p0 = m.Parameter(0);
Node* const p1 = m.Parameter(1);
Node* r =
m.Word32Sar(m.Word32Shl(p1, m.Int32Constant(16)), m.Int32Constant(16));
m.Return(m.Word32Equal(r, p0));
Stream s = m.Build();
ASSERT_EQ(1U, s.size());
EXPECT_EQ(kArm64Cmp32, s[0]->arch_opcode());
EXPECT_EQ(kMode_Operand2_R_SXTH, s[0]->addressing_mode());
ASSERT_EQ(2U, s[0]->InputCount());
EXPECT_EQ(s.ToVreg(p0), s.ToVreg(s[0]->InputAt(0)));
EXPECT_EQ(s.ToVreg(p1), s.ToVreg(s[0]->InputAt(1)));
ASSERT_EQ(1U, s[0]->OutputCount());
}
}
TEST_F(InstructionSelectorTest, Word32EqualZeroWithWord32Equal) {
{
StreamBuilder m(this, MachineType::Int32(), MachineType::Int32(),
MachineType::Int32());
Node* const p0 = m.Parameter(0);
Node* const p1 = m.Parameter(1);
m.Return(m.Word32Equal(m.Word32Equal(p0, p1), m.Int32Constant(0)));
Stream s = m.Build();
ASSERT_EQ(1U, s.size());
EXPECT_EQ(kArm64Cmp32, s[0]->arch_opcode());
ASSERT_EQ(2U, s[0]->InputCount());
EXPECT_EQ(s.ToVreg(p0), s.ToVreg(s[0]->InputAt(0)));
EXPECT_EQ(s.ToVreg(p1), s.ToVreg(s[0]->InputAt(1)));
EXPECT_EQ(1U, s[0]->OutputCount());
EXPECT_EQ(kFlags_set, s[0]->flags_mode());
EXPECT_EQ(kNotEqual, s[0]->flags_condition());
}
{
StreamBuilder m(this, MachineType::Int32(), MachineType::Int32(),
MachineType::Int32());
Node* const p0 = m.Parameter(0);
Node* const p1 = m.Parameter(1);
m.Return(m.Word32Equal(m.Int32Constant(0), m.Word32Equal(p0, p1)));
Stream s = m.Build();
ASSERT_EQ(1U, s.size());
EXPECT_EQ(kArm64Cmp32, s[0]->arch_opcode());
ASSERT_EQ(2U, s[0]->InputCount());
EXPECT_EQ(s.ToVreg(p0), s.ToVreg(s[0]->InputAt(0)));
EXPECT_EQ(s.ToVreg(p1), s.ToVreg(s[0]->InputAt(1)));
EXPECT_EQ(1U, s[0]->OutputCount());
EXPECT_EQ(kFlags_set, s[0]->flags_mode());
EXPECT_EQ(kNotEqual, s[0]->flags_condition());
}
}
namespace {
struct IntegerCmp {
MachInst2 mi;
FlagsCondition cond;
FlagsCondition commuted_cond;
};
std::ostream& operator<<(std::ostream& os, const IntegerCmp& cmp) {
return os << cmp.mi;
}
// ARM64 32-bit integer comparison instructions.
const IntegerCmp kIntegerCmpInstructions[] = {
{{&RawMachineAssembler::Word32Equal, "Word32Equal", kArm64Cmp32,
MachineType::Int32()},
kEqual,
kEqual},
{{&RawMachineAssembler::Int32LessThan, "Int32LessThan", kArm64Cmp32,
MachineType::Int32()},
kSignedLessThan,
kSignedGreaterThan},
{{&RawMachineAssembler::Int32LessThanOrEqual, "Int32LessThanOrEqual",
kArm64Cmp32, MachineType::Int32()},
kSignedLessThanOrEqual,
kSignedGreaterThanOrEqual},
{{&RawMachineAssembler::Uint32LessThan, "Uint32LessThan", kArm64Cmp32,
MachineType::Uint32()},
kUnsignedLessThan,
kUnsignedGreaterThan},
{{&RawMachineAssembler::Uint32LessThanOrEqual, "Uint32LessThanOrEqual",
kArm64Cmp32, MachineType::Uint32()},
kUnsignedLessThanOrEqual,
kUnsignedGreaterThanOrEqual}};
const IntegerCmp kIntegerCmpEqualityInstructions[] = {
{{&RawMachineAssembler::Word32Equal, "Word32Equal", kArm64Cmp32,
MachineType::Int32()},
kEqual,
kEqual},
{{&RawMachineAssembler::Word32NotEqual, "Word32NotEqual", kArm64Cmp32,
MachineType::Int32()},
kNotEqual,
kNotEqual}};
} // namespace
TEST_F(InstructionSelectorTest, Word32CompareNegateWithWord32Shift) {
TRACED_FOREACH(IntegerCmp, cmp, kIntegerCmpEqualityInstructions) {
TRACED_FOREACH(Shift, shift, kShiftInstructions) {
// Test 32-bit operations. Ignore ROR shifts, as compare-negate does not
// support them.
if (shift.mi.machine_type != MachineType::Int32() ||
shift.mi.arch_opcode == kArm64Ror32) {
continue;
}
TRACED_FORRANGE(int32_t, imm, -32, 63) {
StreamBuilder m(this, MachineType::Int32(), MachineType::Int32(),
MachineType::Int32());
Node* const p0 = m.Parameter(0);
Node* const p1 = m.Parameter(1);
Node* r = (m.*shift.mi.constructor)(p1, m.Int32Constant(imm));
m.Return(
(m.*cmp.mi.constructor)(p0, m.Int32Sub(m.Int32Constant(0), r)));
Stream s = m.Build();
ASSERT_EQ(1U, s.size());
EXPECT_EQ(kArm64Cmn32, s[0]->arch_opcode());
EXPECT_EQ(3U, s[0]->InputCount());
EXPECT_EQ(shift.mode, s[0]->addressing_mode());
EXPECT_EQ(0x3F & imm, 0x3F & s.ToInt32(s[0]->InputAt(2)));
EXPECT_EQ(1U, s[0]->OutputCount());
EXPECT_EQ(kFlags_set, s[0]->flags_mode());
EXPECT_EQ(cmp.cond, s[0]->flags_condition());
}
}
}
}
TEST_F(InstructionSelectorTest, CmpWithImmediateOnLeft) {
TRACED_FOREACH(IntegerCmp, cmp, kIntegerCmpInstructions) {
TRACED_FOREACH(int32_t, imm, kAddSubImmediates) {
// kEqual and kNotEqual trigger the cbz/cbnz optimization, which
// is tested elsewhere.
if (cmp.cond == kEqual || cmp.cond == kNotEqual) continue;
// For signed less than or equal to zero, we generate TBNZ.
if (cmp.cond == kSignedLessThanOrEqual && imm == 0) continue;
StreamBuilder m(this, MachineType::Int32(), MachineType::Int32());
Node* const p0 = m.Parameter(0);
m.Return((m.*cmp.mi.constructor)(m.Int32Constant(imm), p0));
Stream s = m.Build();
ASSERT_EQ(1U, s.size());
EXPECT_EQ(kArm64Cmp32, s[0]->arch_opcode());
ASSERT_LE(2U, s[0]->InputCount());
EXPECT_EQ(kFlags_set, s[0]->flags_mode());
EXPECT_EQ(cmp.commuted_cond, s[0]->flags_condition());
EXPECT_EQ(imm, s.ToInt32(s[0]->InputAt(1)));
}
}
}
TEST_F(InstructionSelectorTest, CmnWithImmediateOnLeft) {
TRACED_FOREACH(IntegerCmp, cmp, kIntegerCmpEqualityInstructions) {
TRACED_FOREACH(int32_t, imm, kAddSubImmediates) {
// kEqual and kNotEqual trigger the cbz/cbnz optimization, which
// is tested elsewhere.
if (cmp.cond == kEqual || cmp.cond == kNotEqual) continue;
StreamBuilder m(this, MachineType::Int32(), MachineType::Int32());
Node* sub = m.Int32Sub(m.Int32Constant(0), m.Parameter(0));
m.Return((m.*cmp.mi.constructor)(m.Int32Constant(imm), sub));
Stream s = m.Build();
ASSERT_EQ(1U, s.size());
EXPECT_EQ(kArm64Cmn32, s[0]->arch_opcode());
ASSERT_LE(2U, s[0]->InputCount());
EXPECT_EQ(kFlags_set, s[0]->flags_mode());
EXPECT_EQ(cmp.cond, s[0]->flags_condition());
EXPECT_EQ(imm, s.ToInt32(s[0]->InputAt(1)));
}
}
}
TEST_F(InstructionSelectorTest, CmpSignedExtendByteOnLeft) {
TRACED_FOREACH(IntegerCmp, cmp, kIntegerCmpInstructions) {
StreamBuilder m(this, MachineType::Int32(), MachineType::Int32(),
MachineType::Int32());
Node* extend = m.Word32Sar(m.Word32Shl(m.Parameter(0), m.Int32Constant(24)),
m.Int32Constant(24));
m.Return((m.*cmp.mi.constructor)(extend, m.Parameter(1)));
Stream s = m.Build();
ASSERT_EQ(1U, s.size());
EXPECT_EQ(kArm64Cmp32, s[0]->arch_opcode());
EXPECT_EQ(kFlags_set, s[0]->flags_mode());
EXPECT_EQ(cmp.commuted_cond, s[0]->flags_condition());
EXPECT_EQ(kMode_Operand2_R_SXTB, s[0]->addressing_mode());
}
}
TEST_F(InstructionSelectorTest, CmnSignedExtendByteOnLeft) {
TRACED_FOREACH(IntegerCmp, cmp, kIntegerCmpEqualityInstructions) {
StreamBuilder m(this, MachineType::Int32(), MachineType::Int32(),
MachineType::Int32());
Node* sub = m.Int32Sub(m.Int32Constant(0), m.Parameter(0));
Node* extend = m.Word32Sar(m.Word32Shl(m.Parameter(0), m.Int32Constant(24)),
m.Int32Constant(24));
m.Return((m.*cmp.mi.constructor)(extend, sub));
Stream s = m.Build();
ASSERT_EQ(1U, s.size());
EXPECT_EQ(kArm64Cmn32, s[0]->arch_opcode());
EXPECT_EQ(kFlags_set, s[0]->flags_mode());
EXPECT_EQ(cmp.cond, s[0]->flags_condition());
EXPECT_EQ(kMode_Operand2_R_SXTB, s[0]->addressing_mode());
}
}
TEST_F(InstructionSelectorTest, CmpShiftByImmediateOnLeft) {
TRACED_FOREACH(IntegerCmp, cmp, kIntegerCmpInstructions) {
TRACED_FOREACH(Shift, shift, kShiftInstructions) {
// Only test relevant shifted operands.
if (shift.mi.machine_type != MachineType::Int32()) continue;
// The available shift operand range is `0 <= imm < 32`, but we also test
// that immediates outside this range are handled properly (modulo-32).
TRACED_FORRANGE(int, imm, -32, 63) {
StreamBuilder m(this, MachineType::Int32(), MachineType::Int32(),
MachineType::Int32());
m.Return((m.*cmp.mi.constructor)(
(m.*shift.mi.constructor)(m.Parameter(1), m.Int32Constant(imm)),
m.Parameter(0)));
Stream s = m.Build();
// Cmp does not support ROR shifts.
if (shift.mi.arch_opcode == kArm64Ror32) {
ASSERT_EQ(2U, s.size());
continue;
}
ASSERT_EQ(1U, s.size());
EXPECT_EQ(kArm64Cmp32, s[0]->arch_opcode());
EXPECT_EQ(shift.mode, s[0]->addressing_mode());
EXPECT_EQ(3U, s[0]->InputCount());
EXPECT_EQ(0x3F & imm, 0x3F & s.ToInt64(s[0]->InputAt(2)));
EXPECT_EQ(1U, s[0]->OutputCount());
EXPECT_EQ(kFlags_set, s[0]->flags_mode());
EXPECT_EQ(cmp.commuted_cond, s[0]->flags_condition());
}
}
}
}
TEST_F(InstructionSelectorTest, CmnShiftByImmediateOnLeft) {
TRACED_FOREACH(IntegerCmp, cmp, kIntegerCmpEqualityInstructions) {
TRACED_FOREACH(Shift, shift, kShiftInstructions) {
// Only test relevant shifted operands.
if (shift.mi.machine_type != MachineType::Int32()) continue;
// The available shift operand range is `0 <= imm < 32`, but we also test
// that immediates outside this range are handled properly (modulo-32).
TRACED_FORRANGE(int, imm, -32, 63) {
StreamBuilder m(this, MachineType::Int32(), MachineType::Int32(),
MachineType::Int32());
Node* sub = m.Int32Sub(m.Int32Constant(0), m.Parameter(0));
m.Return((m.*cmp.mi.constructor)(
(m.*shift.mi.constructor)(m.Parameter(1), m.Int32Constant(imm)),
sub));
Stream s = m.Build();
// Cmn does not support ROR shifts.
if (shift.mi.arch_opcode == kArm64Ror32) {
ASSERT_EQ(2U, s.size());
continue;
}
ASSERT_EQ(1U, s.size());
EXPECT_EQ(kArm64Cmn32, s[0]->arch_opcode());
EXPECT_EQ(shift.mode, s[0]->addressing_mode());
EXPECT_EQ(3U, s[0]->InputCount());
EXPECT_EQ(0x3F & imm, 0x3F & s.ToInt64(s[0]->InputAt(2)));
EXPECT_EQ(1U, s[0]->OutputCount());
EXPECT_EQ(kFlags_set, s[0]->flags_mode());
EXPECT_EQ(cmp.cond, s[0]->flags_condition());
}
}
}
}
// your_sha256_hash-------------
// Flag-setting add and and instructions.
const IntegerCmp kBinopCmpZeroRightInstructions[] = {
{{&RawMachineAssembler::Word32Equal, "Word32Equal", kArm64Cmp32,
MachineType::Int32()},
kEqual,
kEqual},
{{&RawMachineAssembler::Word32NotEqual, "Word32NotEqual", kArm64Cmp32,
MachineType::Int32()},
kNotEqual,
kNotEqual},
{{&RawMachineAssembler::Int32LessThan, "Int32LessThan", kArm64Cmp32,
MachineType::Int32()},
kNegative,
kNegative},
{{&RawMachineAssembler::Int32GreaterThanOrEqual, "Int32GreaterThanOrEqual",
kArm64Cmp32, MachineType::Int32()},
kPositiveOrZero,
kPositiveOrZero},
{{&RawMachineAssembler::Uint32LessThanOrEqual, "Uint32LessThanOrEqual",
kArm64Cmp32, MachineType::Int32()},
kEqual,
kEqual},
{{&RawMachineAssembler::Uint32GreaterThan, "Uint32GreaterThan", kArm64Cmp32,
MachineType::Int32()},
kNotEqual,
kNotEqual}};
const IntegerCmp kBinopCmpZeroLeftInstructions[] = {
{{&RawMachineAssembler::Word32Equal, "Word32Equal", kArm64Cmp32,
MachineType::Int32()},
kEqual,
kEqual},
{{&RawMachineAssembler::Word32NotEqual, "Word32NotEqual", kArm64Cmp32,
MachineType::Int32()},
kNotEqual,
kNotEqual},
{{&RawMachineAssembler::Int32GreaterThan, "Int32GreaterThan", kArm64Cmp32,
MachineType::Int32()},
kNegative,
kNegative},
{{&RawMachineAssembler::Int32LessThanOrEqual, "Int32LessThanOrEqual",
kArm64Cmp32, MachineType::Int32()},
kPositiveOrZero,
kPositiveOrZero},
{{&RawMachineAssembler::Uint32GreaterThanOrEqual,
"Uint32GreaterThanOrEqual", kArm64Cmp32, MachineType::Int32()},
kEqual,
kEqual},
{{&RawMachineAssembler::Uint32LessThan, "Uint32LessThan", kArm64Cmp32,
MachineType::Int32()},
kNotEqual,
kNotEqual}};
struct FlagSettingInst {
MachInst2 mi;
ArchOpcode no_output_opcode;
};
std::ostream& operator<<(std::ostream& os, const FlagSettingInst& inst) {
return os << inst.mi.constructor_name;
}
const FlagSettingInst kFlagSettingInstructions[] = {
{{&RawMachineAssembler::Int32Add, "Int32Add", kArm64Add32,
MachineType::Int32()},
kArm64Cmn32},
{{&RawMachineAssembler::Word32And, "Word32And", kArm64And32,
MachineType::Int32()},
kArm64Tst32}};
typedef InstructionSelectorTestWithParam<FlagSettingInst>
InstructionSelectorFlagSettingTest;
TEST_P(InstructionSelectorFlagSettingTest, CmpZeroRight) {
const FlagSettingInst inst = GetParam();
// Add with single user : a cmp instruction.
TRACED_FOREACH(IntegerCmp, cmp, kBinopCmpZeroRightInstructions) {
StreamBuilder m(this, MachineType::Int32(), MachineType::Int32(),
MachineType::Int32());
Node* binop = (m.*inst.mi.constructor)(m.Parameter(0), m.Parameter(1));
m.Return((m.*cmp.mi.constructor)(binop, m.Int32Constant(0)));
Stream s = m.Build();
ASSERT_EQ(1U, s.size());
ASSERT_EQ(2U, s[0]->InputCount());
EXPECT_EQ(inst.no_output_opcode, s[0]->arch_opcode());
EXPECT_EQ(s.ToVreg(m.Parameter(0)), s.ToVreg(s[0]->InputAt(0)));
EXPECT_EQ(s.ToVreg(m.Parameter(1)), s.ToVreg(s[0]->InputAt(1)));
EXPECT_EQ(kFlags_set, s[0]->flags_mode());
EXPECT_EQ(cmp.cond, s[0]->flags_condition());
}
}
TEST_P(InstructionSelectorFlagSettingTest, CmpZeroLeft) {
const FlagSettingInst inst = GetParam();
// Test a cmp with zero on the left-hand side.
TRACED_FOREACH(IntegerCmp, cmp, kBinopCmpZeroLeftInstructions) {
StreamBuilder m(this, MachineType::Int32(), MachineType::Int32(),
MachineType::Int32());
Node* binop = (m.*inst.mi.constructor)(m.Parameter(0), m.Parameter(1));
m.Return((m.*cmp.mi.constructor)(m.Int32Constant(0), binop));
Stream s = m.Build();
ASSERT_EQ(1U, s.size());
ASSERT_EQ(2U, s[0]->InputCount());
EXPECT_EQ(inst.no_output_opcode, s[0]->arch_opcode());
EXPECT_EQ(s.ToVreg(m.Parameter(0)), s.ToVreg(s[0]->InputAt(0)));
EXPECT_EQ(s.ToVreg(m.Parameter(1)), s.ToVreg(s[0]->InputAt(1)));
EXPECT_EQ(kFlags_set, s[0]->flags_mode());
EXPECT_EQ(cmp.cond, s[0]->flags_condition());
}
}
TEST_P(InstructionSelectorFlagSettingTest, CmpZeroOnlyUserInBasicBlock) {
const FlagSettingInst inst = GetParam();
// Binop with additional users, but in a different basic block.
TRACED_FOREACH(IntegerCmp, cmp, kBinopCmpZeroRightInstructions) {
StreamBuilder m(this, MachineType::Int32(), MachineType::Int32(),
MachineType::Int32());
RawMachineLabel a, b;
Node* binop = (m.*inst.mi.constructor)(m.Parameter(0), m.Parameter(1));
Node* comp = (m.*cmp.mi.constructor)(binop, m.Int32Constant(0));
m.Branch(m.Parameter(0), &a, &b);
m.Bind(&a);
m.Return(binop);
m.Bind(&b);
m.Return(comp);
Stream s = m.Build();
ASSERT_EQ(2U, s.size()); // Flag-setting instruction and branch.
ASSERT_EQ(2U, s[0]->InputCount());
EXPECT_EQ(inst.mi.arch_opcode, s[0]->arch_opcode());
EXPECT_EQ(s.ToVreg(m.Parameter(0)), s.ToVreg(s[0]->InputAt(0)));
EXPECT_EQ(s.ToVreg(m.Parameter(1)), s.ToVreg(s[0]->InputAt(1)));
EXPECT_EQ(kFlags_set, s[0]->flags_mode());
EXPECT_EQ(cmp.cond, s[0]->flags_condition());
}
}
TEST_P(InstructionSelectorFlagSettingTest, ShiftedOperand) {
const FlagSettingInst inst = GetParam();
// Like the test above, but with a shifted input to the binary operator.
TRACED_FOREACH(IntegerCmp, cmp, kBinopCmpZeroRightInstructions) {
StreamBuilder m(this, MachineType::Int32(), MachineType::Int32(),
MachineType::Int32());
RawMachineLabel a, b;
Node* imm = m.Int32Constant(5);
Node* shift = m.Word32Shl(m.Parameter(1), imm);
Node* binop = (m.*inst.mi.constructor)(m.Parameter(0), shift);
Node* comp = (m.*cmp.mi.constructor)(binop, m.Int32Constant(0));
m.Branch(m.Parameter(0), &a, &b);
m.Bind(&a);
m.Return(binop);
m.Bind(&b);
m.Return(comp);
Stream s = m.Build();
ASSERT_EQ(2U, s.size()); // Flag-setting instruction and branch.
ASSERT_EQ(3U, s[0]->InputCount());
EXPECT_EQ(inst.mi.arch_opcode, s[0]->arch_opcode());
EXPECT_EQ(s.ToVreg(m.Parameter(0)), s.ToVreg(s[0]->InputAt(0)));
EXPECT_EQ(s.ToVreg(m.Parameter(1)), s.ToVreg(s[0]->InputAt(1)));
EXPECT_EQ(5, s.ToInt32(s[0]->InputAt(2)));
EXPECT_EQ(kMode_Operand2_R_LSL_I, s[0]->addressing_mode());
EXPECT_EQ(kFlags_set, s[0]->flags_mode());
EXPECT_EQ(cmp.cond, s[0]->flags_condition());
}
}
TEST_P(InstructionSelectorFlagSettingTest, UsersInSameBasicBlock) {
const FlagSettingInst inst = GetParam();
// Binop with additional users, in the same basic block. We need to make sure
// we don't try to optimise this case.
TRACED_FOREACH(IntegerCmp, cmp, kIntegerCmpInstructions) {
StreamBuilder m(this, MachineType::Int32(), MachineType::Int32(),
MachineType::Int32());
RawMachineLabel a, b;
Node* binop = (m.*inst.mi.constructor)(m.Parameter(0), m.Parameter(1));
Node* mul = m.Int32Mul(m.Parameter(0), binop);
Node* comp = (m.*cmp.mi.constructor)(binop, m.Int32Constant(0));
m.Branch(m.Parameter(0), &a, &b);
m.Bind(&a);
m.Return(mul);
m.Bind(&b);
m.Return(comp);
Stream s = m.Build();
ASSERT_EQ(4U, s.size()); // Includes the compare and branch instruction.
EXPECT_EQ(inst.mi.arch_opcode, s[0]->arch_opcode());
EXPECT_EQ(kFlags_none, s[0]->flags_mode());
EXPECT_EQ(kArm64Mul32, s[1]->arch_opcode());
EXPECT_EQ(kArm64Cmp32, s[2]->arch_opcode());
EXPECT_EQ(kFlags_set, s[2]->flags_mode());
EXPECT_EQ(cmp.cond, s[2]->flags_condition());
}
}
TEST_P(InstructionSelectorFlagSettingTest, CommuteImmediate) {
const FlagSettingInst inst = GetParam();
// Immediate on left hand side of the binary operator.
TRACED_FOREACH(IntegerCmp, cmp, kBinopCmpZeroRightInstructions) {
StreamBuilder m(this, MachineType::Int32(), MachineType::Int32());
// 3 can be an immediate on both arithmetic and logical instructions.
Node* imm = m.Int32Constant(3);
Node* binop = (m.*inst.mi.constructor)(imm, m.Parameter(0));
Node* comp = (m.*cmp.mi.constructor)(binop, m.Int32Constant(0));
m.Return(comp);
Stream s = m.Build();
ASSERT_EQ(1U, s.size());
ASSERT_EQ(2U, s[0]->InputCount());
EXPECT_EQ(inst.no_output_opcode, s[0]->arch_opcode());
EXPECT_EQ(s.ToVreg(m.Parameter(0)), s.ToVreg(s[0]->InputAt(0)));
EXPECT_EQ(3, s.ToInt32(s[0]->InputAt(1)));
EXPECT_EQ(kFlags_set, s[0]->flags_mode());
EXPECT_EQ(cmp.cond, s[0]->flags_condition());
}
}
TEST_P(InstructionSelectorFlagSettingTest, CommuteShift) {
const FlagSettingInst inst = GetParam();
// Left-hand side operand shifted by immediate.
TRACED_FOREACH(IntegerCmp, cmp, kBinopCmpZeroRightInstructions) {
TRACED_FOREACH(Shift, shift, kShiftInstructions) {
// Only test relevant shifted operands.
if (shift.mi.machine_type != MachineType::Int32()) continue;
StreamBuilder m(this, MachineType::Int32(), MachineType::Int32(),
MachineType::Int32());
Node* imm = m.Int32Constant(5);
Node* shifted_operand = (m.*shift.mi.constructor)(m.Parameter(0), imm);
Node* binop = (m.*inst.mi.constructor)(shifted_operand, m.Parameter(1));
Node* comp = (m.*cmp.mi.constructor)(binop, m.Int32Constant(0));
m.Return(comp);
Stream s = m.Build();
// Cmn does not support ROR shifts.
if (inst.no_output_opcode == kArm64Cmn32 &&
shift.mi.arch_opcode == kArm64Ror32) {
ASSERT_EQ(2U, s.size());
continue;
}
ASSERT_EQ(1U, s.size());
EXPECT_EQ(inst.no_output_opcode, s[0]->arch_opcode());
EXPECT_EQ(shift.mode, s[0]->addressing_mode());
EXPECT_EQ(3U, s[0]->InputCount());
EXPECT_EQ(5, s.ToInt64(s[0]->InputAt(2)));
EXPECT_EQ(1U, s[0]->OutputCount());
EXPECT_EQ(kFlags_set, s[0]->flags_mode());
EXPECT_EQ(cmp.cond, s[0]->flags_condition());
}
}
}
INSTANTIATE_TEST_CASE_P(InstructionSelectorTest,
InstructionSelectorFlagSettingTest,
::testing::ValuesIn(kFlagSettingInstructions));
TEST_F(InstructionSelectorTest, TstInvalidImmediate) {
// Make sure we do not generate an invalid immediate for TST.
TRACED_FOREACH(IntegerCmp, cmp, kBinopCmpZeroRightInstructions) {
StreamBuilder m(this, MachineType::Int32(), MachineType::Int32());
// 5 is not a valid constant for TST.
Node* imm = m.Int32Constant(5);
Node* binop = m.Word32And(imm, m.Parameter(0));
Node* comp = (m.*cmp.mi.constructor)(binop, m.Int32Constant(0));
m.Return(comp);
Stream s = m.Build();
ASSERT_EQ(1U, s.size());
ASSERT_EQ(2U, s[0]->InputCount());
EXPECT_EQ(kArm64Tst32, s[0]->arch_opcode());
EXPECT_NE(InstructionOperand::IMMEDIATE, s[0]->InputAt(0)->kind());
EXPECT_NE(InstructionOperand::IMMEDIATE, s[0]->InputAt(1)->kind());
EXPECT_EQ(kFlags_set, s[0]->flags_mode());
EXPECT_EQ(cmp.cond, s[0]->flags_condition());
}
}
TEST_F(InstructionSelectorTest, CommuteAddsExtend) {
// Extended left-hand side operand.
TRACED_FOREACH(IntegerCmp, cmp, kBinopCmpZeroRightInstructions) {
StreamBuilder m(this, MachineType::Int32(), MachineType::Int32(),
MachineType::Int32());
Node* extend = m.Word32Sar(m.Word32Shl(m.Parameter(0), m.Int32Constant(24)),
m.Int32Constant(24));
Node* binop = m.Int32Add(extend, m.Parameter(1));
m.Return((m.*cmp.mi.constructor)(binop, m.Int32Constant(0)));
Stream s = m.Build();
ASSERT_EQ(1U, s.size());
EXPECT_EQ(kArm64Cmn32, s[0]->arch_opcode());
EXPECT_EQ(kFlags_set, s[0]->flags_mode());
EXPECT_EQ(cmp.cond, s[0]->flags_condition());
EXPECT_EQ(kMode_Operand2_R_SXTB, s[0]->addressing_mode());
}
}
// your_sha256_hash-------------
// Miscellaneous
static const MachInst2 kLogicalWithNotRHSs[] = {
{&RawMachineAssembler::Word32And, "Word32And", kArm64Bic32,
MachineType::Int32()},
{&RawMachineAssembler::Word64And, "Word64And", kArm64Bic,
MachineType::Int64()},
{&RawMachineAssembler::Word32Or, "Word32Or", kArm64Orn32,
MachineType::Int32()},
{&RawMachineAssembler::Word64Or, "Word64Or", kArm64Orn,
MachineType::Int64()},
{&RawMachineAssembler::Word32Xor, "Word32Xor", kArm64Eon32,
MachineType::Int32()},
{&RawMachineAssembler::Word64Xor, "Word64Xor", kArm64Eon,
MachineType::Int64()}};
typedef InstructionSelectorTestWithParam<MachInst2>
InstructionSelectorLogicalWithNotRHSTest;
TEST_P(InstructionSelectorLogicalWithNotRHSTest, Parameter) {
const MachInst2 inst = GetParam();
const MachineType type = inst.machine_type;
// Test cases where RHS is Xor(x, -1).
{
StreamBuilder m(this, type, type, type);
if (type == MachineType::Int32()) {
m.Return((m.*inst.constructor)(
m.Parameter(0), m.Word32Xor(m.Parameter(1), m.Int32Constant(-1))));
} else {
ASSERT_EQ(MachineType::Int64(), type);
m.Return((m.*inst.constructor)(
m.Parameter(0), m.Word64Xor(m.Parameter(1), m.Int64Constant(-1))));
}
Stream s = m.Build();
ASSERT_EQ(1U, s.size());
EXPECT_EQ(inst.arch_opcode, s[0]->arch_opcode());
EXPECT_EQ(2U, s[0]->InputCount());
EXPECT_EQ(1U, s[0]->OutputCount());
}
{
StreamBuilder m(this, type, type, type);
if (type == MachineType::Int32()) {
m.Return((m.*inst.constructor)(
m.Word32Xor(m.Parameter(0), m.Int32Constant(-1)), m.Parameter(1)));
} else {
ASSERT_EQ(MachineType::Int64(), type);
m.Return((m.*inst.constructor)(
m.Word64Xor(m.Parameter(0), m.Int64Constant(-1)), m.Parameter(1)));
}
Stream s = m.Build();
ASSERT_EQ(1U, s.size());
EXPECT_EQ(inst.arch_opcode, s[0]->arch_opcode());
EXPECT_EQ(2U, s[0]->InputCount());
EXPECT_EQ(1U, s[0]->OutputCount());
}
// Test cases where RHS is Not(x).
{
StreamBuilder m(this, type, type, type);
if (type == MachineType::Int32()) {
m.Return(
(m.*inst.constructor)(m.Parameter(0), m.Word32Not(m.Parameter(1))));
} else {
ASSERT_EQ(MachineType::Int64(), type);
m.Return(
(m.*inst.constructor)(m.Parameter(0), m.Word64Not(m.Parameter(1))));
}
Stream s = m.Build();
ASSERT_EQ(1U, s.size());
EXPECT_EQ(inst.arch_opcode, s[0]->arch_opcode());
EXPECT_EQ(2U, s[0]->InputCount());
EXPECT_EQ(1U, s[0]->OutputCount());
}
{
StreamBuilder m(this, type, type, type);
if (type == MachineType::Int32()) {
m.Return(
(m.*inst.constructor)(m.Word32Not(m.Parameter(0)), m.Parameter(1)));
} else {
ASSERT_EQ(MachineType::Int64(), type);
m.Return(
(m.*inst.constructor)(m.Word64Not(m.Parameter(0)), m.Parameter(1)));
}
Stream s = m.Build();
ASSERT_EQ(1U, s.size());
EXPECT_EQ(inst.arch_opcode, s[0]->arch_opcode());
EXPECT_EQ(2U, s[0]->InputCount());
EXPECT_EQ(1U, s[0]->OutputCount());
}
}
INSTANTIATE_TEST_CASE_P(InstructionSelectorTest,
InstructionSelectorLogicalWithNotRHSTest,
::testing::ValuesIn(kLogicalWithNotRHSs));
TEST_F(InstructionSelectorTest, Word32NotWithParameter) {
StreamBuilder m(this, MachineType::Int32(), MachineType::Int32());
m.Return(m.Word32Not(m.Parameter(0)));
Stream s = m.Build();
ASSERT_EQ(1U, s.size());
EXPECT_EQ(kArm64Not32, s[0]->arch_opcode());
EXPECT_EQ(1U, s[0]->InputCount());
EXPECT_EQ(1U, s[0]->OutputCount());
}
TEST_F(InstructionSelectorTest, Word64NotWithParameter) {
StreamBuilder m(this, MachineType::Int64(), MachineType::Int64());
m.Return(m.Word64Not(m.Parameter(0)));
Stream s = m.Build();
ASSERT_EQ(1U, s.size());
EXPECT_EQ(kArm64Not, s[0]->arch_opcode());
EXPECT_EQ(1U, s[0]->InputCount());
EXPECT_EQ(1U, s[0]->OutputCount());
}
TEST_F(InstructionSelectorTest, Word32XorMinusOneWithParameter) {
{
StreamBuilder m(this, MachineType::Int32(), MachineType::Int32());
m.Return(m.Word32Xor(m.Parameter(0), m.Int32Constant(-1)));
Stream s = m.Build();
ASSERT_EQ(1U, s.size());
EXPECT_EQ(kArm64Not32, s[0]->arch_opcode());
EXPECT_EQ(1U, s[0]->InputCount());
EXPECT_EQ(1U, s[0]->OutputCount());
}
{
StreamBuilder m(this, MachineType::Int32(), MachineType::Int32());
m.Return(m.Word32Xor(m.Int32Constant(-1), m.Parameter(0)));
Stream s = m.Build();
ASSERT_EQ(1U, s.size());
EXPECT_EQ(kArm64Not32, s[0]->arch_opcode());
EXPECT_EQ(1U, s[0]->InputCount());
EXPECT_EQ(1U, s[0]->OutputCount());
}
}
TEST_F(InstructionSelectorTest, Word64XorMinusOneWithParameter) {
{
StreamBuilder m(this, MachineType::Int64(), MachineType::Int64());
m.Return(m.Word64Xor(m.Parameter(0), m.Int64Constant(-1)));
Stream s = m.Build();
ASSERT_EQ(1U, s.size());
EXPECT_EQ(kArm64Not, s[0]->arch_opcode());
EXPECT_EQ(1U, s[0]->InputCount());
EXPECT_EQ(1U, s[0]->OutputCount());
}
{
StreamBuilder m(this, MachineType::Int64(), MachineType::Int64());
m.Return(m.Word64Xor(m.Int64Constant(-1), m.Parameter(0)));
Stream s = m.Build();
ASSERT_EQ(1U, s.size());
EXPECT_EQ(kArm64Not, s[0]->arch_opcode());
EXPECT_EQ(1U, s[0]->InputCount());
EXPECT_EQ(1U, s[0]->OutputCount());
}
}
TEST_F(InstructionSelectorTest, Word32ShrWithWord32AndWithImmediate) {
// The available shift operand range is `0 <= imm < 32`, but we also test
// that immediates outside this range are handled properly (modulo-32).
TRACED_FORRANGE(int32_t, shift, -32, 63) {
int32_t lsb = shift & 0x1F;
TRACED_FORRANGE(int32_t, width, 1, 32 - lsb) {
uint32_t jnk = rng()->NextInt();
jnk = (lsb > 0) ? (jnk >> (32 - lsb)) : 0;
uint32_t msk = ((0xFFFFFFFFu >> (32 - width)) << lsb) | jnk;
StreamBuilder m(this, MachineType::Int32(), MachineType::Int32());
m.Return(m.Word32Shr(m.Word32And(m.Parameter(0), m.Int32Constant(msk)),
m.Int32Constant(shift)));
Stream s = m.Build();
ASSERT_EQ(1U, s.size());
EXPECT_EQ(kArm64Ubfx32, s[0]->arch_opcode());
ASSERT_EQ(3U, s[0]->InputCount());
EXPECT_EQ(lsb, s.ToInt32(s[0]->InputAt(1)));
EXPECT_EQ(width, s.ToInt32(s[0]->InputAt(2)));
}
}
TRACED_FORRANGE(int32_t, shift, -32, 63) {
int32_t lsb = shift & 0x1F;
TRACED_FORRANGE(int32_t, width, 1, 32 - lsb) {
uint32_t jnk = rng()->NextInt();
jnk = (lsb > 0) ? (jnk >> (32 - lsb)) : 0;
uint32_t msk = ((0xFFFFFFFFu >> (32 - width)) << lsb) | jnk;
StreamBuilder m(this, MachineType::Int32(), MachineType::Int32());
m.Return(m.Word32Shr(m.Word32And(m.Int32Constant(msk), m.Parameter(0)),
m.Int32Constant(shift)));
Stream s = m.Build();
ASSERT_EQ(1U, s.size());
EXPECT_EQ(kArm64Ubfx32, s[0]->arch_opcode());
ASSERT_EQ(3U, s[0]->InputCount());
EXPECT_EQ(lsb, s.ToInt32(s[0]->InputAt(1)));
EXPECT_EQ(width, s.ToInt32(s[0]->InputAt(2)));
}
}
}
TEST_F(InstructionSelectorTest, Word64ShrWithWord64AndWithImmediate) {
// The available shift operand range is `0 <= imm < 64`, but we also test
// that immediates outside this range are handled properly (modulo-64).
TRACED_FORRANGE(int32_t, shift, -64, 127) {
int32_t lsb = shift & 0x3F;
TRACED_FORRANGE(int32_t, width, 1, 64 - lsb) {
uint64_t jnk = rng()->NextInt64();
jnk = (lsb > 0) ? (jnk >> (64 - lsb)) : 0;
uint64_t msk =
((uint64_t{0xFFFFFFFFFFFFFFFF} >> (64 - width)) << lsb) | jnk;
StreamBuilder m(this, MachineType::Int64(), MachineType::Int64());
m.Return(m.Word64Shr(m.Word64And(m.Parameter(0), m.Int64Constant(msk)),
m.Int64Constant(shift)));
Stream s = m.Build();
ASSERT_EQ(1U, s.size());
EXPECT_EQ(kArm64Ubfx, s[0]->arch_opcode());
ASSERT_EQ(3U, s[0]->InputCount());
EXPECT_EQ(lsb, s.ToInt64(s[0]->InputAt(1)));
EXPECT_EQ(width, s.ToInt64(s[0]->InputAt(2)));
}
}
TRACED_FORRANGE(int32_t, shift, -64, 127) {
int32_t lsb = shift & 0x3F;
TRACED_FORRANGE(int32_t, width, 1, 64 - lsb) {
uint64_t jnk = rng()->NextInt64();
jnk = (lsb > 0) ? (jnk >> (64 - lsb)) : 0;
uint64_t msk =
((uint64_t{0xFFFFFFFFFFFFFFFF} >> (64 - width)) << lsb) | jnk;
StreamBuilder m(this, MachineType::Int64(), MachineType::Int64());
m.Return(m.Word64Shr(m.Word64And(m.Int64Constant(msk), m.Parameter(0)),
m.Int64Constant(shift)));
Stream s = m.Build();
ASSERT_EQ(1U, s.size());
EXPECT_EQ(kArm64Ubfx, s[0]->arch_opcode());
ASSERT_EQ(3U, s[0]->InputCount());
EXPECT_EQ(lsb, s.ToInt64(s[0]->InputAt(1)));
EXPECT_EQ(width, s.ToInt64(s[0]->InputAt(2)));
}
}
}
TEST_F(InstructionSelectorTest, Word32AndWithImmediateWithWord32Shr) {
// The available shift operand range is `0 <= imm < 32`, but we also test
// that immediates outside this range are handled properly (modulo-32).
TRACED_FORRANGE(int32_t, shift, -32, 63) {
int32_t lsb = shift & 0x1F;
TRACED_FORRANGE(int32_t, width, 1, 31) {
uint32_t msk = (1 << width) - 1;
StreamBuilder m(this, MachineType::Int32(), MachineType::Int32());
m.Return(m.Word32And(m.Word32Shr(m.Parameter(0), m.Int32Constant(shift)),
m.Int32Constant(msk)));
Stream s = m.Build();
ASSERT_EQ(1U, s.size());
EXPECT_EQ(kArm64Ubfx32, s[0]->arch_opcode());
ASSERT_EQ(3U, s[0]->InputCount());
EXPECT_EQ(lsb, s.ToInt32(s[0]->InputAt(1)));
int32_t actual_width = (lsb + width > 32) ? (32 - lsb) : width;
EXPECT_EQ(actual_width, s.ToInt32(s[0]->InputAt(2)));
}
}
TRACED_FORRANGE(int32_t, shift, -32, 63) {
int32_t lsb = shift & 0x1F;
TRACED_FORRANGE(int32_t, width, 1, 31) {
uint32_t msk = (1 << width) - 1;
StreamBuilder m(this, MachineType::Int32(), MachineType::Int32());
m.Return(
m.Word32And(m.Int32Constant(msk),
m.Word32Shr(m.Parameter(0), m.Int32Constant(shift))));
Stream s = m.Build();
ASSERT_EQ(1U, s.size());
EXPECT_EQ(kArm64Ubfx32, s[0]->arch_opcode());
ASSERT_EQ(3U, s[0]->InputCount());
EXPECT_EQ(lsb, s.ToInt32(s[0]->InputAt(1)));
int32_t actual_width = (lsb + width > 32) ? (32 - lsb) : width;
EXPECT_EQ(actual_width, s.ToInt32(s[0]->InputAt(2)));
}
}
}
TEST_F(InstructionSelectorTest, Word64AndWithImmediateWithWord64Shr) {
// The available shift operand range is `0 <= imm < 64`, but we also test
// that immediates outside this range are handled properly (modulo-64).
TRACED_FORRANGE(int64_t, shift, -64, 127) {
int64_t lsb = shift & 0x3F;
TRACED_FORRANGE(int64_t, width, 1, 63) {
uint64_t msk = (uint64_t{1} << width) - 1;
StreamBuilder m(this, MachineType::Int64(), MachineType::Int64());
m.Return(m.Word64And(m.Word64Shr(m.Parameter(0), m.Int64Constant(shift)),
m.Int64Constant(msk)));
Stream s = m.Build();
ASSERT_EQ(1U, s.size());
EXPECT_EQ(kArm64Ubfx, s[0]->arch_opcode());
ASSERT_EQ(3U, s[0]->InputCount());
EXPECT_EQ(lsb, s.ToInt64(s[0]->InputAt(1)));
int64_t actual_width = (lsb + width > 64) ? (64 - lsb) : width;
EXPECT_EQ(actual_width, s.ToInt64(s[0]->InputAt(2)));
}
}
TRACED_FORRANGE(int64_t, shift, -64, 127) {
int64_t lsb = shift & 0x3F;
TRACED_FORRANGE(int64_t, width, 1, 63) {
uint64_t msk = (uint64_t{1} << width) - 1;
StreamBuilder m(this, MachineType::Int64(), MachineType::Int64());
m.Return(
m.Word64And(m.Int64Constant(msk),
m.Word64Shr(m.Parameter(0), m.Int64Constant(shift))));
Stream s = m.Build();
ASSERT_EQ(1U, s.size());
EXPECT_EQ(kArm64Ubfx, s[0]->arch_opcode());
ASSERT_EQ(3U, s[0]->InputCount());
EXPECT_EQ(lsb, s.ToInt64(s[0]->InputAt(1)));
int64_t actual_width = (lsb + width > 64) ? (64 - lsb) : width;
EXPECT_EQ(actual_width, s.ToInt64(s[0]->InputAt(2)));
}
}
}
TEST_F(InstructionSelectorTest, Int32MulHighWithParameters) {
StreamBuilder m(this, MachineType::Int32(), MachineType::Int32(),
MachineType::Int32());
Node* const p0 = m.Parameter(0);
Node* const p1 = m.Parameter(1);
Node* const n = m.Int32MulHigh(p0, p1);
m.Return(n);
Stream s = m.Build();
ASSERT_EQ(2U, s.size());
EXPECT_EQ(kArm64Smull, s[0]->arch_opcode());
ASSERT_EQ(2U, s[0]->InputCount());
EXPECT_EQ(s.ToVreg(p0), s.ToVreg(s[0]->InputAt(0)));
EXPECT_EQ(s.ToVreg(p1), s.ToVreg(s[0]->InputAt(1)));
ASSERT_EQ(1U, s[0]->OutputCount());
EXPECT_EQ(kArm64Asr, s[1]->arch_opcode());
ASSERT_EQ(2U, s[1]->InputCount());
EXPECT_EQ(s.ToVreg(s[0]->Output()), s.ToVreg(s[1]->InputAt(0)));
EXPECT_EQ(32, s.ToInt64(s[1]->InputAt(1)));
ASSERT_EQ(1U, s[1]->OutputCount());
EXPECT_EQ(s.ToVreg(n), s.ToVreg(s[1]->Output()));
}
TEST_F(InstructionSelectorTest, Int32MulHighWithSar) {
TRACED_FORRANGE(int32_t, shift, -32, 63) {
StreamBuilder m(this, MachineType::Int32(), MachineType::Int32(),
MachineType::Int32());
Node* const p0 = m.Parameter(0);
Node* const p1 = m.Parameter(1);
Node* const n = m.Word32Sar(m.Int32MulHigh(p0, p1), m.Int32Constant(shift));
m.Return(n);
Stream s = m.Build();
ASSERT_EQ(2U, s.size());
EXPECT_EQ(kArm64Smull, s[0]->arch_opcode());
ASSERT_EQ(2U, s[0]->InputCount());
EXPECT_EQ(s.ToVreg(p0), s.ToVreg(s[0]->InputAt(0)));
EXPECT_EQ(s.ToVreg(p1), s.ToVreg(s[0]->InputAt(1)));
ASSERT_EQ(1U, s[0]->OutputCount());
EXPECT_EQ(kArm64Asr, s[1]->arch_opcode());
ASSERT_EQ(2U, s[1]->InputCount());
EXPECT_EQ(s.ToVreg(s[0]->Output()), s.ToVreg(s[1]->InputAt(0)));
EXPECT_EQ((shift & 0x1F) + 32, s.ToInt64(s[1]->InputAt(1)));
ASSERT_EQ(1U, s[1]->OutputCount());
EXPECT_EQ(s.ToVreg(n), s.ToVreg(s[1]->Output()));
}
}
TEST_F(InstructionSelectorTest, Int32MulHighWithAdd) {
StreamBuilder m(this, MachineType::Int32(), MachineType::Int32(),
MachineType::Int32());
Node* const p0 = m.Parameter(0);
Node* const p1 = m.Parameter(1);
Node* const a = m.Int32Add(m.Int32MulHigh(p0, p1), p0);
// Test only one shift constant here, as we're only interested in it being a
// 32-bit operation; the shift amount is irrelevant.
Node* const n = m.Word32Sar(a, m.Int32Constant(1));
m.Return(n);
Stream s = m.Build();
ASSERT_EQ(3U, s.size());
EXPECT_EQ(kArm64Smull, s[0]->arch_opcode());
ASSERT_EQ(2U, s[0]->InputCount());
EXPECT_EQ(s.ToVreg(p0), s.ToVreg(s[0]->InputAt(0)));
EXPECT_EQ(s.ToVreg(p1), s.ToVreg(s[0]->InputAt(1)));
ASSERT_EQ(1U, s[0]->OutputCount());
EXPECT_EQ(kArm64Add, s[1]->arch_opcode());
EXPECT_EQ(kMode_Operand2_R_ASR_I, s[1]->addressing_mode());
ASSERT_EQ(3U, s[1]->InputCount());
EXPECT_EQ(s.ToVreg(p0), s.ToVreg(s[1]->InputAt(0)));
EXPECT_EQ(s.ToVreg(s[0]->Output()), s.ToVreg(s[1]->InputAt(1)));
EXPECT_EQ(32, s.ToInt64(s[1]->InputAt(2)));
ASSERT_EQ(1U, s[1]->OutputCount());
EXPECT_EQ(kArm64Asr32, s[2]->arch_opcode());
ASSERT_EQ(2U, s[2]->InputCount());
EXPECT_EQ(s.ToVreg(s[1]->Output()), s.ToVreg(s[2]->InputAt(0)));
EXPECT_EQ(1, s.ToInt64(s[2]->InputAt(1)));
ASSERT_EQ(1U, s[2]->OutputCount());
EXPECT_EQ(s.ToVreg(n), s.ToVreg(s[2]->Output()));
}
TEST_F(InstructionSelectorTest, Uint32MulHighWithShr) {
TRACED_FORRANGE(int32_t, shift, -32, 63) {
StreamBuilder m(this, MachineType::Int32(), MachineType::Int32(),
MachineType::Int32());
Node* const p0 = m.Parameter(0);
Node* const p1 = m.Parameter(1);
Node* const n =
m.Word32Shr(m.Uint32MulHigh(p0, p1), m.Int32Constant(shift));
m.Return(n);
Stream s = m.Build();
ASSERT_EQ(2U, s.size());
EXPECT_EQ(kArm64Umull, s[0]->arch_opcode());
ASSERT_EQ(2U, s[0]->InputCount());
EXPECT_EQ(s.ToVreg(p0), s.ToVreg(s[0]->InputAt(0)));
EXPECT_EQ(s.ToVreg(p1), s.ToVreg(s[0]->InputAt(1)));
ASSERT_EQ(1U, s[0]->OutputCount());
EXPECT_EQ(kArm64Lsr, s[1]->arch_opcode());
ASSERT_EQ(2U, s[1]->InputCount());
EXPECT_EQ(s.ToVreg(s[0]->Output()), s.ToVreg(s[1]->InputAt(0)));
EXPECT_EQ((shift & 0x1F) + 32, s.ToInt64(s[1]->InputAt(1)));
ASSERT_EQ(1U, s[1]->OutputCount());
EXPECT_EQ(s.ToVreg(n), s.ToVreg(s[1]->Output()));
}
}
TEST_F(InstructionSelectorTest, Word32SarWithWord32Shl) {
TRACED_FORRANGE(int32_t, shift, 1, 31) {
StreamBuilder m(this, MachineType::Int32(), MachineType::Int32());
Node* const p0 = m.Parameter(0);
Node* const r = m.Word32Sar(m.Word32Shl(p0, m.Int32Constant(shift)),
m.Int32Constant(shift));
m.Return(r);
Stream s = m.Build();
ASSERT_EQ(1U, s.size());
EXPECT_EQ(kArm64Sbfx32, s[0]->arch_opcode());
ASSERT_EQ(3U, s[0]->InputCount());
EXPECT_EQ(s.ToVreg(p0), s.ToVreg(s[0]->InputAt(0)));
ASSERT_EQ(1U, s[0]->OutputCount());
EXPECT_EQ(s.ToVreg(r), s.ToVreg(s[0]->Output()));
}
TRACED_FORRANGE(int32_t, shift, 1, 31) {
StreamBuilder m(this, MachineType::Int32(), MachineType::Int32());
Node* const p0 = m.Parameter(0);
Node* const r = m.Word32Sar(m.Word32Shl(p0, m.Int32Constant(shift + 32)),
m.Int32Constant(shift + 64));
m.Return(r);
Stream s = m.Build();
ASSERT_EQ(1U, s.size());
EXPECT_EQ(kArm64Sbfx32, s[0]->arch_opcode());
ASSERT_EQ(3U, s[0]->InputCount());
EXPECT_EQ(s.ToVreg(p0), s.ToVreg(s[0]->InputAt(0)));
ASSERT_EQ(1U, s[0]->OutputCount());
EXPECT_EQ(s.ToVreg(r), s.ToVreg(s[0]->Output()));
}
}
TEST_F(InstructionSelectorTest, Word32ShrWithWord32Shl) {
TRACED_FORRANGE(int32_t, shift, 1, 31) {
StreamBuilder m(this, MachineType::Int32(), MachineType::Int32());
Node* const p0 = m.Parameter(0);
Node* const r = m.Word32Shr(m.Word32Shl(p0, m.Int32Constant(shift)),
m.Int32Constant(shift));
m.Return(r);
Stream s = m.Build();
ASSERT_EQ(1U, s.size());
EXPECT_EQ(kArm64Ubfx32, s[0]->arch_opcode());
ASSERT_EQ(3U, s[0]->InputCount());
EXPECT_EQ(s.ToVreg(p0), s.ToVreg(s[0]->InputAt(0)));
ASSERT_EQ(1U, s[0]->OutputCount());
EXPECT_EQ(s.ToVreg(r), s.ToVreg(s[0]->Output()));
}
TRACED_FORRANGE(int32_t, shift, 1, 31) {
StreamBuilder m(this, MachineType::Int32(), MachineType::Int32());
Node* const p0 = m.Parameter(0);
Node* const r = m.Word32Shr(m.Word32Shl(p0, m.Int32Constant(shift + 32)),
m.Int32Constant(shift + 64));
m.Return(r);
Stream s = m.Build();
ASSERT_EQ(1U, s.size());
EXPECT_EQ(kArm64Ubfx32, s[0]->arch_opcode());
ASSERT_EQ(3U, s[0]->InputCount());
EXPECT_EQ(s.ToVreg(p0), s.ToVreg(s[0]->InputAt(0)));
ASSERT_EQ(1U, s[0]->OutputCount());
EXPECT_EQ(s.ToVreg(r), s.ToVreg(s[0]->Output()));
}
}
TEST_F(InstructionSelectorTest, Word32ShlWithWord32And) {
TRACED_FORRANGE(int32_t, shift, 1, 30) {
StreamBuilder m(this, MachineType::Int32(), MachineType::Int32());
Node* const p0 = m.Parameter(0);
Node* const r =
m.Word32Shl(m.Word32And(p0, m.Int32Constant((1 << (31 - shift)) - 1)),
m.Int32Constant(shift));
m.Return(r);
Stream s = m.Build();
ASSERT_EQ(1U, s.size());
EXPECT_EQ(kArm64Ubfiz32, s[0]->arch_opcode());
ASSERT_EQ(3U, s[0]->InputCount());
EXPECT_EQ(s.ToVreg(p0), s.ToVreg(s[0]->InputAt(0)));
ASSERT_EQ(1U, s[0]->OutputCount());
EXPECT_EQ(s.ToVreg(r), s.ToVreg(s[0]->Output()));
}
TRACED_FORRANGE(int32_t, shift, 0, 30) {
StreamBuilder m(this, MachineType::Int32(), MachineType::Int32());
Node* const p0 = m.Parameter(0);
Node* const r =
m.Word32Shl(m.Word32And(p0, m.Int32Constant((1 << (31 - shift)) - 1)),
m.Int32Constant(shift + 1));
m.Return(r);
Stream s = m.Build();
ASSERT_EQ(1U, s.size());
EXPECT_EQ(kArm64Lsl32, s[0]->arch_opcode());
ASSERT_EQ(2U, s[0]->InputCount());
EXPECT_EQ(s.ToVreg(p0), s.ToVreg(s[0]->InputAt(0)));
ASSERT_EQ(1U, s[0]->OutputCount());
EXPECT_EQ(s.ToVreg(r), s.ToVreg(s[0]->Output()));
}
}
TEST_F(InstructionSelectorTest, Word32Clz) {
StreamBuilder m(this, MachineType::Uint32(), MachineType::Uint32());
Node* const p0 = m.Parameter(0);
Node* const n = m.Word32Clz(p0);
m.Return(n);
Stream s = m.Build();
ASSERT_EQ(1U, s.size());
EXPECT_EQ(kArm64Clz32, s[0]->arch_opcode());
ASSERT_EQ(1U, s[0]->InputCount());
EXPECT_EQ(s.ToVreg(p0), s.ToVreg(s[0]->InputAt(0)));
ASSERT_EQ(1U, s[0]->OutputCount());
EXPECT_EQ(s.ToVreg(n), s.ToVreg(s[0]->Output()));
}
TEST_F(InstructionSelectorTest, Float32Abs) {
StreamBuilder m(this, MachineType::Float32(), MachineType::Float32());
Node* const p0 = m.Parameter(0);
Node* const n = m.Float32Abs(p0);
m.Return(n);
Stream s = m.Build();
ASSERT_EQ(1U, s.size());
EXPECT_EQ(kArm64Float32Abs, s[0]->arch_opcode());
ASSERT_EQ(1U, s[0]->InputCount());
EXPECT_EQ(s.ToVreg(p0), s.ToVreg(s[0]->InputAt(0)));
ASSERT_EQ(1U, s[0]->OutputCount());
EXPECT_EQ(s.ToVreg(n), s.ToVreg(s[0]->Output()));
}
TEST_F(InstructionSelectorTest, Float64Abs) {
StreamBuilder m(this, MachineType::Float64(), MachineType::Float64());
Node* const p0 = m.Parameter(0);
Node* const n = m.Float64Abs(p0);
m.Return(n);
Stream s = m.Build();
ASSERT_EQ(1U, s.size());
EXPECT_EQ(kArm64Float64Abs, s[0]->arch_opcode());
ASSERT_EQ(1U, s[0]->InputCount());
EXPECT_EQ(s.ToVreg(p0), s.ToVreg(s[0]->InputAt(0)));
ASSERT_EQ(1U, s[0]->OutputCount());
EXPECT_EQ(s.ToVreg(n), s.ToVreg(s[0]->Output()));
}
TEST_F(InstructionSelectorTest, Float64Max) {
StreamBuilder m(this, MachineType::Float64(), MachineType::Float64(),
MachineType::Float64());
Node* const p0 = m.Parameter(0);
Node* const p1 = m.Parameter(1);
Node* const n = m.Float64Max(p0, p1);
m.Return(n);
Stream s = m.Build();
ASSERT_EQ(1U, s.size());
EXPECT_EQ(kArm64Float64Max, s[0]->arch_opcode());
ASSERT_EQ(2U, s[0]->InputCount());
EXPECT_EQ(s.ToVreg(p0), s.ToVreg(s[0]->InputAt(0)));
EXPECT_EQ(s.ToVreg(p1), s.ToVreg(s[0]->InputAt(1)));
ASSERT_EQ(1U, s[0]->OutputCount());
EXPECT_EQ(s.ToVreg(n), s.ToVreg(s[0]->Output()));
}
TEST_F(InstructionSelectorTest, Float64Min) {
StreamBuilder m(this, MachineType::Float64(), MachineType::Float64(),
MachineType::Float64());
Node* const p0 = m.Parameter(0);
Node* const p1 = m.Parameter(1);
Node* const n = m.Float64Min(p0, p1);
m.Return(n);
Stream s = m.Build();
ASSERT_EQ(1U, s.size());
EXPECT_EQ(kArm64Float64Min, s[0]->arch_opcode());
ASSERT_EQ(2U, s[0]->InputCount());
EXPECT_EQ(s.ToVreg(p0), s.ToVreg(s[0]->InputAt(0)));
EXPECT_EQ(s.ToVreg(p1), s.ToVreg(s[0]->InputAt(1)));
ASSERT_EQ(1U, s[0]->OutputCount());
EXPECT_EQ(s.ToVreg(n), s.ToVreg(s[0]->Output()));
}
TEST_F(InstructionSelectorTest, Float32Neg) {
StreamBuilder m(this, MachineType::Float32(), MachineType::Float32());
Node* const p0 = m.Parameter(0);
// Don't use m.Float32Neg() as that generates an explicit sub.
Node* const n = m.AddNode(m.machine()->Float32Neg(), m.Parameter(0));
m.Return(n);
Stream s = m.Build();
ASSERT_EQ(1U, s.size());
EXPECT_EQ(kArm64Float32Neg, s[0]->arch_opcode());
ASSERT_EQ(1U, s[0]->InputCount());
EXPECT_EQ(s.ToVreg(p0), s.ToVreg(s[0]->InputAt(0)));
ASSERT_EQ(1U, s[0]->OutputCount());
EXPECT_EQ(s.ToVreg(n), s.ToVreg(s[0]->Output()));
}
TEST_F(InstructionSelectorTest, Float64Neg) {
StreamBuilder m(this, MachineType::Float64(), MachineType::Float64());
Node* const p0 = m.Parameter(0);
// Don't use m.Float64Neg() as that generates an explicit sub.
Node* const n = m.AddNode(m.machine()->Float64Neg(), m.Parameter(0));
m.Return(n);
Stream s = m.Build();
ASSERT_EQ(1U, s.size());
EXPECT_EQ(kArm64Float64Neg, s[0]->arch_opcode());
ASSERT_EQ(1U, s[0]->InputCount());
EXPECT_EQ(s.ToVreg(p0), s.ToVreg(s[0]->InputAt(0)));
ASSERT_EQ(1U, s[0]->OutputCount());
EXPECT_EQ(s.ToVreg(n), s.ToVreg(s[0]->Output()));
}
TEST_F(InstructionSelectorTest, LoadAndShiftRight) {
{
int32_t immediates[] = {-256, -255, -3, -2, -1, 0, 1,
2, 3, 255, 256, 260, 4096, 4100,
8192, 8196, 3276, 3280, 16376, 16380};
TRACED_FOREACH(int32_t, index, immediates) {
StreamBuilder m(this, MachineType::Uint64(), MachineType::Pointer());
Node* const load = m.Load(MachineType::Uint64(), m.Parameter(0),
m.Int32Constant(index - 4));
Node* const sar = m.Word64Sar(load, m.Int32Constant(32));
// Make sure we don't fold the shift into the following add:
m.Return(m.Int64Add(sar, m.Parameter(0)));
Stream s = m.Build();
ASSERT_EQ(2U, s.size());
EXPECT_EQ(kArm64Ldrsw, s[0]->arch_opcode());
EXPECT_EQ(kMode_MRI, s[0]->addressing_mode());
EXPECT_EQ(2U, s[0]->InputCount());
EXPECT_EQ(s.ToVreg(m.Parameter(0)), s.ToVreg(s[0]->InputAt(0)));
ASSERT_EQ(InstructionOperand::IMMEDIATE, s[0]->InputAt(1)->kind());
EXPECT_EQ(index, s.ToInt32(s[0]->InputAt(1)));
ASSERT_EQ(1U, s[0]->OutputCount());
}
}
}
TEST_F(InstructionSelectorTest, CompareAgainstZero32) {
TRACED_FOREACH(IntegerCmp, cmp, kBinopCmpZeroRightInstructions) {
StreamBuilder m(this, MachineType::Int32(), MachineType::Int32());
Node* const param = m.Parameter(0);
RawMachineLabel a, b;
m.Branch((m.*cmp.mi.constructor)(param, m.Int32Constant(0)), &a, &b);
m.Bind(&a);
m.Return(m.Int32Constant(1));
m.Bind(&b);
m.Return(m.Int32Constant(0));
Stream s = m.Build();
ASSERT_EQ(1U, s.size());
EXPECT_EQ(s.ToVreg(param), s.ToVreg(s[0]->InputAt(0)));
if (cmp.cond == kNegative || cmp.cond == kPositiveOrZero) {
EXPECT_EQ(kArm64TestAndBranch32, s[0]->arch_opcode());
EXPECT_EQ(4U, s[0]->InputCount()); // The labels are also inputs.
EXPECT_EQ((cmp.cond == kNegative) ? kNotEqual : kEqual,
s[0]->flags_condition());
EXPECT_EQ(InstructionOperand::IMMEDIATE, s[0]->InputAt(1)->kind());
EXPECT_EQ(31, s.ToInt32(s[0]->InputAt(1)));
} else {
EXPECT_EQ(kArm64CompareAndBranch32, s[0]->arch_opcode());
EXPECT_EQ(3U, s[0]->InputCount()); // The labels are also inputs.
EXPECT_EQ(cmp.cond, s[0]->flags_condition());
}
}
}
TEST_F(InstructionSelectorTest, CompareFloat64HighLessThanZero64) {
StreamBuilder m(this, MachineType::Int32(), MachineType::Float64());
Node* const param = m.Parameter(0);
Node* const high = m.Float64ExtractHighWord32(param);
RawMachineLabel a, b;
m.Branch(m.Int32LessThan(high, m.Int32Constant(0)), &a, &b);
m.Bind(&a);
m.Return(m.Int32Constant(1));
m.Bind(&b);
m.Return(m.Int32Constant(0));
Stream s = m.Build();
ASSERT_EQ(2U, s.size());
EXPECT_EQ(kArm64U64MoveFloat64, s[0]->arch_opcode());
EXPECT_EQ(kArm64TestAndBranch, s[1]->arch_opcode());
EXPECT_EQ(kNotEqual, s[1]->flags_condition());
EXPECT_EQ(4U, s[1]->InputCount());
EXPECT_EQ(InstructionOperand::IMMEDIATE, s[1]->InputAt(1)->kind());
EXPECT_EQ(63, s.ToInt32(s[1]->InputAt(1)));
}
TEST_F(InstructionSelectorTest, CompareFloat64HighGreaterThanOrEqualZero64) {
StreamBuilder m(this, MachineType::Int32(), MachineType::Float64());
Node* const param = m.Parameter(0);
Node* const high = m.Float64ExtractHighWord32(param);
RawMachineLabel a, b;
m.Branch(m.Int32GreaterThanOrEqual(high, m.Int32Constant(0)), &a, &b);
m.Bind(&a);
m.Return(m.Int32Constant(1));
m.Bind(&b);
m.Return(m.Int32Constant(0));
Stream s = m.Build();
ASSERT_EQ(2U, s.size());
EXPECT_EQ(kArm64U64MoveFloat64, s[0]->arch_opcode());
EXPECT_EQ(kArm64TestAndBranch, s[1]->arch_opcode());
EXPECT_EQ(kEqual, s[1]->flags_condition());
EXPECT_EQ(4U, s[1]->InputCount());
EXPECT_EQ(InstructionOperand::IMMEDIATE, s[1]->InputAt(1)->kind());
EXPECT_EQ(63, s.ToInt32(s[1]->InputAt(1)));
}
TEST_F(InstructionSelectorTest, SpeculationFence) {
StreamBuilder m(this, MachineType::Int32());
m.SpeculationFence();
m.Return(m.Int32Constant(0));
Stream s = m.Build();
ASSERT_EQ(1U, s.size());
EXPECT_EQ(kArm64DsbIsb, s[0]->arch_opcode());
}
} // namespace compiler
} // namespace internal
} // namespace v8
```
|
```shell
Interactively unstage changes
Specify a commit by its ancestry
Useful stashing options
Remember the results of previous hunk conflicts
Sharing data by bundling
```
|
```javascript
Handling modules
Typed Arrays
The `for-of` loop in ES6
Strings in ES6
`WeakMap` in ES6
```
|
Atso Askonen (born February 20, 1970) is a Finnish retired professional ice hockey forward.
Askonen played five games for KooKoo during the 1989–90 SM-liiga season where he scored no points. He continued to play with KooKoo in the 1. Divisioona until 1996.
After retiring in 2002, Askonen returned to KooKoo as head coach of their Jr. C and Jr. B teams. He later became an assistant coach for Pelicans' Jr. B team.
References
External links
1970 births
Living people
Finnish ice hockey forwards
Imatran Ketterä players
KooKoo players
Sportspeople from Kouvola
|
```javascript
import deploy from './deploy.js';
import list from './list.js';
import logs from './logs.js';
import remove from './remove.js';
import secrets from './secrets.js';
import setup from './setup.js';
import system from './system.js';
import templates from './templates.js';
import update from './update.js';
import version from './version.js';
export default (fastify, opts, next) => {
// enable auth for all routes
fastify.addHook('preHandler', fastify.auth([fastify.verifyJWT]));
deploy(fastify);
list(fastify);
remove(fastify);
logs(fastify);
update(fastify);
version(fastify);
templates(fastify);
setup(fastify);
secrets(fastify);
system(fastify);
next();
};
```
|
Gabriela is a 1942 Czech drama film directed by Miroslav Josef Krnanský and starring Marie Glázrová, Karel Höger and Vladimír Leraus.
It was made in Prague during the German occupation of Czechoslovakia. The film's sets were designed by the art director Alois Mecera.
Cast
Marie Glázrová as Gabriela Tuzarová
Karel Höger as Petr Tuzar
Vladimír Leraus as Stepán Tuzar
Zdeňka Baldová as Zofka
Jirí Steimar as Michal
Marie Rosulková as Irena Seborová
Jindřich Plachta as Kudrna
Vladimír Salač as Jindrísek
Theodor as Palous
Josef Gruss as Carda
František Filipovský as Frantisek Kalista
Ada Dohnal as Auditor
Bohus Záhorský as Auditor
F. X. Mlejnek as Postman
Alois Dvorský as Machine-man
Karel Kolár as Matousek
Karel Máj as Marek
Frantisek Lasek as Coffee House Guest
Milos Subrt as Coffee House Guest
Slávka Rosenbergová as Coffee House Guest
Emanuel Kovarík as Pilferer
Antonín Jirsa as Porter
Vladimír Stros as Receptionist
Frantisek Paul as Watchman
Svetla Svozilová as Annoying Woman
Ada Karlovský as Party Guest
Bohumil Langer as Party Guest
Jaroslav Hladík as Party Guest
Josef Dvorský as Party Guest
Jirina Hladikova as Party Guest
Hugo Huska as Party Guest
Ema Kubalova as Party Guest
Milena Velísková as Concert Listener
References
Bibliography
Bohuslav Hoffmann. Vladimír Neff. Československý spisovatel, 1982.
External links
1942 films
Czech drama films
1942 drama films
1940s Czech-language films
Films directed by Miroslav Josef Krnanský
Czechoslovak drama films
Czech black-and-white films
1940s Czech films
|
```html
<!DOCTYPE html>
<html>
<head lang="en">
<title> API Documentation </title>
<link rel="stylesheet" href="path_to_url">
<link href='path_to_url rel='stylesheet' type='text/css'>
<link rel="stylesheet" href="path_to_url">
<script src="path_to_url"></script>
<script src="path_to_url"></script>
<style type="text/css">
body {
font-family: 'Roboto', sans-serif;
}
.hidden {
display:none;
}
pre {
outline: 1px solid #ccc;
padding: 5px; margin: 5px;
}
.string { color: green; }
.number { color: darkorange; }
.boolean { color: blue; }
.null { color: magenta; }
.key { color: red; }
</style>
<style type="text/css">
pre.prettyprint {
border: 1px solid #ccc;
margin-bottom: 0;
padding: 9.5px;
}
</style>
<script>
function syntaxHighlight(json) {
json = json.replace(/&/g, '&').replace(/</g, '<').replace(/>/g, '>');
return json.replace(/("(\\u[a-zA-Z0-9]{4}|\\[^u]|[^\\"])*"(\s*:)?|\b(true|false|null)\b|-?\d+(?:\.\d*)?(?:[eE][+\-]?\d+)?)/g, function (match) {
var cls = 'number';
if (/^"/.test(match)) {
if (/:$/.test(match)) {
cls = 'key';
} else {
cls = 'string';
}
} else if (/true|false/.test(match)) {
cls = 'boolean';
} else if (/null/.test(match)) {
cls = 'null';
}
return '<span class="' + cls + '">' + match + '</span>';
});
}
function spaceJson(json){
var validJson = JSON.parse(json);
return JSON.stringify(validJson, undefined, 4);
}
</script>
</head>
<body>
<nav class="navbar navbar-default navbar-fixed-top">
<div class="container-fluid">
<div class="navbar-header">
<button type="button" class="navbar-toggle collapsed" data-toggle="collapse"
data-target="#bs-example-navbar-collapse-1">
<span class="sr-only">Toggle navigation</span>
<span class="icon-bar"></span>
<span class="icon-bar"></span>
<span class="icon-bar"></span>
</button>
<a class="navbar-brand" href="#">Gin</a>
<p class="navbar-text">Developed by Gophers at <a href="path_to_url">Betacraft</a></p>
</div>
</div>
</nav>
<div class="container-fluid" style="margin-top: 70px;margin-bottom: 20px;">
<div class="container-fluid">
<div class="col-md-4">
<div class="panel panel-default">
<div class="panel-heading">Base Urls</div>
<div class="panel-body">
<p>Production : <strong>/api/v1</strong></p>
<p>Staging : <strong>/api/v1</strong></p>
</div>
</div>
<ul class="nav nav-pills nav-stacked" role="tablist">
<li role="presentation"><a href="#0top" role="tab" data-toggle="tab">POST : /api/v1/hostgroup</a></li>
<li role="presentation"><a href="#1top" role="tab" data-toggle="tab">POST : /api/v1/hostgroup/host</a></li>
<li role="presentation"><a href="#2top" role="tab" data-toggle="tab">PUT : /api/v1/hostgroup/host</a></li>
<li role="presentation"><a href="#3top" role="tab" data-toggle="tab">GET : /api/v1/hostgroup/343</a></li>
<li role="presentation"><a href="#4top" role="tab" data-toggle="tab">GET : /api/v1/hostgroup</a></li>
<li role="presentation"><a href="#5top" role="tab" data-toggle="tab">DELETE : /api/v1/hostgroup/343</a></li>
<li role="presentation"><a href="#6top" role="tab" data-toggle="tab">GET : /api/v1/hostgroup/3/template</a></li>
<li role="presentation"><a href="#7top" role="tab" data-toggle="tab">PUT : /api/v1/hostgroup/template</a></li>
<li role="presentation"><a href="#8top" role="tab" data-toggle="tab">POST : /api/v1/hostgroup/template</a></li>
<ul>
</div>
<div class="col-md-8 tab-content">
<div id="0top" role="tabpanel" class="tab-pane col-md-10">
<p> <H4> Request Headers </H4> </p>
<table class="table table-bordered table-striped">
<tr>
<th>Key</th>
<th>Value</th>
</tr>
<tr>
<td>Apitoken</td>
<td> {"name":"root","sig":"427d6803b78311e68afd0242ac130006"}</td>
</tr>
<tr>
<td>Content-Type</td>
<td> application/json
</td>
</tr>
<tr>
<td>X-Forwarded-For</td>
<td> 127.0.0.1
</td>
</tr>
</table>
<p> <H4> Request Body </H4> </p>
<pre id="request-body-0-0" class="prettyprint">{"name":"testhostgroup"}</pre>
<script>
var requestHeader ={"Apitoken":"{\"name\":\"root\",\"sig\":\"427d6803b78311e68afd0242ac130006\"}","Content-Type":" application/json\r","X-Forwarded-For":" 127.0.0.1\r"};
if (requestHeader["Content-Type"] === "application/json"){
try {
var jsonStr = spaceJson("{\"name\":\"testhostgroup\"}");
document.getElementById('request-body0-0').innerHTML = syntaxHighlight(jsonStr);
} catch (e) {
}
}
</script>
<p><h4> Response Code</h4></p>
<pre class="prettyprint lang-json">200</pre>
<p><h4> Response Headers</h4></p>
<table class="table table-bordered table-striped">
<tr>
<th>Key</th>
<th>Value</th>
</tr>
<tr>
<td>Access-Control-Allow-Credentials</td>
<td> true</td>
</tr>
<tr>
<td>Access-Control-Allow-Headers</td>
<td> Content-Type, Content-Length, Apitoken</td>
</tr>
<tr>
<td>Access-Control-Allow-Methods</td>
<td> POST, GET, OPTIONS, PUT, DELETE, UPDATE</td>
</tr>
<tr>
<td>Access-Control-Allow-Origin</td>
<td> *</td>
</tr>
<tr>
<td>Access-Control-Expose-Headers</td>
<td> Content-Length</td>
</tr>
<tr>
<td>Access-Control-Max-Age</td>
<td> 86400</td>
</tr>
<tr>
<td>Content-Type</td>
<td> application/json; charset=utf-8</td>
</tr>
</table>
<p> <H4> Response Body </H4> </p>
<pre class="prettyprint" id="response-body-0-0">{"id":343,"grp_name":"testhostgroup","create_user":"root"}</pre>
<script>
var responseHeader ={"Access-Control-Allow-Credentials":"true","Access-Control-Allow-Headers":"Content-Type, Content-Length, Apitoken","Access-Control-Allow-Methods":"POST, GET, OPTIONS, PUT, DELETE, UPDATE","Access-Control-Allow-Origin":"*","Access-Control-Expose-Headers":"Content-Length","Access-Control-Max-Age":"86400","Content-Type":"application/json; charset=utf-8"};
if (responseHeader["Content-Type"] === "application/json"){
try {
var jsonStr = spaceJson("{\"id\":343,\"grp_name\":\"testhostgroup\",\"create_user\":\"root\"}");
document.getElementById('response-body-0-0').innerHTML = syntaxHighlight(jsonStr);
} catch (e) {
}
}
</script>
<hr>
</div>
<div id="1top" role="tabpanel" class="tab-pane col-md-10">
<p> <H4> Request Headers </H4> </p>
<table class="table table-bordered table-striped">
<tr>
<th>Key</th>
<th>Value</th>
</tr>
<tr>
<td>Apitoken</td>
<td> {"name":"root","sig":"427d6803b78311e68afd0242ac130006"}</td>
</tr>
<tr>
<td>Content-Type</td>
<td> application/json
</td>
</tr>
<tr>
<td>X-Forwarded-For</td>
<td> 127.0.0.1
</td>
</tr>
</table>
<p> <H4> Request Body </H4> </p>
<pre id="request-body-1-0" class="prettyprint">{"hosts":["testhostgroup","agent_test"],"hostgroup_id":342}</pre>
<script>
var requestHeader ={"Apitoken":"{\"name\":\"root\",\"sig\":\"427d6803b78311e68afd0242ac130006\"}","Content-Type":" application/json\r","X-Forwarded-For":" 127.0.0.1\r"};
if (requestHeader["Content-Type"] === "application/json"){
try {
var jsonStr = spaceJson("{\"hosts\":[\"testhostgroup\",\"agent_test\"],\"hostgroup_id\":342}");
document.getElementById('request-body1-0').innerHTML = syntaxHighlight(jsonStr);
} catch (e) {
}
}
</script>
<p><h4> Response Code</h4></p>
<pre class="prettyprint lang-json">417</pre>
<p><h4> Response Headers</h4></p>
<table class="table table-bordered table-striped">
<tr>
<th>Key</th>
<th>Value</th>
</tr>
<tr>
<td>Access-Control-Allow-Credentials</td>
<td> true</td>
</tr>
<tr>
<td>Access-Control-Allow-Headers</td>
<td> Content-Type, Content-Length, Apitoken</td>
</tr>
<tr>
<td>Access-Control-Allow-Methods</td>
<td> POST, GET, OPTIONS, PUT, DELETE, UPDATE</td>
</tr>
<tr>
<td>Access-Control-Allow-Origin</td>
<td> *</td>
</tr>
<tr>
<td>Access-Control-Expose-Headers</td>
<td> Content-Length</td>
</tr>
<tr>
<td>Access-Control-Max-Age</td>
<td> 86400</td>
</tr>
<tr>
<td>Content-Type</td>
<td> application/json; charset=utf-8</td>
</tr>
</table>
<p> <H4> Response Body </H4> </p>
<pre class="prettyprint" id="response-body-1-0">{"error":"record not found"}</pre>
<script>
var responseHeader ={"Access-Control-Allow-Credentials":"true","Access-Control-Allow-Headers":"Content-Type, Content-Length, Apitoken","Access-Control-Allow-Methods":"POST, GET, OPTIONS, PUT, DELETE, UPDATE","Access-Control-Allow-Origin":"*","Access-Control-Expose-Headers":"Content-Length","Access-Control-Max-Age":"86400","Content-Type":"application/json; charset=utf-8"};
if (responseHeader["Content-Type"] === "application/json"){
try {
var jsonStr = spaceJson("{\"error\":\"record not found\"}");
document.getElementById('response-body-1-0').innerHTML = syntaxHighlight(jsonStr);
} catch (e) {
}
}
</script>
<hr>
<p> <H4> Request Headers </H4> </p>
<table class="table table-bordered table-striped">
<tr>
<th>Key</th>
<th>Value</th>
</tr>
<tr>
<td>Apitoken</td>
<td> {"name":"root","sig":"427d6803b78311e68afd0242ac130006"}</td>
</tr>
<tr>
<td>Content-Type</td>
<td> application/json
</td>
</tr>
<tr>
<td>X-Forwarded-For</td>
<td> 127.0.0.1
</td>
</tr>
</table>
<p> <H4> Request Body </H4> </p>
<pre id="request-body-1-1" class="prettyprint">{"hosts":["testhostgroup","agent_test"],"hostgroup_id":343}</pre>
<script>
var requestHeader ={"Apitoken":"{\"name\":\"root\",\"sig\":\"427d6803b78311e68afd0242ac130006\"}","Content-Type":" application/json\r","X-Forwarded-For":" 127.0.0.1\r"};
if (requestHeader["Content-Type"] === "application/json"){
try {
var jsonStr = spaceJson("{\"hosts\":[\"testhostgroup\",\"agent_test\"],\"hostgroup_id\":343}");
document.getElementById('request-body1-1').innerHTML = syntaxHighlight(jsonStr);
} catch (e) {
}
}
</script>
<p><h4> Response Code</h4></p>
<pre class="prettyprint lang-json">200</pre>
<p><h4> Response Headers</h4></p>
<table class="table table-bordered table-striped">
<tr>
<th>Key</th>
<th>Value</th>
</tr>
<tr>
<td>Access-Control-Allow-Credentials</td>
<td> true</td>
</tr>
<tr>
<td>Access-Control-Allow-Headers</td>
<td> Content-Type, Content-Length, Apitoken</td>
</tr>
<tr>
<td>Access-Control-Allow-Methods</td>
<td> POST, GET, OPTIONS, PUT, DELETE, UPDATE</td>
</tr>
<tr>
<td>Access-Control-Allow-Origin</td>
<td> *</td>
</tr>
<tr>
<td>Access-Control-Expose-Headers</td>
<td> Content-Length</td>
</tr>
<tr>
<td>Access-Control-Max-Age</td>
<td> 86400</td>
</tr>
<tr>
<td>Content-Type</td>
<td> application/json; charset=utf-8</td>
</tr>
</table>
<p> <H4> Response Body </H4> </p>
<pre class="prettyprint" id="response-body-1-1">{"message":"[9312 9313] bind to hostgroup: 343"}</pre>
<script>
var responseHeader ={"Access-Control-Allow-Credentials":"true","Access-Control-Allow-Headers":"Content-Type, Content-Length, Apitoken","Access-Control-Allow-Methods":"POST, GET, OPTIONS, PUT, DELETE, UPDATE","Access-Control-Allow-Origin":"*","Access-Control-Expose-Headers":"Content-Length","Access-Control-Max-Age":"86400","Content-Type":"application/json; charset=utf-8"};
if (responseHeader["Content-Type"] === "application/json"){
try {
var jsonStr = spaceJson("{\"message\":\"[9312 9313] bind to hostgroup: 343\"}");
document.getElementById('response-body-1-1').innerHTML = syntaxHighlight(jsonStr);
} catch (e) {
}
}
</script>
<hr>
</div>
<div id="2top" role="tabpanel" class="tab-pane col-md-10">
<p> <H4> Request Headers </H4> </p>
<table class="table table-bordered table-striped">
<tr>
<th>Key</th>
<th>Value</th>
</tr>
<tr>
<td>Apitoken</td>
<td> {"name":"root","sig":"427d6803b78311e68afd0242ac130006"}</td>
</tr>
<tr>
<td>Content-Type</td>
<td> application/json
</td>
</tr>
<tr>
<td>X-Forwarded-For</td>
<td> 127.0.0.1
</td>
</tr>
</table>
<p> <H4> Request Body </H4> </p>
<pre id="request-body-2-0" class="prettyprint">{"hostgroup_id":343,"host_id":9312}</pre>
<script>
var requestHeader ={"Apitoken":"{\"name\":\"root\",\"sig\":\"427d6803b78311e68afd0242ac130006\"}","Content-Type":" application/json\r","X-Forwarded-For":" 127.0.0.1\r"};
if (requestHeader["Content-Type"] === "application/json"){
try {
var jsonStr = spaceJson("{\"hostgroup_id\":343,\"host_id\":9312}");
document.getElementById('request-body2-0').innerHTML = syntaxHighlight(jsonStr);
} catch (e) {
}
}
</script>
<p><h4> Response Code</h4></p>
<pre class="prettyprint lang-json">200</pre>
<p><h4> Response Headers</h4></p>
<table class="table table-bordered table-striped">
<tr>
<th>Key</th>
<th>Value</th>
</tr>
<tr>
<td>Access-Control-Allow-Credentials</td>
<td> true</td>
</tr>
<tr>
<td>Access-Control-Allow-Headers</td>
<td> Content-Type, Content-Length, Apitoken</td>
</tr>
<tr>
<td>Access-Control-Allow-Methods</td>
<td> POST, GET, OPTIONS, PUT, DELETE, UPDATE</td>
</tr>
<tr>
<td>Access-Control-Allow-Origin</td>
<td> *</td>
</tr>
<tr>
<td>Access-Control-Expose-Headers</td>
<td> Content-Length</td>
</tr>
<tr>
<td>Access-Control-Max-Age</td>
<td> 86400</td>
</tr>
<tr>
<td>Content-Type</td>
<td> application/json; charset=utf-8</td>
</tr>
</table>
<p> <H4> Response Body </H4> </p>
<pre class="prettyprint" id="response-body-2-0">{"message":"unbind host:9312 of hostgroup: 343"}</pre>
<script>
var responseHeader ={"Access-Control-Allow-Credentials":"true","Access-Control-Allow-Headers":"Content-Type, Content-Length, Apitoken","Access-Control-Allow-Methods":"POST, GET, OPTIONS, PUT, DELETE, UPDATE","Access-Control-Allow-Origin":"*","Access-Control-Expose-Headers":"Content-Length","Access-Control-Max-Age":"86400","Content-Type":"application/json; charset=utf-8"};
if (responseHeader["Content-Type"] === "application/json"){
try {
var jsonStr = spaceJson("{\"message\":\"unbind host:9312 of hostgroup: 343\"}");
document.getElementById('response-body-2-0').innerHTML = syntaxHighlight(jsonStr);
} catch (e) {
}
}
</script>
<hr>
</div>
<div id="3top" role="tabpanel" class="tab-pane col-md-10">
<p> <H4> Request Headers </H4> </p>
<table class="table table-bordered table-striped">
<tr>
<th>Key</th>
<th>Value</th>
</tr>
<tr>
<td>Apitoken</td>
<td> {"name":"root","sig":"427d6803b78311e68afd0242ac130006"}</td>
</tr>
<tr>
<td>X-Forwarded-For</td>
<td> 127.0.0.1
</td>
</tr>
</table>
<p><h4> Response Code</h4></p>
<pre class="prettyprint lang-json">200</pre>
<p><h4> Response Headers</h4></p>
<table class="table table-bordered table-striped">
<tr>
<th>Key</th>
<th>Value</th>
</tr>
<tr>
<td>Access-Control-Allow-Credentials</td>
<td> true</td>
</tr>
<tr>
<td>Access-Control-Allow-Headers</td>
<td> Content-Type, Content-Length, Apitoken</td>
</tr>
<tr>
<td>Access-Control-Allow-Methods</td>
<td> POST, GET, OPTIONS, PUT, DELETE, UPDATE</td>
</tr>
<tr>
<td>Access-Control-Allow-Origin</td>
<td> *</td>
</tr>
<tr>
<td>Access-Control-Expose-Headers</td>
<td> Content-Length</td>
</tr>
<tr>
<td>Access-Control-Max-Age</td>
<td> 86400</td>
</tr>
<tr>
<td>Content-Type</td>
<td> application/json; charset=utf-8</td>
</tr>
</table>
<p> <H4> Response Body </H4> </p>
<pre class="prettyprint" id="response-body-3-0">{"hostgroup":{"id":343,"grp_name":"testhostgroup","create_user":"root"},"hosts":[{"id":9313,"hostname":"agent_test","ip":"","agent_version":"","plugin_version":"","maintain_begin":0,"maintain_end":0}]}</pre>
<script>
var responseHeader ={"Access-Control-Allow-Credentials":"true","Access-Control-Allow-Headers":"Content-Type, Content-Length, Apitoken","Access-Control-Allow-Methods":"POST, GET, OPTIONS, PUT, DELETE, UPDATE","Access-Control-Allow-Origin":"*","Access-Control-Expose-Headers":"Content-Length","Access-Control-Max-Age":"86400","Content-Type":"application/json; charset=utf-8"};
if (responseHeader["Content-Type"] === "application/json"){
try {
var jsonStr = spaceJson("{\"hostgroup\":{\"id\":343,\"grp_name\":\"testhostgroup\",\"create_user\":\"root\"},\"hosts\":[{\"id\":9313,\"hostname\":\"agent_test\",\"ip\":\"\",\"agent_version\":\"\",\"plugin_version\":\"\",\"maintain_begin\":0,\"maintain_end\":0}]}");
document.getElementById('response-body-3-0').innerHTML = syntaxHighlight(jsonStr);
} catch (e) {
}
}
</script>
<hr>
</div>
<div id="4top" role="tabpanel" class="tab-pane col-md-10">
<p> <H4> Request Headers </H4> </p>
<table class="table table-bordered table-striped">
<tr>
<th>Key</th>
<th>Value</th>
</tr>
<tr>
<td>Apitoken</td>
<td> {"name":"root","sig":"427d6803b78311e68afd0242ac130006"}</td>
</tr>
<tr>
<td>X-Forwarded-For</td>
<td> 127.0.0.1
</td>
</tr>
</table>
<p><h4> Response Code</h4></p>
<pre class="prettyprint lang-json">200</pre>
<p><h4> Response Headers</h4></p>
<table class="table table-bordered table-striped">
<tr>
<th>Key</th>
<th>Value</th>
</tr>
<tr>
<td>Access-Control-Allow-Credentials</td>
<td> true</td>
</tr>
<tr>
<td>Access-Control-Allow-Headers</td>
<td> Content-Type, Content-Length, Apitoken</td>
</tr>
<tr>
<td>Access-Control-Allow-Methods</td>
<td> POST, GET, OPTIONS, PUT, DELETE, UPDATE</td>
</tr>
<tr>
<td>Access-Control-Allow-Origin</td>
<td> *</td>
</tr>
<tr>
<td>Access-Control-Expose-Headers</td>
<td> Content-Length</td>
</tr>
<tr>
<td>Access-Control-Max-Age</td>
<td> 86400</td>
</tr>
<tr>
<td>Content-Type</td>
<td> application/json; charset=utf-8</td>
</tr>
</table>
<p> <H4> Response Body </H4> </p>
<pre class="prettyprint" id="response-body-4-0">[{"id":3,"grp_name":"hostnameA","create_user":"UserA"},{"id":5,"grp_name":"TAI","create_user":"UserB"},{"id":8,"grp_name":"ForTestHostG","create_user":"root"}]</pre>
<script>
var responseHeader ={"Access-Control-Allow-Credentials":"true","Access-Control-Allow-Headers":"Content-Type, Content-Length, Apitoken","Access-Control-Allow-Methods":"POST, GET, OPTIONS, PUT, DELETE, UPDATE","Access-Control-Allow-Origin":"*","Access-Control-Expose-Headers":"Content-Length","Access-Control-Max-Age":"86400","Content-Type":"application/json; charset=utf-8"};
if (responseHeader["Content-Type"] === "application/json"){
try {
var jsonStr = spaceJson("[{\"id\":3,\"grp_name\":\"hostnameA\",\"create_user\":\"UserA\"},{\"id\":5,\"grp_name\":\"TAI\",\"create_user\":\"UserB\"},{\"id\":8,\"grp_name\":\"ForTestHostG\",\"create_user\":\"root\"}]");
document.getElementById('response-body-4-0').innerHTML = syntaxHighlight(jsonStr);
} catch (e) {
}
}
</script>
<hr>
<p> <H4> Request Headers </H4> </p>
<table class="table table-bordered table-striped">
<tr>
<th>Key</th>
<th>Value</th>
</tr>
<tr>
<td>Apitoken</td>
<td> {"name":"root","sig":"427d6803b78311e68afd0242ac130006"}</td>
</tr>
<tr>
<td>X-Forwarded-For</td>
<td> 127.0.0.1
</td>
</tr>
</table>
<p> <H4> URL Params </H4> </p>
<table class="table table-bordered table-striped">
<tr>
<th>Key</th>
<th>Value</th>
</tr>
<tr>
<td>limit</td>
<td> 10</td>
</tr>
<tr>
<td>page</td>
<td> 1</td>
</tr>
</table>
<p><h4> Response Code</h4></p>
<pre class="prettyprint lang-json">200</pre>
<p><h4> Response Headers</h4></p>
<table class="table table-bordered table-striped">
<tr>
<th>Key</th>
<th>Value</th>
</tr>
<tr>
<td>Access-Control-Allow-Credentials</td>
<td> true</td>
</tr>
<tr>
<td>Access-Control-Allow-Headers</td>
<td> Content-Type, Content-Length, Apitoken</td>
</tr>
<tr>
<td>Access-Control-Allow-Methods</td>
<td> POST, GET, OPTIONS, PUT, DELETE, UPDATE</td>
</tr>
<tr>
<td>Access-Control-Allow-Origin</td>
<td> *</td>
</tr>
<tr>
<td>Access-Control-Expose-Headers</td>
<td> Content-Length</td>
</tr>
<tr>
<td>Access-Control-Max-Age</td>
<td> 86400</td>
</tr>
<tr>
<td>Content-Type</td>
<td> application/json; charset=utf-8</td>
</tr>
</table>
<p> <H4> Response Body </H4> </p>
<pre class="prettyprint" id="response-body-4-1">[{"id":3,"grp_name":"docker-A","create_user":"user-A"},{"id":5,"grp_name":"docker-T","create_user":"cheminlin"},{"id":8,"grp_name":"docker-F","create_user":"root"},{"id":9,"grp_name":"docker-B","create_user":"root"},{"id":11,"grp_name":"docker-D","create_user":"user-C"},{"id":12,"grp_name":"docker-E","create_user":"user-C"},{"id":14,"grp_name":"docker-G","create_user":"user-C"},{"id":15,"grp_name":"docker-G2","create_user":"user-C"},{"id":16,"grp_name":"docker-H","create_user":"user-C"},{"id":17,"grp_name":"tools","create_user":"user-C"}]</pre>
<script>
var responseHeader ={"Access-Control-Allow-Credentials":"true","Access-Control-Allow-Headers":"Content-Type, Content-Length, Apitoken","Access-Control-Allow-Methods":"POST, GET, OPTIONS, PUT, DELETE, UPDATE","Access-Control-Allow-Origin":"*","Access-Control-Expose-Headers":"Content-Length","Access-Control-Max-Age":"86400","Content-Type":"application/json; charset=utf-8"};
if (responseHeader["Content-Type"] === "application/json"){
try {
var jsonStr = spaceJson("[{\"id\":3,\"grp_name\":\"docker-A\",\"create_user\":\"user-A\"},{\"id\":5,\"grp_name\":\"docker-T\",\"create_user\":\"cheminlin\"},{\"id\":8,\"grp_name\":\"docker-F\",\"create_user\":\"root\"},{\"id\":9,\"grp_name\":\"docker-B\",\"create_user\":\"root\"},{\"id\":11,\"grp_name\":\"docker-D\",\"create_user\":\"user-C\"},{\"id\":12,\"grp_name\":\"docker-E\",\"create_user\":\"user-C\"},{\"id\":14,\"grp_name\":\"docker-G\",\"create_user\":\"user-C\"},{\"id\":15,\"grp_name\":\"docker-G2\",\"create_user\":\"user-C\"},{\"id\":16,\"grp_name\":\"docker-H\",\"create_user\":\"user-C\"},{\"id\":17,\"grp_name\":\"tools\",\"create_user\":\"user-C\"}]");
document.getElementById('response-body-4-1').innerHTML = syntaxHighlight(jsonStr);
} catch (e) {
}
}
</script>
<hr>
</div>
<div id="5top" role="tabpanel" class="tab-pane col-md-10">
<p> <H4> Request Headers </H4> </p>
<table class="table table-bordered table-striped">
<tr>
<th>Key</th>
<th>Value</th>
</tr>
<tr>
<td>Apitoken</td>
<td> {"name":"root","sig":"427d6803b78311e68afd0242ac130006"}</td>
</tr>
<tr>
<td>X-Forwarded-For</td>
<td> 127.0.0.1
</td>
</tr>
</table>
<p><h4> Response Code</h4></p>
<pre class="prettyprint lang-json">200</pre>
<p><h4> Response Headers</h4></p>
<table class="table table-bordered table-striped">
<tr>
<th>Key</th>
<th>Value</th>
</tr>
<tr>
<td>Access-Control-Allow-Credentials</td>
<td> true</td>
</tr>
<tr>
<td>Access-Control-Allow-Headers</td>
<td> Content-Type, Content-Length, Apitoken</td>
</tr>
<tr>
<td>Access-Control-Allow-Methods</td>
<td> POST, GET, OPTIONS, PUT, DELETE, UPDATE</td>
</tr>
<tr>
<td>Access-Control-Allow-Origin</td>
<td> *</td>
</tr>
<tr>
<td>Access-Control-Expose-Headers</td>
<td> Content-Length</td>
</tr>
<tr>
<td>Access-Control-Max-Age</td>
<td> 86400</td>
</tr>
<tr>
<td>Content-Type</td>
<td> application/json; charset=utf-8</td>
</tr>
</table>
<p> <H4> Response Body </H4> </p>
<pre class="prettyprint" id="response-body-5-0">{"message":"hostgroup:343 has been deleted"}</pre>
<script>
var responseHeader ={"Access-Control-Allow-Credentials":"true","Access-Control-Allow-Headers":"Content-Type, Content-Length, Apitoken","Access-Control-Allow-Methods":"POST, GET, OPTIONS, PUT, DELETE, UPDATE","Access-Control-Allow-Origin":"*","Access-Control-Expose-Headers":"Content-Length","Access-Control-Max-Age":"86400","Content-Type":"application/json; charset=utf-8"};
if (responseHeader["Content-Type"] === "application/json"){
try {
var jsonStr = spaceJson("{\"message\":\"hostgroup:343 has been deleted\"}");
document.getElementById('response-body-5-0').innerHTML = syntaxHighlight(jsonStr);
} catch (e) {
}
}
</script>
<hr>
</div>
<div id="6top" role="tabpanel" class="tab-pane col-md-10">
<p> <H4> Request Headers </H4> </p>
<table class="table table-bordered table-striped">
<tr>
<th>Key</th>
<th>Value</th>
</tr>
<tr>
<td>Apitoken</td>
<td> {"name":"root","sig":"427d6803b78311e68afd0242ac130006"}</td>
</tr>
<tr>
<td>X-Forwarded-For</td>
<td> 127.0.0.1
</td>
</tr>
</table>
<p><h4> Response Code</h4></p>
<pre class="prettyprint lang-json">200</pre>
<p><h4> Response Headers</h4></p>
<table class="table table-bordered table-striped">
<tr>
<th>Key</th>
<th>Value</th>
</tr>
<tr>
<td>Access-Control-Allow-Credentials</td>
<td> true</td>
</tr>
<tr>
<td>Access-Control-Allow-Headers</td>
<td> Content-Type, Content-Length, Apitoken</td>
</tr>
<tr>
<td>Access-Control-Allow-Methods</td>
<td> POST, GET, OPTIONS, PUT, DELETE, UPDATE</td>
</tr>
<tr>
<td>Access-Control-Allow-Origin</td>
<td> *</td>
</tr>
<tr>
<td>Access-Control-Expose-Headers</td>
<td> Content-Length</td>
</tr>
<tr>
<td>Access-Control-Max-Age</td>
<td> 86400</td>
</tr>
<tr>
<td>Content-Type</td>
<td> application/json; charset=utf-8</td>
</tr>
</table>
<p> <H4> Response Body </H4> </p>
<pre class="prettyprint" id="response-body-6-0">{"hostgroup":{"id":3,"grp_name":"hostgroupA","create_user":"root"},"templates":[{"id":5,"tpl_name":"TplA","parent_id":0,"action_id":12,"create_user":"root"},{"id":91,"tpl_name":"TplB","parent_id":0,"action_id":59,"create_user":"userA"},{"id":94,"tpl_name":"TplB","parent_id":0,"action_id":62,"create_user":"userA"},{"id":103,"tpl_name":"TplC","parent_id":0,"action_id":74,"create_user":"root"},{"id":104,"tpl_name":"TplD","parent_id":0,"action_id":75,"create_user":"root"},{"id":105,"tpl_name":"TplE","parent_id":0,"action_id":76,"create_user":"root"},{"id":116,"tpl_name":"TplG","parent_id":0,"action_id":87,"create_user":"root"},{"id":125,"tpl_name":"TplH","parent_id":0,"action_id":99,"create_user":"root"},{"id":126,"tpl_name":"http","parent_id":0,"action_id":100,"create_user":"root"},{"id":127,"tpl_name":"TplJ","parent_id":0,"action_id":101,"create_user":"root"},{"id":194,"tpl_name":"TplK","parent_id":0,"action_id":153,"create_user":"root"},{"id":208,"tpl_name":"PT_TEST","parent_id":0,"action_id":163,"create_user":"userO"}]}</pre>
<script>
var responseHeader ={"Access-Control-Allow-Credentials":"true","Access-Control-Allow-Headers":"Content-Type, Content-Length, Apitoken","Access-Control-Allow-Methods":"POST, GET, OPTIONS, PUT, DELETE, UPDATE","Access-Control-Allow-Origin":"*","Access-Control-Expose-Headers":"Content-Length","Access-Control-Max-Age":"86400","Content-Type":"application/json; charset=utf-8"};
if (responseHeader["Content-Type"] === "application/json"){
try {
var jsonStr = spaceJson("{\"hostgroup\":{\"id\":3,\"grp_name\":\"hostgroupA\",\"create_user\":\"root\"},\"templates\":[{\"id\":5,\"tpl_name\":\"TplA\",\"parent_id\":0,\"action_id\":12,\"create_user\":\"root\"},{\"id\":91,\"tpl_name\":\"TplB\",\"parent_id\":0,\"action_id\":59,\"create_user\":\"userA\"},{\"id\":94,\"tpl_name\":\"TplB\",\"parent_id\":0,\"action_id\":62,\"create_user\":\"userA\"},{\"id\":103,\"tpl_name\":\"TplC\",\"parent_id\":0,\"action_id\":74,\"create_user\":\"root\"},{\"id\":104,\"tpl_name\":\"TplD\",\"parent_id\":0,\"action_id\":75,\"create_user\":\"root\"},{\"id\":105,\"tpl_name\":\"TplE\",\"parent_id\":0,\"action_id\":76,\"create_user\":\"root\"},{\"id\":116,\"tpl_name\":\"TplG\",\"parent_id\":0,\"action_id\":87,\"create_user\":\"root\"},{\"id\":125,\"tpl_name\":\"TplH\",\"parent_id\":0,\"action_id\":99,\"create_user\":\"root\"},{\"id\":126,\"tpl_name\":\"TplI\",\"parent_id\":0,\"action_id\":100,\"create_user\":\"root\"},{\"id\":127,\"tpl_name\":\"TplJ\",\"parent_id\":0,\"action_id\":101,\"create_user\":\"root\"},{\"id\":194,\"tpl_name\":\"TplK\",\"parent_id\":0,\"action_id\":153,\"create_user\":\"root\"},{\"id\":208,\"tpl_name\":\"PT_TEST\",\"parent_id\":0,\"action_id\":163,\"create_user\":\"userO\"}]}");
document.getElementById('response-body-6-0').innerHTML = syntaxHighlight(jsonStr);
} catch (e) {
}
}
</script>
<hr>
</div>
<div id="7top" role="tabpanel" class="tab-pane col-md-10">
<p> <H4> Request Headers </H4> </p>
<table class="table table-bordered table-striped">
<tr>
<th>Key</th>
<th>Value</th>
</tr>
<tr>
<td>Apitoken</td>
<td> {"name":"root","sig":"427d6803b78311e68afd0242ac130006"}</td>
</tr>
<tr>
<td>Content-Type</td>
<td> application/json
</td>
</tr>
<tr>
<td>X-Forwarded-For</td>
<td> 127.0.0.1
</td>
</tr>
</table>
<p> <H4> Request Body </H4> </p>
<pre id="request-body-7-0" class="prettyprint">{"tpl_id":5,"grp_id":3}</pre>
<script>
var requestHeader ={"Apitoken":"{\"name\":\"root\",\"sig\":\"427d6803b78311e68afd0242ac130006\"}","Content-Type":" application/json\r","X-Forwarded-For":" 127.0.0.1\r"};
if (requestHeader["Content-Type"] === "application/json"){
try {
var jsonStr = spaceJson("{\"tpl_id\":5,\"grp_id\":3}");
document.getElementById('request-body7-0').innerHTML = syntaxHighlight(jsonStr);
} catch (e) {
}
}
</script>
<p><h4> Response Code</h4></p>
<pre class="prettyprint lang-json">200</pre>
<p><h4> Response Headers</h4></p>
<table class="table table-bordered table-striped">
<tr>
<th>Key</th>
<th>Value</th>
</tr>
<tr>
<td>Access-Control-Allow-Credentials</td>
<td> true</td>
</tr>
<tr>
<td>Access-Control-Allow-Headers</td>
<td> Content-Type, Content-Length, Apitoken</td>
</tr>
<tr>
<td>Access-Control-Allow-Methods</td>
<td> POST, GET, OPTIONS, PUT, DELETE, UPDATE</td>
</tr>
<tr>
<td>Access-Control-Allow-Origin</td>
<td> *</td>
</tr>
<tr>
<td>Access-Control-Expose-Headers</td>
<td> Content-Length</td>
</tr>
<tr>
<td>Access-Control-Max-Age</td>
<td> 86400</td>
</tr>
<tr>
<td>Content-Type</td>
<td> application/json; charset=utf-8</td>
</tr>
</table>
<p> <H4> Response Body </H4> </p>
<pre class="prettyprint" id="response-body-7-0">{"message":"template: 5 is unbind of HostGroup: 3"}</pre>
<script>
var responseHeader ={"Access-Control-Allow-Credentials":"true","Access-Control-Allow-Headers":"Content-Type, Content-Length, Apitoken","Access-Control-Allow-Methods":"POST, GET, OPTIONS, PUT, DELETE, UPDATE","Access-Control-Allow-Origin":"*","Access-Control-Expose-Headers":"Content-Length","Access-Control-Max-Age":"86400","Content-Type":"application/json; charset=utf-8"};
if (responseHeader["Content-Type"] === "application/json"){
try {
var jsonStr = spaceJson("{\"message\":\"template: 5 is unbind of HostGroup: 3\"}");
document.getElementById('response-body-7-0').innerHTML = syntaxHighlight(jsonStr);
} catch (e) {
}
}
</script>
<hr>
</div>
<div id="8top" role="tabpanel" class="tab-pane col-md-10">
<p> <H4> Request Headers </H4> </p>
<table class="table table-bordered table-striped">
<tr>
<th>Key</th>
<th>Value</th>
</tr>
<tr>
<td>Apitoken</td>
<td> {"name":"root","sig":"427d6803b78311e68afd0242ac130006"}</td>
</tr>
<tr>
<td>Content-Type</td>
<td> application/json
</td>
</tr>
<tr>
<td>X-Forwarded-For</td>
<td> 127.0.0.1
</td>
</tr>
</table>
<p> <H4> Request Body </H4> </p>
<pre id="request-body-8-0" class="prettyprint">{"tpl_id":5,"grp_id":3}</pre>
<script>
var requestHeader ={"Apitoken":"{\"name\":\"root\",\"sig\":\"427d6803b78311e68afd0242ac130006\"}","Content-Type":" application/json\r","X-Forwarded-For":" 127.0.0.1\r"};
if (requestHeader["Content-Type"] === "application/json"){
try {
var jsonStr = spaceJson("{\"tpl_id\":5,\"grp_id\":3}");
document.getElementById('request-body8-0').innerHTML = syntaxHighlight(jsonStr);
} catch (e) {
}
}
</script>
<p><h4> Response Code</h4></p>
<pre class="prettyprint lang-json">200</pre>
<p><h4> Response Headers</h4></p>
<table class="table table-bordered table-striped">
<tr>
<th>Key</th>
<th>Value</th>
</tr>
<tr>
<td>Access-Control-Allow-Credentials</td>
<td> true</td>
</tr>
<tr>
<td>Access-Control-Allow-Headers</td>
<td> Content-Type, Content-Length, Apitoken</td>
</tr>
<tr>
<td>Access-Control-Allow-Methods</td>
<td> POST, GET, OPTIONS, PUT, DELETE, UPDATE</td>
</tr>
<tr>
<td>Access-Control-Allow-Origin</td>
<td> *</td>
</tr>
<tr>
<td>Access-Control-Expose-Headers</td>
<td> Content-Length</td>
</tr>
<tr>
<td>Access-Control-Max-Age</td>
<td> 86400</td>
</tr>
<tr>
<td>Content-Type</td>
<td> application/json; charset=utf-8</td>
</tr>
</table>
<p> <H4> Response Body </H4> </p>
<pre class="prettyprint" id="response-body-8-0">{"grp_id":3,"tpl_id":5,"bind_user":2}</pre>
<script>
var responseHeader ={"Access-Control-Allow-Credentials":"true","Access-Control-Allow-Headers":"Content-Type, Content-Length, Apitoken","Access-Control-Allow-Methods":"POST, GET, OPTIONS, PUT, DELETE, UPDATE","Access-Control-Allow-Origin":"*","Access-Control-Expose-Headers":"Content-Length","Access-Control-Max-Age":"86400","Content-Type":"application/json; charset=utf-8"};
if (responseHeader["Content-Type"] === "application/json"){
try {
var jsonStr = spaceJson("{\"grp_id\":3,\"tpl_id\":5,\"bind_user\":2}");
document.getElementById('response-body-8-0').innerHTML = syntaxHighlight(jsonStr);
} catch (e) {
}
}
</script>
<hr>
</div>
</div>
</div>
</div>
<hr>
</body>
</html>
```
|
I'm Too Sensitive for This Shit is the fourth extended play by American pop singer Hayley Kiyoko. Originally set to be released October 11, 2019 and later December 12, 2019, it was eventually released January 14, 2020 via Empire Distribution and Atlantic Records.
I'm Too Sensitive for This Shit came out single by single, being the EP's release date the same day as the last one was unveiled. It was preceded by the singles "I Wish", "Demons", "L.O.V.E. Me", "Runaway" and "She".
Track listing
Notes
"I Wish" is an original composition from Jason Evigan that was previously used when producing the original demo for the unreleased song "I Wish" by Charli XCX. Therefore, in some instances, Charli XCX, Noonie Bao and Scott Harris are listed as uncredited writers.
References
External links
2020 EPs
Hayley Kiyoko EPs
Atlantic Records EPs
Empire Distribution EPs
|
The T-19 was a Soviet light tank design of the interwar years. Conceived as the mainstay of the new Soviet tank armies, it was a development of the T-18, ultimately based on the First World War-era French Renault FT. When ready for production in 1931, it was already obsolete; the project was terminated in favour of the Vickers based T-26.
Technical requirements
The T-19 was to become the mainstay of the mobile subdivisions of the USSR. The main requirements for the T-19 were:
The ability to overcome the majority of field fortifications and wire entanglements without the aid of a “tail” and at maximum speed
firepower should ensure superiority on the battlefield over all known combat vehicles of similar mass
armor should protect its crew from rifle and machine-gun bullets at all distances, and from the fire of 37 mm guns beyond 1000 meters
According to the technical specifications, the tank's mass should not be more than 7.3 tons, with its maximum speed reaching 30 km/h on good soil with a 100 hp engine, an armament of at least a 40 mm main gun and two machine guns. Armor was to be 18–20 mm thick. Production of the T-19 was assigned to Semyon Alexandrovich Ginzburg.
The suspension of the T-19 became that of the French Renault NC. The T-19 was longer than the T-18, which improved its performance without a “tail”, it also decreased any longitudinal vibrations in the hull.
Armor
Experts often state that sloped armored plate (for increasing the protection of the tank) was first used on the T-34. That is not the case. The fact is that the designers could not exceed the permissible mass of the T-19, therefore they used a maximum thickness of 16 mm of armor. The shape of the hull would be critical in terms of protection. Successful construction of the T-19 depended on sloped armor, such as that proposed to M. I. Tarshinovym (who was already occupied in KB KHPZ with the production of the T-12/T-24), by Ginzburg, which made it more likely for bullets and projectiles to ricochet rather than penetrate.
Armament
The main armament of the T-19 was the 1930 37 mm semi-automatic gun, along with two Degtyaryov machine guns (DT), one located in the frontal portion of the hull near the radio operator; the other was in the turret. The mounting of the armament in the turret was provided in two versions - an independent installation of gun and machine gun, and a coupled installation as a unit.
The turret was the same as the T-18. The cannon could not be mass-produced for a time, and by the time it could, it was used on the BT series of tanks. The planned domestic six-cylinder air-cooled engine with a power of 100 hp was not produced; and the installation of the larger high-speed motor “Franklin” (95 hp) required reprocessing the construction of the gearbox, onboard transfers and even housing (engine it was more on the overall sizes). The T-19 required ball bearings, which at that time were not produced domestically, and had to be bought abroad. Price varied with the installation of chemical warfare equipment, flotation devices and other accessories.
Self containment
The T-19 became the first tank specially designed for the conditions of chemical warfare. It was equipped with plenum ventilation producing 180 m3/h of filtered air, and capable of neutralizing phosgene, hydrocyanic acid, chloropicrin, carbon monoxide and toxic smokes during 3-X of hours. Beyond that point the crew could stop to replace filters, or alternatively carry out a combat mission in gas masks.
Maneuverability
The T-19 was provided with floatation equipment powered using pneumatic or "skeleton" floats, whose discharge could be produced without the output of crew from the machine. For the production were accepted the floating crafts of naval engineer B.S. Smirnov's system. There was initially the desire to equip tank with two detachable screws for propulsion through the water, but the T -19 was instead equipped with a special “water tractor”, which was created in 1931.
The T-19 did not have a “tail” and overcame entrenchments and narrow ditches to 2 meters due to the proper length. However, by the width 2,5 – 3 m two T -19 had to couple in the case of encounter with the antitank ditch, being lengthened doubly, for which in the front and rear extremities of machine it was provided for the installation of the special framework constructions (on the housing of tank there was on three openings in the nose and rear portions for the installation of the farms of cohesion).
For battlefield surveillance, the tank no longer used simple slots, known as “broneglaz”. Initially it was planned to use "stroboscopic" instruments of the type used on the tank made by E.Grote (TG), but bulletproof glass of the “Simplex- triplex” type, with easily removable cartridge clips, was used instead.
Political decision
The decision of the Revolutionary Military Council session of July 17 to 18, 1929, placed before the defense industry a complex problem: to create a new military vehicle in a very short time- the “T-19 basic tracked tank”. GKB OAT was tasked with its design that autumn. The end-of-development date was January 15, 1930, but this proved to be optimistic. The numerous denunciations and complaints of the designers, and also the influence of the leaders of the RKKA (Workers' and Peasants' Red Army) heavily impeded the design process, and several partial prototypes were simply dismantled. In one of the complaints, an unknown “patriot” complained about the designer's desire to use "... helical gears in the transmission of the T-19 instead of spur-gear, which is the direct proof of their sabotage… “. These sorts of complaints came from the military, too; one of the commanders required that the basic tank would be equipped with "... elbow-shaped paws with the shafts through the walls to provide motion in snowy conditions and mountains… “. Nevertheless, despite the delays, inspection of the finished product took place on March 1, 1930.
Production
Production of the first T-19 began in June 1931, and toward the end of August tanks were being delivered. However, the characteristics of the tank proved to be those below those planned, the weight was above the specifications (7,6-8 t), and the production was extremely complex. When added to the fact that the six-ton vehicle purchased from Vickers was both quicker and cheaper to produce, the ultimate outcome was that in 1931 work on the T-19 was cancelled and production redirected to the former, redubbed the T-26. At the time of cancellation, two T-19s had been completed, as well as a housing from the welded and cast parts and a number of accessories.
References
M. Svirin and A. Beskurnikov. The First Soviet Tanks, in Armada Nº 1
External links
Russian tanks and armor
Main infantry tank T-19
The Russian Battlefield - Main tank T-19 (in Russian)
Light tanks of the Soviet Union
Interwar tanks of the Soviet Union
|
```go
package vm
import (
"encoding/binary"
)
func opVerify(vm *virtualMachine) error {
err := vm.applyCost(1)
if err != nil {
return err
}
p, err := vm.pop(true)
if err != nil {
return err
}
if AsBool(p) {
return nil
}
return ErrVerifyFailed
}
func opFail(vm *virtualMachine) error {
err := vm.applyCost(1)
if err != nil {
return err
}
return ErrReturn
}
func opCheckPredicate(vm *virtualMachine) error {
err := vm.applyCost(256)
if err != nil {
return err
}
vm.deferCost(-256 + 64) // get most of that cost back at the end
limit, err := vm.popInt64(true)
if err != nil {
return err
}
predicate, err := vm.pop(true)
if err != nil {
return err
}
n, err := vm.popInt64(true)
if err != nil {
return err
}
if limit < 0 {
return ErrBadValue
}
l := int64(len(vm.dataStack))
if n > l {
return ErrDataStackUnderflow
}
if limit == 0 {
limit = vm.runLimit
}
err = vm.applyCost(limit)
if err != nil {
return err
}
childVM := virtualMachine{
context: vm.context,
program: predicate,
runLimit: limit,
depth: vm.depth + 1,
dataStack: append([][]byte{}, vm.dataStack[l-n:]...),
}
vm.dataStack = vm.dataStack[:l-n]
childErr := childVM.run()
vm.deferCost(-childVM.runLimit)
vm.deferCost(-stackCost(childVM.dataStack))
vm.deferCost(-stackCost(childVM.altStack))
return vm.pushBool(childErr == nil && !childVM.falseResult(), true)
}
func opJump(vm *virtualMachine) error {
err := vm.applyCost(1)
if err != nil {
return err
}
address := binary.LittleEndian.Uint32(vm.data)
vm.nextPC = address
return nil
}
func opJumpIf(vm *virtualMachine) error {
err := vm.applyCost(1)
if err != nil {
return err
}
p, err := vm.pop(true)
if err != nil {
return err
}
if AsBool(p) {
address := binary.LittleEndian.Uint32(vm.data)
vm.nextPC = address
}
return nil
}
```
|
The 1961 NCAA University Division Cross Country Championships were the 23rd annual cross country meet to determine the team and individual national champions of men's collegiate cross country running in the United States. Held on November 27, 1961, the meet was hosted by Michigan State University at the Forest Akers East Golf Course in East Lansing, Michigan. The distance for the race was 4 miles (6.4 kilometers).
All NCAA University Division members were eligible to qualify for the meet. In total, 17 teams and 134 individual runners contested this championship.
The team national championship was won by the Oregon State Beavers, their first. The individual championship was won by Dale Story, also from Oregon State, with a time of 19:46.84.
Men's title
Distance: 4 miles (6.4 kilometers)
Team Result (Top 10)
See also
NCAA Men's College Division Cross Country Championship
References
NCAA Cross Country Championships
NCAA University Division Cross Country Championships
NCAA University Division Cross Country Championships
NCAA University Division Cross Country Championships
Sports competitions in East Lansing, Michigan
Track and field in Michigan
Michigan State University
|
The men's canoe slalom K-1 competition at the 2019 Pan American Games in Lima took place between 3 and 4 August at the Cañete River in Lunahuaná.
The gold medal was won by Pepe Gonçalves of the Brazil.
Schedule
All times are Local Time (UTC−5).
Results
References
Men's slalom K-1
|
```python
#
#
# path_to_url
#
# Unless required by applicable law or agreed to in writing, software
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
"""Multitask base trainer implementation.
The trainer derives from the Orbit `StandardTrainer` class.
"""
from typing import Union
import gin
import orbit
import tensorflow as tf, tf_keras
from official.modeling import optimization
from official.modeling.multitask import base_model
from official.modeling.multitask import multitask
@gin.configurable
class MultiTaskBaseTrainer(orbit.StandardTrainer):
"""Multitask base trainer."""
def __init__(self,
multi_task: multitask.MultiTask,
multi_task_model: Union[tf_keras.Model,
base_model.MultiTaskBaseModel],
optimizer: tf.optimizers.Optimizer,
trainer_options=None,
train_datasets=None):
self._strategy = tf.distribute.get_strategy()
self._multi_task = multi_task
self._multi_task_model = multi_task_model
self._optimizer = optimizer
self._training_losses = None
self._training_metrics = None
self._global_step = orbit.utils.create_global_step()
# Creates a shadow copy of the weights to store weights moving average.
if isinstance(self._optimizer, optimization.ExponentialMovingAverage
) and not self._optimizer.has_shadow_copy:
self._optimizer.shadow_copy(multi_task_model)
if hasattr(self.multi_task_model, "checkpoint_items"):
checkpoint_items = self.multi_task_model.checkpoint_items
else:
checkpoint_items = {}
self._checkpoint = tf.train.Checkpoint(
model=self.multi_task_model,
optimizer=self.optimizer,
global_step=self.global_step,
**checkpoint_items)
if train_datasets is None:
train_datasets = {}
for name, task in self.multi_task.tasks.items():
train_datasets[name] = orbit.utils.make_distributed_dataset(
self.strategy, task.build_inputs, task.task_config.train_data)
super().__init__(
train_dataset=train_datasets,
options=trainer_options or orbit.StandardTrainerOptions())
def train_loop_begin(self):
"""Clean up states that hold losses and metrics."""
for _, train_loss_metric in self.training_losses.items():
train_loss_metric.reset_states()
for _, metrics in self.training_metrics.items():
for metric in metrics:
metric.reset_states()
def train_loop_end(self):
"""Record loss and metric values per task."""
result = {}
for task_name, loss in self.training_losses.items():
result[task_name] = {loss.name: loss.result()}
for task_name, task_metrics in self.training_metrics.items():
result[task_name].update(
{metric.name: metric.result() for metric in task_metrics})
# Note that, the learning rate schedule is managed by the keras optimizer
# internally, which respects the number of backward pass as `iterations`.
# The learning rate schedule does not follow the trainer logical global
# step of multiple tasks.
if callable(self.optimizer.learning_rate):
result["learning_rate"] = self.optimizer.learning_rate(
self.optimizer.iterations)
else:
result["learning_rate"] = self.optimizer.learning_rate
return result
@property
def checkpoint(self):
"""Accesses the training checkpoint."""
return self._checkpoint
@property
def training_losses(self):
"""Access training loss metric objects for all tasks."""
if self._training_losses is None:
# Builds the per-task metrics and losses.
# This the total summed training loss of tasks in the joint training.
self._training_losses = dict(
total_loss=tf_keras.metrics.Mean("training_loss", dtype=tf.float32))
for name in self.multi_task.tasks:
self._training_losses[name] = tf_keras.metrics.Mean(
"training_loss", dtype=tf.float32)
return self._training_losses
@property
def training_metrics(self):
"""Access training metric metric objects for all tasks."""
if self._training_metrics is None:
# Builds the per-task metrics and losses.
self._training_metrics = {}
for name, task in self.multi_task.tasks.items():
self._training_metrics[name] = task.build_metrics(training=True)
return self._training_metrics
@property
def strategy(self):
return self._strategy
@property
def multi_task(self):
return self._multi_task
@property
def multi_task_model(self):
return self._multi_task_model
@property
def optimizer(self):
return self._optimizer
@property
def global_step(self):
return self._global_step
def train_step(self, iterator_map):
"""The default train step calling the multi-task train step.
Args:
iterator_map: a dictionary of task names and per-task dataset iterators.
"""
def step_fn(inputs):
losses = self.multi_task.joint_train_step(
inputs,
multi_task_model=self.multi_task_model,
optimizer=self.optimizer,
task_metrics=self.training_metrics)
for key, loss in losses.items():
self.training_losses[key].update_state(loss)
self.global_step.assign_add(1)
self.strategy.run(
step_fn, args=(tf.nest.map_structure(next, iterator_map),))
```
|
```scala
//// See LICENSE for license details.
//
package chipyard.example
import chisel3._
import chisel3.util._
import dspblocks._
import dsptools.numbers._
import freechips.rocketchip.amba.axi4stream._
import org.chipsalliance.cde.config.{Parameters, Field, Config}
import freechips.rocketchip.diplomacy._
import freechips.rocketchip.tilelink._
import freechips.rocketchip.subsystem._
import fixedpoint._
import fixedpoint.{fromIntToBinaryPoint, fromSIntToFixedPoint, fromUIntToFixedPoint}
// FIR params
case class GenericFIRParams(
writeAddress: BigInt = 0x2000,
readAddress: BigInt = 0x2100,
depth: Int
)
case object GenericFIRKey extends Field[Option[GenericFIRParams]](None)
class GenericFIRCellBundle[T<:Data:Ring](genIn:T, genOut:T) extends Bundle {
val data: T = genIn.cloneType
val carry: T = genOut.cloneType
}
object GenericFIRCellBundle {
def apply[T<:Data:Ring](genIn:T, genOut:T): GenericFIRCellBundle[T] = new GenericFIRCellBundle(genIn, genOut)
}
class GenericFIRCellIO[T<:Data:Ring](genIn:T, genOut:T) extends Bundle {
val coeff = Input(genIn.cloneType)
val in = Flipped(Decoupled(GenericFIRCellBundle(genIn, genOut)))
val out = Decoupled(GenericFIRCellBundle(genIn, genOut))
}
object GenericFIRCellIO {
def apply[T<:Data:Ring](genIn:T, genOut:T): GenericFIRCellIO[T] = new GenericFIRCellIO(genIn, genOut)
}
class GenericFIRBundle[T<:Data:Ring](proto: T) extends Bundle {
val data: T = proto.cloneType
}
object GenericFIRBundle {
def apply[T<:Data:Ring](proto: T): GenericFIRBundle[T] = new GenericFIRBundle(proto)
}
class GenericFIRIO[T<:Data:Ring](genIn:T, genOut:T) extends Bundle {
val in = Flipped(Decoupled(GenericFIRBundle(genIn)))
val out = Decoupled(GenericFIRBundle(genOut))
}
object GenericFIRIO {
def apply[T<:Data:Ring](genIn:T, genOut:T): GenericFIRIO[T] = new GenericFIRIO(genIn, genOut)
}
// A generic FIR filter
// DOC include start: GenericFIR chisel
class GenericFIR[T<:Data:Ring](genIn:T, genOut:T, coeffs: => Seq[T]) extends Module {
val io = IO(GenericFIRIO(genIn, genOut))
// Construct a vector of genericFIRDirectCells
val directCells = Seq.fill(coeffs.length){ Module(new GenericFIRDirectCell(genIn, genOut)).io }
// Construct the direct FIR chain
for ((cell, coeff) <- directCells.zip(coeffs)) {
cell.coeff := coeff
}
// Connect input to first cell
directCells.head.in.bits.data := io.in.bits.data
directCells.head.in.bits.carry := Ring[T].zero
directCells.head.in.valid := io.in.valid
io.in.ready := directCells.head.in.ready
// Connect adjacent cells
// Note that .tail() returns a collection that consists of all
// elements in the inital collection minus the first one.
// This means that we zip together directCells[0, n] and
// directCells[1, n]. However, since zip ignores unmatched elements,
// the resulting zip is (directCells[0], directCells[1]) ...
// (directCells[n-1], directCells[n])
for ((current, next) <- directCells.zip(directCells.tail)) {
next.in.bits := current.out.bits
next.in.valid := current.out.valid
current.out.ready := next.in.ready
}
// Connect output to last cell
io.out.bits.data := directCells.last.out.bits.carry
directCells.last.out.ready := io.out.ready
io.out.valid := directCells.last.out.valid
}
// DOC include end: GenericFIR chisel
// A generic FIR direct cell used to construct a larger direct FIR chain
//
// in ----- [z^-1]-- out
// |
// coeff ----[*]
// |
// carryIn --[+]-- carryOut
//
// DOC include start: GenericFIRDirectCell chisel
class GenericFIRDirectCell[T<:Data:Ring](genIn: T, genOut: T) extends Module {
val io = IO(GenericFIRCellIO(genIn, genOut))
// Registers to delay the input and the valid to propagate with calculations
val hasNewData = RegInit(0.U)
val inputReg = Reg(genIn.cloneType)
// Passthrough ready
io.in.ready := io.out.ready
// When a new transaction is ready on the input, we will have new data to output
// next cycle. Take this data in
when (io.in.fire) {
hasNewData := 1.U
inputReg := io.in.bits.data
}
// We should output data when our cell has new data to output and is ready to
// recieve new data. This insures that every cell in the chain passes its data
// on at the same time
io.out.valid := hasNewData & io.in.fire
io.out.bits.data := inputReg
// Compute carry
// This uses the ring implementation for + and *, i.e.
// (a * b) maps to (Ring[T].prod(a, b)) for whicever T you use
io.out.bits.carry := inputReg * io.coeff + io.in.bits.carry
}
// DOC include end: GenericFIRDirectCell chisel
// DOC include start: GenericFIRBlock chisel
abstract class GenericFIRBlock[D, U, EO, EI, B<:Data, T<:Data:Ring]
(
genIn: T,
genOut: T,
coeffs: => Seq[T]
)(implicit p: Parameters) extends DspBlock[D, U, EO, EI, B] {
val streamNode = AXI4StreamIdentityNode()
val mem = None
lazy val module = new LazyModuleImp(this) {
require(streamNode.in.length == 1)
require(streamNode.out.length == 1)
val in = streamNode.in.head._1
val out = streamNode.out.head._1
// instantiate generic fir
val fir = Module(new GenericFIR(genIn, genOut, coeffs))
// Attach ready and valid to outside interface
in.ready := fir.io.in.ready
fir.io.in.valid := in.valid
fir.io.out.ready := out.ready
out.valid := fir.io.out.valid
// cast UInt to T
fir.io.in.bits := in.bits.data.asTypeOf(GenericFIRBundle(genIn))
// cast T to UInt
out.bits.data := fir.io.out.bits.asUInt
}
}
// DOC include end: GenericFIRBlock chisel
// DOC include start: TLGenericFIRBlock chisel
class TLGenericFIRBlock[T<:Data:Ring]
(
val genIn: T,
val genOut: T,
coeffs: => Seq[T]
)(implicit p: Parameters) extends
GenericFIRBlock[TLClientPortParameters, TLManagerPortParameters, TLEdgeOut, TLEdgeIn, TLBundle, T](
genIn, genOut, coeffs
) with TLDspBlock
// DOC include end: TLGenericFIRBlock chisel
// DOC include start: TLGenericFIRChain chisel
class TLGenericFIRChain[T<:Data:Ring] (genIn: T, genOut: T, coeffs: => Seq[T], params: GenericFIRParams)(implicit p: Parameters)
extends TLChain(Seq(
TLWriteQueue(params.depth, AddressSet(params.writeAddress, 0xff))(_),
{ implicit p: Parameters =>
val fir = LazyModule(new TLGenericFIRBlock(genIn, genOut, coeffs))
fir
},
TLReadQueue(params.depth, AddressSet(params.readAddress, 0xff))(_)
))
// DOC include end: TLGenericFIRChain chisel
// DOC include start: CanHavePeripheryStreamingFIR chisel
trait CanHavePeripheryStreamingFIR extends BaseSubsystem {
val streamingFIR = p(GenericFIRKey) match {
case Some(params) => {
val pbus = locateTLBusWrapper(PBUS)
val domain = pbus.generateSynchronousDomain.suggestName("fir_domain")
val streamingFIR = domain { LazyModule(new TLGenericFIRChain(
genIn = FixedPoint(8.W, 3.BP),
genOut = FixedPoint(8.W, 3.BP),
coeffs = Seq(1.U.asFixedPoint(0.BP), 2.U.asFixedPoint(0.BP), 3.U.asFixedPoint(0.BP)),
params = params)) }
pbus.coupleTo("streamingFIR") { domain { streamingFIR.mem.get := TLFIFOFixer() := TLFragmenter(pbus.beatBytes, pbus.blockBytes) } := _ }
Some(streamingFIR)
}
case None => None
}
}
// DOC include end: CanHavePeripheryStreamingFIR chisel
/**
* Mixin to add FIR to rocket config
*/
// DOC include start: WithStreamingFIR
class WithStreamingFIR extends Config((site, here, up) => {
case GenericFIRKey => Some(GenericFIRParams(depth = 8))
})
// DOC include end: WithStreamingFIR
```
|
```smalltalk
using Microsoft.Extensions.DependencyInjection;
using Volo.Abp.EntityFrameworkCore;
using Volo.Abp.IdentityServer.ApiResources;
using Volo.Abp.IdentityServer.ApiScopes;
using Volo.Abp.IdentityServer.Clients;
using Volo.Abp.IdentityServer.Devices;
using Volo.Abp.IdentityServer.Grants;
using Volo.Abp.IdentityServer.IdentityResources;
using Volo.Abp.Modularity;
namespace Volo.Abp.IdentityServer.EntityFrameworkCore;
[DependsOn(
typeof(AbpIdentityServerDomainModule),
typeof(AbpEntityFrameworkCoreModule)
)]
public class AbpIdentityServerEntityFrameworkCoreModule : AbpModule
{
public override void PreConfigureServices(ServiceConfigurationContext context)
{
context.Services.PreConfigure<IIdentityServerBuilder>(
builder =>
{
builder.AddAbpStores();
}
);
}
public override void ConfigureServices(ServiceConfigurationContext context)
{
context.Services.AddAbpDbContext<IdentityServerDbContext>(options =>
{
options.AddDefaultRepositories<IIdentityServerDbContext>();
options.AddRepository<Client, ClientRepository>();
options.AddRepository<ApiResource, ApiResourceRepository>();
options.AddRepository<ApiScope, ApiScopeRepository>();
options.AddRepository<IdentityResource, IdentityResourceRepository>();
options.AddRepository<PersistedGrant, PersistentGrantRepository>();
options.AddRepository<DeviceFlowCodes, DeviceFlowCodesRepository>();
});
}
}
```
|
Verconia spencerensis is a species of colourful sea slug, a dorid nudibranch, a shell-less marine gastropod mollusk in the family Chromodorididae. This species is localized to Australia.
Distribution
This species was described from sixteen specimens collected on wharf piles at Warna Point, Louth Bay, Eyre Peninsula, South Australia, .
Description
Verconia spencerensis has a deep pink mantle which is mottled with opaque white and has a submarginal row of bright reddish orange spots. The gills and rhinophores are translucent white dusted with opaque white.
The body colour range from yellow to red, scattered with red or orange spots. With a red or orange mark on the front of the rhinophore club. It feeds on a range of pink and yellow aplysillid sponges.
This species is endemic to Australia.
Ecology
References
Chromodorididae
Gastropods described in 1987
|
```xml
export enum LayoutType {
Compact = "Compact",
FilmStrip = "Filmstrip",
Grid = "Grid",
Button = "Button",
List = "List",
Tiles = "Tiles"
}
export enum TileSize {
Small = 22,
Medium = 30,
Large = 36,
XLarge = 60,
FillSpace = 60.1,
}
```
|
```prolog
################################################################################
#
# ppptools.pl -- various utility functions
#
# WARNING: This will be called by old perls. You can't use modern constructs
# in it.
#
################################################################################
#
#
# This program is free software; you can redistribute it and/or
# modify it under the same terms as Perl itself.
#
################################################################################
require './parts/inc/inctools';
sub cat_file
{
eval { require File::Spec };
return $@ ? join('/', @_) : File::Spec->catfile(@_);
}
sub all_files_in_dir
{
my $dir = shift;
local *DIR;
opendir DIR, $dir or die "cannot open directory $dir: $!\n";
my @files = grep { !-d && !/^\./ } readdir DIR; # no dirs or hidden files
closedir DIR;
return map { cat_file($dir, $_) } sort @files;
}
sub parse_todo
{
# Creates a hash with the keys being all symbols found in all the files in
# the input directory (default 'parts/todo'), and the values being each a
# subhash like so:
# 'utf8_hop_forward' => {
# 'code' => 'U',
# 'version' => '5.025007'
# },
#
# The input line that generated that was this:
#
# utf8_hop_forward # U
my $dir = shift || 'parts/todo';
local *TODO;
my %todo;
my $todo;
for $todo (all_files_in_dir($dir)) {
open TODO, $todo or die "cannot open $todo: $!\n";
my $version = <TODO>;
chomp $version;
while (<TODO>) {
chomp;
s/#(?: (\w)\b)?.*//; # 'code' is optional
my $code = $1;
s/^\s+//; s/\s+$//;
/^\s*$/ and next;
/^\w+$/ or die "parse_todo: invalid identifier in $todo: $_\n";
exists $todo{$_} and die "parse_todo: duplicate identifier in $todo: $_ ($todo{$_} <=> $version)\n";
$todo{$_}{'version'} = $version;
$todo{$_}{'code'} = $code if $code;
}
close TODO;
}
return \%todo;
}
sub expand_version
{
my($op, $ver) = @_;
my($r, $v, $s) = parse_version($ver);
$r =~ / ^ [57] $ /x or die "only Perl revisions [57] are supported\n";
my $bcdver = sprintf "0x%d%03d%03d", $r, $v, $s;
return "(PERL_BCDVERSION $op $bcdver)";
}
sub parse_partspec
{
my $file = shift;
my $section = 'implementation';
my $vsec = join '|', qw( provides dontwarn implementation
xsubs xsinit xsmisc xshead xsboot tests );
my(%data, %options);
local *F;
open F, $file or die "$file: $!\n";
while (<F>) {
/[ \t]+$/ and warn "$file:$.: warning: trailing whitespace\n";
if ($section eq 'implementation') {
m!//! && !m!(?:=~|s/).*//! && !m!(?:ht|f)tp(?:s)://!
and warn "$file:$.: warning: potential C++ comment\n";
}
/^##/ and next;
if (/^=($vsec)(?:\s+(.*))?/) {
$section = $1;
if (defined $2) {
my $opt = $2;
$options{$section} = eval "{ $opt }";
$@ and die "$file:$.: invalid options ($opt) in section $section: $@\n";
}
next;
}
push @{$data{$section}}, $_;
}
close F;
for (keys %data) {
my @v = @{$data{$_}};
shift @v while @v && $v[0] =~ /^\s*$/;
pop @v while @v && $v[-1] =~ /^\s*$/;
$data{$_} = join '', @v;
}
if (! exists $data{provides}) {
if ($file =~ /inctools$/) { # This file is special, it doesn't 'provide'
# any API, but has subs to use internally
$data{provides} = "";
}
else {
$data{provides} = ($file =~ /(\w+)\.?$/)[0];
}
}
$data{provides} = [$data{provides} =~ /(\S+)/g];
if (exists $data{dontwarn}) {
$data{dontwarn} = [$data{dontwarn} =~ /(\S+)/g];
}
my @prov;
my %proto;
if (exists $data{tests} && (!exists $data{implementation} || $data{implementation} !~ /\S/)) {
$data{implementation} = '';
}
else {
$data{implementation} =~ /\S/ or die "Empty implementation in $file\n";
my $p;
for $p (@{$data{provides}}) {
if ($p =~ m#^/.*/\w*$#) {
my @tmp = eval "\$data{implementation} =~ ${p}gm";
$@ and die "invalid regex $p in $file\n";
@tmp or warn "no matches for regex $p in $file\n";
push @prov, do { my %h; grep !$h{$_}++, @tmp };
}
elsif ($p eq '__UNDEFINED__') {
my @tmp = $data{implementation} =~ /^\s*__UNDEFINED__[^\r\n\S]+(\w+)/gm;
@tmp or warn "no __UNDEFINED__ macros in $file\n";
push @prov, @tmp;
}
else {
push @prov, $p;
}
}
for (@prov) {
if ($data{implementation} !~ /\b\Q$_\E\b/) {
warn "$file claims to provide $_, but doesn't seem to do so\n";
next;
}
# scan for prototypes
my($proto) = $data{implementation} =~ /
( ^ (?:[\w*]|[^\S\r\n])+
[\r\n]*?
^ \b$_\b \s*
\( [^{]* \)
)
\s* \{
/xm or next;
$proto =~ s/^\s+//;
$proto =~ s/\s+$//;
$proto =~ s/\s+/ /g;
exists $proto{$_} and warn "$file: duplicate prototype for $_\n";
$proto{$_} = $proto;
}
}
for $section (qw( implementation xsubs xsinit xsmisc xshead xsboot )) {
if (exists $data{$section}) {
$data{$section} =~ s/\{\s*version\s*(<|>|==|!=|>=|<=)\s*([\d._]+)\s*\}/expand_version($1, $2)/gei;
}
}
$data{provides} = \@prov;
$data{prototypes} = \%proto;
$data{OPTIONS} = \%options;
my %prov = map { ($_ => 1) } @prov;
my %dontwarn = exists $data{dontwarn} ? map { ($_ => 1) } @{$data{dontwarn}} : ();
my @maybeprov = do { my %h;
grep {
my($nop) = /^Perl_(.*)/;
not exists $prov{$_} ||
exists $dontwarn{$_} ||
/^D_PPP_/ ||
(defined $nop && exists $prov{$nop} ) ||
(defined $nop && exists $dontwarn{$nop}) ||
$h{$_}++;
}
$data{implementation} =~ /^\s*#\s*define\s+(\w+)/gm };
if (@maybeprov) {
warn "$file seems to provide these macros, but doesn't list them:\n "
. join("\n ", @maybeprov) . "\n";
}
return \%data;
}
sub compare_prototypes
{
my($p1, $p2) = @_;
for ($p1, $p2) {
s/^\s+//;
s/\s+$//;
s/\s+/ /g;
s/(\w)\s(\W)/$1$2/g;
s/(\W)\s(\w)/$1$2/g;
}
return $p1 cmp $p2;
}
sub ppcond
{
my $s = shift;
my @c;
my $p;
for $p (@$s) {
push @c, map "!($_)", @{$p->{pre}};
defined $p->{cur} and push @c, "($p->{cur})";
}
join " && ", @c;
}
sub trim_arg # Splits the argument into type and name, returning the
# pair: (type, name)
{
my $in = shift;
my $remove = join '|', qw( NN NULLOK VOL );
$in eq '...' and return ($in);
local $_ = $in;
my $name; # Work on the name
s/[*()]/ /g; # Get rid of this punctuation
s/ \[ [^\]]* \] / /xg; # Get rid of dimensions
s/\b(?:auto|const|extern|inline|register|static|volatile|restrict)\b//g;
s/\b(?:$remove)\b//;
s/^\s+//; s/\s+$//; # No leading, trailing space
if( /^\b (?:struct|union|enum) \s+ \w+ (?: \s+ ( \w+ ) )? $/x ) {
defined $1 and $name = $1; # Extract the name for one of these declarations
}
else {
if( s/\b(?:char|double|float|int|long|short|signed|unsigned|void)\b//g ) {
/^ \s* (\w+) \s* $/x and $name = $1; # Similarly for these
}
elsif (/^ \s* " [^"]+ " \s+ (\w+) \s* $/x) { # A literal string (is special)
$name = $1;
}
else {
/^ \s* \w+ \s+ (\w+) \s* $/x and $name = $1; # Everything else.
}
}
$_ = $in; # Now work on the type.
# Get rid of the name if we found one
defined $name and s/\b$name\b//;
# these don't matter at all; note that const does matter
s/\b(?:auto|extern|inline|register|static|volatile|restrict)\b//g;
s/\b(?:$remove)\b//;
while (s/ \* \s+ \* /**/xg) {} # No spaces within pointer sequences
s/ \s* ( \*+ ) \s* / $1 /xg; # Normalize pointer sequences to be surrounded
# by a single space
s/^\s+//; s/\s+$//; # No leading, trailing spacd
s/\s+/ /g; # Collapse multiple space into one
return ($_, $name) if defined $name;
return $_;
}
sub parse_embed
{
my @files = @_;
my @func;
my @pps;
my $file;
local *FILE;
for $file (@files) {
open FILE, $file or die "$file: $!\n";
my($line, $l);
while (defined($line = <FILE>)) {
while ($line =~ /\\$/ && defined($l = <FILE>)) {
$line =~ s/\\\s*//;
$line .= $l;
}
next if $line =~ /^\s*:/;
$line =~ s/^\s+|\s+$//gs;
my($dir, $args) = ($line =~ /^\s*#\s*(\w+)(?:\s*(.*?)\s*)?$/);
if (defined $dir and defined $args) {
for ($dir) {
/^ifdef$/ and do { push @pps, { pre => [], cur => "defined($args)" } ; last };
/^ifndef$/ and do { push @pps, { pre => [], cur => "!defined($args)" } ; last };
/^if$/ and do { push @pps, { pre => [], cur => $args } ; last };
/^elif$/ and do { push @{$pps[-1]{pre}}, $pps[-1]{cur}; $pps[-1]{cur} = $args; last };
/^else$/ and do { push @{$pps[-1]{pre}}, $pps[-1]{cur}; $pps[-1]{cur} = undef; last };
/^endif$/ and do { pop @pps ; last };
/^include$/ and last;
/^define$/ and last;
/^undef$/ and last;
warn "unhandled preprocessor directive: $dir\n";
}
}
else {
my @e = split /\s*\|\s*/, $line;
if( @e >= 3 ) {
my($flags, $ret, $name, @args) = @e;
# Skip non-name entries, like
# PL_parser-E<gt>linestr
# which documents a struct entry rather than a function. We retain
# all other entries, so that our caller has full information, and
# may skip things like non-public functions.
next if $flags =~ /N/;
# M implies m for the purposes of this module.
$flags .= 'm' if $flags =~ /M/;
# An entry marked 'b' is in mathoms, so is effectively deprecated,
# as it can be removed at anytime. But if it also has a macro to
# implement it, that macro stays when mathoms is removed, so the
# non-'Perl_' form isn't deprecated. embed.fnc is supposed to have
# already set this up, but make sure.
if ($flags =~ /b/ && $flags !~ /m/ && $flags !~ /D/) {
warn "Expecting D flag for '$name', since it is b without [Mm]";
$flags .= 'D';
}
if ($name =~ /^[^\W\d]\w*$/) {
my $cond = ppcond(\@pps);
if ($cond =~ /defined\(PERL_IN_[A-Z0-9_]+_[CH]/ && $flags =~ /A/)
{
warn "$name marked as API, but restricted scope: $cond\n";
}
#warn "$name: $cond" if length $cond && $flags =~ /A/;
for (@args) {
$_ = [trim_arg($_)];
}
($ret) = trim_arg($ret);
push @func, {
name => $name,
flags => { map { $_, 1 } $flags =~ /./g },
ret => $ret,
args => \@args,
cond => $cond,
};
$func[-1]{'ppport_fnc'} = 1 if $file =~ /ppport\.fnc/;
}
elsif ($flags !~ /y/) {
warn "mysterious name [$name] in $file, line $.\n";
}
}
}
}
close FILE;
}
# Here's what two elements of the array look like:
# {
# 'args' => [
# [
# 'const nl_item',
# 'item'
# ]
# ],
# 'cond' => '(defined(HAS_NL_LANGINFO) && defined(PERL_LANGINFO_H))',
# 'flags' => {
# 'A' => 1,
# 'T' => 1,
# 'd' => 1,
# 'o' => 1
# },
# 'name' => 'Perl_langinfo',
# 'ret' => 'const char *'
# },
# {
# 'args' => [
# [
# 'const int',
# 'item'
# ]
# ],
# 'cond' => '!(defined(HAS_NL_LANGINFO) && defined(PERL_LANGINFO_H))',
# 'flags' => {
# 'A' => 1,
# 'T' => 1,
# 'd' => 1,
# 'o' => 1
# },
# 'name' => 'Perl_langinfo',
# 'ret' => 'const char *'
# },
return @func;
}
sub known_but_hard_to_test_for
{
# This returns a list of functions/symbols that are in Perl, but the tests
# for their existence don't work, usually as a result of them being XS,
# and using XS to test. Effectively, any XS code that compiles and works
# is exercising most of these XS-related ones.
#
# The values for the keys are each the version that ppport.h makes them
# work on, and were gleaned by manually looking at the code parts/inc/*.
# For functions, scanprov will automatically figure out the version
# they were introduced in.
my %return;
for (qw(CLASS CPERLscope dMY_CXT_SV dXSI32 END_EXTERN_C EXTERN_C items
ix PERL_USE_GCC_BRACE_GROUPS PL_hexdigit pTHX_ PTRV
RETVAL START_EXTERN_C STMT_END STMT_START StructCopy
STR_WITH_LEN svtype THIS XS XSPROTO))
{
# __MIN_PERL__ is this at the time of this commit. This is the
# earliest these have been tested to at the time of the commit, but
# likely go back further.
$return{$_} = '5.003_07';
}
for (qw(_pMY_CXT pMY_CXT_)) {
$return{$_} = '5.9.0';
}
for (qw(PERLIO_FUNCS_DECL)) {
$return{$_} = '5.9.3';
}
for (qw(XopDISABLE XopENABLE XopENTRY XopENTRYCUSTOM XopENTRY_set)) {
$return{$_} = '5.13.7';
}
for (qw(XS_EXTERNAL XS_INTERNAL)) {
$return{$_} = '5.15.2';
}
return \%return;
}
sub normalize_prototype # So that they can be compared more easily
{
my $proto = shift;
$proto =~ s/\s* \* \s* / * /xg;
return $proto;
}
sub make_prototype
{
my $f = shift;
my @args = map { "@$_" } @{$f->{args}};
my $proto;
my $pTHX_ = exists $f->{flags}{T} ? "" : "pTHX_ ";
$proto = "$f->{ret} $f->{name}" . "($pTHX_" . join(', ', @args) . ')';
return normalize_prototype($proto);
}
1;
```
|
Santa Fe, also named La Fe, is the second largest town on Isla de la Juventud of Cuba.
Geography
The town is located 20 km south of Nueva Gerona, the island's seat and main town. It was the first settlement on the island, built around mineral springs. Santa fe is linked with Nueva Gerona with a 15 km-long expressway.
Personalities
Tomás Aldazabal (b. 1976), volleyball player
See also
List of cities in Cuba
Municipalities of Cuba
Autopista de la Isla de la Juventud
References
External links
Santa Fe on guije.com
Populated places in Isla de la Juventud
|
```kotlin
package net.corda.nodeapi.internal.crypto
import net.corda.core.crypto.internal.AliasPrivateKey
import net.corda.coretesting.internal.stubs.CertificateStoreStubs
import org.junit.Rule
import org.junit.Test
import org.junit.rules.TemporaryFolder
import kotlin.test.assertEquals
import kotlin.test.assertTrue
class AliasPrivateKeyTest {
@Rule
@JvmField
val tempFolder = TemporaryFolder()
@Test(timeout=300_000)
fun `store AliasPrivateKey entry and cert to keystore`() {
val alias = "01234567890"
val aliasPrivateKey = AliasPrivateKey(alias)
val certificatesDirectory = tempFolder.root.toPath()
val signingCertStore = CertificateStoreStubs.Signing.withCertificatesDirectory(
certificatesDirectory,
"keystorepass").get(createNew = true)
signingCertStore.query {
setPrivateKey(alias, aliasPrivateKey, listOf(NOT_YET_REGISTERED_MARKER_KEYS_AND_CERTS.ECDSAR1_CERT), "entrypassword")
}
// We can retrieve the certificate.
assertTrue { signingCertStore.contains(alias) }
// We can retrieve the certificate.
assertEquals(NOT_YET_REGISTERED_MARKER_KEYS_AND_CERTS.ECDSAR1_CERT, signingCertStore[alias])
assertEquals(aliasPrivateKey, signingCertStore.query { getPrivateKey(alias, "entrypassword") })
}
}
```
|
```html
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8">
<meta http-equiv="content-type" content="text/html; charset=utf-8" />
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1">
<meta name="Content-Language" content="en, english"/>
<meta name="author" content="leon"> <!-- CHANGE THIS -->
<link rel="icon" type="image/png" href="/artwork/favicon.png">
<title>loklak.org - Apps </title> <!-- CHANGE THIS -->
<!-- ngMaterial -->
<link rel="stylesheet" href="css/angular-material.min.css">
<link href="css/style.css" rel="stylesheet">
<link href="/css/bootstrap.min.css" rel="stylesheet">
<!-- <link href="/css/dashboard.css" rel="stylesheet"> -->
<link href="/css/loklak.css" rel="stylesheet">
<!-- HTML5 shim and Respond.js for IE8 support of HTML5 elements and media queries -->
<!--[if lt IE 9]>
<script src="/js/html5shiv.min.js"></script>
<script src="/js/respond.min.js"></script>
<![endif]-->
<script src="../../js/angular-modules/angular.min.js"></script>
<script src="../../js/angular-route.min.js"></script>
<script src="../../js/loklak.js"></script>
</head>
<body ng-app="myApp" >
<nav class="navbar navbar-inverse navbar-fixed-top">
<div class="container-fluid">
<div class="navbar-header">
<button type="button" class="navbar-toggle collapsed"
data-toggle="collapse" data-target="#navbar"
aria-expanded="false" aria-controls="navbar">
<span class="sr-only">Toggle navigation</span>
<span class="icon-bar"></span>
<span class="icon-bar"></span>
<span class="icon-bar"></span>
</button>
<a class="navbar-brand" href="path_to_url">
<img src="/images/loklak_org.png"
height="24" style="float:left;">: Tweet Feed
</a>
</div>
<div id="navbar" class="navbar-collapse collapse">
<ul class="nav navbar-nav navbar-right">
</ul>
</div>
</div>
</nav>
<!-- Fancy Form -->
<div ng-controller="MainCtrl as vm" ng-cloak="">
<form ng-submit="poll(query.type, query.term, query.interval)"
class="layout-margin layout-fill" name="queryForm">
<!-- form name for ng-messages -->
<md-content md-theme="docs-dark" layout-gt-sm="row"
layout-xs="column" layout-padding>
<div flex="10" ></div>
<md-input-container class="md-block" flex-gt-sm>
<label>Query Type</label>
<md-select ng-model="query.type">
<md-option ng-repeat="api in apis" value="{{api.type}}">
{{api.type}}
</md-option>
</md-select>
</md-input-container>
<md-input-container class="md-block" flex-gt-sm>
<label>Query String</label>
<input ng-model="query.term">
</md-input-container>
<md-input-container class="md-block" flex-gt-sm>
<label>Query Rate /min</label>
<input type="number" step="1" name="interval"
ng-model="query.interval" min="1"
max="30" ng-pattern="/^\d+$/"/>
<div ng-messages="queryForm.interval.$error" multiple md-auto-hide="false">
<div ng-message="min">
Minimum 1 min
</div>
<div ng-message="max">
Maximum 15 min
</div>
</div>
</md-input-container>
<!-- submit when enter, calls ng-submit -->
<md-button type='submit' md-no-ink class="md-primary">
<!-- ng-click="poll(query.type, query.term, query.interval)"> -->
Submit
</md-button>
<div flex="10" ></div>
</md-content>
</form>
<!-- Pinterest-like grid -->
<md-content class="layout-padding" id="content-scroller">
<div>
<div
class="cards-wrap"
angular-grid="vm.wallTweets"
ag-grid-width="300"
ag-gutter-size="12"
ag-id="tweets"
ag-infinite-scroll="vm.loadMoreTweets()"
>
<div class="card" ng-repeat="tweet in vm.wallTweets track by $index">
<!-- Images are not being scraped properly for now 19/5/2016 -->
<!-- <div ng-if="tweet.images_count" class="img"
style="background-image: url({{::tweet.images[0]}});">
</div> -->
<div class="inside">
<md-card-header layout="row">
<md-card-avatar>
<img class="md-user-avatar" ng-src="{{tweet.user.profile_image_url_https}}"
fallback-src ='profile_fallback.png'/>
</md-card-avatar>
<md-card-header-text layout="column">
<div class="card-title" ng-bind-html="rmvSpan(tweet.user.name)"></div>
<div class="card-subhead" ng-bind-html="handlify(tweet.user.screen_name)"></div>
</md-card-header-text>
</md-card-header>
<div class="description" ng-bind-html="tweetify(tweet.text)"></div>
<div class="description favs" layout="row" layout-align="end end">
<div>{{tweet.favourites_count}}</div>
<md-icon aria-hidden="true">
<svg xmlns="path_to_url" width="100%"
height="100%" viewBox="0 0 24 24" fit=""
preserveAspectRatio="xMidYMid meet" focusable="false">
<path d="M0 0h24v24h-24z" fill="none"></path>
<path d="M12 21.35l-1.45-1.32c-5.15-4.67-8.55-7.75-8.55-11.53
0-3.08 2.42-5.5 5.5-5.5 1.74 0 3.41.81 4.5 2.09
1.09-1.28 2.76-2.09 4.5-2.09 3.08 0 5.5 2.42 5.5
5.5 0 3.78-3.4 6.86-8.55 11.54l-1.45 1.31z"></path>
</svg>
</md-icon>
<div> {{tweet.retweet_count}}</div>
<md-icon>
<svg xmlns="path_to_url" viewBox="0 5 75 72">
<path d="M70.676 36.644C70.166 35.636 69.13
35 68 35h-7V19c0-2.21-1.79-4-4-4H34c-2.21
0-4 1.79-4 4s1.79 4 4 4h18c.552 0 .998.446
1 .998V35h-7c-1.13 0-2.165.636-2.676 1.644-.51
1.01-.412 2.22.257 3.13l11 15C55.148 55.545
56.046 56 57 56s1.855-.455
2.42-1.226l11-15c.668-.912.767-2.122.256-3.13zM40
48H22c-.54 0-.97-.427-.992-.96L21 36h7c1.13 0
2.166-.636 2.677-1.644.51-1.01.412-2.22-.257-3.13l-11-15C18.854
15.455 17.956 15 17 15s-1.854.455-2.42 1.226l-11
15c-.667.912-.767 2.122-.255 3.13C3.835 35.365
4.87 36 6 36h7l.012 16.003c.002 2.208 1.792 3.997
4 3.997h22.99c2.208 0 4-1.79 4-4s-1.792-4-4-4z"/>
</svg>
</md-icon>
</div>
</div>
</div>
</div>
<div class="loading-more-indicator" ng-show="vm.loadingMore">
<md-progress-circular md-mode="indeterminate"
md-diameter="64"
class="progress-swatch"></md-progress-circular>
</div>
</div>
</md-content>
</div>
<!-- Angular deps, ngMaterial, ngMessages, localStorage, angulargrid, imgfallback -->
<script src="../../js/angular-modules/angular-sanitize.min.js"></script>
<script src="../../js/angular-modules/angular-aria.min.js"></script>
<script src="../../js/angular-modules/angular-animate.min.js"></script>
<script src="../../js/angular-modules/angular-material.min.js"></script>
<script src="../../js/angular-modules/ngStorage.min.js"></script>
<script src="../../js/angular-modules/angular-messages.min.js"></script>
<script src='../../js/angular-modules/angulargrid.min.js'></script>
<script src="../../js/angular-modules/angular.dcb-img-fallback.min.js"></script>
<script src="app.js"></script>
<!-- Services -->
<script src="services/dataService.js"></script>
<script src="services/analyticService.js"></script>
<script src="services/queryService.js"></script>
<!-- Bootstrap core JavaScript
================================================== -->
<!-- Placed at the end of the document so the pages load faster -->
<script src="/js/jquery.min.js"></script>
<script src="/js/bootstrap.min.js"></script>
<!-- IE10 viewport hack for Surface/desktop Windows 8 bug -->
<script src="/js/ie10-viewport-bug-workaround.js"></script>
</body>
</html>
```
|
The 2020–21 Gonzaga Bulldogs women's basketball team represents Gonzaga University in the 2020–21 NCAA Division I women's basketball season. The Bulldogs (also informally referred to as the "Zags"), are members of the West Coast Conference. The Bulldogs, led by seventh year head coach Lisa Fortier, play their home games at the McCarthey Athletic Center on the university campus in Spokane, Washington.
Roster
Schedule
|-
!colspan=9 style=| Non-conference regular season
|-
|-
|-
|-
|-
|-
|-
|-
!colspan=9 style=| WCC regular season
|-
|-
|-
|-
|-
|-
|-
|-
|-
|-
|-
|-
|-
|-
|-
|-
|-
|-
|-
!colspan=9 style=| WCC Women's Tournament
|-
|-
!colspan=9 style=| NCAA Women's Tournament
Rankings
2020–21 NCAA Division I women's basketball rankings
^Coaches did not release a Week 2 poll.
See also
2020–21 Gonzaga Bulldogs men's basketball team
References
Gonzaga
Gonzaga Bulldogs women's basketball seasons
Gonzaga
Gonzaga
Gonzaga
|
```sqlpl
--
--
--
-- path_to_url
--
-- Unless required by applicable law or agreed to in writing, software
-- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
--
-- delta schema to upgrade apollo portal db from v2.1.0 to v2.2.0
Use ApolloPortalDB;
ALTER TABLE `App`
MODIFY COLUMN `AppId` VARCHAR(64) NOT NULL DEFAULT 'default' COMMENT 'AppID';
ALTER TABLE `Consumer`
MODIFY COLUMN `AppId` VARCHAR(64) NOT NULL DEFAULT 'default' COMMENT 'AppID';
ALTER TABLE `Favorite`
MODIFY COLUMN `AppId` VARCHAR(64) NOT NULL DEFAULT 'default' COMMENT 'AppID';
ALTER TABLE `Favorite`
DROP INDEX `AppId`,
ADD INDEX `AppId` (`AppId`);
DROP TABLE IF EXISTS `AuditLog`;
CREATE TABLE `AuditLog` (
`Id` int(10) unsigned NOT NULL AUTO_INCREMENT COMMENT '',
`TraceId` varchar(32) NOT NULL DEFAULT '' COMMENT 'ID',
`SpanId` varchar(32) NOT NULL DEFAULT '' COMMENT 'ID',
`ParentSpanId` varchar(32) DEFAULT NULL COMMENT 'ID',
`FollowsFromSpanId` varchar(32) DEFAULT NULL COMMENT 'ID',
`Operator` varchar(64) NOT NULL DEFAULT 'anonymous' COMMENT '',
`OpType` varchar(50) NOT NULL DEFAULT 'default' COMMENT '',
`OpName` varchar(150) NOT NULL DEFAULT 'default' COMMENT '',
`Description` varchar(200) DEFAULT NULL COMMENT '',
`IsDeleted` bit(1) NOT NULL DEFAULT b'0' COMMENT '1: deleted, 0: normal',
`DeletedAt` BIGINT(20) NOT NULL DEFAULT '0' COMMENT 'Delete timestamp based on milliseconds',
`DataChange_CreatedBy` varchar(64) DEFAULT NULL COMMENT '',
`DataChange_CreatedTime` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP COMMENT '',
`DataChange_LastModifiedBy` varchar(64) DEFAULT '' COMMENT '',
`DataChange_LastTime` timestamp NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP COMMENT '',
PRIMARY KEY (`Id`),
KEY `IX_TraceId` (`TraceId`),
KEY `IX_OpName` (`OpName`),
KEY `IX_DataChange_CreatedTime` (`DataChange_CreatedTime`),
KEY `IX_Operator` (`Operator`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COMMENT='';
DROP TABLE IF EXISTS `AuditLogDataInfluence`;
CREATE TABLE `AuditLogDataInfluence` (
`Id` int(10) unsigned NOT NULL AUTO_INCREMENT COMMENT '',
`SpanId` char(32) NOT NULL DEFAULT '' COMMENT 'ID',
`InfluenceEntityId` varchar(50) NOT NULL DEFAULT '0' COMMENT 'ID',
`InfluenceEntityName` varchar(50) NOT NULL DEFAULT 'default' COMMENT '',
`FieldName` varchar(50) DEFAULT NULL COMMENT '',
`FieldOldValue` varchar(500) DEFAULT NULL COMMENT '',
`FieldNewValue` varchar(500) DEFAULT NULL COMMENT '',
`IsDeleted` bit(1) NOT NULL DEFAULT b'0' COMMENT '1: deleted, 0: normal',
`DeletedAt` BIGINT(20) NOT NULL DEFAULT '0' COMMENT 'Delete timestamp based on milliseconds',
`DataChange_CreatedBy` varchar(64) DEFAULT NULL COMMENT '',
`DataChange_CreatedTime` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP COMMENT '',
`DataChange_LastModifiedBy` varchar(64) DEFAULT '' COMMENT '',
`DataChange_LastTime` timestamp NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP COMMENT '',
PRIMARY KEY (`Id`),
KEY `IX_SpanId` (`SpanId`),
KEY `IX_DataChange_CreatedTime` (`DataChange_CreatedTime`),
KEY `IX_EntityId` (`InfluenceEntityId`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COMMENT='';
```
|
Cửu Long may refer to:
Mekong River or Cửu Long River, a major river in Southeast Asia
Mekong Delta or Cửu Long Delta, region in southwestern Vietnam where the Mekong River empties into the sea
Cửu Long Province, a former Vietnamese province in the Mekong Delta
4th Corps (Vietnam People's Army) or Cửu Long Corps, a regular army corps of the People's Army of Vietnam
See also
Operation Cuu Long 44-02, a 1971 operation by South Vietnamese and Cambodian forces to reopen Route 4 in Cambodia
Jiulong (disambiguation), Mandarin equivalent
Kowloon (disambiguation), Cantonese equivalent
九龍 (disambiguation), logogram equivalent
|
```objective-c
/*++ BUILD Version: 0001 // Increment this if a change has global effects --*/
/*****************************************************************************\
* *
* ddeml.h - DDEML API header file *
* *
* Version 3.10 *
* *
* *
\*****************************************************************************/
#ifndef _INC_DDEMLH
#define _INC_DDEMLH
#ifdef __cplusplus
extern "C" {
#endif /* __cplusplus */
/******** public types ********/
DECLARE_HANDLE(HCONVLIST);
DECLARE_HANDLE(HCONV);
DECLARE_HANDLE(HSZ);
DECLARE_HANDLE(HDDEDATA);
#define EXPENTRY CALLBACK
/* the following structure is for use with XTYP_WILDCONNECT processing. */
typedef struct tagHSZPAIR {
HSZ hszSvc;
HSZ hszTopic;
} HSZPAIR;
typedef HSZPAIR FAR *PHSZPAIR;
/* The following structure is used by DdeConnect() and DdeConnectList() and
by XTYP_CONNECT and XTYP_WILDCONNECT callbacks. */
typedef struct tagCONVCONTEXT {
UINT cb; /* set to sizeof(CONVCONTEXT) */
UINT wFlags; /* none currently defined. */
UINT wCountryID; /* country code for topic/item strings used. */
int iCodePage; /* codepage used for topic/item strings. */
DWORD dwLangID; /* language ID for topic/item strings. */
DWORD dwSecurity; /* Private security code. */
SECURITY_QUALITY_OF_SERVICE qos; /* client side's quality of service */
} CONVCONTEXT;
typedef CONVCONTEXT FAR *PCONVCONTEXT;
/* The following structure is used by DdeQueryConvInfo(): */
typedef struct tagCONVINFO {
DWORD cb; /* sizeof(CONVINFO) */
DWORD_PTR hUser; /* user specified field */
HCONV hConvPartner; /* hConv on other end or 0 if non-ddemgr partner */
HSZ hszSvcPartner; /* app name of partner if obtainable */
HSZ hszServiceReq; /* AppName requested for connection */
HSZ hszTopic; /* Topic name for conversation */
HSZ hszItem; /* transaction item name or NULL if quiescent */
UINT wFmt; /* transaction format or NULL if quiescent */
UINT wType; /* XTYP_ for current transaction */
UINT wStatus; /* ST_ constant for current conversation */
UINT wConvst; /* XST_ constant for current transaction */
UINT wLastError; /* last transaction error. */
HCONVLIST hConvList; /* parent hConvList if this conversation is in a list */
CONVCONTEXT ConvCtxt; /* conversation context */
HWND hwnd; /* window handle for this conversation */
HWND hwndPartner; /* partner window handle for this conversation */
} CONVINFO;
typedef CONVINFO FAR *PCONVINFO;
/***** conversation states (usState) *****/
#define XST_NULL 0 /* quiescent states */
#define XST_INCOMPLETE 1
#define XST_CONNECTED 2
#define XST_INIT1 3 /* mid-initiation states */
#define XST_INIT2 4
#define XST_REQSENT 5 /* active conversation states */
#define XST_DATARCVD 6
#define XST_POKESENT 7
#define XST_POKEACKRCVD 8
#define XST_EXECSENT 9
#define XST_EXECACKRCVD 10
#define XST_ADVSENT 11
#define XST_UNADVSENT 12
#define XST_ADVACKRCVD 13
#define XST_UNADVACKRCVD 14
#define XST_ADVDATASENT 15
#define XST_ADVDATAACKRCVD 16
/* used in LOWORD(dwData1) of XTYP_ADVREQ callbacks... */
#define CADV_LATEACK 0xFFFF
/***** conversation status bits (fsStatus) *****/
#define ST_CONNECTED 0x0001
#define ST_ADVISE 0x0002
#define ST_ISLOCAL 0x0004
#define ST_BLOCKED 0x0008
#define ST_CLIENT 0x0010
#define ST_TERMINATED 0x0020
#define ST_INLIST 0x0040
#define ST_BLOCKNEXT 0x0080
#define ST_ISSELF 0x0100
/* DDE constants for wStatus field */
#define DDE_FACK 0x8000
#define DDE_FBUSY 0x4000
#define DDE_FDEFERUPD 0x4000
#define DDE_FACKREQ 0x8000
#define DDE_FRELEASE 0x2000
#define DDE_FREQUESTED 0x1000
#define DDE_FAPPSTATUS 0x00ff
#define DDE_FNOTPROCESSED 0x0000
#define DDE_FACKRESERVED (~(DDE_FACK | DDE_FBUSY | DDE_FAPPSTATUS))
#define DDE_FADVRESERVED (~(DDE_FACKREQ | DDE_FDEFERUPD))
#define DDE_FDATRESERVED (~(DDE_FACKREQ | DDE_FRELEASE | DDE_FREQUESTED))
#define DDE_FPOKRESERVED (~(DDE_FRELEASE))
/***** message filter hook types *****/
#define MSGF_DDEMGR 0x8001
/***** codepage constants ****/
#define CP_WINANSI 1004 /* default codepage for windows & old DDE convs. */
#define CP_WINUNICODE 1200
#ifdef UNICODE
#define CP_WINNEUTRAL CP_WINUNICODE
#else // !UNICODE
#define CP_WINNEUTRAL CP_WINANSI
#endif // !UNICODE
/***** transaction types *****/
#define XTYPF_NOBLOCK 0x0002 /* CBR_BLOCK will not work */
#define XTYPF_NODATA 0x0004 /* DDE_FDEFERUPD */
#define XTYPF_ACKREQ 0x0008 /* DDE_FACKREQ */
#define XCLASS_MASK 0xFC00
#define XCLASS_BOOL 0x1000
#define XCLASS_DATA 0x2000
#define XCLASS_FLAGS 0x4000
#define XCLASS_NOTIFICATION 0x8000
#define XTYP_ERROR (0x0000 | XCLASS_NOTIFICATION | XTYPF_NOBLOCK )
#define XTYP_ADVDATA (0x0010 | XCLASS_FLAGS )
#define XTYP_ADVREQ (0x0020 | XCLASS_DATA | XTYPF_NOBLOCK )
#define XTYP_ADVSTART (0x0030 | XCLASS_BOOL )
#define XTYP_ADVSTOP (0x0040 | XCLASS_NOTIFICATION)
#define XTYP_EXECUTE (0x0050 | XCLASS_FLAGS )
#define XTYP_CONNECT (0x0060 | XCLASS_BOOL | XTYPF_NOBLOCK)
#define XTYP_CONNECT_CONFIRM (0x0070 | XCLASS_NOTIFICATION | XTYPF_NOBLOCK)
#define XTYP_XACT_COMPLETE (0x0080 | XCLASS_NOTIFICATION )
#define XTYP_POKE (0x0090 | XCLASS_FLAGS )
#define XTYP_REGISTER (0x00A0 | XCLASS_NOTIFICATION | XTYPF_NOBLOCK)
#define XTYP_REQUEST (0x00B0 | XCLASS_DATA )
#define XTYP_DISCONNECT (0x00C0 | XCLASS_NOTIFICATION | XTYPF_NOBLOCK)
#define XTYP_UNREGISTER (0x00D0 | XCLASS_NOTIFICATION | XTYPF_NOBLOCK)
#define XTYP_WILDCONNECT (0x00E0 | XCLASS_DATA | XTYPF_NOBLOCK)
#define XTYP_MASK 0x00F0
#define XTYP_SHIFT 4 /* shift to turn XTYP_ into an index */
/***** Timeout constants *****/
#define TIMEOUT_ASYNC 0xFFFFFFFF
/***** Transaction ID constants *****/
#define QID_SYNC 0xFFFFFFFF
/****** public strings used in DDE ******/
#ifdef UNICODE
#define SZDDESYS_TOPIC L"System"
#define SZDDESYS_ITEM_TOPICS L"Topics"
#define SZDDESYS_ITEM_SYSITEMS L"SysItems"
#define SZDDESYS_ITEM_RTNMSG L"ReturnMessage"
#define SZDDESYS_ITEM_STATUS L"Status"
#define SZDDESYS_ITEM_FORMATS L"Formats"
#define SZDDESYS_ITEM_HELP L"Help"
#define SZDDE_ITEM_ITEMLIST L"TopicItemList"
#else
#define SZDDESYS_TOPIC "System"
#define SZDDESYS_ITEM_TOPICS "Topics"
#define SZDDESYS_ITEM_SYSITEMS "SysItems"
#define SZDDESYS_ITEM_RTNMSG "ReturnMessage"
#define SZDDESYS_ITEM_STATUS "Status"
#define SZDDESYS_ITEM_FORMATS "Formats"
#define SZDDESYS_ITEM_HELP "Help"
#define SZDDE_ITEM_ITEMLIST "TopicItemList"
#endif
/****** API entry points ******/
typedef HDDEDATA CALLBACK FNCALLBACK(UINT wType, UINT wFmt, HCONV hConv,
HSZ hsz1, HSZ hsz2, HDDEDATA hData, ULONG_PTR dwData1, ULONG_PTR dwData2);
typedef HDDEDATA (CALLBACK *PFNCALLBACK)(UINT wType, UINT wFmt, HCONV hConv,
HSZ hsz1, HSZ hsz2, HDDEDATA hData, ULONG_PTR dwData1, ULONG_PTR dwData2);
#define CBR_BLOCK ((HDDEDATA)-1)
/* DLL registration functions */
UINT WINAPI DdeInitializeA( IN OUT LPDWORD pidInst, IN PFNCALLBACK pfnCallback,
IN DWORD afCmd, IN DWORD ulRes);
UINT WINAPI DdeInitializeW( IN OUT LPDWORD pidInst, IN PFNCALLBACK pfnCallback,
IN DWORD afCmd, IN DWORD ulRes);
#ifdef UNICODE
#define DdeInitialize DdeInitializeW
#else
#define DdeInitialize DdeInitializeA
#endif // !UNICODE
/*
* Callback filter flags for use with standard apps.
*/
#define CBF_FAIL_SELFCONNECTIONS 0x00001000
#define CBF_FAIL_CONNECTIONS 0x00002000
#define CBF_FAIL_ADVISES 0x00004000
#define CBF_FAIL_EXECUTES 0x00008000
#define CBF_FAIL_POKES 0x00010000
#define CBF_FAIL_REQUESTS 0x00020000
#define CBF_FAIL_ALLSVRXACTIONS 0x0003f000
#define CBF_SKIP_CONNECT_CONFIRMS 0x00040000
#define CBF_SKIP_REGISTRATIONS 0x00080000
#define CBF_SKIP_UNREGISTRATIONS 0x00100000
#define CBF_SKIP_DISCONNECTS 0x00200000
#define CBF_SKIP_ALLNOTIFICATIONS 0x003c0000
/*
* Application command flags
*/
#define APPCMD_CLIENTONLY 0x00000010L
#define APPCMD_FILTERINITS 0x00000020L
#define APPCMD_MASK 0x00000FF0L
/*
* Application classification flags
*/
#define APPCLASS_STANDARD 0x00000000L
#define APPCLASS_MASK 0x0000000FL
BOOL WINAPI DdeUninitialize( IN DWORD idInst);
/*
* conversation enumeration functions
*/
HCONVLIST WINAPI DdeConnectList( IN DWORD idInst, IN HSZ hszService, IN HSZ hszTopic,
IN HCONVLIST hConvList, IN PCONVCONTEXT pCC);
HCONV WINAPI DdeQueryNextServer( IN HCONVLIST hConvList, IN HCONV hConvPrev);
BOOL WINAPI DdeDisconnectList( IN HCONVLIST hConvList);
/*
* conversation control functions
*/
HCONV WINAPI DdeConnect( IN DWORD idInst, IN HSZ hszService, IN HSZ hszTopic,
IN PCONVCONTEXT pCC);
BOOL WINAPI DdeDisconnect( IN OUT HCONV hConv);
HCONV WINAPI DdeReconnect( IN HCONV hConv);
UINT WINAPI DdeQueryConvInfo( IN HCONV hConv, IN DWORD idTransaction, IN OUT PCONVINFO pConvInfo);
BOOL WINAPI DdeSetUserHandle( IN HCONV hConv, IN DWORD id, IN DWORD_PTR hUser);
BOOL WINAPI DdeAbandonTransaction( IN DWORD idInst, IN HCONV hConv, IN DWORD idTransaction);
/*
* app server interface functions
*/
BOOL WINAPI DdePostAdvise( IN DWORD idInst, IN HSZ hszTopic, IN HSZ hszItem);
BOOL WINAPI DdeEnableCallback( IN DWORD idInst, IN HCONV hConv, IN UINT wCmd);
BOOL WINAPI DdeImpersonateClient( IN HCONV hConv);
#define EC_ENABLEALL 0
#define EC_ENABLEONE ST_BLOCKNEXT
#define EC_DISABLE ST_BLOCKED
#define EC_QUERYWAITING 2
HDDEDATA WINAPI DdeNameService( IN DWORD idInst, IN HSZ hsz1, IN HSZ hsz2, IN UINT afCmd);
#define DNS_REGISTER 0x0001
#define DNS_UNREGISTER 0x0002
#define DNS_FILTERON 0x0004
#define DNS_FILTEROFF 0x0008
/*
* app client interface functions
*/
HDDEDATA WINAPI DdeClientTransaction( IN LPBYTE pData, IN DWORD cbData,
IN HCONV hConv, IN HSZ hszItem, IN UINT wFmt, IN UINT wType,
IN DWORD dwTimeout, OUT LPDWORD pdwResult);
/*
*data transfer functions
*/
HDDEDATA WINAPI DdeCreateDataHandle( IN DWORD idInst, IN LPBYTE pSrc, IN DWORD cb,
IN DWORD cbOff, IN HSZ hszItem, IN UINT wFmt, IN UINT afCmd);
HDDEDATA WINAPI DdeAddData( IN HDDEDATA hData, IN LPBYTE pSrc, IN DWORD cb, IN DWORD cbOff);
DWORD WINAPI DdeGetData( IN HDDEDATA hData, OUT LPBYTE pDst, IN DWORD cbMax, IN DWORD cbOff);
LPBYTE WINAPI DdeAccessData( IN HDDEDATA hData, OUT LPDWORD pcbDataSize);
BOOL WINAPI DdeUnaccessData( IN HDDEDATA hData);
BOOL WINAPI DdeFreeDataHandle( IN OUT HDDEDATA hData);
#define HDATA_APPOWNED 0x0001
UINT WINAPI DdeGetLastError( IN DWORD idInst);
#define DMLERR_NO_ERROR 0 /* must be 0 */
#define DMLERR_FIRST 0x4000
#define DMLERR_ADVACKTIMEOUT 0x4000
#define DMLERR_BUSY 0x4001
#define DMLERR_DATAACKTIMEOUT 0x4002
#define DMLERR_DLL_NOT_INITIALIZED 0x4003
#define DMLERR_DLL_USAGE 0x4004
#define DMLERR_EXECACKTIMEOUT 0x4005
#define DMLERR_INVALIDPARAMETER 0x4006
#define DMLERR_LOW_MEMORY 0x4007
#define DMLERR_MEMORY_ERROR 0x4008
#define DMLERR_NOTPROCESSED 0x4009
#define DMLERR_NO_CONV_ESTABLISHED 0x400a
#define DMLERR_POKEACKTIMEOUT 0x400b
#define DMLERR_POSTMSG_FAILED 0x400c
#define DMLERR_REENTRANCY 0x400d
#define DMLERR_SERVER_DIED 0x400e
#define DMLERR_SYS_ERROR 0x400f
#define DMLERR_UNADVACKTIMEOUT 0x4010
#define DMLERR_UNFOUND_QUEUE_ID 0x4011
#define DMLERR_LAST 0x4011
HSZ WINAPI DdeCreateStringHandleA( IN DWORD idInst, IN LPCSTR psz, IN int iCodePage);
HSZ WINAPI DdeCreateStringHandleW( IN DWORD idInst, IN LPCWSTR psz, IN int iCodePage);
#ifdef UNICODE
#define DdeCreateStringHandle DdeCreateStringHandleW
#else
#define DdeCreateStringHandle DdeCreateStringHandleA
#endif // !UNICODE
DWORD WINAPI DdeQueryStringA( IN DWORD idInst, IN HSZ hsz, IN OUT LPSTR psz, IN DWORD cchMax, IN int iCodePage);
DWORD WINAPI DdeQueryStringW( IN DWORD idInst, IN HSZ hsz, IN OUT LPWSTR psz, IN DWORD cchMax, IN int iCodePage);
#ifdef UNICODE
#define DdeQueryString DdeQueryStringW
#else
#define DdeQueryString DdeQueryStringA
#endif // !UNICODE
BOOL WINAPI DdeFreeStringHandle( IN DWORD idInst, IN OUT HSZ hsz);
BOOL WINAPI DdeKeepStringHandle( IN DWORD idInst, IN OUT HSZ hsz);
int WINAPI DdeCmpStringHandles( IN HSZ hsz1, IN HSZ hsz2);
#ifndef NODDEMLSPY
/*
* DDEML public debugging header file info
*/
typedef struct tagDDEML_MSG_HOOK_DATA { // new for NT
UINT_PTR uiLo; // unpacked lo and hi parts of lParam
UINT_PTR uiHi;
DWORD cbData; // amount of data in message, if any. May be > than 32 bytes.
DWORD Data[8]; // data peeking by DDESPY is limited to 32 bytes.
} DDEML_MSG_HOOK_DATA, *PDDEML_MSG_HOOK_DATA;
typedef struct tagMONMSGSTRUCT {
UINT cb;
HWND hwndTo;
DWORD dwTime;
HANDLE hTask;
UINT wMsg;
WPARAM wParam;
LPARAM lParam;
DDEML_MSG_HOOK_DATA dmhd; // new for NT
} MONMSGSTRUCT, *PMONMSGSTRUCT;
typedef struct tagMONCBSTRUCT {
UINT cb;
DWORD dwTime;
HANDLE hTask;
DWORD dwRet;
UINT wType;
UINT wFmt;
HCONV hConv;
HSZ hsz1;
HSZ hsz2;
HDDEDATA hData;
ULONG_PTR dwData1;
ULONG_PTR dwData2;
CONVCONTEXT cc; // new for NT for XTYP_CONNECT callbacks
DWORD cbData; // new for NT for data peeking
DWORD Data[8]; // new for NT for data peeking
} MONCBSTRUCT, *PMONCBSTRUCT;
typedef struct tagMONHSZSTRUCTA {
UINT cb;
BOOL fsAction; /* MH_ value */
DWORD dwTime;
HSZ hsz;
HANDLE hTask;
CHAR str[1];
} MONHSZSTRUCTA, *PMONHSZSTRUCTA;
typedef struct tagMONHSZSTRUCTW {
UINT cb;
BOOL fsAction; /* MH_ value */
DWORD dwTime;
HSZ hsz;
HANDLE hTask;
WCHAR str[1];
} MONHSZSTRUCTW, *PMONHSZSTRUCTW;
#ifdef UNICODE
typedef MONHSZSTRUCTW MONHSZSTRUCT;
typedef PMONHSZSTRUCTW PMONHSZSTRUCT;
#else
typedef MONHSZSTRUCTA MONHSZSTRUCT;
typedef PMONHSZSTRUCTA PMONHSZSTRUCT;
#endif // UNICODE
#define MH_CREATE 1
#define MH_KEEP 2
#define MH_DELETE 3
#define MH_CLEANUP 4
typedef struct tagMONERRSTRUCT {
UINT cb;
UINT wLastError;
DWORD dwTime;
HANDLE hTask;
} MONERRSTRUCT, *PMONERRSTRUCT;
typedef struct tagMONLINKSTRUCT {
UINT cb;
DWORD dwTime;
HANDLE hTask;
BOOL fEstablished;
BOOL fNoData;
HSZ hszSvc;
HSZ hszTopic;
HSZ hszItem;
UINT wFmt;
BOOL fServer;
HCONV hConvServer;
HCONV hConvClient;
} MONLINKSTRUCT, *PMONLINKSTRUCT;
typedef struct tagMONCONVSTRUCT {
UINT cb;
BOOL fConnect;
DWORD dwTime;
HANDLE hTask;
HSZ hszSvc;
HSZ hszTopic;
HCONV hConvClient; // Globally unique value != apps local hConv
HCONV hConvServer; // Globally unique value != apps local hConv
} MONCONVSTRUCT, *PMONCONVSTRUCT;
#define MAX_MONITORS 4
#define APPCLASS_MONITOR 0x00000001L
#define XTYP_MONITOR (0x00F0 | XCLASS_NOTIFICATION | XTYPF_NOBLOCK)
/*
* Callback filter flags for use with MONITOR apps - 0 implies no monitor
* callbacks.
*/
#define MF_HSZ_INFO 0x01000000
#define MF_SENDMSGS 0x02000000
#define MF_POSTMSGS 0x04000000
#define MF_CALLBACKS 0x08000000
#define MF_ERRORS 0x10000000
#define MF_LINKS 0x20000000
#define MF_CONV 0x40000000
#define MF_MASK 0xFF000000
#endif /* NODDEMLSPY */
#ifdef __cplusplus
}
#endif /* __cplusplus */
#endif /* _INC_DDEMLH */
```
|
R.P. Inderaprastha Institute of Medical Sciences (RPIIMS) is part of the R.P. Educational Trust, Karnal, Haryana, India, established by Sh. R.P. Singal, a leading and learned industrialist. RPIIT Campus symbolizes the inspiration, desire and dream of its founder for the enhancement of Technological and Management Education required for the overall development of India. RPIIMS is approved by the Indian Nursing Council.
References
Nursing schools in India
Universities and colleges in Haryana
Karnal district
|
```python
from __future__ import annotations
import os
from typing import Any, Dict, List, Optional, Text
import logging
from rasa.engine.graph import GraphComponent, ExecutionContext
from rasa.engine.recipes.default_recipe import DefaultV1Recipe
from rasa.shared.constants import DOCS_URL_TRAINING_DATA
from rasa.shared.nlu.constants import ENTITIES, TEXT
from rasa.shared.nlu.training_data.training_data import TrainingData
from rasa.shared.nlu.training_data.message import Message
from rasa.nlu.utils import write_json_to_file
from rasa.nlu.extractors.extractor import EntityExtractorMixin
import rasa.utils.io
import rasa.shared.utils.io
from rasa.engine.storage.resource import Resource
from rasa.engine.storage.storage import ModelStorage
logger = logging.getLogger(__name__)
@DefaultV1Recipe.register(
DefaultV1Recipe.ComponentType.ENTITY_EXTRACTOR, is_trainable=True
)
class EntitySynonymMapper(GraphComponent, EntityExtractorMixin):
"""Maps entities to their synonyms if they appear in the training data."""
SYNONYM_FILENAME = "synonyms.json"
def __init__(
self,
config: Optional[Dict[Text, Any]],
model_storage: ModelStorage,
resource: Resource,
synonyms: Optional[Dict[Text, Any]] = None,
) -> None:
"""Creates the mapper.
Args:
config: The mapper's config.
model_storage: Storage which the component can use to persist and load
itself.
resource: Resource locator for this component which can be used to persist
and load itself from the `model_storage`.
synonyms: A dictionary of previously known synonyms.
"""
self._config = config
self._model_storage = model_storage
self._resource = resource
self.synonyms = synonyms if synonyms else {}
@classmethod
def create(
cls,
config: Dict[Text, Any],
model_storage: ModelStorage,
resource: Resource,
execution_context: ExecutionContext,
synonyms: Optional[Dict[Text, Any]] = None,
) -> EntitySynonymMapper:
"""Creates component (see parent class for full docstring)."""
return cls(config, model_storage, resource, synonyms)
def train(self, training_data: TrainingData) -> Resource:
"""Trains the synonym lookup table."""
for key, value in list(training_data.entity_synonyms.items()):
self._add_entities_if_synonyms(key, value)
for example in training_data.entity_examples:
for entity in example.get(ENTITIES, []):
entity_val = example.get(TEXT)[entity["start"] : entity["end"]]
self._add_entities_if_synonyms(entity_val, str(entity.get("value")))
self._persist()
return self._resource
def process(self, messages: List[Message]) -> List[Message]:
"""Modifies entities attached to message to resolve synonyms.
Args:
messages: List containing the latest user message
Returns:
List containing the latest user message with entities resolved to
synonyms if there is a match.
"""
for message in messages:
updated_entities = message.get(ENTITIES, [])[:]
self.replace_synonyms(updated_entities)
message.set(ENTITIES, updated_entities, add_to_output=True)
return messages
def _persist(self) -> None:
if self.synonyms:
with self._model_storage.write_to(self._resource) as storage:
entity_synonyms_file = storage / EntitySynonymMapper.SYNONYM_FILENAME
write_json_to_file(
entity_synonyms_file, self.synonyms, separators=(",", ": ")
)
# Adapt to get path from model storage and resource
@classmethod
def load(
cls,
config: Dict[Text, Any],
model_storage: ModelStorage,
resource: Resource,
execution_context: ExecutionContext,
**kwargs: Any,
) -> EntitySynonymMapper:
"""Loads trained component (see parent class for full docstring)."""
synonyms = None
try:
with model_storage.read_from(resource) as storage:
entity_synonyms_file = storage / EntitySynonymMapper.SYNONYM_FILENAME
if os.path.isfile(entity_synonyms_file):
synonyms = rasa.shared.utils.io.read_json_file(entity_synonyms_file)
else:
synonyms = None
rasa.shared.utils.io.raise_warning(
f"Failed to load synonyms file from '{entity_synonyms_file}'.",
docs=DOCS_URL_TRAINING_DATA + "#synonyms",
)
except ValueError:
logger.debug(
f"Failed to load {cls.__class__.__name__} from model storage. Resource "
f"'{resource.name}' doesn't exist."
)
return cls(config, model_storage, resource, synonyms)
def replace_synonyms(self, entities: List[Dict[Text, Any]]) -> None:
"""Replace any entities which match a synonym with the synonymous entity."""
for entity in entities:
# need to wrap in `str` to handle e.g. entity values of type int
entity_value = str(entity["value"])
if entity_value.lower() in self.synonyms:
entity["value"] = self.synonyms[entity_value.lower()]
self.add_processor_name(entity)
def _add_entities_if_synonyms(self, entity: Text, synonym: Optional[Text]) -> None:
"""Adds entities to the synonym lookup table.
Lowercase is used as keys to make the lookup case-insensitive.
"""
if synonym is not None:
entity = str(entity)
synonym = str(synonym)
if entity != synonym:
entity_lowercase = entity.lower()
if (
entity_lowercase in self.synonyms
and self.synonyms[entity_lowercase] != synonym
):
rasa.shared.utils.io.raise_warning(
f"Found conflicting synonym definitions "
f"for {entity_lowercase!r}. Overwriting target "
f"{self.synonyms[entity_lowercase]!r} with "
f"{synonym!r}. "
f"Check your training data and remove "
f"conflicting synonym definitions to "
f"prevent this from happening.",
docs=DOCS_URL_TRAINING_DATA + "#synonyms",
)
self.synonyms[entity_lowercase] = synonym
# add a self-reference to handle entities extracted in alternate cases
# i.e. for a synonym Austria,
# entities extracted as AUSTRIA, austria, ausTRIA, etc
# should also have the value of `Austria`
synonym_lowercase = synonym.lower()
if synonym_lowercase not in self.synonyms:
self.synonyms[synonym_lowercase] = synonym
```
|
```python
__version__ = "2.2.1"
# Work around to update TensorFlow's absl.logging threshold which alters the
# default Python logging output behavior when present.
# see: path_to_url
# and: path_to_url#issuecomment-500369493
try:
import absl.logging
absl.logging.set_verbosity('info')
absl.logging.set_stderrthreshold('info')
absl.logging._warn_preinit_stderr = False
except:
pass
import logging
logger = logging.getLogger(__name__) # pylint: disable=invalid-name
# Files and general utilities
from .file_utils import (TRANSFORMERS_CACHE, PYTORCH_TRANSFORMERS_CACHE, PYTORCH_PRETRAINED_BERT_CACHE,
cached_path, add_start_docstrings, add_end_docstrings,
WEIGHTS_NAME, TF2_WEIGHTS_NAME, TF_WEIGHTS_NAME, CONFIG_NAME,
is_tf_available, is_torch_available)
from .data import (is_sklearn_available,
InputExample, InputFeatures, DataProcessor,
glue_output_modes, glue_convert_examples_to_features,
glue_processors, glue_tasks_num_labels,
xnli_output_modes, xnli_processors, xnli_tasks_num_labels,
squad_convert_examples_to_features, SquadFeatures,
SquadExample, SquadV1Processor, SquadV2Processor)
if is_sklearn_available():
from .data import glue_compute_metrics, xnli_compute_metrics
# Tokenizers
from .tokenization_utils import (PreTrainedTokenizer)
from .tokenization_auto import AutoTokenizer
from .tokenization_bert import BertTokenizer, BasicTokenizer, WordpieceTokenizer
from .tokenization_openai import OpenAIGPTTokenizer
from .tokenization_transfo_xl import (TransfoXLTokenizer, TransfoXLCorpus)
from .tokenization_gpt2 import GPT2Tokenizer
from .tokenization_ctrl import CTRLTokenizer
from .tokenization_xlnet import XLNetTokenizer, SPIECE_UNDERLINE
from .tokenization_xlm import XLMTokenizer
from .tokenization_roberta import RobertaTokenizer
from .tokenization_distilbert import DistilBertTokenizer
from .tokenization_albert import AlbertTokenizer
from .tokenization_camembert import CamembertTokenizer
# Configurations
from .configuration_utils import PretrainedConfig
from .configuration_auto import AutoConfig
from .configuration_bert import BertConfig, BERT_PRETRAINED_CONFIG_ARCHIVE_MAP
from .configuration_openai import OpenAIGPTConfig, OPENAI_GPT_PRETRAINED_CONFIG_ARCHIVE_MAP
from .configuration_transfo_xl import TransfoXLConfig, TRANSFO_XL_PRETRAINED_CONFIG_ARCHIVE_MAP
from .configuration_gpt2 import GPT2Config, GPT2_PRETRAINED_CONFIG_ARCHIVE_MAP
from .configuration_ctrl import CTRLConfig, CTRL_PRETRAINED_CONFIG_ARCHIVE_MAP
from .configuration_xlnet import XLNetConfig, XLNET_PRETRAINED_CONFIG_ARCHIVE_MAP
from .configuration_ctrl import CTRLConfig, CTRL_PRETRAINED_CONFIG_ARCHIVE_MAP
from .configuration_xlm import XLMConfig, XLM_PRETRAINED_CONFIG_ARCHIVE_MAP
from .configuration_roberta import RobertaConfig, ROBERTA_PRETRAINED_CONFIG_ARCHIVE_MAP
from .configuration_distilbert import DistilBertConfig, DISTILBERT_PRETRAINED_CONFIG_ARCHIVE_MAP
from .configuration_albert import AlbertConfig, ALBERT_PRETRAINED_CONFIG_ARCHIVE_MAP
from .configuration_camembert import CamembertConfig, CAMEMBERT_PRETRAINED_CONFIG_ARCHIVE_MAP
# Modeling
if is_torch_available():
from .modeling_utils import (PreTrainedModel, prune_layer, Conv1D)
from .modeling_auto import (AutoModel, AutoModelForSequenceClassification, AutoModelForQuestionAnswering,
AutoModelWithLMHead)
from .modeling_bert import (BertPreTrainedModel, BertModel, BertForPreTraining,
BertForMaskedLM, BertForNextSentencePrediction,
BertForSequenceClassification, BertForMultipleChoice,
BertForTokenClassification, BertForQuestionAnswering,
load_tf_weights_in_bert, BERT_PRETRAINED_MODEL_ARCHIVE_MAP)
from .modeling_openai import (OpenAIGPTPreTrainedModel, OpenAIGPTModel,
OpenAIGPTLMHeadModel, OpenAIGPTDoubleHeadsModel,
load_tf_weights_in_openai_gpt, OPENAI_GPT_PRETRAINED_MODEL_ARCHIVE_MAP)
from .modeling_transfo_xl import (TransfoXLPreTrainedModel, TransfoXLModel, TransfoXLLMHeadModel,
AdaptiveEmbedding,
load_tf_weights_in_transfo_xl, TRANSFO_XL_PRETRAINED_MODEL_ARCHIVE_MAP)
from .modeling_gpt2 import (GPT2PreTrainedModel, GPT2Model,
GPT2LMHeadModel, GPT2DoubleHeadsModel,
load_tf_weights_in_gpt2, GPT2_PRETRAINED_MODEL_ARCHIVE_MAP)
from .modeling_ctrl import (CTRLPreTrainedModel, CTRLModel,
CTRLLMHeadModel,
CTRL_PRETRAINED_MODEL_ARCHIVE_MAP)
from .modeling_xlnet import (XLNetPreTrainedModel, XLNetModel, XLNetLMHeadModel,
XLNetForSequenceClassification, XLNetForTokenClassification,
XLNetForMultipleChoice, XLNetForQuestionAnsweringSimple,
XLNetForQuestionAnswering, load_tf_weights_in_xlnet,
XLNET_PRETRAINED_MODEL_ARCHIVE_MAP)
from .modeling_xlm import (XLMPreTrainedModel , XLMModel,
XLMWithLMHeadModel, XLMForSequenceClassification,
XLMForQuestionAnswering, XLMForQuestionAnsweringSimple,
XLM_PRETRAINED_MODEL_ARCHIVE_MAP)
from .modeling_roberta import (RobertaForMaskedLM, RobertaModel,
RobertaForSequenceClassification, RobertaForMultipleChoice,
RobertaForTokenClassification,
ROBERTA_PRETRAINED_MODEL_ARCHIVE_MAP)
from .modeling_distilbert import (DistilBertPreTrainedModel, DistilBertForMaskedLM, DistilBertModel,
DistilBertForSequenceClassification, DistilBertForQuestionAnswering,
DistilBertForTokenClassification,
DISTILBERT_PRETRAINED_MODEL_ARCHIVE_MAP)
from .modeling_camembert import (CamembertForMaskedLM, CamembertModel,
CamembertForSequenceClassification, CamembertForMultipleChoice,
CamembertForTokenClassification,
CAMEMBERT_PRETRAINED_MODEL_ARCHIVE_MAP)
from .modeling_encoder_decoder import PreTrainedEncoderDecoder, Model2Model
from .modeling_albert import (AlbertPreTrainedModel, AlbertModel, AlbertForMaskedLM, AlbertForSequenceClassification,
AlbertForQuestionAnswering,
load_tf_weights_in_albert, ALBERT_PRETRAINED_MODEL_ARCHIVE_MAP)
# Optimization
from .optimization import (AdamW, get_constant_schedule, get_constant_schedule_with_warmup, get_cosine_schedule_with_warmup,
get_cosine_with_hard_restarts_schedule_with_warmup, get_linear_schedule_with_warmup)
# TensorFlow
if is_tf_available():
from .modeling_tf_utils import TFPreTrainedModel, TFSharedEmbeddings, TFSequenceSummary, shape_list
from .modeling_tf_auto import (TFAutoModel, TFAutoModelForSequenceClassification, TFAutoModelForQuestionAnswering,
TFAutoModelWithLMHead)
from .modeling_tf_bert import (TFBertPreTrainedModel, TFBertMainLayer, TFBertEmbeddings,
TFBertModel, TFBertForPreTraining,
TFBertForMaskedLM, TFBertForNextSentencePrediction,
TFBertForSequenceClassification, TFBertForMultipleChoice,
TFBertForTokenClassification, TFBertForQuestionAnswering,
TF_BERT_PRETRAINED_MODEL_ARCHIVE_MAP)
from .modeling_tf_gpt2 import (TFGPT2PreTrainedModel, TFGPT2MainLayer,
TFGPT2Model, TFGPT2LMHeadModel, TFGPT2DoubleHeadsModel,
TF_GPT2_PRETRAINED_MODEL_ARCHIVE_MAP)
from .modeling_tf_openai import (TFOpenAIGPTPreTrainedModel, TFOpenAIGPTMainLayer,
TFOpenAIGPTModel, TFOpenAIGPTLMHeadModel, TFOpenAIGPTDoubleHeadsModel,
TF_OPENAI_GPT_PRETRAINED_MODEL_ARCHIVE_MAP)
from .modeling_tf_transfo_xl import (TFTransfoXLPreTrainedModel, TFTransfoXLMainLayer,
TFTransfoXLModel, TFTransfoXLLMHeadModel,
TF_TRANSFO_XL_PRETRAINED_MODEL_ARCHIVE_MAP)
from .modeling_tf_xlnet import (TFXLNetPreTrainedModel, TFXLNetMainLayer,
TFXLNetModel, TFXLNetLMHeadModel,
TFXLNetForSequenceClassification,
TFXLNetForTokenClassification,
TFXLNetForQuestionAnsweringSimple,
TF_XLNET_PRETRAINED_MODEL_ARCHIVE_MAP)
from .modeling_tf_xlm import (TFXLMPreTrainedModel, TFXLMMainLayer,
TFXLMModel, TFXLMWithLMHeadModel,
TFXLMForSequenceClassification,
TFXLMForQuestionAnsweringSimple,
TF_XLM_PRETRAINED_MODEL_ARCHIVE_MAP)
from .modeling_tf_roberta import (TFRobertaPreTrainedModel, TFRobertaMainLayer,
TFRobertaModel, TFRobertaForMaskedLM,
TFRobertaForSequenceClassification,
TFRobertaForTokenClassification,
TF_ROBERTA_PRETRAINED_MODEL_ARCHIVE_MAP)
from .modeling_tf_distilbert import (TFDistilBertPreTrainedModel, TFDistilBertMainLayer,
TFDistilBertModel, TFDistilBertForMaskedLM,
TFDistilBertForSequenceClassification,
TFDistilBertForTokenClassification,
TFDistilBertForQuestionAnswering,
TF_DISTILBERT_PRETRAINED_MODEL_ARCHIVE_MAP)
from .modeling_tf_ctrl import (TFCTRLPreTrainedModel, TFCTRLModel,
TFCTRLLMHeadModel,
TF_CTRL_PRETRAINED_MODEL_ARCHIVE_MAP)
from .modeling_tf_albert import (TFAlbertPreTrainedModel, TFAlbertModel, TFAlbertForMaskedLM,
TFAlbertForSequenceClassification,
TF_ALBERT_PRETRAINED_MODEL_ARCHIVE_MAP)
# Optimization
from .optimization_tf import (WarmUp, create_optimizer, AdamWeightDecay, GradientAccumulator)
# TF 2.0 <=> PyTorch conversion utilities
from .modeling_tf_pytorch_utils import (convert_tf_weight_name_to_pt_weight_name,
load_pytorch_checkpoint_in_tf2_model,
load_pytorch_weights_in_tf2_model,
load_pytorch_model_in_tf2_model,
load_tf2_checkpoint_in_pytorch_model,
load_tf2_weights_in_pytorch_model,
load_tf2_model_in_pytorch_model)
if not is_tf_available() and not is_torch_available():
logger.warning("Neither PyTorch nor TensorFlow >= 2.0 have been found."
"Models won't be available and only tokenizers, configuration"
"and file/data utilities can be used.")
```
|
```javascript
import React from 'react';
function removeUserProp(WrappedComponent) {
return class NewComponent extends WrappedComponent {
render() {
const {user, ...otherProps} = this.props;
this.props = otherProps;
return super.render();
}
};
}
/*
function removeUserProp(WrappedComponent) {
return class NewComponent extends WrappedComponent {
render() {
const elements = super.render();
const {user, ...otherProps} = this.props;
console.log('##', elements);
return React.cloneElement(elements, otherProps, elements.props.children);
}
};
}
*/
export default removeUserProp;
```
|
```c
*
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
* in the Software without restriction, including without limitation the rights
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
* copies of the Software, and to permit persons to whom the Software is
* furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included in all
* copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
* SOFTWARE.
*/
#include "Hacl_HMAC_Blake2b_256.h"
#include "internal/Hacl_Krmllib.h"
#include "internal/Hacl_Hash_Blake2b_Simd256.h"
#include "internal/Hacl_HMAC.h"
/* SNIPPET_START: Hacl_HMAC_Blake2b_256_compute_blake2b_256 */
/**
Write the HMAC-BLAKE2b MAC of a message (`data`) by using a key (`key`) into `dst`.
The key can be any length and will be hashed if it is longer and padded if it is shorter than 128 bytes.
`dst` must point to 64 bytes of memory.
*/
void
Hacl_HMAC_Blake2b_256_compute_blake2b_256(
uint8_t *dst,
uint8_t *key,
uint32_t key_len,
uint8_t *data,
uint32_t data_len
)
{
uint32_t l = 128U;
KRML_CHECK_SIZE(sizeof (uint8_t), l);
uint8_t key_block[l];
memset(key_block, 0U, l * sizeof (uint8_t));
uint8_t *nkey = key_block;
uint32_t ite;
if (key_len <= 128U)
{
ite = key_len;
}
else
{
ite = 64U;
}
uint8_t *zeroes = key_block + ite;
KRML_MAYBE_UNUSED_VAR(zeroes);
if (key_len <= 128U)
{
memcpy(nkey, key, key_len * sizeof (uint8_t));
}
else
{
Hacl_Hash_Blake2b_Simd256_hash_with_key(nkey, 64U, key, key_len, NULL, 0U);
}
KRML_CHECK_SIZE(sizeof (uint8_t), l);
uint8_t ipad[l];
memset(ipad, 0x36U, l * sizeof (uint8_t));
for (uint32_t i = 0U; i < l; i++)
{
uint8_t xi = ipad[i];
uint8_t yi = key_block[i];
ipad[i] = (uint32_t)xi ^ (uint32_t)yi;
}
KRML_CHECK_SIZE(sizeof (uint8_t), l);
uint8_t opad[l];
memset(opad, 0x5cU, l * sizeof (uint8_t));
for (uint32_t i = 0U; i < l; i++)
{
uint8_t xi = opad[i];
uint8_t yi = key_block[i];
opad[i] = (uint32_t)xi ^ (uint32_t)yi;
}
KRML_PRE_ALIGN(32) Lib_IntVector_Intrinsics_vec256 s[4U] KRML_POST_ALIGN(32) = { 0U };
Hacl_Hash_Blake2b_Simd256_init(s, 0U, 64U);
Lib_IntVector_Intrinsics_vec256 *s0 = s;
uint8_t *dst1 = ipad;
if (data_len == 0U)
{
KRML_PRE_ALIGN(32) Lib_IntVector_Intrinsics_vec256 wv[4U] KRML_POST_ALIGN(32) = { 0U };
Hacl_Hash_Blake2b_Simd256_update_last(128U,
wv,
s0,
false,
FStar_UInt128_uint64_to_uint128(0ULL),
128U,
ipad);
}
else
{
uint32_t block_len = 128U;
uint32_t n_blocks0 = data_len / block_len;
uint32_t rem0 = data_len % block_len;
K___uint32_t_uint32_t scrut;
if (n_blocks0 > 0U && rem0 == 0U)
{
uint32_t n_blocks_ = n_blocks0 - 1U;
scrut = ((K___uint32_t_uint32_t){ .fst = n_blocks_, .snd = data_len - n_blocks_ * block_len });
}
else
{
scrut = ((K___uint32_t_uint32_t){ .fst = n_blocks0, .snd = rem0 });
}
uint32_t n_blocks = scrut.fst;
uint32_t rem_len = scrut.snd;
uint32_t full_blocks_len = n_blocks * block_len;
uint8_t *full_blocks = data;
uint8_t *rem = data + full_blocks_len;
KRML_PRE_ALIGN(32) Lib_IntVector_Intrinsics_vec256 wv[4U] KRML_POST_ALIGN(32) = { 0U };
Hacl_Hash_Blake2b_Simd256_update_multi(128U,
wv,
s0,
FStar_UInt128_uint64_to_uint128(0ULL),
ipad,
1U);
KRML_PRE_ALIGN(32) Lib_IntVector_Intrinsics_vec256 wv0[4U] KRML_POST_ALIGN(32) = { 0U };
Hacl_Hash_Blake2b_Simd256_update_multi(n_blocks * 128U,
wv0,
s0,
FStar_UInt128_uint64_to_uint128((uint64_t)block_len),
full_blocks,
n_blocks);
KRML_PRE_ALIGN(32) Lib_IntVector_Intrinsics_vec256 wv1[4U] KRML_POST_ALIGN(32) = { 0U };
Hacl_Hash_Blake2b_Simd256_update_last(rem_len,
wv1,
s0,
false,
FStar_UInt128_add(FStar_UInt128_uint64_to_uint128((uint64_t)128U),
FStar_UInt128_uint64_to_uint128((uint64_t)full_blocks_len)),
rem_len,
rem);
}
Hacl_Hash_Blake2b_Simd256_finish(64U, dst1, s0);
uint8_t *hash1 = ipad;
Hacl_Hash_Blake2b_Simd256_init(s0, 0U, 64U);
uint32_t block_len = 128U;
uint32_t n_blocks0 = 64U / block_len;
uint32_t rem0 = 64U % block_len;
K___uint32_t_uint32_t scrut;
if (n_blocks0 > 0U && rem0 == 0U)
{
uint32_t n_blocks_ = n_blocks0 - 1U;
scrut = ((K___uint32_t_uint32_t){ .fst = n_blocks_, .snd = 64U - n_blocks_ * block_len });
}
else
{
scrut = ((K___uint32_t_uint32_t){ .fst = n_blocks0, .snd = rem0 });
}
uint32_t n_blocks = scrut.fst;
uint32_t rem_len = scrut.snd;
uint32_t full_blocks_len = n_blocks * block_len;
uint8_t *full_blocks = hash1;
uint8_t *rem = hash1 + full_blocks_len;
KRML_PRE_ALIGN(32) Lib_IntVector_Intrinsics_vec256 wv[4U] KRML_POST_ALIGN(32) = { 0U };
Hacl_Hash_Blake2b_Simd256_update_multi(128U,
wv,
s0,
FStar_UInt128_uint64_to_uint128(0ULL),
opad,
1U);
KRML_PRE_ALIGN(32) Lib_IntVector_Intrinsics_vec256 wv0[4U] KRML_POST_ALIGN(32) = { 0U };
Hacl_Hash_Blake2b_Simd256_update_multi(n_blocks * 128U,
wv0,
s0,
FStar_UInt128_uint64_to_uint128((uint64_t)block_len),
full_blocks,
n_blocks);
KRML_PRE_ALIGN(32) Lib_IntVector_Intrinsics_vec256 wv1[4U] KRML_POST_ALIGN(32) = { 0U };
Hacl_Hash_Blake2b_Simd256_update_last(rem_len,
wv1,
s0,
false,
FStar_UInt128_add(FStar_UInt128_uint64_to_uint128((uint64_t)128U),
FStar_UInt128_uint64_to_uint128((uint64_t)full_blocks_len)),
rem_len,
rem);
Hacl_Hash_Blake2b_Simd256_finish(64U, dst, s0);
}
/* SNIPPET_END: Hacl_HMAC_Blake2b_256_compute_blake2b_256 */
```
|
Salina Stadium is a sport stadium in Salina, Kansas. It is located on the campus of Salina High School Central. It is home to both Salina High School Central and Salina High School South's football, soccer, and track and field teams.
The Kansas Wesleyan University Coyotes football, soccer, and track and field programs used the facility as well while their on-campus stadium underwent an extensive renovation, but their use ended officially on October 3, 2015, with the opening of the Graves Family Sports Complex. The stadium is also used for other community events.
External links
Salina Central Mustangs Football Official website
Kansas Wesleyan University Athletic Facilities Official website
References
College football venues
Sports venues in Salina, Kansas
American football venues in Kansas
Kansas Wesleyan Coyotes football
Soccer venues in Kansas
High school football venues in the United States
|
The Manse may refer to:
The Manse (Northampton, Massachusetts), listed on the NRHP in Massachusetts
The Manse (Natchez, Mississippi), listed on the NRHP in Mississippi
The Manse, Mount Druitt, a museum in Sydney, Australia
See also
Manse (disambiguation)
|
Since its first use in 1999, the National Weather Service (NWS) has used the Tornado Emergency bulletin, which is an enhanced form of a Tornado Warning used when a confirmed tornado poses a significant threat to life and property in a populated area. There have been 195 known tornado emergencies issued in the United States to date, and all but 16 have resulted in a confirmed tornado, with the resulting tornadoes being responsible for a total of 554 fatalities.
Below is a listing of each individual emergency. Tornadoes that had multiple emergencies issued for them are displayed with the tornadoes' injuries, deaths, and references grouped together. Tornadoes emergencies with multiple tornadoes within them will be displayed with all tornadoes within the emergency section.
Chronology of events
1999–2009
2010–2019
2020–present
See also
List of Storm Prediction Center meso-gamma mesoscale discussions
List of deadliest Storm Prediction Center days by outlook risk level
List of Storm Prediction Center high risk days
List of tornadoes and tornado outbreaks
Particularly Dangerous Situation
References
Emergencies
National Weather Service
Tornado-related lists
Weather warnings and advisories
|
Matthew Todd Mieske (born February 13, 1968) is a former outfielder in Major League Baseball (MLB) who played from to for the Milwaukee Brewers, Chicago Cubs, Seattle Mariners, Houston Astros and Arizona Diamondbacks.
In 663 games over eight seasons, Mieske posted a .262 batting average (406-for-1547) with 225 runs, 78 doubles, 10 triples, 56 home runs, 226 RBI, 124 bases on balls, .318 on-base percentage and .434 slugging percentage. He finished his career with a .979 fielding percentage playing at all three outfield positions.
External links
1968 births
Living people
Milwaukee Brewers players
Chicago Cubs players
Seattle Mariners players
Houston Astros players
Arizona Diamondbacks players
Baseball players from Michigan
Major League Baseball right fielders
Sportspeople from Midland, Michigan
Western Michigan Broncos baseball players
Spokane Indians players
High Desert Mavericks players
Denver Zephyrs players
New Orleans Zephyrs players
Iowa Cubs players
Tucson Sidewinders players
|
The Tenjong Dendang Formation is a geologic formation in Malaysia. The band of graptolite- and trilobite-bearing shales interbedded in limestones preserves graptolite, brachiopod and trilobite fossils dating back to the Hirnantian stage of the Late Ordovician period. The sediments were deposited during the Late Ordovician glaciation.
Fossil content
The following fossils were reported from the formation:
Trilobites
Mucronaspis mucronata
?Stenopareia sp.
Hyolitha
Hyolithida indet.
Strophomenata
Plectambonitoidea indet.
Gastropods
Lophospira sp.
?Megalomphala sp.
Pterobranchia
Climacograptus sp.
See also
Soom Shale, Hirnantian fossiliferous formation of South Africa
Tufs et calcaires de Rosan, Hirnantian fossiliferous formation of France
Cancañiri Formation, Hirnantian fossiliferous formation of Bolivia
References
Bibliography
Geologic formations of Malaysia
Ordovician System of Asia
Paleozoic Malaysia
Hirnantian
Limestone formations
Shale formations
Open marine deposits
Ordovician northern paleotemperate deposits
Paleontology in Malaysia
Formations
|
```javascript
// Redistribution and use in source and binary forms, with or without
// modification, are permitted provided that the following conditions are
// met:
//
// * Redistributions of source code must retain the above copyright
// notice, this list of conditions and the following disclaimer.
// * Redistributions in binary form must reproduce the above
// copyright notice, this list of conditions and the following
// disclaimer in the documentation and/or other materials provided
// with the distribution.
// * Neither the name of Google Inc. nor the names of its
// contributors may be used to endorse or promote products derived
// from this software without specific prior written permission.
//
// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
"use strict";
// This is based on Octane's RNG.
function createRNG(seed)
{
return function() {
// Robert Jenkins' 32 bit integer hash function.
seed = ((seed + 0x7ed55d16) + (seed << 12)) & 0xffffffff;
seed = ((seed ^ 0xc761c23c) ^ (seed >>> 19)) & 0xffffffff;
seed = ((seed + 0x165667b1) + (seed << 5)) & 0xffffffff;
seed = ((seed + 0xd3a2646c) ^ (seed << 9)) & 0xffffffff;
seed = ((seed + 0xfd7046c5) + (seed << 3)) & 0xffffffff;
seed = ((seed ^ 0xb55a4f09) ^ (seed >>> 16)) & 0xffffffff;
return (seed & 0xfffffff) / 0x10000000;
};
}
function createRNGWithFixedSeed()
{
// This uses Octane's initial seed.
return createRNG(49734321);
}
function createRNGWithRandomSeed()
{
return createRNG((Math.random() * 4294967296) | 0);
}
```
|
```python
from NN.Basic.Networks import *
from Util.Util import DataUtil
def main():
nn = NNDist()
save = False
load = False
show_loss = True
train_only = False
verbose = 2
lr = 0.001
lb = 0.001
epoch = 5
record_period = 1
use_cnn = True
x, y = DataUtil.get_dataset("mnist", "../../../_Data/mnist.txt", quantized=True, one_hot=True)
if use_cnn:
x = x.reshape(len(x), 1, 28, 28)
batch_size = 32
else:
batch_size = 128
if not load:
if use_cnn:
nn.add("ConvReLU", (x.shape[1:], (16, 3, 3)))
nn.add("MaxPool", ((3, 3),), 1)
nn.add("ConvNorm")
nn.add("ConvDrop")
else:
nn.add("ReLU", (x.shape[1], 1024))
nn.add("ReLU", (1024,))
nn.add("CrossEntropy", (y.shape[1],))
nn.optimizer = "Adam"
nn.preview()
nn.fit(x, y, lr=lr, lb=lb,
epoch=epoch, batch_size=batch_size, record_period=record_period,
show_loss=show_loss, train_only=train_only, do_log=True, verbose=verbose)
if save:
nn.save()
nn.draw_results()
else:
nn.load()
nn.preview()
print(nn.evaluate(x, y)[0])
nn.show_timing_log()
if __name__ == '__main__':
main()
```
|
```objective-c
/*
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
* 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
*
* THIS SOFTWARE IS PROVIDED BY APPLE COMPUTER, INC. ``AS IS'' AND ANY
* EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
* PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE COMPUTER, INC. OR
* CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
* EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
* PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
* PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
* OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
#ifndef Int32Array_h
#define Int32Array_h
#include "wtf/IntegralTypedArrayBase.h"
namespace WTF {
class Int32Array final : public IntegralTypedArrayBase<int> {
public:
static inline PassRefPtr<Int32Array> create(unsigned length);
static inline PassRefPtr<Int32Array> create(const int* array, unsigned length);
static inline PassRefPtr<Int32Array> create(PassRefPtr<ArrayBuffer>, unsigned byteOffset, unsigned length);
using TypedArrayBase<int>::set;
using IntegralTypedArrayBase<int>::set;
ViewType type() const override
{
return TypeInt32;
}
private:
inline Int32Array(PassRefPtr<ArrayBuffer>,
unsigned byteOffset,
unsigned length);
// Make constructor visible to superclass.
friend class TypedArrayBase<int>;
};
PassRefPtr<Int32Array> Int32Array::create(unsigned length)
{
return TypedArrayBase<int>::create<Int32Array>(length);
}
PassRefPtr<Int32Array> Int32Array::create(const int* array, unsigned length)
{
return TypedArrayBase<int>::create<Int32Array>(array, length);
}
PassRefPtr<Int32Array> Int32Array::create(PassRefPtr<ArrayBuffer> buffer, unsigned byteOffset, unsigned length)
{
return TypedArrayBase<int>::create<Int32Array>(buffer, byteOffset, length);
}
Int32Array::Int32Array(PassRefPtr<ArrayBuffer> buffer, unsigned byteOffset, unsigned length)
: IntegralTypedArrayBase<int>(buffer, byteOffset, length)
{
}
} // namespace WTF
using WTF::Int32Array;
#endif // Int32Array_h
```
|
```html
<!DOCTYPE html>
<html lang="en">
<head>
<meta http-equiv="refresh" content="0;URL=struct.Definition.html">
</head>
<body>
<p>Redirecting to <a href="struct.Definition.html">struct.Definition.html</a>...</p>
<script>location.replace("struct.Definition.html" + location.search + location.hash);</script>
</body>
</html>
```
|
```xml
// See LICENSE.txt for license information.
import {Image} from 'expo-image';
import React from 'react';
import {StyleSheet, View} from 'react-native';
import {buildAbsoluteUrl} from '@actions/remote/file';
import {buildProfileImageUrlFromUser} from '@actions/remote/user';
import {useServerUrl} from '@app/context/server';
import CompassIcon from '@components/compass_icon';
import {changeOpacity} from '@utils/theme';
import type UserModel from '@typings/database/models/servers/user';
type Props = {
author?: UserModel;
overrideIconUrl?: string;
}
const styles = StyleSheet.create({
avatarContainer: {
backgroundColor: 'rgba(255, 255, 255, 0.4)',
margin: 2,
width: 32,
height: 32,
},
avatar: {
height: 32,
width: 32,
},
avatarRadius: {
borderRadius: 18,
},
});
const Avatar = ({
author,
overrideIconUrl,
}: Props) => {
const serverUrl = useServerUrl();
let uri = overrideIconUrl;
if (!uri && author) {
uri = buildProfileImageUrlFromUser(serverUrl, author);
}
let picture;
if (uri) {
picture = (
<Image
source={{uri: buildAbsoluteUrl(serverUrl, uri)}}
style={[styles.avatar, styles.avatarRadius]}
/>
);
} else {
picture = (
<CompassIcon
name='account-outline'
size={32}
color={changeOpacity('#fff', 0.48)}
/>
);
}
return (
<View style={[styles.avatarContainer, styles.avatarRadius]}>
{picture}
</View>
);
};
export default Avatar;
```
|
```c++
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
#include "src/compiler/frame.h"
#include "src/compiler/linkage.h"
#include "src/compiler/register-allocator.h"
#include "src/macro-assembler.h"
namespace v8 {
namespace internal {
namespace compiler {
Frame::Frame(int fixed_frame_size_in_slots, const CallDescriptor* descriptor)
: frame_slot_count_(fixed_frame_size_in_slots),
callee_saved_slot_count_(0),
spill_slot_count_(0),
allocated_registers_(nullptr),
allocated_double_registers_(nullptr) {}
int Frame::AlignFrame(int alignment) {
DCHECK_EQ(0, callee_saved_slot_count_);
int alignment_slots = alignment / kPointerSize;
int delta = alignment_slots - (frame_slot_count_ & (alignment_slots - 1));
if (delta != alignment_slots) {
frame_slot_count_ += delta;
if (spill_slot_count_ != 0) {
spill_slot_count_ += delta;
}
}
return delta;
}
void FrameAccessState::MarkHasFrame(bool state) {
has_frame_ = state;
SetFrameAccessToDefault();
}
void FrameAccessState::SetFrameAccessToDefault() {
if (has_frame() && !FLAG_turbo_sp_frame_access) {
SetFrameAccessToFP();
} else {
SetFrameAccessToSP();
}
}
FrameOffset FrameAccessState::GetFrameOffset(int spill_slot) const {
const int frame_offset = FrameSlotToFPOffset(spill_slot);
if (access_frame_with_fp()) {
return FrameOffset::FromFramePointer(frame_offset);
} else {
// No frame. Retrieve all parameters relative to stack pointer.
int sp_offset = frame_offset + GetSPToFPOffset();
return FrameOffset::FromStackPointer(sp_offset);
}
}
} // namespace compiler
} // namespace internal
} // namespace v8
```
|
The Gold Line is a rapid transit line of the Doha Metro. The east-west Gold Line runs through Doha, extending from Ras Abu Aboud Station to Al Aziziya Station over a distance of 32 km. Is a part of the Qatar Integrated Rail Project, which is guided by the Qatar National Vision 2030. It was officially opened on 21 November, 2019.
Stations
Construction
Gold Line metro project was awarded to a global consortium (Joint Venture Company) consisting of five companies. Aktor S.A from Greece, Larsen & Toubro LTD from India, Yapi Merkezi from Turkey, STFA also from Turkey and Al Jaber Engineering from Qatar.
External links
Qatar Rail – official website
References
Doha Metro
Rapid transit in Qatar
2019 establishments in Qatar
Railway lines opened in 2019
|
```javascript
/**
* @license React
* react-server-dom-turbopack-server.node.production.js
*
*
* This source code is licensed under the MIT license found in the
* LICENSE file in the root directory of this source tree.
*/
"use strict";
var stream = require("stream"),
util = require("util");
require("crypto");
var async_hooks = require("async_hooks"),
ReactDOM = require("react-dom"),
React = require("react"),
scheduleMicrotask = queueMicrotask,
currentView = null,
writtenBytes = 0,
destinationHasCapacity = !0;
function writeToDestination(destination, view) {
destination = destination.write(view);
destinationHasCapacity = destinationHasCapacity && destination;
}
function writeChunkAndReturn(destination, chunk) {
if ("string" === typeof chunk) {
if (0 !== chunk.length)
if (2048 < 3 * chunk.length)
0 < writtenBytes &&
(writeToDestination(
destination,
currentView.subarray(0, writtenBytes)
),
(currentView = new Uint8Array(2048)),
(writtenBytes = 0)),
writeToDestination(destination, chunk);
else {
var target = currentView;
0 < writtenBytes && (target = currentView.subarray(writtenBytes));
target = textEncoder.encodeInto(chunk, target);
var read = target.read;
writtenBytes += target.written;
read < chunk.length &&
(writeToDestination(
destination,
currentView.subarray(0, writtenBytes)
),
(currentView = new Uint8Array(2048)),
(writtenBytes = textEncoder.encodeInto(
chunk.slice(read),
currentView
).written));
2048 === writtenBytes &&
(writeToDestination(destination, currentView),
(currentView = new Uint8Array(2048)),
(writtenBytes = 0));
}
} else
0 !== chunk.byteLength &&
(2048 < chunk.byteLength
? (0 < writtenBytes &&
(writeToDestination(
destination,
currentView.subarray(0, writtenBytes)
),
(currentView = new Uint8Array(2048)),
(writtenBytes = 0)),
writeToDestination(destination, chunk))
: ((target = currentView.length - writtenBytes),
target < chunk.byteLength &&
(0 === target
? writeToDestination(destination, currentView)
: (currentView.set(chunk.subarray(0, target), writtenBytes),
(writtenBytes += target),
writeToDestination(destination, currentView),
(chunk = chunk.subarray(target))),
(currentView = new Uint8Array(2048)),
(writtenBytes = 0)),
currentView.set(chunk, writtenBytes),
(writtenBytes += chunk.byteLength),
2048 === writtenBytes &&
(writeToDestination(destination, currentView),
(currentView = new Uint8Array(2048)),
(writtenBytes = 0))));
return destinationHasCapacity;
}
var textEncoder = new util.TextEncoder();
function byteLengthOfChunk(chunk) {
return "string" === typeof chunk
? Buffer.byteLength(chunk, "utf8")
: chunk.byteLength;
}
var CLIENT_REFERENCE_TAG$1 = Symbol.for("react.client.reference"),
SERVER_REFERENCE_TAG = Symbol.for("react.server.reference");
function registerClientReferenceImpl(proxyImplementation, id, async) {
return Object.defineProperties(proxyImplementation, {
$$typeof: { value: CLIENT_REFERENCE_TAG$1 },
$$id: { value: id },
$$async: { value: async }
});
}
var FunctionBind = Function.prototype.bind,
ArraySlice = Array.prototype.slice;
function bind() {
var newFn = FunctionBind.apply(this, arguments);
if (this.$$typeof === SERVER_REFERENCE_TAG) {
var args = ArraySlice.call(arguments, 1);
return Object.defineProperties(newFn, {
$$typeof: { value: SERVER_REFERENCE_TAG },
$$id: { value: this.$$id },
$$bound: { value: this.$$bound ? this.$$bound.concat(args) : args },
bind: { value: bind }
});
}
return newFn;
}
var PROMISE_PROTOTYPE = Promise.prototype,
deepProxyHandlers = {
get: function (target, name) {
switch (name) {
case "$$typeof":
return target.$$typeof;
case "$$id":
return target.$$id;
case "$$async":
return target.$$async;
case "name":
return target.name;
case "displayName":
return;
case "defaultProps":
return;
case "toJSON":
return;
case Symbol.toPrimitive:
return Object.prototype[Symbol.toPrimitive];
case Symbol.toStringTag:
return Object.prototype[Symbol.toStringTag];
case "Provider":
throw Error(
"Cannot render a Client Context Provider on the Server. Instead, you can export a Client Component wrapper that itself renders a Client Context Provider."
);
case "then":
throw Error(
"Cannot await or return from a thenable. You cannot await a client module from a server component."
);
}
throw Error(
"Cannot access " +
(String(target.name) + "." + String(name)) +
" on the server. You cannot dot into a client module from a server component. You can only pass the imported name through."
);
},
set: function () {
throw Error("Cannot assign to a client module from a server module.");
}
};
function getReference(target, name) {
switch (name) {
case "$$typeof":
return target.$$typeof;
case "$$id":
return target.$$id;
case "$$async":
return target.$$async;
case "name":
return target.name;
case "defaultProps":
return;
case "toJSON":
return;
case Symbol.toPrimitive:
return Object.prototype[Symbol.toPrimitive];
case Symbol.toStringTag:
return Object.prototype[Symbol.toStringTag];
case "__esModule":
var moduleId = target.$$id;
target.default = registerClientReferenceImpl(
function () {
throw Error(
"Attempted to call the default export of " +
moduleId +
" from the server but it's on the client. It's not possible to invoke a client function from the server, it can only be rendered as a Component or passed to props of a Client Component."
);
},
target.$$id + "#",
target.$$async
);
return !0;
case "then":
if (target.then) return target.then;
if (target.$$async) return;
var clientReference = registerClientReferenceImpl({}, target.$$id, !0),
proxy = new Proxy(clientReference, proxyHandlers$1);
target.status = "fulfilled";
target.value = proxy;
return (target.then = registerClientReferenceImpl(
function (resolve) {
return Promise.resolve(resolve(proxy));
},
target.$$id + "#then",
!1
));
}
if ("symbol" === typeof name)
throw Error(
"Cannot read Symbol exports. Only named exports are supported on a client module imported on the server."
);
clientReference = target[name];
clientReference ||
((clientReference = registerClientReferenceImpl(
function () {
throw Error(
"Attempted to call " +
String(name) +
"() from the server but " +
String(name) +
" is on the client. It's not possible to invoke a client function from the server, it can only be rendered as a Component or passed to props of a Client Component."
);
},
target.$$id + "#" + name,
target.$$async
)),
Object.defineProperty(clientReference, "name", { value: name }),
(clientReference = target[name] =
new Proxy(clientReference, deepProxyHandlers)));
return clientReference;
}
var proxyHandlers$1 = {
get: function (target, name) {
return getReference(target, name);
},
getOwnPropertyDescriptor: function (target, name) {
var descriptor = Object.getOwnPropertyDescriptor(target, name);
descriptor ||
((descriptor = {
value: getReference(target, name),
writable: !1,
configurable: !1,
enumerable: !1
}),
Object.defineProperty(target, name, descriptor));
return descriptor;
},
getPrototypeOf: function () {
return PROMISE_PROTOTYPE;
},
set: function () {
throw Error("Cannot assign to a client module from a server module.");
}
},
ReactDOMSharedInternals =
ReactDOM.__DOM_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE,
previousDispatcher = ReactDOMSharedInternals.d;
ReactDOMSharedInternals.d = {
f: previousDispatcher.f,
r: previousDispatcher.r,
D: prefetchDNS,
C: preconnect,
L: preload,
m: preloadModule$1,
X: preinitScript,
S: preinitStyle,
M: preinitModuleScript
};
function prefetchDNS(href) {
if ("string" === typeof href && href) {
var request = resolveRequest();
if (request) {
var hints = request.hints,
key = "D|" + href;
hints.has(key) || (hints.add(key), emitHint(request, "D", href));
} else previousDispatcher.D(href);
}
}
function preconnect(href, crossOrigin) {
if ("string" === typeof href) {
var request = resolveRequest();
if (request) {
var hints = request.hints,
key = "C|" + (null == crossOrigin ? "null" : crossOrigin) + "|" + href;
hints.has(key) ||
(hints.add(key),
"string" === typeof crossOrigin
? emitHint(request, "C", [href, crossOrigin])
: emitHint(request, "C", href));
} else previousDispatcher.C(href, crossOrigin);
}
}
function preload(href, as, options) {
if ("string" === typeof href) {
var request = resolveRequest();
if (request) {
var hints = request.hints,
key = "L";
if ("image" === as && options) {
var imageSrcSet = options.imageSrcSet,
imageSizes = options.imageSizes,
uniquePart = "";
"string" === typeof imageSrcSet && "" !== imageSrcSet
? ((uniquePart += "[" + imageSrcSet + "]"),
"string" === typeof imageSizes &&
(uniquePart += "[" + imageSizes + "]"))
: (uniquePart += "[][]" + href);
key += "[image]" + uniquePart;
} else key += "[" + as + "]" + href;
hints.has(key) ||
(hints.add(key),
(options = trimOptions(options))
? emitHint(request, "L", [href, as, options])
: emitHint(request, "L", [href, as]));
} else previousDispatcher.L(href, as, options);
}
}
function preloadModule$1(href, options) {
if ("string" === typeof href) {
var request = resolveRequest();
if (request) {
var hints = request.hints,
key = "m|" + href;
if (hints.has(key)) return;
hints.add(key);
return (options = trimOptions(options))
? emitHint(request, "m", [href, options])
: emitHint(request, "m", href);
}
previousDispatcher.m(href, options);
}
}
function preinitStyle(href, precedence, options) {
if ("string" === typeof href) {
var request = resolveRequest();
if (request) {
var hints = request.hints,
key = "S|" + href;
if (hints.has(key)) return;
hints.add(key);
return (options = trimOptions(options))
? emitHint(request, "S", [
href,
"string" === typeof precedence ? precedence : 0,
options
])
: "string" === typeof precedence
? emitHint(request, "S", [href, precedence])
: emitHint(request, "S", href);
}
previousDispatcher.S(href, precedence, options);
}
}
function preinitScript(src, options) {
if ("string" === typeof src) {
var request = resolveRequest();
if (request) {
var hints = request.hints,
key = "X|" + src;
if (hints.has(key)) return;
hints.add(key);
return (options = trimOptions(options))
? emitHint(request, "X", [src, options])
: emitHint(request, "X", src);
}
previousDispatcher.X(src, options);
}
}
function preinitModuleScript(src, options) {
if ("string" === typeof src) {
var request = resolveRequest();
if (request) {
var hints = request.hints,
key = "M|" + src;
if (hints.has(key)) return;
hints.add(key);
return (options = trimOptions(options))
? emitHint(request, "M", [src, options])
: emitHint(request, "M", src);
}
previousDispatcher.M(src, options);
}
}
function trimOptions(options) {
if (null == options) return null;
var hasProperties = !1,
trimmed = {},
key;
for (key in options)
null != options[key] &&
((hasProperties = !0), (trimmed[key] = options[key]));
return hasProperties ? trimmed : null;
}
var requestStorage = new async_hooks.AsyncLocalStorage(),
TEMPORARY_REFERENCE_TAG = Symbol.for("react.temporary.reference"),
proxyHandlers = {
get: function (target, name) {
switch (name) {
case "$$typeof":
return target.$$typeof;
case "name":
return;
case "displayName":
return;
case "defaultProps":
return;
case "toJSON":
return;
case Symbol.toPrimitive:
return Object.prototype[Symbol.toPrimitive];
case Symbol.toStringTag:
return Object.prototype[Symbol.toStringTag];
case "Provider":
throw Error(
"Cannot render a Client Context Provider on the Server. Instead, you can export a Client Component wrapper that itself renders a Client Context Provider."
);
}
throw Error(
"Cannot access " +
String(name) +
" on the server. You cannot dot into a temporary client reference from a server component. You can only pass the value through to the client."
);
},
set: function () {
throw Error(
"Cannot assign to a temporary client reference from a server module."
);
}
};
function createTemporaryReference(temporaryReferences, id) {
var reference = Object.defineProperties(
function () {
throw Error(
"Attempted to call a temporary Client Reference from the server but it is on the client. It's not possible to invoke a client function from the server, it can only be rendered as a Component or passed to props of a Client Component."
);
},
{ $$typeof: { value: TEMPORARY_REFERENCE_TAG } }
);
reference = new Proxy(reference, proxyHandlers);
temporaryReferences.set(reference, id);
return reference;
}
var REACT_LEGACY_ELEMENT_TYPE = Symbol.for("react.element"),
REACT_ELEMENT_TYPE = Symbol.for("react.transitional.element"),
REACT_FRAGMENT_TYPE = Symbol.for("react.fragment"),
REACT_CONTEXT_TYPE = Symbol.for("react.context"),
REACT_FORWARD_REF_TYPE = Symbol.for("react.forward_ref"),
REACT_SUSPENSE_TYPE = Symbol.for("react.suspense"),
REACT_SUSPENSE_LIST_TYPE = Symbol.for("react.suspense_list"),
REACT_MEMO_TYPE = Symbol.for("react.memo"),
REACT_LAZY_TYPE = Symbol.for("react.lazy"),
REACT_MEMO_CACHE_SENTINEL = Symbol.for("react.memo_cache_sentinel"),
REACT_POSTPONE_TYPE = Symbol.for("react.postpone"),
MAYBE_ITERATOR_SYMBOL = Symbol.iterator;
function getIteratorFn(maybeIterable) {
if (null === maybeIterable || "object" !== typeof maybeIterable) return null;
maybeIterable =
(MAYBE_ITERATOR_SYMBOL && maybeIterable[MAYBE_ITERATOR_SYMBOL]) ||
maybeIterable["@@iterator"];
return "function" === typeof maybeIterable ? maybeIterable : null;
}
var ASYNC_ITERATOR = Symbol.asyncIterator,
SuspenseException = Error(
"Suspense Exception: This is not a real error! It's an implementation detail of `use` to interrupt the current render. You must either rethrow it immediately, or move the `use` call outside of the `try/catch` block. Capturing without rethrowing will lead to unexpected behavior.\n\nTo handle async errors, wrap your component in an error boundary, or call the promise's `.catch` method and pass the result to `use`"
);
function noop$1() {}
function trackUsedThenable(thenableState, thenable, index) {
index = thenableState[index];
void 0 === index
? thenableState.push(thenable)
: index !== thenable && (thenable.then(noop$1, noop$1), (thenable = index));
switch (thenable.status) {
case "fulfilled":
return thenable.value;
case "rejected":
throw thenable.reason;
default:
"string" === typeof thenable.status
? thenable.then(noop$1, noop$1)
: ((thenableState = thenable),
(thenableState.status = "pending"),
thenableState.then(
function (fulfilledValue) {
if ("pending" === thenable.status) {
var fulfilledThenable = thenable;
fulfilledThenable.status = "fulfilled";
fulfilledThenable.value = fulfilledValue;
}
},
function (error) {
if ("pending" === thenable.status) {
var rejectedThenable = thenable;
rejectedThenable.status = "rejected";
rejectedThenable.reason = error;
}
}
));
switch (thenable.status) {
case "fulfilled":
return thenable.value;
case "rejected":
throw thenable.reason;
}
suspendedThenable = thenable;
throw SuspenseException;
}
}
var suspendedThenable = null;
function getSuspendedThenable() {
if (null === suspendedThenable)
throw Error(
"Expected a suspended thenable. This is a bug in React. Please file an issue."
);
var thenable = suspendedThenable;
suspendedThenable = null;
return thenable;
}
var currentRequest$1 = null,
thenableIndexCounter = 0,
thenableState = null;
function getThenableStateAfterSuspending() {
var state = thenableState || [];
thenableState = null;
return state;
}
var HooksDispatcher = {
useMemo: function (nextCreate) {
return nextCreate();
},
useCallback: function (callback) {
return callback;
},
useDebugValue: function () {},
useDeferredValue: unsupportedHook,
useTransition: unsupportedHook,
readContext: unsupportedContext,
useContext: unsupportedContext,
useReducer: unsupportedHook,
useRef: unsupportedHook,
useState: unsupportedHook,
useInsertionEffect: unsupportedHook,
useLayoutEffect: unsupportedHook,
useImperativeHandle: unsupportedHook,
useEffect: unsupportedHook,
useId: useId,
useSyncExternalStore: unsupportedHook,
useCacheRefresh: function () {
return unsupportedRefresh;
},
useMemoCache: function (size) {
for (var data = Array(size), i = 0; i < size; i++)
data[i] = REACT_MEMO_CACHE_SENTINEL;
return data;
},
use: use
};
function unsupportedHook() {
throw Error("This Hook is not supported in Server Components.");
}
function unsupportedRefresh() {
throw Error("Refreshing the cache is not supported in Server Components.");
}
function unsupportedContext() {
throw Error("Cannot read a Client Context from a Server Component.");
}
function useId() {
if (null === currentRequest$1)
throw Error("useId can only be used while React is rendering");
var id = currentRequest$1.identifierCount++;
return ":" + currentRequest$1.identifierPrefix + "S" + id.toString(32) + ":";
}
function use(usable) {
if (
(null !== usable && "object" === typeof usable) ||
"function" === typeof usable
) {
if ("function" === typeof usable.then) {
var index = thenableIndexCounter;
thenableIndexCounter += 1;
null === thenableState && (thenableState = []);
return trackUsedThenable(thenableState, usable, index);
}
usable.$$typeof === REACT_CONTEXT_TYPE && unsupportedContext();
}
if (usable.$$typeof === CLIENT_REFERENCE_TAG$1) {
if (null != usable.value && usable.value.$$typeof === REACT_CONTEXT_TYPE)
throw Error("Cannot read a Client Context from a Server Component.");
throw Error("Cannot use() an already resolved Client Reference.");
}
throw Error("An unsupported type was passed to use(): " + String(usable));
}
var DefaultAsyncDispatcher = {
getCacheForType: function (resourceType) {
var JSCompiler_inline_result = (JSCompiler_inline_result =
resolveRequest())
? JSCompiler_inline_result.cache
: new Map();
var entry = JSCompiler_inline_result.get(resourceType);
void 0 === entry &&
((entry = resourceType()),
JSCompiler_inline_result.set(resourceType, entry));
return entry;
}
},
ReactSharedInternalsServer =
React.__SERVER_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE;
if (!ReactSharedInternalsServer)
throw Error(
'The "react" package in this environment is not configured correctly. The "react-server" condition must be enabled in any environment that runs React Server Components.'
);
var isArrayImpl = Array.isArray,
getPrototypeOf = Object.getPrototypeOf;
function objectName(object) {
return Object.prototype.toString
.call(object)
.replace(/^\[object (.*)\]$/, function (m, p0) {
return p0;
});
}
function describeValueForErrorMessage(value) {
switch (typeof value) {
case "string":
return JSON.stringify(
10 >= value.length ? value : value.slice(0, 10) + "..."
);
case "object":
if (isArrayImpl(value)) return "[...]";
if (null !== value && value.$$typeof === CLIENT_REFERENCE_TAG)
return "client";
value = objectName(value);
return "Object" === value ? "{...}" : value;
case "function":
return value.$$typeof === CLIENT_REFERENCE_TAG
? "client"
: (value = value.displayName || value.name)
? "function " + value
: "function";
default:
return String(value);
}
}
function describeElementType(type) {
if ("string" === typeof type) return type;
switch (type) {
case REACT_SUSPENSE_TYPE:
return "Suspense";
case REACT_SUSPENSE_LIST_TYPE:
return "SuspenseList";
}
if ("object" === typeof type)
switch (type.$$typeof) {
case REACT_FORWARD_REF_TYPE:
return describeElementType(type.render);
case REACT_MEMO_TYPE:
return describeElementType(type.type);
case REACT_LAZY_TYPE:
var payload = type._payload;
type = type._init;
try {
return describeElementType(type(payload));
} catch (x) {}
}
return "";
}
var CLIENT_REFERENCE_TAG = Symbol.for("react.client.reference");
function describeObjectForErrorMessage(objectOrArray, expandedName) {
var objKind = objectName(objectOrArray);
if ("Object" !== objKind && "Array" !== objKind) return objKind;
objKind = -1;
var length = 0;
if (isArrayImpl(objectOrArray)) {
var str = "[";
for (var i = 0; i < objectOrArray.length; i++) {
0 < i && (str += ", ");
var value = objectOrArray[i];
value =
"object" === typeof value && null !== value
? describeObjectForErrorMessage(value)
: describeValueForErrorMessage(value);
"" + i === expandedName
? ((objKind = str.length), (length = value.length), (str += value))
: (str =
10 > value.length && 40 > str.length + value.length
? str + value
: str + "...");
}
str += "]";
} else if (objectOrArray.$$typeof === REACT_ELEMENT_TYPE)
str = "<" + describeElementType(objectOrArray.type) + "/>";
else {
if (objectOrArray.$$typeof === CLIENT_REFERENCE_TAG) return "client";
str = "{";
i = Object.keys(objectOrArray);
for (value = 0; value < i.length; value++) {
0 < value && (str += ", ");
var name = i[value],
encodedKey = JSON.stringify(name);
str += ('"' + name + '"' === encodedKey ? name : encodedKey) + ": ";
encodedKey = objectOrArray[name];
encodedKey =
"object" === typeof encodedKey && null !== encodedKey
? describeObjectForErrorMessage(encodedKey)
: describeValueForErrorMessage(encodedKey);
name === expandedName
? ((objKind = str.length),
(length = encodedKey.length),
(str += encodedKey))
: (str =
10 > encodedKey.length && 40 > str.length + encodedKey.length
? str + encodedKey
: str + "...");
}
str += "}";
}
return void 0 === expandedName
? str
: -1 < objKind && 0 < length
? ((objectOrArray = " ".repeat(objKind) + "^".repeat(length)),
"\n " + str + "\n " + objectOrArray)
: "\n " + str;
}
var ObjectPrototype = Object.prototype,
stringify = JSON.stringify,
TaintRegistryObjects = ReactSharedInternalsServer.TaintRegistryObjects,
TaintRegistryValues = ReactSharedInternalsServer.TaintRegistryValues,
TaintRegistryByteLengths =
ReactSharedInternalsServer.TaintRegistryByteLengths,
TaintRegistryPendingRequests =
ReactSharedInternalsServer.TaintRegistryPendingRequests;
function throwTaintViolation(message) {
throw Error(message);
}
function cleanupTaintQueue(request) {
request = request.taintCleanupQueue;
TaintRegistryPendingRequests.delete(request);
for (var i = 0; i < request.length; i++) {
var entryValue = request[i],
entry = TaintRegistryValues.get(entryValue);
void 0 !== entry &&
(1 === entry.count
? TaintRegistryValues.delete(entryValue)
: entry.count--);
}
request.length = 0;
}
function defaultErrorHandler(error) {
console.error(error);
}
function defaultPostponeHandler() {}
function RequestInstance(
model,
bundlerConfig,
onError,
identifierPrefix,
onPostpone,
temporaryReferences,
environmentName,
filterStackFrame,
onAllReady,
onFatalError
) {
if (
null !== ReactSharedInternalsServer.A &&
ReactSharedInternalsServer.A !== DefaultAsyncDispatcher
)
throw Error("Currently React only supports one RSC renderer at a time.");
ReactSharedInternalsServer.A = DefaultAsyncDispatcher;
filterStackFrame = new Set();
environmentName = [];
var cleanupQueue = [];
TaintRegistryPendingRequests.add(cleanupQueue);
var hints = new Set();
this.status = 0;
this.flushScheduled = !1;
this.destination = this.fatalError = null;
this.bundlerConfig = bundlerConfig;
this.cache = new Map();
this.pendingChunks = this.nextChunkId = 0;
this.hints = hints;
this.abortListeners = new Set();
this.abortableTasks = filterStackFrame;
this.pingedTasks = environmentName;
this.completedImportChunks = [];
this.completedHintChunks = [];
this.completedRegularChunks = [];
this.completedErrorChunks = [];
this.writtenSymbols = new Map();
this.writtenClientReferences = new Map();
this.writtenServerReferences = new Map();
this.writtenObjects = new WeakMap();
this.temporaryReferences = temporaryReferences;
this.identifierPrefix = identifierPrefix || "";
this.identifierCount = 1;
this.taintCleanupQueue = cleanupQueue;
this.onError = void 0 === onError ? defaultErrorHandler : onError;
this.onPostpone = void 0 === onPostpone ? defaultPostponeHandler : onPostpone;
this.onAllReady = void 0 === onAllReady ? noop : onAllReady;
this.onFatalError = void 0 === onFatalError ? noop : onFatalError;
model = createTask(this, model, null, !1, filterStackFrame);
environmentName.push(model);
}
function noop() {}
var currentRequest = null;
function resolveRequest() {
if (currentRequest) return currentRequest;
var store = requestStorage.getStore();
return store ? store : null;
}
function serializeThenable(request, task, thenable) {
var newTask = createTask(
request,
null,
task.keyPath,
task.implicitSlot,
request.abortableTasks
);
switch (thenable.status) {
case "fulfilled":
return (
(newTask.model = thenable.value), pingTask(request, newTask), newTask.id
);
case "rejected":
return (
(task = thenable.reason),
"object" === typeof task &&
null !== task &&
task.$$typeof === REACT_POSTPONE_TYPE
? (logPostpone(request, task.message, newTask),
emitPostponeChunk(request, newTask.id))
: ((task = logRecoverableError(request, task, null)),
emitErrorChunk(request, newTask.id, task)),
(newTask.status = 4),
request.abortableTasks.delete(newTask),
newTask.id
);
default:
if (1 === request.status)
return (
(newTask.status = 3),
(task = stringify(serializeByValueID(request.fatalError))),
emitModelChunk(request, newTask.id, task),
request.abortableTasks.delete(newTask),
newTask.id
);
"string" !== typeof thenable.status &&
((thenable.status = "pending"),
thenable.then(
function (fulfilledValue) {
"pending" === thenable.status &&
((thenable.status = "fulfilled"),
(thenable.value = fulfilledValue));
},
function (error) {
"pending" === thenable.status &&
((thenable.status = "rejected"), (thenable.reason = error));
}
));
}
thenable.then(
function (value) {
newTask.model = value;
pingTask(request, newTask);
},
function (reason) {
"object" === typeof reason &&
null !== reason &&
reason.$$typeof === REACT_POSTPONE_TYPE
? (logPostpone(request, reason.message, newTask),
emitPostponeChunk(request, newTask.id))
: ((reason = logRecoverableError(request, reason, newTask)),
emitErrorChunk(request, newTask.id, reason));
newTask.status = 4;
request.abortableTasks.delete(newTask);
enqueueFlush(request);
}
);
return newTask.id;
}
function serializeReadableStream(request, task, stream) {
function progress(entry) {
if (!aborted)
if (entry.done)
request.abortListeners.delete(error),
(entry = streamTask.id.toString(16) + ":C\n"),
request.completedRegularChunks.push(entry),
enqueueFlush(request),
(aborted = !0);
else
try {
(streamTask.model = entry.value),
request.pendingChunks++,
emitChunk(request, streamTask, streamTask.model),
enqueueFlush(request),
reader.read().then(progress, error);
} catch (x$9) {
error(x$9);
}
}
function error(reason) {
if (!aborted) {
aborted = !0;
request.abortListeners.delete(error);
if (
"object" === typeof reason &&
null !== reason &&
reason.$$typeof === REACT_POSTPONE_TYPE
)
logPostpone(request, reason.message, streamTask),
emitPostponeChunk(request, streamTask.id);
else {
var digest = logRecoverableError(request, reason, streamTask);
emitErrorChunk(request, streamTask.id, digest);
}
enqueueFlush(request);
reader.cancel(reason).then(error, error);
}
}
var supportsBYOB = stream.supportsBYOB;
if (void 0 === supportsBYOB)
try {
stream.getReader({ mode: "byob" }).releaseLock(), (supportsBYOB = !0);
} catch (x) {
supportsBYOB = !1;
}
var reader = stream.getReader(),
streamTask = createTask(
request,
task.model,
task.keyPath,
task.implicitSlot,
request.abortableTasks
);
request.abortableTasks.delete(streamTask);
request.pendingChunks++;
task = streamTask.id.toString(16) + ":" + (supportsBYOB ? "r" : "R") + "\n";
request.completedRegularChunks.push(task);
var aborted = !1;
request.abortListeners.add(error);
reader.read().then(progress, error);
return serializeByValueID(streamTask.id);
}
function serializeAsyncIterable(request, task, iterable, iterator) {
function progress(entry) {
if (!aborted)
if (entry.done) {
request.abortListeners.delete(error);
if (void 0 === entry.value)
var endStreamRow = streamTask.id.toString(16) + ":C\n";
else
try {
var chunkId = outlineModel(request, entry.value);
endStreamRow =
streamTask.id.toString(16) +
":C" +
stringify(serializeByValueID(chunkId)) +
"\n";
} catch (x) {
error(x);
return;
}
request.completedRegularChunks.push(endStreamRow);
enqueueFlush(request);
aborted = !0;
} else
try {
(streamTask.model = entry.value),
request.pendingChunks++,
emitChunk(request, streamTask, streamTask.model),
enqueueFlush(request),
iterator.next().then(progress, error);
} catch (x$10) {
error(x$10);
}
}
function error(reason) {
if (!aborted) {
aborted = !0;
request.abortListeners.delete(error);
if (
"object" === typeof reason &&
null !== reason &&
reason.$$typeof === REACT_POSTPONE_TYPE
)
logPostpone(request, reason.message, streamTask),
emitPostponeChunk(request, streamTask.id);
else {
var digest = logRecoverableError(request, reason, streamTask);
emitErrorChunk(request, streamTask.id, digest);
}
enqueueFlush(request);
"function" === typeof iterator.throw &&
iterator.throw(reason).then(error, error);
}
}
iterable = iterable === iterator;
var streamTask = createTask(
request,
task.model,
task.keyPath,
task.implicitSlot,
request.abortableTasks
);
request.abortableTasks.delete(streamTask);
request.pendingChunks++;
task = streamTask.id.toString(16) + ":" + (iterable ? "x" : "X") + "\n";
request.completedRegularChunks.push(task);
var aborted = !1;
request.abortListeners.add(error);
iterator.next().then(progress, error);
return serializeByValueID(streamTask.id);
}
function emitHint(request, code, model) {
model = stringify(model);
var id = request.nextChunkId++;
code = "H" + code;
code = id.toString(16) + ":" + code;
request.completedHintChunks.push(code + model + "\n");
enqueueFlush(request);
}
function readThenable(thenable) {
if ("fulfilled" === thenable.status) return thenable.value;
if ("rejected" === thenable.status) throw thenable.reason;
throw thenable;
}
function createLazyWrapperAroundWakeable(wakeable) {
switch (wakeable.status) {
case "fulfilled":
case "rejected":
break;
default:
"string" !== typeof wakeable.status &&
((wakeable.status = "pending"),
wakeable.then(
function (fulfilledValue) {
"pending" === wakeable.status &&
((wakeable.status = "fulfilled"),
(wakeable.value = fulfilledValue));
},
function (error) {
"pending" === wakeable.status &&
((wakeable.status = "rejected"), (wakeable.reason = error));
}
));
}
return { $$typeof: REACT_LAZY_TYPE, _payload: wakeable, _init: readThenable };
}
function voidHandler() {}
function renderFunctionComponent(request, task, key, Component, props) {
var prevThenableState = task.thenableState;
task.thenableState = null;
thenableIndexCounter = 0;
thenableState = prevThenableState;
Component = Component(props, void 0);
if (1 === request.status)
throw (
("object" === typeof Component &&
null !== Component &&
"function" === typeof Component.then &&
Component.$$typeof !== CLIENT_REFERENCE_TAG$1 &&
Component.then(voidHandler, voidHandler),
null)
);
if (
"object" === typeof Component &&
null !== Component &&
Component.$$typeof !== CLIENT_REFERENCE_TAG$1
) {
if ("function" === typeof Component.then) {
props = Component;
if ("fulfilled" === props.status) return props.value;
Component = createLazyWrapperAroundWakeable(Component);
}
var iteratorFn = getIteratorFn(Component);
if (iteratorFn) {
var iterableChild = Component;
Component = {};
Component =
((Component[Symbol.iterator] = function () {
return iteratorFn.call(iterableChild);
}),
Component);
} else if (
!(
"function" !== typeof Component[ASYNC_ITERATOR] ||
("function" === typeof ReadableStream &&
Component instanceof ReadableStream)
)
) {
var iterableChild$11 = Component;
Component = {};
Component =
((Component[ASYNC_ITERATOR] = function () {
return iterableChild$11[ASYNC_ITERATOR]();
}),
Component);
}
}
props = task.keyPath;
prevThenableState = task.implicitSlot;
null !== key
? (task.keyPath = null === props ? key : props + "," + key)
: null === props && (task.implicitSlot = !0);
request = renderModelDestructive(request, task, emptyRoot, "", Component);
task.keyPath = props;
task.implicitSlot = prevThenableState;
return request;
}
function renderFragment(request, task, children) {
return null !== task.keyPath
? ((request = [
REACT_ELEMENT_TYPE,
REACT_FRAGMENT_TYPE,
task.keyPath,
{ children: children }
]),
task.implicitSlot ? [request] : request)
: children;
}
function renderElement(request, task, type, key, ref, props) {
if (null !== ref && void 0 !== ref)
throw Error(
"Refs cannot be used in Server Components, nor passed to Client Components."
);
if (
"function" === typeof type &&
type.$$typeof !== CLIENT_REFERENCE_TAG$1 &&
type.$$typeof !== TEMPORARY_REFERENCE_TAG
)
return renderFunctionComponent(request, task, key, type, props);
if (type === REACT_FRAGMENT_TYPE && null === key)
return (
(type = task.implicitSlot),
null === task.keyPath && (task.implicitSlot = !0),
(props = renderModelDestructive(
request,
task,
emptyRoot,
"",
props.children
)),
(task.implicitSlot = type),
props
);
if (
null != type &&
"object" === typeof type &&
type.$$typeof !== CLIENT_REFERENCE_TAG$1
)
switch (type.$$typeof) {
case REACT_LAZY_TYPE:
var init = type._init;
type = init(type._payload);
if (1 === request.status) throw null;
return renderElement(request, task, type, key, ref, props);
case REACT_FORWARD_REF_TYPE:
return renderFunctionComponent(request, task, key, type.render, props);
case REACT_MEMO_TYPE:
return renderElement(request, task, type.type, key, ref, props);
}
request = key;
key = task.keyPath;
null === request
? (request = key)
: null !== key && (request = key + "," + request);
props = [REACT_ELEMENT_TYPE, type, request, props];
task = task.implicitSlot && null !== request ? [props] : props;
return task;
}
function pingTask(request, task) {
var pingedTasks = request.pingedTasks;
pingedTasks.push(task);
1 === pingedTasks.length &&
((request.flushScheduled = null !== request.destination),
scheduleMicrotask(function () {
return performWork(request);
}));
}
function createTask(request, model, keyPath, implicitSlot, abortSet) {
request.pendingChunks++;
var id = request.nextChunkId++;
"object" !== typeof model ||
null === model ||
null !== keyPath ||
implicitSlot ||
request.writtenObjects.set(model, serializeByValueID(id));
var task = {
id: id,
status: 0,
model: model,
keyPath: keyPath,
implicitSlot: implicitSlot,
ping: function () {
return pingTask(request, task);
},
toJSON: function (parentPropertyName, value) {
return renderModel(request, task, this, parentPropertyName, value);
},
thenableState: null
};
abortSet.add(task);
return task;
}
function serializeByValueID(id) {
return "$" + id.toString(16);
}
function serializeLazyID(id) {
return "$L" + id.toString(16);
}
function encodeReferenceChunk(request, id, reference) {
request = stringify(reference);
return id.toString(16) + ":" + request + "\n";
}
function serializeClientReference(
request,
parent,
parentPropertyName,
clientReference
) {
var clientReferenceKey = clientReference.$$async
? clientReference.$$id + "#async"
: clientReference.$$id,
writtenClientReferences = request.writtenClientReferences,
existingId = writtenClientReferences.get(clientReferenceKey);
if (void 0 !== existingId)
return parent[0] === REACT_ELEMENT_TYPE && "1" === parentPropertyName
? serializeLazyID(existingId)
: serializeByValueID(existingId);
try {
var config = request.bundlerConfig,
modulePath = clientReference.$$id;
existingId = "";
var resolvedModuleData = config[modulePath];
if (resolvedModuleData) existingId = resolvedModuleData.name;
else {
var idx = modulePath.lastIndexOf("#");
-1 !== idx &&
((existingId = modulePath.slice(idx + 1)),
(resolvedModuleData = config[modulePath.slice(0, idx)]));
if (!resolvedModuleData)
throw Error(
'Could not find the module "' +
modulePath +
'" in the React Client Manifest. This is probably a bug in the React Server Components bundler.'
);
}
var JSCompiler_inline_result =
!0 === clientReference.$$async
? [resolvedModuleData.id, resolvedModuleData.chunks, existingId, 1]
: [resolvedModuleData.id, resolvedModuleData.chunks, existingId];
request.pendingChunks++;
var importId = request.nextChunkId++,
json = stringify(JSCompiler_inline_result),
processedChunk = importId.toString(16) + ":I" + json + "\n";
request.completedImportChunks.push(processedChunk);
writtenClientReferences.set(clientReferenceKey, importId);
return parent[0] === REACT_ELEMENT_TYPE && "1" === parentPropertyName
? serializeLazyID(importId)
: serializeByValueID(importId);
} catch (x) {
return (
request.pendingChunks++,
(parent = request.nextChunkId++),
(parentPropertyName = logRecoverableError(request, x, null)),
emitErrorChunk(request, parent, parentPropertyName),
serializeByValueID(parent)
);
}
}
function outlineModel(request, value) {
value = createTask(request, value, null, !1, request.abortableTasks);
retryTask(request, value);
return value.id;
}
function serializeTypedArray(request, tag, typedArray) {
request.pendingChunks++;
var bufferId = request.nextChunkId++;
emitTypedArrayChunk(request, bufferId, tag, typedArray);
return serializeByValueID(bufferId);
}
function serializeBlob(request, blob) {
function progress(entry) {
if (!aborted)
if (entry.done)
request.abortListeners.delete(error),
(aborted = !0),
pingTask(request, newTask);
else
return (
model.push(entry.value), reader.read().then(progress).catch(error)
);
}
function error(reason) {
if (!aborted) {
aborted = !0;
request.abortListeners.delete(error);
var digest = logRecoverableError(request, reason, newTask);
emitErrorChunk(request, newTask.id, digest);
request.abortableTasks.delete(newTask);
enqueueFlush(request);
reader.cancel(reason).then(error, error);
}
}
var model = [blob.type],
newTask = createTask(request, model, null, !1, request.abortableTasks),
reader = blob.stream().getReader(),
aborted = !1;
request.abortListeners.add(error);
reader.read().then(progress).catch(error);
return "$B" + newTask.id.toString(16);
}
var modelRoot = !1;
function renderModel(request, task, parent, key, value) {
var prevKeyPath = task.keyPath,
prevImplicitSlot = task.implicitSlot;
try {
return renderModelDestructive(request, task, parent, key, value);
} catch (thrownValue) {
parent = task.model;
parent =
"object" === typeof parent &&
null !== parent &&
(parent.$$typeof === REACT_ELEMENT_TYPE ||
parent.$$typeof === REACT_LAZY_TYPE);
key =
thrownValue === SuspenseException ? getSuspendedThenable() : thrownValue;
if ("object" === typeof key && null !== key) {
if ("function" === typeof key.then) {
if (1 === request.status)
return (
(task.status = 3),
(task = request.fatalError),
parent ? serializeLazyID(task) : serializeByValueID(task)
);
request = createTask(
request,
task.model,
task.keyPath,
task.implicitSlot,
request.abortableTasks
);
value = request.ping;
key.then(value, value);
request.thenableState = getThenableStateAfterSuspending();
task.keyPath = prevKeyPath;
task.implicitSlot = prevImplicitSlot;
return parent
? serializeLazyID(request.id)
: serializeByValueID(request.id);
}
if (key.$$typeof === REACT_POSTPONE_TYPE)
return (
request.pendingChunks++,
(value = request.nextChunkId++),
logPostpone(request, key.message, task),
emitPostponeChunk(request, value),
(task.keyPath = prevKeyPath),
(task.implicitSlot = prevImplicitSlot),
parent ? serializeLazyID(value) : serializeByValueID(value)
);
}
if (1 === request.status)
return (
(task.status = 3),
(task = request.fatalError),
parent ? serializeLazyID(task) : serializeByValueID(task)
);
task.keyPath = prevKeyPath;
task.implicitSlot = prevImplicitSlot;
request.pendingChunks++;
prevKeyPath = request.nextChunkId++;
task = logRecoverableError(request, key, task);
emitErrorChunk(request, prevKeyPath, task);
return parent
? serializeLazyID(prevKeyPath)
: serializeByValueID(prevKeyPath);
}
}
function renderModelDestructive(
request,
task,
parent,
parentPropertyName,
value
) {
task.model = value;
if (value === REACT_ELEMENT_TYPE) return "$";
if (null === value) return null;
if ("object" === typeof value) {
switch (value.$$typeof) {
case REACT_ELEMENT_TYPE:
var elementReference = null,
writtenObjects = request.writtenObjects;
if (null === task.keyPath && !task.implicitSlot) {
var existingReference = writtenObjects.get(value);
if (void 0 !== existingReference)
if (modelRoot === value) modelRoot = null;
else return existingReference;
else
-1 === parentPropertyName.indexOf(":") &&
((parent = writtenObjects.get(parent)),
void 0 !== parent &&
((elementReference = parent + ":" + parentPropertyName),
writtenObjects.set(value, elementReference)));
}
parentPropertyName = value.props;
parent = parentPropertyName.ref;
value = renderElement(
request,
task,
value.type,
value.key,
void 0 !== parent ? parent : null,
parentPropertyName
);
"object" === typeof value &&
null !== value &&
null !== elementReference &&
(writtenObjects.has(value) ||
writtenObjects.set(value, elementReference));
return value;
case REACT_LAZY_TYPE:
task.thenableState = null;
parentPropertyName = value._init;
value = parentPropertyName(value._payload);
if (1 === request.status) throw null;
return renderModelDestructive(request, task, emptyRoot, "", value);
case REACT_LEGACY_ELEMENT_TYPE:
throw Error(
'A React Element from an older version of React was rendered. This is not supported. It can happen if:\n- Multiple copies of the "react" package is used.\n- A library pre-bundled an old copy of "react" or "react/jsx-runtime".\n- A compiler tries to "inline" JSX instead of using the runtime.'
);
}
if (value.$$typeof === CLIENT_REFERENCE_TAG$1)
return serializeClientReference(
request,
parent,
parentPropertyName,
value
);
if (
void 0 !== request.temporaryReferences &&
((elementReference = request.temporaryReferences.get(value)),
void 0 !== elementReference)
)
return "$T" + elementReference;
elementReference = TaintRegistryObjects.get(value);
void 0 !== elementReference && throwTaintViolation(elementReference);
elementReference = request.writtenObjects;
writtenObjects = elementReference.get(value);
if ("function" === typeof value.then) {
if (void 0 !== writtenObjects) {
if (null !== task.keyPath || task.implicitSlot)
return "$@" + serializeThenable(request, task, value).toString(16);
if (modelRoot === value) modelRoot = null;
else return writtenObjects;
}
request = "$@" + serializeThenable(request, task, value).toString(16);
elementReference.set(value, request);
return request;
}
if (void 0 !== writtenObjects)
if (modelRoot === value) modelRoot = null;
else return writtenObjects;
else if (
-1 === parentPropertyName.indexOf(":") &&
((writtenObjects = elementReference.get(parent)),
void 0 !== writtenObjects)
) {
existingReference = parentPropertyName;
if (isArrayImpl(parent) && parent[0] === REACT_ELEMENT_TYPE)
switch (parentPropertyName) {
case "1":
existingReference = "type";
break;
case "2":
existingReference = "key";
break;
case "3":
existingReference = "props";
}
elementReference.set(value, writtenObjects + ":" + existingReference);
}
if (isArrayImpl(value)) return renderFragment(request, task, value);
if (value instanceof Map)
return (
(value = Array.from(value)),
"$Q" + outlineModel(request, value).toString(16)
);
if (value instanceof Set)
return (
(value = Array.from(value)),
"$W" + outlineModel(request, value).toString(16)
);
if ("function" === typeof FormData && value instanceof FormData)
return (
(value = Array.from(value.entries())),
"$K" + outlineModel(request, value).toString(16)
);
if (value instanceof ArrayBuffer)
return serializeTypedArray(request, "A", new Uint8Array(value));
if (value instanceof Int8Array)
return serializeTypedArray(request, "O", value);
if (value instanceof Uint8Array)
return serializeTypedArray(request, "o", value);
if (value instanceof Uint8ClampedArray)
return serializeTypedArray(request, "U", value);
if (value instanceof Int16Array)
return serializeTypedArray(request, "S", value);
if (value instanceof Uint16Array)
return serializeTypedArray(request, "s", value);
if (value instanceof Int32Array)
return serializeTypedArray(request, "L", value);
if (value instanceof Uint32Array)
return serializeTypedArray(request, "l", value);
if (value instanceof Float32Array)
return serializeTypedArray(request, "G", value);
if (value instanceof Float64Array)
return serializeTypedArray(request, "g", value);
if (value instanceof BigInt64Array)
return serializeTypedArray(request, "M", value);
if (value instanceof BigUint64Array)
return serializeTypedArray(request, "m", value);
if (value instanceof DataView)
return serializeTypedArray(request, "V", value);
if ("function" === typeof Blob && value instanceof Blob)
return serializeBlob(request, value);
if ((elementReference = getIteratorFn(value)))
return (
(parentPropertyName = elementReference.call(value)),
parentPropertyName === value
? "$i" +
outlineModel(request, Array.from(parentPropertyName)).toString(16)
: renderFragment(request, task, Array.from(parentPropertyName))
);
if ("function" === typeof ReadableStream && value instanceof ReadableStream)
return serializeReadableStream(request, task, value);
elementReference = value[ASYNC_ITERATOR];
if ("function" === typeof elementReference)
return (
null !== task.keyPath
? ((value = [
REACT_ELEMENT_TYPE,
REACT_FRAGMENT_TYPE,
task.keyPath,
{ children: value }
]),
(value = task.implicitSlot ? [value] : value))
: ((parentPropertyName = elementReference.call(value)),
(value = serializeAsyncIterable(
request,
task,
value,
parentPropertyName
))),
value
);
request = getPrototypeOf(value);
if (
request !== ObjectPrototype &&
(null === request || null !== getPrototypeOf(request))
)
throw Error(
"Only plain objects, and a few built-ins, can be passed to Client Components from Server Components. Classes or null prototypes are not supported." +
describeObjectForErrorMessage(parent, parentPropertyName)
);
return value;
}
if ("string" === typeof value) {
task = TaintRegistryValues.get(value);
void 0 !== task && throwTaintViolation(task.message);
if (
"Z" === value[value.length - 1] &&
parent[parentPropertyName] instanceof Date
)
return "$D" + value;
if (1024 <= value.length && null !== byteLengthOfChunk)
return (
request.pendingChunks++,
(task = request.nextChunkId++),
emitTextChunk(request, task, value),
serializeByValueID(task)
);
value = "$" === value[0] ? "$" + value : value;
return value;
}
if ("boolean" === typeof value) return value;
if ("number" === typeof value)
return Number.isFinite(value)
? 0 === value && -Infinity === 1 / value
? "$-0"
: value
: Infinity === value
? "$Infinity"
: -Infinity === value
? "$-Infinity"
: "$NaN";
if ("undefined" === typeof value) return "$undefined";
if ("function" === typeof value) {
if (value.$$typeof === CLIENT_REFERENCE_TAG$1)
return serializeClientReference(
request,
parent,
parentPropertyName,
value
);
if (value.$$typeof === SERVER_REFERENCE_TAG)
return (
(task = request.writtenServerReferences),
(parentPropertyName = task.get(value)),
void 0 !== parentPropertyName
? (value = "$F" + parentPropertyName.toString(16))
: ((parentPropertyName = value.$$bound),
(parentPropertyName = {
id: value.$$id,
bound: parentPropertyName
? Promise.resolve(parentPropertyName)
: null
}),
(request = outlineModel(request, parentPropertyName)),
task.set(value, request),
(value = "$F" + request.toString(16))),
value
);
if (
void 0 !== request.temporaryReferences &&
((request = request.temporaryReferences.get(value)), void 0 !== request)
)
return "$T" + request;
request = TaintRegistryObjects.get(value);
void 0 !== request && throwTaintViolation(request);
if (value.$$typeof === TEMPORARY_REFERENCE_TAG)
throw Error(
"Could not reference an opaque temporary reference. This is likely due to misconfiguring the temporaryReferences options on the server."
);
if (/^on[A-Z]/.test(parentPropertyName))
throw Error(
"Event handlers cannot be passed to Client Component props." +
describeObjectForErrorMessage(parent, parentPropertyName) +
"\nIf you need interactivity, consider converting part of this to a Client Component."
);
throw Error(
'Functions cannot be passed directly to Client Components unless you explicitly expose it by marking it with "use server". Or maybe you meant to call this function rather than return it.' +
describeObjectForErrorMessage(parent, parentPropertyName)
);
}
if ("symbol" === typeof value) {
task = request.writtenSymbols;
elementReference = task.get(value);
if (void 0 !== elementReference)
return serializeByValueID(elementReference);
elementReference = value.description;
if (Symbol.for(elementReference) !== value)
throw Error(
"Only global symbols received from Symbol.for(...) can be passed to Client Components. The symbol Symbol.for(" +
(value.description + ") cannot be found among global symbols.") +
describeObjectForErrorMessage(parent, parentPropertyName)
);
request.pendingChunks++;
parentPropertyName = request.nextChunkId++;
parent = encodeReferenceChunk(
request,
parentPropertyName,
"$S" + elementReference
);
request.completedImportChunks.push(parent);
task.set(value, parentPropertyName);
return serializeByValueID(parentPropertyName);
}
if ("bigint" === typeof value)
return (
(request = TaintRegistryValues.get(value)),
void 0 !== request && throwTaintViolation(request.message),
"$n" + value.toString(10)
);
throw Error(
"Type " +
typeof value +
" is not supported in Client Component props." +
describeObjectForErrorMessage(parent, parentPropertyName)
);
}
function logPostpone(request, reason) {
var prevRequest = currentRequest;
currentRequest = null;
try {
requestStorage.run(void 0, request.onPostpone, reason);
} finally {
currentRequest = prevRequest;
}
}
function logRecoverableError(request, error) {
var prevRequest = currentRequest;
currentRequest = null;
try {
var errorDigest = requestStorage.run(void 0, request.onError, error);
} finally {
currentRequest = prevRequest;
}
if (null != errorDigest && "string" !== typeof errorDigest)
throw Error(
'onError returned something with a type other than "string". onError should return a string and may return null or undefined but must not return anything else. It received something of type "' +
typeof errorDigest +
'" instead'
);
return errorDigest || "";
}
function fatalError(request, error) {
var onFatalError = request.onFatalError;
onFatalError(error);
cleanupTaintQueue(request);
null !== request.destination
? ((request.status = 3), request.destination.destroy(error))
: ((request.status = 2), (request.fatalError = error));
}
function emitPostponeChunk(request, id) {
id = id.toString(16) + ":P\n";
request.completedErrorChunks.push(id);
}
function emitErrorChunk(request, id, digest) {
digest = { digest: digest };
id = id.toString(16) + ":E" + stringify(digest) + "\n";
request.completedErrorChunks.push(id);
}
function emitModelChunk(request, id, json) {
id = id.toString(16) + ":" + json + "\n";
request.completedRegularChunks.push(id);
}
function emitTypedArrayChunk(request, id, tag, typedArray) {
if (TaintRegistryByteLengths.has(typedArray.byteLength)) {
var tainted = TaintRegistryValues.get(
String.fromCharCode.apply(
String,
new Uint8Array(
typedArray.buffer,
typedArray.byteOffset,
typedArray.byteLength
)
)
);
void 0 !== tainted && throwTaintViolation(tainted.message);
}
request.pendingChunks++;
typedArray = new Uint8Array(
typedArray.buffer,
typedArray.byteOffset,
typedArray.byteLength
);
tainted = typedArray.byteLength;
id = id.toString(16) + ":" + tag + tainted.toString(16) + ",";
request.completedRegularChunks.push(id, typedArray);
}
function emitTextChunk(request, id, text) {
if (null === byteLengthOfChunk)
throw Error(
"Existence of byteLengthOfChunk should have already been checked. This is a bug in React."
);
request.pendingChunks++;
var binaryLength = byteLengthOfChunk(text);
id = id.toString(16) + ":T" + binaryLength.toString(16) + ",";
request.completedRegularChunks.push(id, text);
}
function emitChunk(request, task, value) {
var id = task.id;
"string" === typeof value && null !== byteLengthOfChunk
? ((task = TaintRegistryValues.get(value)),
void 0 !== task && throwTaintViolation(task.message),
emitTextChunk(request, id, value))
: value instanceof ArrayBuffer
? emitTypedArrayChunk(request, id, "A", new Uint8Array(value))
: value instanceof Int8Array
? emitTypedArrayChunk(request, id, "O", value)
: value instanceof Uint8Array
? emitTypedArrayChunk(request, id, "o", value)
: value instanceof Uint8ClampedArray
? emitTypedArrayChunk(request, id, "U", value)
: value instanceof Int16Array
? emitTypedArrayChunk(request, id, "S", value)
: value instanceof Uint16Array
? emitTypedArrayChunk(request, id, "s", value)
: value instanceof Int32Array
? emitTypedArrayChunk(request, id, "L", value)
: value instanceof Uint32Array
? emitTypedArrayChunk(request, id, "l", value)
: value instanceof Float32Array
? emitTypedArrayChunk(request, id, "G", value)
: value instanceof Float64Array
? emitTypedArrayChunk(request, id, "g", value)
: value instanceof BigInt64Array
? emitTypedArrayChunk(request, id, "M", value)
: value instanceof BigUint64Array
? emitTypedArrayChunk(request, id, "m", value)
: value instanceof DataView
? emitTypedArrayChunk(request, id, "V", value)
: ((value = stringify(value, task.toJSON)),
emitModelChunk(request, task.id, value));
}
var emptyRoot = {};
function retryTask(request, task) {
if (0 === task.status) {
task.status = 5;
try {
modelRoot = task.model;
var resolvedModel = renderModelDestructive(
request,
task,
emptyRoot,
"",
task.model
);
modelRoot = resolvedModel;
task.keyPath = null;
task.implicitSlot = !1;
if ("object" === typeof resolvedModel && null !== resolvedModel)
request.writtenObjects.set(resolvedModel, serializeByValueID(task.id)),
emitChunk(request, task, resolvedModel);
else {
var json = stringify(resolvedModel);
emitModelChunk(request, task.id, json);
}
request.abortableTasks.delete(task);
task.status = 1;
} catch (thrownValue) {
var x =
thrownValue === SuspenseException
? getSuspendedThenable()
: thrownValue;
if ("object" === typeof x && null !== x) {
if ("function" === typeof x.then) {
if (1 === request.status) {
request.abortableTasks.delete(task);
task.status = 3;
var model = stringify(serializeByValueID(request.fatalError));
emitModelChunk(request, task.id, model);
return;
}
task.status = 0;
task.thenableState = getThenableStateAfterSuspending();
var ping = task.ping;
x.then(ping, ping);
return;
}
if (x.$$typeof === REACT_POSTPONE_TYPE) {
request.abortableTasks.delete(task);
task.status = 4;
logPostpone(request, x.message, task);
emitPostponeChunk(request, task.id);
return;
}
}
if (1 === request.status) {
request.abortableTasks.delete(task);
task.status = 3;
var model$23 = stringify(serializeByValueID(request.fatalError));
emitModelChunk(request, task.id, model$23);
} else {
request.abortableTasks.delete(task);
task.status = 4;
var digest = logRecoverableError(request, x, task);
emitErrorChunk(request, task.id, digest);
}
} finally {
}
}
}
function performWork(request) {
var prevDispatcher = ReactSharedInternalsServer.H;
ReactSharedInternalsServer.H = HooksDispatcher;
var prevRequest = currentRequest;
currentRequest$1 = currentRequest = request;
try {
var pingedTasks = request.pingedTasks;
request.pingedTasks = [];
for (var i = 0; i < pingedTasks.length; i++)
retryTask(request, pingedTasks[i]);
null !== request.destination &&
flushCompletedChunks(request, request.destination);
if (0 === request.abortableTasks.size) {
var onAllReady = request.onAllReady;
onAllReady();
}
} catch (error) {
logRecoverableError(request, error, null), fatalError(request, error);
} finally {
(ReactSharedInternalsServer.H = prevDispatcher),
(currentRequest$1 = null),
(currentRequest = prevRequest);
}
}
function flushCompletedChunks(request, destination) {
currentView = new Uint8Array(2048);
writtenBytes = 0;
destinationHasCapacity = !0;
try {
for (
var importsChunks = request.completedImportChunks, i = 0;
i < importsChunks.length;
i++
)
if (
(request.pendingChunks--,
!writeChunkAndReturn(destination, importsChunks[i]))
) {
request.destination = null;
i++;
break;
}
importsChunks.splice(0, i);
var hintChunks = request.completedHintChunks;
for (i = 0; i < hintChunks.length; i++)
if (!writeChunkAndReturn(destination, hintChunks[i])) {
request.destination = null;
i++;
break;
}
hintChunks.splice(0, i);
var regularChunks = request.completedRegularChunks;
for (i = 0; i < regularChunks.length; i++)
if (
(request.pendingChunks--,
!writeChunkAndReturn(destination, regularChunks[i]))
) {
request.destination = null;
i++;
break;
}
regularChunks.splice(0, i);
var errorChunks = request.completedErrorChunks;
for (i = 0; i < errorChunks.length; i++)
if (
(request.pendingChunks--,
!writeChunkAndReturn(destination, errorChunks[i]))
) {
request.destination = null;
i++;
break;
}
errorChunks.splice(0, i);
} finally {
(request.flushScheduled = !1),
currentView &&
0 < writtenBytes &&
destination.write(currentView.subarray(0, writtenBytes)),
(currentView = null),
(writtenBytes = 0),
(destinationHasCapacity = !0);
}
"function" === typeof destination.flush && destination.flush();
0 === request.pendingChunks &&
(cleanupTaintQueue(request),
(request.status = 3),
destination.end(),
(request.destination = null));
}
function startWork(request) {
request.flushScheduled = null !== request.destination;
setImmediate(function () {
return requestStorage.run(request, performWork, request);
});
}
function enqueueFlush(request) {
!1 === request.flushScheduled &&
0 === request.pingedTasks.length &&
null !== request.destination &&
((request.flushScheduled = !0),
setImmediate(function () {
request.flushScheduled = !1;
var destination = request.destination;
destination && flushCompletedChunks(request, destination);
}));
}
function startFlowing(request, destination) {
if (2 === request.status)
(request.status = 3), destination.destroy(request.fatalError);
else if (3 !== request.status && null === request.destination) {
request.destination = destination;
try {
flushCompletedChunks(request, destination);
} catch (error) {
logRecoverableError(request, error, null), fatalError(request, error);
}
}
}
function abort(request, reason) {
try {
0 === request.status && (request.status = 1);
var abortableTasks = request.abortableTasks;
if (0 < abortableTasks.size) {
request.pendingChunks++;
var errorId = request.nextChunkId++;
request.fatalError = errorId;
if (
"object" === typeof reason &&
null !== reason &&
reason.$$typeof === REACT_POSTPONE_TYPE
)
logPostpone(request, reason.message, null),
emitPostponeChunk(request, errorId, reason);
else {
var error =
void 0 === reason
? Error("The render was aborted by the server without a reason.")
: "object" === typeof reason &&
null !== reason &&
"function" === typeof reason.then
? Error("The render was aborted by the server with a promise.")
: reason,
digest = logRecoverableError(request, error, null);
emitErrorChunk(request, errorId, digest, error);
}
abortableTasks.forEach(function (task) {
if (5 !== task.status) {
task.status = 3;
var ref = serializeByValueID(errorId);
task = encodeReferenceChunk(request, task.id, ref);
request.completedErrorChunks.push(task);
}
});
abortableTasks.clear();
}
var abortListeners = request.abortListeners;
if (0 < abortListeners.size) {
var error$30 =
"object" === typeof reason &&
null !== reason &&
reason.$$typeof === REACT_POSTPONE_TYPE
? Error("The render was aborted due to being postponed.")
: void 0 === reason
? Error("The render was aborted by the server without a reason.")
: "object" === typeof reason &&
null !== reason &&
"function" === typeof reason.then
? Error("The render was aborted by the server with a promise.")
: reason;
abortListeners.forEach(function (callback) {
return callback(error$30);
});
abortListeners.clear();
}
null !== request.destination &&
flushCompletedChunks(request, request.destination);
} catch (error$31) {
logRecoverableError(request, error$31, null), fatalError(request, error$31);
}
}
function resolveServerReference(bundlerConfig, id) {
var name = "",
resolvedModuleData = bundlerConfig[id];
if (resolvedModuleData) name = resolvedModuleData.name;
else {
var idx = id.lastIndexOf("#");
-1 !== idx &&
((name = id.slice(idx + 1)),
(resolvedModuleData = bundlerConfig[id.slice(0, idx)]));
if (!resolvedModuleData)
throw Error(
'Could not find the module "' +
id +
'" in the React Server Manifest. This is probably a bug in the React Server Components bundler.'
);
}
return [resolvedModuleData.id, resolvedModuleData.chunks, name];
}
var chunkCache = new Map();
function requireAsyncModule(id) {
var promise = globalThis.__next_require__(id);
if ("function" !== typeof promise.then || "fulfilled" === promise.status)
return null;
promise.then(
function (value) {
promise.status = "fulfilled";
promise.value = value;
},
function (reason) {
promise.status = "rejected";
promise.reason = reason;
}
);
return promise;
}
function ignoreReject() {}
function preloadModule(metadata) {
for (var chunks = metadata[1], promises = [], i = 0; i < chunks.length; i++) {
var chunkFilename = chunks[i],
entry = chunkCache.get(chunkFilename);
if (void 0 === entry) {
entry = globalThis.__next_chunk_load__(chunkFilename);
promises.push(entry);
var resolve = chunkCache.set.bind(chunkCache, chunkFilename, null);
entry.then(resolve, ignoreReject);
chunkCache.set(chunkFilename, entry);
} else null !== entry && promises.push(entry);
}
return 4 === metadata.length
? 0 === promises.length
? requireAsyncModule(metadata[0])
: Promise.all(promises).then(function () {
return requireAsyncModule(metadata[0]);
})
: 0 < promises.length
? Promise.all(promises)
: null;
}
function requireModule(metadata) {
var moduleExports = globalThis.__next_require__(metadata[0]);
if (4 === metadata.length && "function" === typeof moduleExports.then)
if ("fulfilled" === moduleExports.status)
moduleExports = moduleExports.value;
else throw moduleExports.reason;
return "*" === metadata[2]
? moduleExports
: "" === metadata[2]
? moduleExports.__esModule
? moduleExports.default
: moduleExports
: moduleExports[metadata[2]];
}
var hasOwnProperty = Object.prototype.hasOwnProperty;
function Chunk(status, value, reason, response) {
this.status = status;
this.value = value;
this.reason = reason;
this._response = response;
}
Chunk.prototype = Object.create(Promise.prototype);
Chunk.prototype.then = function (resolve, reject) {
switch (this.status) {
case "resolved_model":
initializeModelChunk(this);
}
switch (this.status) {
case "fulfilled":
resolve(this.value);
break;
case "pending":
case "blocked":
case "cyclic":
resolve &&
(null === this.value && (this.value = []), this.value.push(resolve));
reject &&
(null === this.reason && (this.reason = []), this.reason.push(reject));
break;
default:
reject(this.reason);
}
};
function createPendingChunk(response) {
return new Chunk("pending", null, null, response);
}
function wakeChunk(listeners, value) {
for (var i = 0; i < listeners.length; i++) (0, listeners[i])(value);
}
function triggerErrorOnChunk(chunk, error) {
if ("pending" !== chunk.status && "blocked" !== chunk.status)
chunk.reason.error(error);
else {
var listeners = chunk.reason;
chunk.status = "rejected";
chunk.reason = error;
null !== listeners && wakeChunk(listeners, error);
}
}
function resolveModelChunk(chunk, value, id) {
if ("pending" !== chunk.status)
(chunk = chunk.reason),
"C" === value[0]
? chunk.close("C" === value ? '"$undefined"' : value.slice(1))
: chunk.enqueueModel(value);
else {
var resolveListeners = chunk.value,
rejectListeners = chunk.reason;
chunk.status = "resolved_model";
chunk.value = value;
chunk.reason = id;
if (null !== resolveListeners)
switch ((initializeModelChunk(chunk), chunk.status)) {
case "fulfilled":
wakeChunk(resolveListeners, chunk.value);
break;
case "pending":
case "blocked":
case "cyclic":
if (chunk.value)
for (value = 0; value < resolveListeners.length; value++)
chunk.value.push(resolveListeners[value]);
else chunk.value = resolveListeners;
if (chunk.reason) {
if (rejectListeners)
for (value = 0; value < rejectListeners.length; value++)
chunk.reason.push(rejectListeners[value]);
} else chunk.reason = rejectListeners;
break;
case "rejected":
rejectListeners && wakeChunk(rejectListeners, chunk.reason);
}
}
}
function createResolvedIteratorResultChunk(response, value, done) {
return new Chunk(
"resolved_model",
(done ? '{"done":true,"value":' : '{"done":false,"value":') + value + "}",
-1,
response
);
}
function resolveIteratorResultChunk(chunk, value, done) {
resolveModelChunk(
chunk,
(done ? '{"done":true,"value":' : '{"done":false,"value":') + value + "}",
-1
);
}
function loadServerReference$1(
response,
id,
bound,
parentChunk,
parentObject,
key
) {
var serverReference = resolveServerReference(response._bundlerConfig, id);
id = preloadModule(serverReference);
if (bound)
bound = Promise.all([bound, id]).then(function (_ref) {
_ref = _ref[0];
var fn = requireModule(serverReference);
return fn.bind.apply(fn, [null].concat(_ref));
});
else if (id)
bound = Promise.resolve(id).then(function () {
return requireModule(serverReference);
});
else return requireModule(serverReference);
bound.then(
createModelResolver(
parentChunk,
parentObject,
key,
!1,
response,
createModel,
[]
),
createModelReject(parentChunk)
);
return null;
}
function reviveModel(response, parentObj, parentKey, value, reference) {
if ("string" === typeof value)
return parseModelString(response, parentObj, parentKey, value, reference);
if ("object" === typeof value && null !== value)
if (
(void 0 !== reference &&
void 0 !== response._temporaryReferences &&
response._temporaryReferences.set(value, reference),
Array.isArray(value))
)
for (var i = 0; i < value.length; i++)
value[i] = reviveModel(
response,
value,
"" + i,
value[i],
void 0 !== reference ? reference + ":" + i : void 0
);
else
for (i in value)
hasOwnProperty.call(value, i) &&
((parentObj =
void 0 !== reference && -1 === i.indexOf(":")
? reference + ":" + i
: void 0),
(parentObj = reviveModel(response, value, i, value[i], parentObj)),
void 0 !== parentObj ? (value[i] = parentObj) : delete value[i]);
return value;
}
var initializingChunk = null,
initializingChunkBlockedModel = null;
function initializeModelChunk(chunk) {
var prevChunk = initializingChunk,
prevBlocked = initializingChunkBlockedModel;
initializingChunk = chunk;
initializingChunkBlockedModel = null;
var rootReference = -1 === chunk.reason ? void 0 : chunk.reason.toString(16),
resolvedModel = chunk.value;
chunk.status = "cyclic";
chunk.value = null;
chunk.reason = null;
try {
var rawModel = JSON.parse(resolvedModel),
value = reviveModel(
chunk._response,
{ "": rawModel },
"",
rawModel,
rootReference
);
if (
null !== initializingChunkBlockedModel &&
0 < initializingChunkBlockedModel.deps
)
(initializingChunkBlockedModel.value = value), (chunk.status = "blocked");
else {
var resolveListeners = chunk.value;
chunk.status = "fulfilled";
chunk.value = value;
null !== resolveListeners && wakeChunk(resolveListeners, value);
}
} catch (error) {
(chunk.status = "rejected"), (chunk.reason = error);
} finally {
(initializingChunk = prevChunk),
(initializingChunkBlockedModel = prevBlocked);
}
}
function reportGlobalError(response, error) {
response._chunks.forEach(function (chunk) {
"pending" === chunk.status && triggerErrorOnChunk(chunk, error);
});
}
function getChunk(response, id) {
var chunks = response._chunks,
chunk = chunks.get(id);
chunk ||
((chunk = response._formData.get(response._prefix + id)),
(chunk =
null != chunk
? new Chunk("resolved_model", chunk, id, response)
: createPendingChunk(response)),
chunks.set(id, chunk));
return chunk;
}
function createModelResolver(
chunk,
parentObject,
key,
cyclic,
response,
map,
path
) {
if (initializingChunkBlockedModel) {
var blocked = initializingChunkBlockedModel;
cyclic || blocked.deps++;
} else
blocked = initializingChunkBlockedModel = {
deps: cyclic ? 0 : 1,
value: null
};
return function (value) {
for (var i = 1; i < path.length; i++) value = value[path[i]];
parentObject[key] = map(response, value);
"" === key && null === blocked.value && (blocked.value = parentObject[key]);
blocked.deps--;
0 === blocked.deps &&
"blocked" === chunk.status &&
((value = chunk.value),
(chunk.status = "fulfilled"),
(chunk.value = blocked.value),
null !== value && wakeChunk(value, blocked.value));
};
}
function createModelReject(chunk) {
return function (error) {
return triggerErrorOnChunk(chunk, error);
};
}
function getOutlinedModel(response, reference, parentObject, key, map) {
reference = reference.split(":");
var id = parseInt(reference[0], 16);
id = getChunk(response, id);
switch (id.status) {
case "resolved_model":
initializeModelChunk(id);
}
switch (id.status) {
case "fulfilled":
parentObject = id.value;
for (key = 1; key < reference.length; key++)
parentObject = parentObject[reference[key]];
return map(response, parentObject);
case "pending":
case "blocked":
case "cyclic":
var parentChunk = initializingChunk;
id.then(
createModelResolver(
parentChunk,
parentObject,
key,
"cyclic" === id.status,
response,
map,
reference
),
createModelReject(parentChunk)
);
return null;
default:
throw id.reason;
}
}
function createMap(response, model) {
return new Map(model);
}
function createSet(response, model) {
return new Set(model);
}
function extractIterator(response, model) {
return model[Symbol.iterator]();
}
function createModel(response, model) {
return model;
}
function parseTypedArray(
response,
reference,
constructor,
bytesPerElement,
parentObject,
parentKey
) {
reference = parseInt(reference.slice(2), 16);
reference = response._formData.get(response._prefix + reference);
reference =
constructor === ArrayBuffer
? reference.arrayBuffer()
: reference.arrayBuffer().then(function (buffer) {
return new constructor(buffer);
});
bytesPerElement = initializingChunk;
reference.then(
createModelResolver(
bytesPerElement,
parentObject,
parentKey,
!1,
response,
createModel,
[]
),
createModelReject(bytesPerElement)
);
return null;
}
function resolveStream(response, id, stream, controller) {
var chunks = response._chunks;
stream = new Chunk("fulfilled", stream, controller, response);
chunks.set(id, stream);
response = response._formData.getAll(response._prefix + id);
for (id = 0; id < response.length; id++)
(chunks = response[id]),
"C" === chunks[0]
? controller.close("C" === chunks ? '"$undefined"' : chunks.slice(1))
: controller.enqueueModel(chunks);
}
function parseReadableStream(response, reference, type) {
reference = parseInt(reference.slice(2), 16);
var controller = null;
type = new ReadableStream({
type: type,
start: function (c) {
controller = c;
}
});
var previousBlockedChunk = null;
resolveStream(response, reference, type, {
enqueueModel: function (json) {
if (null === previousBlockedChunk) {
var chunk = new Chunk("resolved_model", json, -1, response);
initializeModelChunk(chunk);
"fulfilled" === chunk.status
? controller.enqueue(chunk.value)
: (chunk.then(
function (v) {
return controller.enqueue(v);
},
function (e) {
return controller.error(e);
}
),
(previousBlockedChunk = chunk));
} else {
chunk = previousBlockedChunk;
var chunk$34 = createPendingChunk(response);
chunk$34.then(
function (v) {
return controller.enqueue(v);
},
function (e) {
return controller.error(e);
}
);
previousBlockedChunk = chunk$34;
chunk.then(function () {
previousBlockedChunk === chunk$34 && (previousBlockedChunk = null);
resolveModelChunk(chunk$34, json, -1);
});
}
},
close: function () {
if (null === previousBlockedChunk) controller.close();
else {
var blockedChunk = previousBlockedChunk;
previousBlockedChunk = null;
blockedChunk.then(function () {
return controller.close();
});
}
},
error: function (error) {
if (null === previousBlockedChunk) controller.error(error);
else {
var blockedChunk = previousBlockedChunk;
previousBlockedChunk = null;
blockedChunk.then(function () {
return controller.error(error);
});
}
}
});
return type;
}
function asyncIterator() {
return this;
}
function createIterator(next) {
next = { next: next };
next[ASYNC_ITERATOR] = asyncIterator;
return next;
}
function parseAsyncIterable(response, reference, iterator) {
reference = parseInt(reference.slice(2), 16);
var buffer = [],
closed = !1,
nextWriteIndex = 0,
$jscomp$compprop2 = {};
$jscomp$compprop2 =
(($jscomp$compprop2[ASYNC_ITERATOR] = function () {
var nextReadIndex = 0;
return createIterator(function (arg) {
if (void 0 !== arg)
throw Error(
"Values cannot be passed to next() of AsyncIterables passed to Client Components."
);
if (nextReadIndex === buffer.length) {
if (closed)
return new Chunk(
"fulfilled",
{ done: !0, value: void 0 },
null,
response
);
buffer[nextReadIndex] = createPendingChunk(response);
}
return buffer[nextReadIndex++];
});
}),
$jscomp$compprop2);
iterator = iterator ? $jscomp$compprop2[ASYNC_ITERATOR]() : $jscomp$compprop2;
resolveStream(response, reference, iterator, {
enqueueModel: function (value) {
nextWriteIndex === buffer.length
? (buffer[nextWriteIndex] = createResolvedIteratorResultChunk(
response,
value,
!1
))
: resolveIteratorResultChunk(buffer[nextWriteIndex], value, !1);
nextWriteIndex++;
},
close: function (value) {
closed = !0;
nextWriteIndex === buffer.length
? (buffer[nextWriteIndex] = createResolvedIteratorResultChunk(
response,
value,
!0
))
: resolveIteratorResultChunk(buffer[nextWriteIndex], value, !0);
for (nextWriteIndex++; nextWriteIndex < buffer.length; )
resolveIteratorResultChunk(
buffer[nextWriteIndex++],
'"$undefined"',
!0
);
},
error: function (error) {
closed = !0;
for (
nextWriteIndex === buffer.length &&
(buffer[nextWriteIndex] = createPendingChunk(response));
nextWriteIndex < buffer.length;
)
triggerErrorOnChunk(buffer[nextWriteIndex++], error);
}
});
return iterator;
}
function parseModelString(response, obj, key, value, reference) {
if ("$" === value[0]) {
switch (value[1]) {
case "$":
return value.slice(1);
case "@":
return (obj = parseInt(value.slice(2), 16)), getChunk(response, obj);
case "F":
return (
(value = value.slice(2)),
(value = getOutlinedModel(response, value, obj, key, createModel)),
loadServerReference$1(
response,
value.id,
value.bound,
initializingChunk,
obj,
key
)
);
case "T":
if (void 0 === reference || void 0 === response._temporaryReferences)
throw Error(
"Could not reference an opaque temporary reference. This is likely due to misconfiguring the temporaryReferences options on the server."
);
return createTemporaryReference(
response._temporaryReferences,
reference
);
case "Q":
return (
(value = value.slice(2)),
getOutlinedModel(response, value, obj, key, createMap)
);
case "W":
return (
(value = value.slice(2)),
getOutlinedModel(response, value, obj, key, createSet)
);
case "K":
obj = value.slice(2);
var formPrefix = response._prefix + obj + "_",
data = new FormData();
response._formData.forEach(function (entry, entryKey) {
entryKey.startsWith(formPrefix) &&
data.append(entryKey.slice(formPrefix.length), entry);
});
return data;
case "i":
return (
(value = value.slice(2)),
getOutlinedModel(response, value, obj, key, extractIterator)
);
case "I":
return Infinity;
case "-":
return "$-0" === value ? -0 : -Infinity;
case "N":
return NaN;
case "u":
return;
case "D":
return new Date(Date.parse(value.slice(2)));
case "n":
return BigInt(value.slice(2));
}
switch (value[1]) {
case "A":
return parseTypedArray(response, value, ArrayBuffer, 1, obj, key);
case "O":
return parseTypedArray(response, value, Int8Array, 1, obj, key);
case "o":
return parseTypedArray(response, value, Uint8Array, 1, obj, key);
case "U":
return parseTypedArray(response, value, Uint8ClampedArray, 1, obj, key);
case "S":
return parseTypedArray(response, value, Int16Array, 2, obj, key);
case "s":
return parseTypedArray(response, value, Uint16Array, 2, obj, key);
case "L":
return parseTypedArray(response, value, Int32Array, 4, obj, key);
case "l":
return parseTypedArray(response, value, Uint32Array, 4, obj, key);
case "G":
return parseTypedArray(response, value, Float32Array, 4, obj, key);
case "g":
return parseTypedArray(response, value, Float64Array, 8, obj, key);
case "M":
return parseTypedArray(response, value, BigInt64Array, 8, obj, key);
case "m":
return parseTypedArray(response, value, BigUint64Array, 8, obj, key);
case "V":
return parseTypedArray(response, value, DataView, 1, obj, key);
case "B":
return (
(obj = parseInt(value.slice(2), 16)),
response._formData.get(response._prefix + obj)
);
}
switch (value[1]) {
case "R":
return parseReadableStream(response, value, void 0);
case "r":
return parseReadableStream(response, value, "bytes");
case "X":
return parseAsyncIterable(response, value, !1);
case "x":
return parseAsyncIterable(response, value, !0);
}
value = value.slice(1);
return getOutlinedModel(response, value, obj, key, createModel);
}
return value;
}
function createResponse(bundlerConfig, formFieldPrefix, temporaryReferences) {
var backingFormData =
3 < arguments.length && void 0 !== arguments[3]
? arguments[3]
: new FormData(),
chunks = new Map();
return {
_bundlerConfig: bundlerConfig,
_prefix: formFieldPrefix,
_formData: backingFormData,
_chunks: chunks,
_temporaryReferences: temporaryReferences
};
}
function resolveField(response, key, value) {
response._formData.append(key, value);
var prefix = response._prefix;
key.startsWith(prefix) &&
((response = response._chunks),
(key = +key.slice(prefix.length)),
(prefix = response.get(key)) && resolveModelChunk(prefix, value, key));
}
function close(response) {
reportGlobalError(response, Error("Connection closed."));
}
function loadServerReference(bundlerConfig, id, bound) {
var serverReference = resolveServerReference(bundlerConfig, id);
bundlerConfig = preloadModule(serverReference);
return bound
? Promise.all([bound, bundlerConfig]).then(function (_ref) {
_ref = _ref[0];
var fn = requireModule(serverReference);
return fn.bind.apply(fn, [null].concat(_ref));
})
: bundlerConfig
? Promise.resolve(bundlerConfig).then(function () {
return requireModule(serverReference);
})
: Promise.resolve(requireModule(serverReference));
}
function decodeBoundActionMetaData(body, serverManifest, formFieldPrefix) {
body = createResponse(serverManifest, formFieldPrefix, void 0, body);
close(body);
body = getChunk(body, 0);
body.then(function () {});
if ("fulfilled" !== body.status) throw body.reason;
return body.value;
}
function createDrainHandler(destination, request) {
return function () {
return startFlowing(request, destination);
};
}
function createCancelHandler(request, reason) {
return function () {
request.destination = null;
abort(request, Error(reason));
};
}
function createFakeWritable(readable) {
return {
write: function (chunk) {
return readable.push(chunk);
},
end: function () {
readable.push(null);
},
destroy: function (error) {
readable.destroy(error);
}
};
}
exports.createClientModuleProxy = function (moduleId) {
moduleId = registerClientReferenceImpl({}, moduleId, !1);
return new Proxy(moduleId, proxyHandlers$1);
};
exports.createTemporaryReferenceSet = function () {
return new WeakMap();
};
exports.decodeAction = function (body, serverManifest) {
var formData = new FormData(),
action = null;
body.forEach(function (value, key) {
key.startsWith("$ACTION_")
? key.startsWith("$ACTION_REF_")
? ((value = "$ACTION_" + key.slice(12) + ":"),
(value = decodeBoundActionMetaData(body, serverManifest, value)),
(action = loadServerReference(serverManifest, value.id, value.bound)))
: key.startsWith("$ACTION_ID_") &&
((value = key.slice(11)),
(action = loadServerReference(serverManifest, value, null)))
: formData.append(key, value);
});
return null === action
? null
: action.then(function (fn) {
return fn.bind(null, formData);
});
};
exports.decodeFormState = function (actionResult, body, serverManifest) {
var keyPath = body.get("$ACTION_KEY");
if ("string" !== typeof keyPath) return Promise.resolve(null);
var metaData = null;
body.forEach(function (value, key) {
key.startsWith("$ACTION_REF_") &&
((value = "$ACTION_" + key.slice(12) + ":"),
(metaData = decodeBoundActionMetaData(body, serverManifest, value)));
});
if (null === metaData) return Promise.resolve(null);
var referenceId = metaData.id;
return Promise.resolve(metaData.bound).then(function (bound) {
return null === bound
? null
: [actionResult, keyPath, referenceId, bound.length - 1];
});
};
exports.decodeReply = function (body, turbopackMap, options) {
if ("string" === typeof body) {
var form = new FormData();
form.append("0", body);
body = form;
}
body = createResponse(
turbopackMap,
"",
options ? options.temporaryReferences : void 0,
body
);
turbopackMap = getChunk(body, 0);
close(body);
return turbopackMap;
};
exports.decodeReplyFromBusboy = function (busboyStream, turbopackMap, options) {
var response = createResponse(
turbopackMap,
"",
options ? options.temporaryReferences : void 0
),
pendingFiles = 0,
queuedFields = [];
busboyStream.on("field", function (name, value) {
0 < pendingFiles
? queuedFields.push(name, value)
: resolveField(response, name, value);
});
busboyStream.on("file", function (name, value, _ref) {
var filename = _ref.filename,
mimeType = _ref.mimeType;
if ("base64" === _ref.encoding.toLowerCase())
throw Error(
"React doesn't accept base64 encoded file uploads because we don't expect form data passed from a browser to ever encode data that way. If that's the wrong assumption, we can easily fix it."
);
pendingFiles++;
var JSCompiler_object_inline_chunks_228 = [];
value.on("data", function (chunk) {
JSCompiler_object_inline_chunks_228.push(chunk);
});
value.on("end", function () {
var blob = new Blob(JSCompiler_object_inline_chunks_228, {
type: mimeType
});
response._formData.append(name, blob, filename);
pendingFiles--;
if (0 === pendingFiles) {
for (blob = 0; blob < queuedFields.length; blob += 2)
resolveField(response, queuedFields[blob], queuedFields[blob + 1]);
queuedFields.length = 0;
}
});
});
busboyStream.on("finish", function () {
close(response);
});
busboyStream.on("error", function (err) {
reportGlobalError(response, err);
});
return getChunk(response, 0);
};
exports.prerenderToNodeStream = function (model, turbopackMap, options) {
return new Promise(function (resolve, reject) {
var request = new RequestInstance(
model,
turbopackMap,
options ? options.onError : void 0,
options ? options.identifierPrefix : void 0,
options ? options.onPostpone : void 0,
options ? options.temporaryReferences : void 0,
void 0,
void 0,
function () {
var readable = new stream.Readable({
read: function () {
startFlowing(request, writable);
}
}),
writable = createFakeWritable(readable);
resolve({ prelude: readable });
},
reject
);
if (options && options.signal) {
var signal = options.signal;
if (signal.aborted) abort(request, signal.reason);
else {
var listener = function () {
abort(request, signal.reason);
signal.removeEventListener("abort", listener);
};
signal.addEventListener("abort", listener);
}
}
startWork(request);
});
};
exports.registerClientReference = function (
proxyImplementation,
id,
exportName
) {
return registerClientReferenceImpl(
proxyImplementation,
id + "#" + exportName,
!1
);
};
exports.registerServerReference = function (reference, id, exportName) {
return Object.defineProperties(reference, {
$$typeof: { value: SERVER_REFERENCE_TAG },
$$id: {
value: null === exportName ? id : id + "#" + exportName,
configurable: !0
},
$$bound: { value: null, configurable: !0 },
bind: { value: bind, configurable: !0 }
});
};
exports.renderToPipeableStream = function (model, turbopackMap, options) {
var request = new RequestInstance(
model,
turbopackMap,
options ? options.onError : void 0,
options ? options.identifierPrefix : void 0,
options ? options.onPostpone : void 0,
options ? options.temporaryReferences : void 0,
void 0,
void 0,
void 0,
void 0
),
hasStartedFlowing = !1;
startWork(request);
return {
pipe: function (destination) {
if (hasStartedFlowing)
throw Error(
"React currently only supports piping to one writable stream."
);
hasStartedFlowing = !0;
startFlowing(request, destination);
destination.on("drain", createDrainHandler(destination, request));
destination.on(
"error",
createCancelHandler(
request,
"The destination stream errored while writing data."
)
);
destination.on(
"close",
createCancelHandler(request, "The destination stream closed early.")
);
return destination;
},
abort: function (reason) {
abort(request, reason);
}
};
};
```
|
```rust
use std::fmt;
use crate::{
ast::Field,
parser::Spanning,
validation::{RuleError, ValidatorContext, Visitor},
value::ScalarValue,
};
pub struct ScalarLeafs;
pub fn factory() -> ScalarLeafs {
ScalarLeafs
}
impl<'a, S> Visitor<'a, S> for ScalarLeafs
where
S: ScalarValue,
{
fn enter_field(&mut self, ctx: &mut ValidatorContext<'a, S>, field: &'a Spanning<Field<S>>) {
let field_name = &field.item.name.item;
let error = if let (Some(field_type), Some(field_type_literal)) =
(ctx.current_type(), ctx.current_type_literal())
{
match (field_type.is_leaf(), &field.item.selection_set) {
(true, &Some(_)) => Some(RuleError::new(
&no_allowed_error_message(field_name, field_type_literal),
&[field.span.start],
)),
(false, &None) => Some(RuleError::new(
&required_error_message(field_name, field_type_literal),
&[field.span.start],
)),
_ => None,
}
} else {
None
};
if let Some(error) = error {
ctx.append_errors(vec![error]);
}
}
}
fn no_allowed_error_message(field_name: impl fmt::Display, type_name: impl fmt::Display) -> String {
format!(
r#"Field "{field_name}" must not have a selection since type {type_name} has no subfields"#,
)
}
fn required_error_message(field_name: impl fmt::Display, type_name: impl fmt::Display) -> String {
format!(
r#"Field "{field_name}" of type "{type_name}" must have a selection of subfields. Did you mean "{field_name} {{ ... }}"?"#,
)
}
#[cfg(test)]
mod tests {
use super::{factory, no_allowed_error_message, required_error_message};
use crate::{
parser::SourcePosition,
validation::{expect_fails_rule, expect_passes_rule, RuleError},
value::DefaultScalarValue,
};
#[test]
fn valid_scalar_selection() {
expect_passes_rule::<_, _, DefaultScalarValue>(
factory,
r#"
fragment scalarSelection on Dog {
barks
}
"#,
);
}
#[test]
fn object_type_missing_selection() {
expect_fails_rule::<_, _, DefaultScalarValue>(
factory,
r#"
query directQueryOnObjectWithoutSubFields {
human
}
"#,
&[RuleError::new(
&required_error_message("human", "Human"),
&[SourcePosition::new(67, 2, 12)],
)],
);
}
#[test]
fn interface_type_missing_selection() {
expect_fails_rule::<_, _, DefaultScalarValue>(
factory,
r#"
{
human { pets }
}
"#,
&[RuleError::new(
&required_error_message("pets", "[Pet]"),
&[SourcePosition::new(33, 2, 20)],
)],
);
}
#[test]
fn valid_scalar_selection_with_args() {
expect_passes_rule::<_, _, DefaultScalarValue>(
factory,
r#"
fragment scalarSelectionWithArgs on Dog {
doesKnowCommand(dogCommand: SIT)
}
"#,
);
}
#[test]
fn scalar_selection_not_allowed_on_boolean() {
expect_fails_rule::<_, _, DefaultScalarValue>(
factory,
r#"
fragment scalarSelectionsNotAllowedOnBoolean on Dog {
barks { sinceWhen }
}
"#,
&[RuleError::new(
&no_allowed_error_message("barks", "Boolean"),
&[SourcePosition::new(77, 2, 12)],
)],
);
}
#[test]
fn scalar_selection_not_allowed_on_enum() {
expect_fails_rule::<_, _, DefaultScalarValue>(
factory,
r#"
fragment scalarSelectionsNotAllowedOnEnum on Cat {
furColor { inHexdec }
}
"#,
&[RuleError::new(
&no_allowed_error_message("furColor", "FurColor"),
&[SourcePosition::new(74, 2, 12)],
)],
);
}
#[test]
fn scalar_selection_not_allowed_with_args() {
expect_fails_rule::<_, _, DefaultScalarValue>(
factory,
r#"
fragment scalarSelectionsNotAllowedWithArgs on Dog {
doesKnowCommand(dogCommand: SIT) { sinceWhen }
}
"#,
&[RuleError::new(
&no_allowed_error_message("doesKnowCommand", "Boolean"),
&[SourcePosition::new(76, 2, 12)],
)],
);
}
#[test]
fn scalar_selection_not_allowed_with_directives() {
expect_fails_rule::<_, _, DefaultScalarValue>(
factory,
r#"
fragment scalarSelectionsNotAllowedWithDirectives on Dog {
name @include(if: true) { isAlsoHumanName }
}
"#,
&[RuleError::new(
&no_allowed_error_message("name", "String"),
&[SourcePosition::new(82, 2, 12)],
)],
);
}
#[test]
fn scalar_selection_not_allowed_with_directives_and_args() {
expect_fails_rule::<_, _, DefaultScalarValue>(
factory,
r#"
fragment scalarSelectionsNotAllowedWithDirectivesAndArgs on Dog {
doesKnowCommand(dogCommand: SIT) @include(if: true) { sinceWhen }
}
"#,
&[RuleError::new(
&no_allowed_error_message("doesKnowCommand", "Boolean"),
&[SourcePosition::new(89, 2, 12)],
)],
);
}
}
```
|
```javascript
Use hosted scripts to increase performance
Interaction with the user
Handling click events
Warn user if **Back** button is pressed
Battery API
```
|
Caroline Ann Brothers is an Australian-born novelist, nonfiction writer, and former foreign correspondent.
Early life and education
Brothers was born in Hobart, Australia, and grew up in Melbourne. She studied history at the University of Melbourne and later earned a Ph.D. at University College London, where she wrote her thesis on press photography in the Spanish Civil War. In 1997, she published a book based on her doctoral studies, War and photography : a cultural history.
Career
After Brothers completed her doctorate she joined Reuters news agency where she was trained as a foreign correspondent and went on to report from locations across Latin America and Europe including Amsterdam, Belfast, Brussels, London, Mexico City and Paris. Her work as a journalist has been published in the International Herald Tribune, The New York Times, Granta, The Sunday Times Magazine, The Guardian, the British Journal of Photography and Meanjin and elsewhere.
Working as a journalist in France, Brothers met Afghan refugees and her account of their life in temporary camps was published by The New York Times. Wanting to write more about this subject, Brothers went on to write her first novel, inspired by some of the stories she heard while interviewing Afghan refugees around Europe. Published in 2012, her first novel is called, Hinterland and tells the story of two young Afghan brothers as they cross Europe trying to reach England. The Irish Times book review said that "There is poetry on every page, as well as pity, and the poetry is not always in the pity but in the joy of being alive on this earth". Hinterland has since its publication been adapted as the theatrical installation Flight, produced by the Glasgow-based theatre company Vox Motus at the Edinburgh International Festival and on locations in Ireland, the UAE and New York.
In 2016 Brothers published her second novel, The Memory Stones, which tells the story of a family in Buenos Aires in 1976 during Argentina's Dirty War. Again inspired by real events at the time, Brothers tells the story of a family's search for their daughter and unknown grandchild, representing the real life cases of some 500 illegally adopted babies born to some of the tens of thousands of people who became known as the "disappeared" during Argentina's last military dictatorship. Jennifer Showell-Hartogs, reviewing it for the Washington Independent Review of Books, wrote of the author's "beautiful yet heartbreaking prose.... Even Brothers’ imagery is dark and haunting... Yet within that darkness there is the beauty that can only be found in love and hope".
Brothers has been a Royal Literary Fund Fellow at the University of Westminster
and at the V&A Museum and the Science Museum Group, and in 2022, she was one of the judges for the Society of Authors' inaugural Gordon Bowker Volcano Prize.
Selected publications
References
External links
Year of birth missing (living people)
Living people
University of Melbourne alumni
Alumni of University College London
Writers from Hobart
Australian foreign correspondents
Reuters people
Australian novelists
Australian women novelists
21st-century novelists
|
```c++
//
//
// path_to_url
//
#include "pxr/pxr.h"
#include "pxr/usd/usdGeom/bboxCache.h"
#include "pxr/usd/kind/registry.h"
#include "pxr/usd/usdGeom/boundable.h"
#include "pxr/usd/usdGeom/debugCodes.h"
#include "pxr/usd/usdGeom/modelAPI.h"
#include "pxr/usd/usdGeom/pointBased.h"
#include "pxr/usd/usdGeom/xform.h"
#include "pxr/usd/usd/modelAPI.h"
#include "pxr/usd/usd/primRange.h"
#include "pxr/base/trace/trace.h"
#include "pxr/base/work/withScopedParallelism.h"
#include "pxr/base/tf/hash.h"
#include "pxr/base/tf/pyLock.h"
#include "pxr/base/tf/stringUtils.h"
#include "pxr/base/tf/token.h"
#include <tbb/enumerable_thread_specific.h>
#include <algorithm>
#include <atomic>
PXR_NAMESPACE_OPEN_SCOPE
namespace {
// For code that knows at compile time whether we need to apply a transform.
// Such code is told through a template parameter TransformType whether to
// apply a transform (TransformType = GfMatrix4d) or not (TransformType =
// _IdentityTransform).
class _IdentityTransform
{
};
// Overloads to transform GfBBox3d.
inline void
_Transform(GfBBox3d * const bbox, const _IdentityTransform &m)
{
}
inline void
_Transform(GfBBox3d * const bbox, const GfMatrix4d &m)
{
bbox->Transform(m);
}
}
// Thread-local Xform cache.
// This should be replaced with (TBD) multi-threaded XformCache::Prepopulate
typedef tbb::enumerable_thread_specific<UsdGeomXformCache> _ThreadXformCache;
// your_sha256_hash---------- //
// _BBoxTask
// your_sha256_hash---------- //
class UsdGeomBBoxCache::_BBoxTask {
UsdGeomBBoxCache::_PrimContext _primContext;
GfMatrix4d _inverseComponentCtm;
UsdGeomBBoxCache* _owner;
_ThreadXformCache* _xfCaches;
public:
_BBoxTask() : _owner(nullptr), _xfCaches(nullptr) {}
_BBoxTask(const _PrimContext& primContext,
const GfMatrix4d &inverseComponentCtm,
UsdGeomBBoxCache* owner, _ThreadXformCache* xfCaches)
: _primContext(primContext)
, _inverseComponentCtm(inverseComponentCtm)
, _owner(owner)
, _xfCaches(xfCaches)
{
}
explicit operator bool() const {
return _owner;
}
void operator()() const {
// Do not save state here; all state should be accumulated externally.
_owner->_ResolvePrim(const_cast<_BBoxTask const *>(this), _primContext, _inverseComponentCtm);
}
_ThreadXformCache* GetXformCaches() const { return _xfCaches; }
};
// your_sha256_hash---------- //
// _PrototypeBBoxResolver
//
// If a prototype prim has instances nested within it, resolving its bbox
// will depend on the prototypes for those instances being resolved first.
// These dependencies form an acyclic graph where a given prototype may depend
// on and be a dependency for one or more prototypes.
//
// This helper object tracks those dependencies as tasks are dispatched
// and completed.
// your_sha256_hash---------- //
class UsdGeomBBoxCache::_PrototypeBBoxResolver
{
private:
UsdGeomBBoxCache* _owner;
struct _PrototypeTask
{
_PrototypeTask()
: numDependencies(0) { }
_PrototypeTask(const _PrototypeTask &other)
: dependentPrototypes(other.dependentPrototypes)
{
numDependencies.store(other.numDependencies.load());
}
_PrototypeTask(_PrototypeTask &&other)
: dependentPrototypes(std::move(other.dependentPrototypes))
{
numDependencies.store(other.numDependencies.load());
}
// Number of dependencies -- prototype prims that must be resolved
// before this prototype can be resolved.
std::atomic<size_t> numDependencies;
// List of prototype prims that depend on this prototype.
std::vector<_PrimContext> dependentPrototypes;
};
typedef TfHashMap<_PrimContext, _PrototypeTask, _PrimContextHash>
_PrototypeTaskMap;
public:
_PrototypeBBoxResolver(UsdGeomBBoxCache* bboxCache)
: _owner(bboxCache)
{
}
void Resolve(const std::vector<_PrimContext> &prototypePrimContexts)
{
TRACE_FUNCTION();
_PrototypeTaskMap prototypeTasks;
for (const auto& prototypePrim : prototypePrimContexts) {
_PopulateTasksForPrototype(prototypePrim, &prototypeTasks);
}
// Using the owner's xform cache won't provide a benefit
// because the prototypes are separate parts of the scenegraph
// that won't be traversed when resolving other bounding boxes.
_ThreadXformCache xfCache;
for (const auto& t : prototypeTasks) {
if (t.second.numDependencies == 0) {
_owner->_dispatcher.Run(
&_PrototypeBBoxResolver::_ExecuteTaskForPrototype,
this, t.first, &prototypeTasks, &xfCache,
&_owner->_dispatcher);
}
}
_owner->_dispatcher.Wait();
}
private:
void _PopulateTasksForPrototype(const _PrimContext& prototypePrim,
_PrototypeTaskMap* prototypeTasks)
{
std::pair<_PrototypeTaskMap::iterator, bool> prototypeTaskStatus =
prototypeTasks->insert(std::make_pair(
prototypePrim, _PrototypeTask()));
if (!prototypeTaskStatus.second) {
return;
}
std::vector<_PrimContext> requiredPrototypes;
_owner->_FindOrCreateEntriesForPrim(prototypePrim, &requiredPrototypes);
{
// In order to resolve the bounding box for prototypePrim, we need
// to compute the bounding boxes for all prototypes for nested
// instances.
_PrototypeTask& prototypeTaskData =
prototypeTaskStatus.first->second;
prototypeTaskData.numDependencies = requiredPrototypes.size();
}
// Recursively populate the task map for the prototypes needed for
// nested instances.
for (const auto& reqPrototype : requiredPrototypes) {
_PopulateTasksForPrototype(reqPrototype, prototypeTasks);
(*prototypeTasks)[reqPrototype].dependentPrototypes.push_back(
prototypePrim);
}
}
void _ExecuteTaskForPrototype(const _PrimContext& prototype,
_PrototypeTaskMap* prototypeTasks,
_ThreadXformCache* xfCaches,
WorkDispatcher* dispatcher)
{
UsdGeomBBoxCache::_BBoxTask(
prototype, GfMatrix4d(1.0), _owner, xfCaches)();
// Update all of the prototype prims that depended on the completed
// prototype and dispatch new tasks for those whose dependencies have
// been resolved. We're guaranteed that all the entries were populated
// by _PopulateTasksForPrototype, so we don't check the result of
// 'find()'.
const _PrototypeTask& prototypeData =
prototypeTasks->find(prototype)->second;
for (const auto& dependentPrototype :
prototypeData.dependentPrototypes) {
_PrototypeTask& dependentPrototypeData =
prototypeTasks->find(dependentPrototype)->second;
if (dependentPrototypeData.numDependencies
.fetch_sub(1) == 1){
dispatcher->Run(
&_PrototypeBBoxResolver::_ExecuteTaskForPrototype,
this, dependentPrototype, prototypeTasks, xfCaches,
dispatcher);
}
}
}
};
// your_sha256_hash---------- //
// Helper functions for managing query objects
// your_sha256_hash---------- //
namespace
{
// Enumeration of queries stored for each cached entry that varies
// over time.
enum _Queries {
Extent = 0,
// Note: code in _ResolvePrim relies on ExtentsHint being last.
ExtentsHint,
NumQueries
};
}
#define DEFINE_QUERY_ACCESSOR(Name, Schema) \
static const UsdAttributeQuery& \
_GetOrCreate##Name##Query(const UsdPrim& prim, UsdAttributeQuery* q) \
{ \
if (!*q) { \
if (Schema s = Schema(prim)) { \
UsdAttribute attr = s.Get##Name##Attr(); \
if (TF_VERIFY(attr, "Unable to get attribute '%s' on prim " \
"at path <%s>", #Name, \
prim.GetPath().GetText())) { \
*q = UsdAttributeQuery(attr); \
} \
} \
} \
return *q; \
}
DEFINE_QUERY_ACCESSOR(Extent, UsdGeomBoundable);
DEFINE_QUERY_ACCESSOR(Visibility, UsdGeomImageable);
// ExtentsHint is a custom attribute so we need an additional check
// to see if the attribute exists.
static const UsdAttributeQuery&
_GetOrCreateExtentsHintQuery(UsdGeomModelAPI& geomModel, UsdAttributeQuery* q)
{
if (!*q) {
UsdAttribute extentsHintAttr = geomModel.GetExtentsHintAttr();
if (extentsHintAttr) {
*q = UsdAttributeQuery(extentsHintAttr);
}
}
return *q;
}
// your_sha256_hash---------- //
// UsdGeomBBoxCache Public API
// your_sha256_hash---------- //
UsdGeomBBoxCache::UsdGeomBBoxCache(
UsdTimeCode time, TfTokenVector includedPurposes,
bool useExtentsHint, bool ignoreVisibility)
: _time(time)
, _includedPurposes(includedPurposes)
, _ctmCache(time)
, _useExtentsHint(useExtentsHint)
, _ignoreVisibility(ignoreVisibility)
{
}
UsdGeomBBoxCache::UsdGeomBBoxCache(UsdGeomBBoxCache const &other)
: _time(other._time)
, _baseTime(other._baseTime)
, _includedPurposes(other._includedPurposes)
, _ctmCache(other._ctmCache)
, _bboxCache(other._bboxCache)
, _useExtentsHint(other._useExtentsHint)
{
}
UsdGeomBBoxCache &
UsdGeomBBoxCache::operator=(UsdGeomBBoxCache const &other)
{
if (this == &other)
return *this;
_time = other._time;
_baseTime = other._baseTime;
_includedPurposes = other._includedPurposes;
_ctmCache = other._ctmCache;
_bboxCache = other._bboxCache;
_useExtentsHint = other._useExtentsHint;
return *this;
}
GfBBox3d
UsdGeomBBoxCache::ComputeWorldBound(const UsdPrim& prim)
{
GfBBox3d bbox;
if (!prim) {
TF_CODING_ERROR("Invalid prim: %s", UsdDescribe(prim).c_str());
return bbox;
}
_PurposeToBBoxMap bboxes;
if (!_Resolve(prim, &bboxes))
return bbox;
bbox = _GetCombinedBBoxForIncludedPurposes(bboxes);
GfMatrix4d ctm = _ctmCache.GetLocalToWorldTransform(prim);
bbox.Transform(ctm);
return bbox;
}
GfBBox3d
UsdGeomBBoxCache::ComputeRelativeBound(const UsdPrim& prim,
const UsdPrim &relativeToAncestorPrim)
{
GfBBox3d bbox;
if (!prim) {
TF_CODING_ERROR("Invalid prim: %s", UsdDescribe(prim).c_str());
return bbox;
}
_PurposeToBBoxMap bboxes;
if (!_Resolve(prim, &bboxes))
return bbox;
bbox = _GetCombinedBBoxForIncludedPurposes(bboxes);
GfMatrix4d primCtm = _ctmCache.GetLocalToWorldTransform(prim);
GfMatrix4d ancestorCtm =
_ctmCache.GetLocalToWorldTransform(relativeToAncestorPrim);
GfMatrix4d relativeCtm = primCtm * ancestorCtm.GetInverse();
bbox.Transform(relativeCtm);
return bbox;
}
GfBBox3d
UsdGeomBBoxCache::ComputeLocalBound(const UsdPrim& prim)
{
GfBBox3d bbox;
if (!prim) {
TF_CODING_ERROR("Invalid prim: %s", UsdDescribe(prim).c_str());
return bbox;
}
_PurposeToBBoxMap bboxes;
if (!_Resolve(prim, &bboxes))
return bbox;
bbox = _GetCombinedBBoxForIncludedPurposes(bboxes);
// The value of resetsXformStack does not affect the local bound.
bool resetsXformStack = false;
bbox.Transform(_ctmCache.GetLocalTransformation(prim, &resetsXformStack));
return bbox;
}
GfBBox3d
UsdGeomBBoxCache::ComputeUntransformedBound(const UsdPrim& prim)
{
GfBBox3d empty;
if (!prim) {
TF_CODING_ERROR("Invalid prim: %s", UsdDescribe(prim).c_str());
return empty;
}
_PurposeToBBoxMap bboxes;
if (!_Resolve(prim, &bboxes))
return empty;
return _GetCombinedBBoxForIncludedPurposes(bboxes);
}
template<typename TransformType>
GfBBox3d
UsdGeomBBoxCache::_ComputeBoundWithOverridesHelper(
const UsdPrim &prim,
const SdfPathSet &pathsToSkip,
const TransformType &primOverride,
const TfHashMap<SdfPath, GfMatrix4d, SdfPath::Hash> &ctmOverrides)
{
GfBBox3d empty;
if (!prim) {
TF_CODING_ERROR("Invalid prim: %s", UsdDescribe(prim).c_str());
return empty;
}
// Use a path table to populate a hash map containing all ancestors of the
// paths in pathsToSkip.
SdfPathTable<bool> ancestorsOfPathsToSkip;
for (const SdfPath &p : pathsToSkip) {
ancestorsOfPathsToSkip[p.GetParentPath()] = true;
}
// Use a path table to populate a hash map containing all ancestors of the
// paths in ctmOverrides.
SdfPathTable<bool> ancestorsOfOverrides;
for (const auto &override : ctmOverrides) {
ancestorsOfOverrides[override.first.GetParentPath()] = true;
}
GfBBox3d result;
UsdPrimRange range(prim);
for (auto it = range.begin(); it != range.end(); ++it) {
const UsdPrim &p = *it;
const SdfPath &primPath = p.GetPath();
// If this is one of the paths to be skipped, then prune subtree and
// continue traversal.
if (pathsToSkip.count(primPath)) {
it.PruneChildren();
continue;
}
// If this is an ancestor of a path that's skipped, then we must
// continue the traversal down to find prims whose bounds can be
// included.
if (ancestorsOfPathsToSkip.find(primPath) !=
ancestorsOfPathsToSkip.end()) {
continue;
}
// Check if any of the descendants of the prim have transform overrides.
// If yes, we need to continue the traversal down to find prims whose
// bounds can be included.
if (ancestorsOfOverrides.find(primPath) != ancestorsOfOverrides.end()) {
continue;
}
// Check to see if any of the ancestors of the prim or the prim itself
// has an xform override.
SdfPath pathWithOverride = primPath;
bool foundAncestorWithOverride = false;
TfHashMap<SdfPath, GfMatrix4d, SdfPath::Hash>::const_iterator
overrideIter;
while (pathWithOverride != prim.GetPath()) {
overrideIter = ctmOverrides.find(pathWithOverride);
if (overrideIter != ctmOverrides.end()) {
// We're only interested in the nearest override since we
// have the override CTMs in the given prim's space.
foundAncestorWithOverride = true;
break;
}
pathWithOverride = pathWithOverride.GetParentPath();
}
GfBBox3d bbox;
if (!foundAncestorWithOverride) {
bbox = ComputeRelativeBound(p, prim);
_Transform(&bbox, primOverride);
} else {
// Compute bound relative to the path for which we know the
// corrected prim-relative CTM.
bbox = ComputeRelativeBound(p,
prim.GetStage()->GetPrimAtPath(overrideIter->first));
// Apply the override CTM.
const GfMatrix4d &overrideXform = overrideIter->second;
bbox.Transform(overrideXform);
}
result = GfBBox3d::Combine(result, bbox);
it.PruneChildren();
}
return result;
}
GfBBox3d
UsdGeomBBoxCache::ComputeUntransformedBound(
const UsdPrim &prim,
const SdfPathSet &pathsToSkip,
const TfHashMap<SdfPath, GfMatrix4d, SdfPath::Hash> &ctmOverrides)
{
return _ComputeBoundWithOverridesHelper(
prim,
pathsToSkip,
_IdentityTransform(),
ctmOverrides);
}
GfBBox3d
UsdGeomBBoxCache::ComputeWorldBoundWithOverrides(
const UsdPrim &prim,
const SdfPathSet &pathsToSkip,
const GfMatrix4d &primOverride,
const TfHashMap<SdfPath, GfMatrix4d, SdfPath::Hash> &ctmOverrides)
{
return _ComputeBoundWithOverridesHelper(
prim,
pathsToSkip,
primOverride,
ctmOverrides);
}
bool
UsdGeomBBoxCache::_ComputePointInstanceBoundsHelper(
const UsdGeomPointInstancer &instancer,
int64_t const *instanceIdBegin,
size_t numIds,
GfMatrix4d const &xform,
GfBBox3d *result)
{
UsdTimeCode time = GetTime(), baseTime = GetBaseTime();
VtIntArray protoIndices;
if (!instancer.GetProtoIndicesAttr().Get(&protoIndices, time)) {
TF_WARN("%s -- no prototype indices",
instancer.GetPrim().GetPath().GetText());
return false;
}
VtIntArray const &cprotoIndices = protoIndices;
const UsdRelationship prototypes = instancer.GetPrototypesRel();
SdfPathVector protoPaths;
if (!prototypes.GetTargets(&protoPaths) || protoPaths.empty()) {
TF_WARN("%s -- no prototypes", instancer.GetPrim().GetPath().GetText());
return false;
}
// verify that all the protoIndices are in bounds.
for (auto protoIndex: cprotoIndices) {
if (protoIndex < 0 ||
static_cast<size_t>(protoIndex) >= protoPaths.size()) {
TF_WARN("%s -- invalid prototype index: %d. Should be in [0, %zu)",
instancer.GetPrim().GetPath().GetText(),
protoIndex,
protoPaths.size());
return false;
}
}
// Note that we do NOT apply any masking when computing the instance
// transforms. This is so that for a particular instance we can determine
// both its transform and its prototype. Otherwise, the instanceTransforms
// array would have masked instances culled out and we would lose the
// mapping to the prototypes.
// Masked instances will be culled before being applied to the extent below.
VtMatrix4dArray instanceTransforms;
if (!instancer.ComputeInstanceTransformsAtTime(
&instanceTransforms,
time,
baseTime,
UsdGeomPointInstancer::IncludeProtoXform,
UsdGeomPointInstancer::IgnoreMask)) {
TF_WARN("%s -- could not compute instance transforms",
instancer.GetPrim().GetPath().GetText());
return false;
}
VtMatrix4dArray const &cinstanceTransforms = instanceTransforms;
const UsdStagePtr stage = instancer.GetPrim().GetStage();
for (int64_t const *iid = instanceIdBegin, * const iend = iid + numIds;
iid != iend; ++iid) {
const int protoIndex = cprotoIndices[*iid];
const SdfPath& protoPath = protoPaths[protoIndex];
const UsdPrim& protoPrim = stage->GetPrimAtPath(protoPath);
// Get the prototype bounding box and apply the instance transform and
// the caller's transform.
GfBBox3d &thisBounds = *result++;
thisBounds = ComputeUntransformedBound(protoPrim);
thisBounds.Transform(cinstanceTransforms[*iid] * xform);
}
return true;
}
bool
UsdGeomBBoxCache::ComputePointInstanceWorldBounds(
UsdGeomPointInstancer const &instancer,
int64_t const *instanceIdBegin,
size_t numIds,
GfBBox3d *result)
{
return _ComputePointInstanceBoundsHelper(
instancer, instanceIdBegin, numIds,
_ctmCache.GetLocalToWorldTransform(instancer.GetPrim()), result);
}
bool
UsdGeomBBoxCache::ComputePointInstanceRelativeBounds(
const UsdGeomPointInstancer &instancer,
int64_t const *instanceIdBegin,
size_t numIds,
const UsdPrim &relativeToAncestorPrim,
GfBBox3d *result)
{
GfMatrix4d primCtm =
_ctmCache.GetLocalToWorldTransform(instancer.GetPrim());
GfMatrix4d ancestorCtm =
_ctmCache.GetLocalToWorldTransform(relativeToAncestorPrim);
GfMatrix4d relativeCtm = ancestorCtm.GetInverse() * primCtm;
return _ComputePointInstanceBoundsHelper(
instancer, instanceIdBegin, numIds, relativeCtm, result);
}
bool
UsdGeomBBoxCache::ComputePointInstanceLocalBounds(
const UsdGeomPointInstancer& instancer,
int64_t const *instanceIdBegin,
size_t numIds,
GfBBox3d *result)
{
// The value of resetsXformStack does not affect the local bound.
bool resetsXformStack = false;
return _ComputePointInstanceBoundsHelper(
instancer, instanceIdBegin, numIds,
_ctmCache.GetLocalTransformation(
instancer.GetPrim(), &resetsXformStack), result);
}
bool
UsdGeomBBoxCache::ComputePointInstanceUntransformedBounds(
const UsdGeomPointInstancer& instancer,
int64_t const *instanceIdBegin,
size_t numIds,
GfBBox3d *result)
{
return _ComputePointInstanceBoundsHelper(
instancer, instanceIdBegin, numIds, GfMatrix4d(1), result);
}
void
UsdGeomBBoxCache::Clear()
{
TF_DEBUG(USDGEOM_BBOX).Msg("[BBox Cache] CLEARED\n");
_ctmCache.Clear();
_bboxCache.clear();
}
void
UsdGeomBBoxCache::SetIncludedPurposes(const TfTokenVector& includedPurposes)
{
_includedPurposes = includedPurposes;
}
GfBBox3d
UsdGeomBBoxCache::_GetCombinedBBoxForIncludedPurposes(
const _PurposeToBBoxMap &bboxes)
{
GfBBox3d combinedBound;
for (const TfToken &purpose : _includedPurposes) {
_PurposeToBBoxMap::const_iterator it = bboxes.find(purpose);
if (it != bboxes.end()) {
const GfBBox3d &bboxForPurpose = it->second;
if (!bboxForPurpose.GetRange().IsEmpty())
combinedBound = GfBBox3d::Combine(combinedBound,
bboxForPurpose);
}
}
return combinedBound;
}
void
UsdGeomBBoxCache::SetTime(UsdTimeCode time)
{
if (time == _time)
return;
// If we're switching time into or out of default, then clear all the
// entries in the cache.
//
// This is done because the _IsVarying() check (below) returns false for an
// attribute when
// * it has a default value,
// * it has a single time sample and
// * its default value is different from the varying time sample.
//
// This is an optimization that works well when playing through a shot and
// computing bboxes sequentially.
//
// It should not common to compute bboxes at the default frame. Hence,
// clearing all values here should not cause any performance issues.
//
bool clearUnvarying = false;
if (_time == UsdTimeCode::Default() || time == UsdTimeCode::Default())
clearUnvarying = true;
TF_DEBUG(USDGEOM_BBOX).Msg("[BBox Cache] Setting time: %f "
" clearUnvarying: %s\n",
time.GetValue(),
clearUnvarying ? "true": "false");
for (auto &primAndEntry : _bboxCache) {
if (clearUnvarying || primAndEntry.second.isVarying) {
primAndEntry.second.isComplete = false;
// Clear cached bboxes.
primAndEntry.second.bboxes.clear();
TF_DEBUG(USDGEOM_BBOX).Msg("[BBox Cache] invalidating %s "
"for time change\n",
primAndEntry.first.ToString().c_str());
}
}
_time = time;
_ctmCache.SetTime(_time);
}
// your_sha256_hash---------- //
// UsdGeomBBoxCache Private API
// your_sha256_hash---------- //
bool
UsdGeomBBoxCache::_ShouldIncludePrim(const UsdPrim& prim)
{
TRACE_FUNCTION();
// If the prim is typeless or has an unknown type, it may have descendants
// that are imageable. Hence, we include it in bbox computations.
if (!prim.IsA<UsdTyped>()) {
return true;
}
// If the prim is typed it can participate in child bound accumulation only
// if it is imageable.
if (!prim.IsA<UsdGeomImageable>()) {
TF_DEBUG(USDGEOM_BBOX).Msg("[BBox Cache] excluded, not IMAGEABLE type. "
"prim: %s, primType: %s\n",
prim.GetPath().GetText(),
prim.GetTypeName().GetText());
return false;
}
if (!_ignoreVisibility) {
UsdGeomImageable img(prim);
TfToken vis;
if (img.GetVisibilityAttr().Get(&vis, _time)
&& vis == UsdGeomTokens->invisible) {
TF_DEBUG(USDGEOM_BBOX).Msg("[BBox Cache] excluded for VISIBILITY. "
"prim: %s visibility at time %s: %s\n",
prim.GetPath().GetText(),
TfStringify(_time).c_str(),
vis.GetText());
return false;
}
}
return true;
}
template <class AttributeOrQuery>
static bool
_IsVaryingImpl(const UsdTimeCode time, const AttributeOrQuery& attr)
{
// XXX: Copied from UsdImagingDelegate::_TrackVariability.
// XXX: This logic is highly sensitive to the underlying quantization of
// time. Also, the epsilon value (.000001) may become zero for large
// time values.
double lower, upper, queryTime;
bool hasSamples;
queryTime = time.IsDefault() ? 1.000001 : time.GetValue() + 0.000001;
// TODO: migrate this logic into UsdAttribute.
if (attr.GetBracketingTimeSamples(queryTime, &lower, &upper, &hasSamples)
&& hasSamples)
{
// The potential results are:
// * Requested time was between two time samples
// * Requested time was out of the range of time samples (lesser)
// * Requested time was out of the range of time samples (greater)
// * There was a time sample exactly at the requested time or
// there was exactly one time sample.
// The following logic determines which of these states we are in.
// Between samples?
if (lower != upper) {
return true;
}
// Out of range (lower) or exactly on a time sample?
attr.GetBracketingTimeSamples(lower+.000001,
&lower, &upper, &hasSamples);
if (lower != upper) {
return true;
}
// Out of range (greater)?
attr.GetBracketingTimeSamples(lower-.000001,
&lower, &upper, &hasSamples);
if (lower != upper) {
return true;
}
// Really only one time sample --> not varying for our purposes
}
return false;
}
bool
UsdGeomBBoxCache::_IsVarying(const UsdAttribute& attr)
{
return _IsVaryingImpl(_time, attr);
}
bool
UsdGeomBBoxCache::_IsVarying(const UsdAttributeQuery& query)
{
return _IsVaryingImpl(_time, query);
}
// Returns true if the given prim is a component or a subcomponent.
static
bool
_IsComponentOrSubComponent(const UsdPrim &prim)
{
UsdModelAPI model(prim);
TfToken kind;
if (!model.GetKind(&kind))
return false;
return KindRegistry::IsA(kind, KindTokens->component) ||
KindRegistry::IsA(kind, KindTokens->subcomponent);
}
// Returns the nearest ancestor prim that's a component or a subcomponent, or
// the stage's pseudoRoot if none are found. For the purpose of computing
// bounding boxes, subcomponents as treated similar to components, i.e. child
// bounds are accumulated in subcomponent-space for prims that are underneath
// a subcomponent.
//
static
UsdPrim
_GetNearestComponent(const UsdPrim &prim)
{
UsdPrim modelPrim = prim;
while (modelPrim) {
if (_IsComponentOrSubComponent(modelPrim))
return modelPrim;
modelPrim = modelPrim.GetParent();
}
// If we get here, it means we did not find a model or a subcomponent at or
// above the given prim. Hence, return the stage's pseudoRoot.
return prim.GetStage()->GetPseudoRoot();
}
template <bool IsRecursive>
void
UsdGeomBBoxCache::_ComputePurposeInfo(
_Entry *entry, const _PrimContext &primContext)
{
if (entry->purposeInfo) {
return;
}
const UsdPrim &prim = primContext.prim;
// Special case for prototype prims. Prototypes don't actually have their
// own purpose attribute. The prims that instance the prototype will provide
// its purpose. It's important that we apply the instancing prim's purpose
// to this prototype prim context so that the prototype's children can
// properly inherit the instancing prim's purpose if needed. Note that this
// only applies if the instancing prim provides a purpose that is
// inheritable.
if (prim.IsPrototype()) {
if (primContext.instanceInheritablePurpose.IsEmpty()) {
// If the instancing prim's purpose is not inheritable, this
// prototype prim context won't provide an inheritable purpose to
// its children either.
entry->purposeInfo = UsdGeomImageable::PurposeInfo(
UsdGeomTokens->default_, false);
} else {
// Otherwise this prototype can provide the instancing prim's
// inheritable pupose to its children.
entry->purposeInfo = UsdGeomImageable::PurposeInfo(
primContext.instanceInheritablePurpose, true);
}
} else {
UsdGeomImageable img(prim);
UsdPrim parentPrim = prim.GetParent();
if (parentPrim && parentPrim.GetPath() != SdfPath::AbsoluteRootPath()) {
// Try and get the parent prim's purpose first. If we find it in the
// cache, we can compute this prim's purpose efficiently by avoiding
// the n^2 recursion which results from using the
// UsdGeomImageable::ComputePurpose() API directly.
// If this prim is in a prototype then its parent prim will be too.
// The parent prim's context will have the same inheritable purpose
// from the instance as this prim context does.
_PrimContext parentPrimContext(
parentPrim, primContext.instanceInheritablePurpose);
_Entry *parentEntry = _FindEntry(parentPrimContext);
if (parentEntry) {
if (IsRecursive) {
// If this is recursive make sure the parent's purpose is
// computed and cached first.
_ComputePurposeInfo<IsRecursive>(
parentEntry, parentPrimContext);
entry->purposeInfo = img.ComputePurposeInfo(
parentEntry->purposeInfo);
return;
} else {
// Not recursive. just check that the parent purpose has
// been computed.
if (parentEntry->purposeInfo) {
entry->purposeInfo = img.ComputePurposeInfo(
parentEntry->purposeInfo);
return;
}
TF_DEBUG(USDGEOM_BBOX).Msg(
"[BBox Cache] Computing purpose for <%s> before purpose"
"of parent <%s> is cached\n",
primContext.ToString().c_str(),
parentPrimContext.ToString().c_str());
}
}
}
TF_DEBUG(USDGEOM_BBOX).Msg("[BBox Cache] Computing purpose without "
"cached parent for <%s>\n",
primContext.ToString().c_str());
entry->purposeInfo = img.ComputePurposeInfo();
}
}
// Helper to determine if we should use extents hints for \p prim.
bool UsdGeomBBoxCache::
_UseExtentsHintForPrim(UsdPrim const &prim) const
{
return _useExtentsHint && prim.IsModel() &&
prim.GetPath() != SdfPath::AbsoluteRootPath();
}
bool
UsdGeomBBoxCache::_ShouldPruneChildren(const UsdPrim &prim,
UsdGeomBBoxCache::_Entry *entry)
{
// If the entry is already complete, we don't need to try to initialize it.
if (entry->isComplete) {
return true;
}
// Check if prim is a UsdGeomBoundable. Boundables should always provide
// their own extent and do not require participation from descendants.
if (prim.IsA<UsdGeomBoundable>()) {
return true;
}
if (!_UseExtentsHintForPrim(prim)) {
return false;
}
UsdAttribute extentsHintAttr = UsdGeomModelAPI(prim).GetExtentsHintAttr();
VtVec3fArray extentsHint;
return (extentsHintAttr
&& extentsHintAttr.Get(&extentsHint, _time)
&& extentsHint.size() >= 2);
}
UsdGeomBBoxCache::_Entry*
UsdGeomBBoxCache::_FindOrCreateEntriesForPrim(
const _PrimContext& primContext,
std::vector<_PrimContext> *prototypePrimContexts)
{
// Add an entry for the prim to the cache and if the bound is already in
// the cache, return it.
//
// Note that this means we always have an entry for the given prim,
// even if that prim does not pass the predicate given to the tree
// iterator below (e.g., the prim is a class).
_Entry* entry = _InsertEntry(primContext);
if (entry && entry->isComplete) {
const _PurposeToBBoxMap& bboxes = entry->bboxes;
TF_DEBUG(USDGEOM_BBOX).Msg("[BBox Cache] hit: %s %s\n",
primContext.ToString().c_str(),
TfStringify(_GetCombinedBBoxForIncludedPurposes(bboxes)).c_str());
return entry;
}
TF_DEBUG(USDGEOM_BBOX).Msg("[BBox Cache] miss: %s\n",
primContext.ToString().c_str());
// isIncluded only gets cached in the multi-threaded path for child prims,
// make sure the prim we're querying has the correct flag cached also. We
// can't do this in _ResolvePrim because we need to compute the flag for
// children before recursing upon them.
entry->isIncluded = _ShouldIncludePrim(primContext.prim);
// Pre-populate all cache entries, note that some entries may already exist.
// Note also we do not exclude unloaded prims - we want them because they
// may have authored extentsHints we can use; thus we can have bboxes in
// model-hierarchy-only.
TfHashSet<_PrimContext, _PrimContextHash> seenPrototypePrimContexts;
UsdPrimRange range(primContext.prim,
(UsdPrimIsActive && UsdPrimIsDefined && !UsdPrimIsAbstract));
for (auto it = range.begin(); it != range.end(); ++it) {
_PrimContext cachePrimContext(
*it, primContext.instanceInheritablePurpose);
_Entry *cacheEntry = _InsertEntry(cachePrimContext);
if (_ShouldPruneChildren(*it, cacheEntry)) {
// The entry already exists and is complete, we don't need
// the child entries for this query.
it.PruneChildren();
}
else if (it->IsInstance()) {
// This prim is an instance without an extent or hint, so we need
// to compute bounding boxes for the prototype prims.
const UsdPrim prototype = it->GetPrototype();
// We typically compute the purpose for prims later in _ResolvePrim,
// but for an instance prim, we need to compute the purpose for this
// prim context now so that we can associate this instance's
// inheritable purpose with the prototype.
//
// Note that we recursively cache the computed purposes of all
// cached ancestors of the prim here as we won't have necessarily
// computed them before reaching this prim. It should be safe to
// cache ancestors recursively as this code is not used in a
// multithreaded context.
_ComputePurposeInfo<true>(cacheEntry, cachePrimContext);
_PrimContext prototypePrimContext(
prototype, cacheEntry->purposeInfo.GetInheritablePurpose());
if (seenPrototypePrimContexts.insert(prototypePrimContext).second) {
prototypePrimContexts->push_back(prototypePrimContext);
}
it.PruneChildren();
}
}
return entry;
}
bool
UsdGeomBBoxCache::_Resolve(
const UsdPrim& prim,
UsdGeomBBoxCache::_PurposeToBBoxMap *bboxes)
{
TRACE_FUNCTION();
// NOTE: Bounds are cached in local space, but computed in world space.
// Drop the GIL here if we have it before we spawn parallel tasks, since
// resolving properties on prims in worker threads may invoke plugin code
// that needs the GIL.
TF_PY_ALLOW_THREADS_IN_SCOPE();
// If the bound is in the cache, return it.
std::vector<_PrimContext> prototypePrimContexts;
_PrimContext primContext(prim);
_Entry *entry = _FindOrCreateEntriesForPrim(primContext,
&prototypePrimContexts);
if (entry && entry->isComplete) {
*bboxes = entry->bboxes;
return (!bboxes->empty());
}
WorkWithScopedParallelism([&]() {
// Resolve all prototype prims first to avoid having to synchronize
// tasks that depend on the same prototype.
if (!prototypePrimContexts.empty()) {
_PrototypeBBoxResolver bboxesForPrototypes(this);
bboxesForPrototypes.Resolve(prototypePrimContexts);
}
// XXX: This swapping out is dubious... see XXX below.
_ThreadXformCache xfCaches;
xfCaches.local().Swap(_ctmCache);
// Find the nearest ancestor prim that's a model or a subcomponent.
UsdPrim modelPrim = _GetNearestComponent(prim);
GfMatrix4d inverseComponentCtm = _ctmCache.GetLocalToWorldTransform(
modelPrim).GetInverse();
_dispatcher.Run(
_BBoxTask(primContext, inverseComponentCtm, this, &xfCaches));
_dispatcher.Wait();
// We save the result of one of the caches, but it might be
// interesting to merge them all here at some point. XXX: Is this
// valid? This only makes sense if we're *100% certain* that
// rootTask above runs in this thread. If it's picked up by another
// worker it won't populate the local xfCaches we're swapping with.
xfCaches.local().Swap(_ctmCache);
});
// Note: the map may contain unresolved entries, but future queries will
// populate them.
// If the bound is in the cache, return it.
entry = _FindEntry(primContext);
if (entry == nullptr) {
return false;
}
*bboxes = entry->bboxes;
return (!bboxes->empty());
}
bool
UsdGeomBBoxCache::_GetBBoxFromExtentsHint(
const UsdGeomModelAPI &geomModel,
const UsdAttributeQuery &extentsHintQuery,
_PurposeToBBoxMap *bboxes)
{
VtVec3fArray extents;
if (!extentsHintQuery || !extentsHintQuery.Get(&extents, _time)){
if (TfDebug::IsEnabled(USDGEOM_BBOX) &&
!geomModel.GetPrim().IsLoaded()){
TF_DEBUG(USDGEOM_BBOX).Msg("[BBox Cache] MISSING extentsHint for "
"UNLOADED model %s.\n",
geomModel.GetPrim().GetPath()
.GetString().c_str());
}
return false;
}
TF_DEBUG(USDGEOM_BBOX).Msg("[BBox Cache] Found cached extentsHint for "
"model %s.\n", geomModel.GetPrim().GetPath().GetString().c_str());
const TfTokenVector &purposeTokens =
UsdGeomImageable::GetOrderedPurposeTokens();
for(size_t i = 0; i < purposeTokens.size(); ++i) {
size_t idx = i*2;
// If extents are not available for the value of purpose, it
// implies that the rest of the bounds are empty.
// Hence, we can break.
if ((idx + 2) > extents.size())
break;
(*bboxes)[purposeTokens[i]] =
GfBBox3d( GfRange3d(extents[idx], extents[idx+1]) );
}
return true;
}
void
UsdGeomBBoxCache::_ResolvePrim(const _BBoxTask* task,
const _PrimContext &primContext,
const GfMatrix4d &inverseComponentCtm)
{
TRACE_FUNCTION();
// NOTE: Bounds are cached in local space, but computed in world space.
// If the bound is in the cache, return it.
_Entry* entry = _FindEntry(primContext);
if (!TF_VERIFY(entry != NULL))
return;
_PurposeToBBoxMap *bboxes = &entry->bboxes;
if (entry->isComplete) {
TF_DEBUG(USDGEOM_BBOX).Msg("[BBox Cache] Dependent cache hit: "
"%s %s\n", primContext.ToString().c_str(),
TfStringify(_GetCombinedBBoxForIncludedPurposes(*bboxes)).c_str());
return;
}
TF_DEBUG(USDGEOM_BBOX).Msg("[BBox Cache] Dependent cache miss: %s\n",
primContext.ToString().c_str());
// Initially the bboxes hash map is empty, which implies empty bounds.
UsdGeomXformCache &xfCache = task->GetXformCaches()->local();
// Setting the time redundantly will be a no-op;
xfCache.SetTime(_time);
// Compute the purpose for the entry. Note that we do not do this
// recursively because _ResolvePrim can be called multithreaded across
// siblings and any parent's purposes should already be cached before this
// _ResolvePrim is called.
_ComputePurposeInfo<false>(entry, primContext);
// Check if the prim is a model and has extentsHint
const UsdPrim &prim = primContext.prim;
const bool useExtentsHintForPrim = _UseExtentsHintForPrim(prim);
std::shared_ptr<UsdAttributeQuery[]> &queries = entry->queries;
if (!queries) {
// If this cache doesn't use extents hints, we don't need the
// corresponding query.
const size_t numQueries =
(useExtentsHintForPrim ? NumQueries : NumQueries - 1);
queries.reset(new UsdAttributeQuery[numQueries]);
}
if (useExtentsHintForPrim) {
UsdGeomModelAPI geomModel(prim);
const UsdAttributeQuery& extentsHintQuery =
_GetOrCreateExtentsHintQuery(geomModel, &queries[ExtentsHint]);
if (_GetBBoxFromExtentsHint(geomModel, extentsHintQuery, bboxes)) {
entry->isComplete = true;
// XXX: Do we only need to be doing the following in
// the non-varying case, similar to below?
entry->isVarying = _IsVarying(extentsHintQuery);
entry->isIncluded = _ShouldIncludePrim(prim);
return;
}
}
// We only check when isVarying is false, since when an entry doesn't
// vary over time, this code will only be executed once. If an entry has
// been marked as varying, we need not check if it's varying again.
// This relies on entries being initialized with isVarying=false.
if (!entry->isVarying) {
// Note that child variability is also accumulated into
// entry->isVarying (below).
UsdAttributeQuery visQuery;
if (!_ignoreVisibility) {
_GetOrCreateVisibilityQuery(prim, &visQuery);
}
const UsdAttributeQuery& extentQuery =
_GetOrCreateExtentQuery(prim, &queries[Extent]);
UsdGeomXformable xformable(prim);
entry->isVarying =
(xformable && xformable.TransformMightBeTimeVarying())
|| (extentQuery && _IsVarying(extentQuery))
|| (visQuery && _IsVarying(visQuery));
}
// Leaf gprims and boundable intermediate prims.
//
// When boundable prims have an authored extent, it is expected to
// incorporate the extent of all children, which are pruned from further
// traversal.
GfRange3d myRange;
// Attempt to resolve a boundable prim's extent. If no extent is authored,
// we attempt to create it for usdGeomPointBased and child classes. If
// it cannot be created or found, the user is notified of an incorrect prim.
if (UsdGeomBoundable boundableObj = UsdGeomBoundable(prim)) {
// UsdGeomBoundable::ComputeExtent checks to see if extent attr has an
// authored value and sets extent to that, if not it computes extent
// using intrinsic geometric parameters, provided ComputeExtentFunction
// is registered for this boundableObj. If we successfully obtain an
// extent, create BBox for purpose.
VtVec3fArray extent;
if (boundableObj.ComputeExtent(_time, &extent)) {
GfBBox3d &bboxForPurpose = (*bboxes)[entry->purposeInfo.purpose];
bboxForPurpose.SetRange(GfRange3d(extent[0], extent[1]));
}
}
else {
// This is not a boundable, so descend to children.
// --
// NOTE: bbox is currently in its local space, the space in which
// we want to cache it. If we need to merge in child bounds below,
// though, we will need to temporarily transform it into component space.
// --
bool bboxInComponentSpace = false;
// This will be computed below if the prim has children with bounds.
GfMatrix4d localToComponentXform(1.0);
// Accumulate child bounds:
//
// 1) Filter and queue up the children to be processed.
// 2) Spawn new child tasks and wait for them to complete.
// 3) Accumulate the results into this cache entry.
//
// Compute the enclosing model's (or subcomponent's) inverse CTM.
// This will be used to compute the child bounds in model-space.
const GfMatrix4d &inverseEnclosingComponentCtm =
_IsComponentOrSubComponent(prim) ?
xfCache.GetLocalToWorldTransform(prim).GetInverse() :
inverseComponentCtm;
std::vector<std::pair<_PrimContext, _BBoxTask> > included;
// See comment in _Resolve about unloaded prims
UsdPrimSiblingRange children;
TfToken childInheritableInstancePurpose;
const bool primIsInstance = prim.IsInstance();
if (primIsInstance) {
const UsdPrim prototype = prim.GetPrototype();
children = prototype.GetFilteredChildren(
UsdPrimIsActive && UsdPrimIsDefined && !UsdPrimIsAbstract);
// Since we're using the prototype's children, we need to make sure
// we propagate this instance's inheritable purpose to the
// prototype's children so they inherit the correct purpose for this
// instance if needed.
childInheritableInstancePurpose =
entry->purposeInfo.GetInheritablePurpose();
}
else {
children = prim.GetFilteredChildren(
UsdPrimIsActive && UsdPrimIsDefined && !UsdPrimIsAbstract);
// Otherwise for standard children that are not across an instance
// boundary, pass this prim's inheritable purpose along to its
// children.
// XXX: It's worth noting that if a child of a prototype
// has a purpose opinion, then that child (and its descendants) will
// have the same computed purpose regardless of the inheritable
// instance purpose of the prototype. Thus it's technically
// redundant to store multiple entries for these children per
// instance purpose. But the trade off for this redundancy means
// that we don't have to worry about different prototypes or
// siblings sharing child entries in the cache which would
// complicate the multithreaded way we resolve bboxes for prototype
// and sibling prims. This may be something to re-evaluate in the
// future.
childInheritableInstancePurpose =
primContext.instanceInheritablePurpose;
}
for(const UsdPrim &childPrim : children) {
_PrimContext childPrimContext(
childPrim, childInheritableInstancePurpose);
// Skip creating bbox tasks for excluded children.
//
// We must do this check here on the children, because when an
// invisible prim is queried explicitly, we want to return the bound
// to the client, even if that prim's bbox is not included in the
// parent bound.
_Entry* childEntry = _FindEntry(childPrimContext);
if (!TF_VERIFY(childEntry, "Could not find prim <%s>"
"in the bboxCache.", childPrimContext.ToString().c_str())) {
continue;
}
// If we're about to process the child for the first time, we must
// populate isIncluded.
if (!childEntry->isComplete)
childEntry->isIncluded = _ShouldIncludePrim(childPrim);
// We're now confident that the cached flag is correct.
if (!_ignoreVisibility && !childEntry->isIncluded) {
// If the child prim is excluded, mark the parent as varying
// if the child is imageable and its visibility is varying.
// This will ensure that the parent entry gets dirtied when
// the child becomes visible.
UsdGeomImageable img (childPrim);
if (img)
entry->isVarying |= _IsVarying(img.GetVisibilityAttr());
continue;
}
// Queue up the child to be processed.
if (primIsInstance) {
// If the prim we're processing is an instance, all of its
// child prims will come from its prototype prim. The bboxes
// for these prims should already have been computed in
// _Resolve, so we don't need to schedule an additional task.
included.push_back(std::make_pair(childPrimContext,
_BBoxTask()));
}
else {
included.emplace_back(childPrimContext,
_BBoxTask(childPrimContext,
inverseEnclosingComponentCtm,
this, task->GetXformCaches()));
}
}
// Spawn and wait.
//
// Warning: calling spawn() before set_ref_count results in undefined
// behavior.
//
// All the child bboxTasks will be NULL if the prim is an instance.
//
if (!primIsInstance) {
WorkWithScopedParallelism([&]() {
WorkDispatcher wd;
for(auto &childAndTask : included) {
if (childAndTask.second) {
wd.Run(childAndTask.second);
}
}
});
// We may have switched threads, grab the thread-local xfCache
// again.
xfCache = task->GetXformCaches()->local();
xfCache.SetTime(_time);
}
// Accumulate child results.
// Process the child bounding boxes, accumulating their variability and
// volume into this cache entry.
for (const auto &childAndTask : included) {
// The child's bbox is returned in local space, so we must convert
// it to model space to be compatible with the current bbox.
_PrimContext const &childPrimContext = childAndTask.first;
UsdPrim const& childPrim = childPrimContext.prim;
const _Entry* childEntry = _FindEntry(childPrimContext);
if (!TF_VERIFY(childEntry->isComplete))
continue;
// Accumulate child variability.
entry->isVarying |= childEntry->isVarying;
// Accumulate child bounds.
if (!childEntry->bboxes.empty()) {
if (!bboxInComponentSpace){
// Put the local extent into "baked" component space, i.e.
// a bbox with identity transform
localToComponentXform =
xfCache.GetLocalToWorldTransform(prim) *
inverseEnclosingComponentCtm;
for (auto &purposeAndBBox : *bboxes) {
GfBBox3d &bbox = purposeAndBBox.second;
bbox.SetMatrix(localToComponentXform);
bbox = GfBBox3d(bbox.ComputeAlignedRange());
}
bboxInComponentSpace = true;
}
_PurposeToBBoxMap childBBoxes = childEntry->bboxes;
GfMatrix4d childLocalToComponentXform;
if (primIsInstance) {
bool resetsXf = false;
childLocalToComponentXform =
xfCache.GetLocalTransformation(childPrim, &resetsXf) *
localToComponentXform;
}
else {
childLocalToComponentXform =
xfCache.GetLocalToWorldTransform(childPrim) *
inverseEnclosingComponentCtm;
}
// Convert the resolved BBox to component space.
for (auto &purposeAndBBox : childBBoxes) {
const TfToken &purposeToken = purposeAndBBox.first;
GfBBox3d &childBBox = purposeAndBBox.second;
childBBox.Transform(childLocalToComponentXform);
// Since the range is in component space and the matrix is
// identity, we can union in component space.
GfBBox3d &bbox = (*bboxes)[purposeToken];
bbox.SetRange(GfRange3d(bbox.GetRange()).UnionWith(
childBBox.ComputeAlignedRange()));
}
}
}
// All prims must be cached in local space: convert bbox from component
// to local space.
if (bboxInComponentSpace) {
// When children are accumulated, the bbox range is in component
// space, so we must apply the inverse component-space transform
// (component-to-local) to move it to local space.
GfMatrix4d componentToLocalXform =
localToComponentXform.GetInverse();
for (auto &purposeAndBBox : *bboxes) {
GfBBox3d &bbox = purposeAndBBox.second;
bbox.SetMatrix(componentToLocalXform);
}
}
}
// --
// NOTE: bbox is now in local space, either via the matrix or range.
// --
// Performance note: we could leverage the fact that the bound is initially
// computed in world space and avoid an extra transformation for recursive
// calls, however that optimization was not significant in early tests.
// Mark as cached and return.
entry->isComplete = true;
TF_DEBUG(USDGEOM_BBOX).Msg("[BBox Cache] resolved value: %s %s "
"(varying: %s)\n",
primContext.ToString().c_str(),
TfStringify(_GetCombinedBBoxForIncludedPurposes(*bboxes)).c_str(),
entry->isVarying ? "true" : "false");
}
std::string
UsdGeomBBoxCache::_PrimContext::ToString() const {
if (instanceInheritablePurpose.IsEmpty()) {
return prim.GetPath().GetString();
} else {
return TfStringPrintf("[%s]%s",
instanceInheritablePurpose.GetText(),
prim.GetPath().GetText());
}
}
PXR_NAMESPACE_CLOSE_SCOPE
```
|
PRAME (preferentially expressed antigen of melanoma) is a protein that in humans is encoded by the PRAME gene. Five alternatively spliced transcript variants encoding the same protein have been observed for this gene.
Function
This gene encodes an antigen that is predominantly expressed in human melanomas and that is recognized by cytolytic T lymphocytes. It is not expressed in normal tissues, except testis. This expression pattern is similar to that of other CT antigens, such as MAGE, BAGE and GAGE. However, unlike these other CT antigens, this gene is also expressed in acute leukemias. The overexpression of PRAME in tumor tissues and relative low levels in normal somatic tissues make it an attractive target for cancer therapy. In recent years, immunotherapy has spearheaded a new era of cancer therapy resulting in the development of numerous novel antigen-specific immunotherapy approaches. Studies on PRAME-specific immunotherapy primarily involve vaccines and cellular immunotherapies.
PRAME can inhibit retinoic acid signaling and retinoic acid mediated differentiation and apoptosis. PRAME overexpression in triple negative breast cancer has also been found to promote cancer cell motility through induction of the epithelial-to-mesenchymal transition.
Model organisms
Model organisms have been used in the study of PRAME function. A conditional knockout mouse line called Prametm1a(KOMP)Wtsi was generated at the Wellcome Trust Sanger Institute. Male and female animals underwent a standardized phenotypic screen to determine the effects of deletion. Additional screens performed: - In-depth immunological phenotyping
References
Further reading
|
```smalltalk
using Microsoft.Extensions.Hosting;
using System.Linq;
using System.Threading;
using System.Threading.Tasks;
using WalletWasabi.BitcoinCore.Monitoring;
using WalletWasabi.Logging;
using WalletWasabi.Nito.AsyncEx;
namespace WalletWasabi.Blockchain.Analysis.FeesEstimation;
/// <summary>
/// Manages multiple fee sources. Returns the best one.
/// Prefers local full node, as long as the fee is accurate.
/// </summary>
public class HybridFeeProvider : IHostedService
{
public HybridFeeProvider(IThirdPartyFeeProvider thirdPartyFeeProvider, RpcFeeProvider? rpcFeeProvider)
{
ThirdPartyFeeProvider = thirdPartyFeeProvider;
RpcFeeProvider = rpcFeeProvider;
}
public event EventHandler<AllFeeEstimate>? AllFeeEstimateChanged;
public RpcFeeProvider? RpcFeeProvider { get; }
public IThirdPartyFeeProvider ThirdPartyFeeProvider { get; }
private object Lock { get; } = new();
public AllFeeEstimate? AllFeeEstimate { get; private set; }
private AbandonedTasks ProcessingEvents { get; } = new();
public Task StartAsync(CancellationToken cancellationToken)
{
SetAllFeeEstimateIfLooksBetter(RpcFeeProvider?.LastAllFeeEstimate);
SetAllFeeEstimateIfLooksBetter(ThirdPartyFeeProvider.LastAllFeeEstimate);
ThirdPartyFeeProvider.AllFeeEstimateArrived += OnAllFeeEstimateArrived;
if (RpcFeeProvider is not null)
{
RpcFeeProvider.AllFeeEstimateArrived += OnAllFeeEstimateArrived;
}
return Task.CompletedTask;
}
public async Task StopAsync(CancellationToken cancellationToken)
{
ThirdPartyFeeProvider.AllFeeEstimateArrived -= OnAllFeeEstimateArrived;
if (RpcFeeProvider is not null)
{
RpcFeeProvider.AllFeeEstimateArrived -= OnAllFeeEstimateArrived;
}
await ProcessingEvents.WhenAllAsync().ConfigureAwait(false);
}
private void OnAllFeeEstimateArrived(object? sender, AllFeeEstimate fees)
{
using (RunningTasks.RememberWith(ProcessingEvents))
{
// Only go further if we have estimations.
if (fees.Estimations.Count == 0)
{
return;
}
var notify = false;
lock (Lock)
{
if (AllFeeEstimate is null)
{
// If it wasn't set before, then set it regardless of everything.
notify = SetAllFeeEstimate(fees);
}
else if (sender is IThirdPartyFeeProvider)
{
var rpcProvider = RpcFeeProvider;
if (rpcProvider is null)
{
// If user doesn't use full node, then set it, this is the best we got.
notify = SetAllFeeEstimate(fees);
}
else
{
if (!rpcProvider.InError)
{
// If user's full node is properly serving data, then we don't care about the third party.
return;
}
// If the third party is properly serving accurate data then, this is the best we got.
notify = SetAllFeeEstimate(fees);
}
}
else if (sender is RpcFeeProvider rpcProvider)
{
// If user's full node is properly serving data, we're done here.
notify = SetAllFeeEstimate(fees);
}
}
if (notify)
{
var from = fees.Estimations.First();
var to = fees.Estimations.Last();
Logger.LogInfo($"Fee rates are acquired from {sender?.GetType()?.Name} ranging from target {from.Key} blocks at {from.Value} sat/vByte to target {to.Key} blocks at {to.Value} sat/vByte.");
AllFeeEstimateChanged?.Invoke(this, fees);
}
}
}
/// <returns>True if changed.</returns>
private bool SetAllFeeEstimateIfLooksBetter(AllFeeEstimate? fees)
{
var current = AllFeeEstimate;
if (fees is null
|| fees == current
|| (current is not null && fees.Estimations.Count <= current.Estimations.Count))
{
return false;
}
return SetAllFeeEstimate(fees);
}
/// <returns>True if changed.</returns>
private bool SetAllFeeEstimate(AllFeeEstimate fees)
{
if (AllFeeEstimate == fees)
{
return false;
}
AllFeeEstimate = fees;
return true;
}
}
```
|
Naba Kishore Das (7 January 1962 – 29 January 2023) was an Indian politician who was a member of Odisha Legislative Assembly from 2009 until his murder, representing Jharsuguda. Originally a member of the Indian National Congress, he later switched to Biju Janata Dal.
Political career
Das was a member of Biju Janata Dal in Odisha politics. Earlier, he was in the Indian National Congress. Das was elected to the 14th Odisha Legislative Assembly with 62,663 votes. He was then elected to the 15th Odisha Legislative Assembly for his second term. He was also elected to the 16th Odisha Legislative Assembly for the third consecutive term. At the time of his death, he served as the state's Minister of Health and Family Welfare.
Death
On 29 January 2023, a policeman of ASI (Assistant sub-inspector) rank, fired four or five bullets on Das as he stepped out of his car at Gandhi square. The incident took place in Brajarajnagar, Jharsuguda district, when the minister was on his way to attend a meeting. He later died whilst undergoing treatment at Apollo hospital in Bhubaneswar. The Odisha Government ordered an inquiry into the incident. Then the crime branch took the accused policeman to the neighbouring Sundargargh district, where senior officers, including ADG Arun Bothra, questioned him.
"Health Minister Naba Das was admitted to Apollo with gunshot wounds to the left chest. A team of doctors led by Dr Debashish Nayak immediately attended to and operated on him. During the operation, it was found that a single bullet had entered and exited the body, injuring the heart and left lung and causing massive internal bleeding and injury. The injuries were repaired, and steps were taken to improve the pumping of the heart. He was given urgent ICU care. But despite best efforts, he could not be revived and succumbed to his injuries," the statement read.
A 3-day state mourning was declared in Odisha. According to an official statement from the Odisha government, the national flag flew at half-mast on the day of death and on the day of the funeral.
References
1962 births
2023 deaths
Biju Janata Dal politicians
Indian National Congress politicians from Odisha
Odisha MLAs 2019–2024
Odisha MLAs 2014–2019
Odisha MLAs 2009–2014
21st-century Indian politicians
Assassinated Indian politicians
People from Jharsuguda district
Deaths by firearm in India
2020s assassinated politicians
20th-century assassinated Indian politicians
|
Jesse David Jennings (July 7, 1909 – August 13, 1997) was an American archaeologist and anthropologist and founding director of the Natural History Museum of Utah. Based at the University of Utah, Jennings is best known for his work on desert west prehistory and his excavation of Danger Cave near Utah's Great Salt Lake. Considered an exacting academic scholar and author, he was known for conducting systematic excavations with order and cleanliness.
Jennings was born in Oklahoma City, Oklahoma on July 7, 1909 and grew up in New Mexico. He began his professional studies at the University of Chicago. In 1935, he married Jane Chase in Washington, D.C. The couple had two sons, David and Herbert. He served in World War II as a naval officer in the North Atlantic. Jennings died in his home in Siletz, Oregon, on August 13, 1997.
Career
In 1929, Jennings began archaeological excavations in the Midwest and Southeast as a graduate student at the University of Chicago. Jennings took several positions with the National Park Service, including serving as the first superintendent of the Ocmulgee National Monument in Macon, Georgia. In 1938 he and his wife dug with Alfred V. Kidder at Kaminaljuyu, Guatemala. His Ph.D. dissertation in 1943 was based on the Guatemala excavations.
In 1948, Jennings left the NPS for the University of Utah, where he taught until his retirement in 1986. Upon arriving at Utah, Jennings drew on his past experience to initiate a state-wide archaeological survey of the poorly known region through extensive surveys and test excavations. During his career, he conducted research and trained students in sites in the Great Basin, the Glen Canyon of the Colorado River, throughout Utah, and in American Samoa.
Jennings' work on Danger Cave in the 1950s was considered ground-breaking due to his exacting standards in excavation and data analysis. Relating the archaeological evidence from Danger Cave to an ethnographic model, Jennings framed a new view of the little-known Great Basin Desert culture. His work in the 1960s in the cultural region of the Ancient Pueblo People near modern Glen Canyon examined the use of agriculture in the canyon lands of southeastern Utah. In 1963, after a funding and development effort spanning twenty years, Jennings opened the Natural History Museum of Utah, the state's natural history museum, located at the University of Utah. From 1980 to 1994, Jennings also conducted graduate seminars as an adjunct professor at the University of Oregon.
Publications
During his career, Jennings produced many professional publications, including reports, reviews, comments, articles, chapters, and monographs. He also wrote textbooks and edited volumes on archaeology.
Selected publications:
The Importance of Scientific Method in Excavation (Bulletin of the Archaeological Society of North Carolina, Vol. 1, No. 1), (1934).
Excavations at Kaminaljuyu, Guatemala. Kidder, Alfred V., Jennings, Jesse D., Shook, Edwin M. Shook, with technological notes by Anna O. Shepard. Carnegie Institution of Washington. Publication 561. Washington, D.C. 1946.
Danger Cave (Society for American Archaeology Memoir No. 14, 1957).
Glen Canyon: A Summary (Anthropological Papers No. 81, University of Utah, 1966).
Prehistoric Man in the New World, edited with Edward Norbeck, (Chicago, 1964).
Prehistory of North America (McGraw-Hill, 1968).
Accidental Archaeologist: Memoirs of Jesse D. Jennings, autobiography, (University of Utah Press), (1994).
Honors
Editor, American Antiquity, 1950-1954.
Executive Board of the American Anthropological Association, 1953-1956.
Viking Medallist in Archaeology, 1958.
President of Society for American Archaeology, 1959-1960.
Vice-President of the American Association for the Advancement of Science, 1961.
Section H chairman of the American Association for the Advancement of Science, 1971.
University of Utah Distinguished Professor, 1974.
National Academy of Sciences, 1977.
University of Utah, honorary Doctorate of Science, 1980.
Distinguished Service Award, Society for American Archaeology, 1982.
Distinguished Service Award, Society for Conservation Archaeology, 1982.
featured speaker, 50th Anniversary of Society for American Archaeology, 1985.
Jesse D. Jennings Prize for Excellence established by the Great Basin Anthropological Conference, 1990.
A. V. Kidder Medal for Achievement in American Archaeology, 1995.
References
Accidental Archaeologist: Memoirs of Jesse D. Jennings University of Utah Press, 1994.
External links
Jesse D. Jennings biography 1909-1997
BIOGRAPHICAL MEMOIR by C. Melvin Aikens
National Academy of Sciences Biographical Memoir
1909 births
University of Utah faculty
University of Chicago alumni
1997 deaths
Members of the United States National Academy of Sciences
20th-century American archaeologists
|
Tennis competitions at the 2023 Pan American Games in Santiago, Chile are scheduled to be held from October 23 to 29. The competitions will take place at the Racket Sports Center, in Ñuñoa.
A total of 83 athletes (42 men and 41 women) are scheduled to compete in five events: singles and doubles for each gender and a mixed doubles event.
The top two in each individual event will qualify for the 2024 Summer Olympics, if ranked in the top 400 in the world by June 10, 2024, and if their country has not passed the maximum quota.
Qualification
A total of 82 tennis players will qualify to compete at the Games (41 men and 41 women). Each country is allowed to enter a maximum of three male and three female athletes (with one pair maximum in each of the doubles events). The singles events will consist of 41 men and 41 women respectively, with those athletes competing in the doubles events. The host nation Chile was allowed to enter with a maximum team of 6 athletes, while the remaining spots were distributed using two regional Games and the ATP rankings, WTA rankings and ITF rankings. A further three wildcards for men and women will be also awarded.
Participating nations
Medal summary
Medal table
Medalists
See also
Tennis at the 2024 Summer Olympics
References
Tennis at the 2023 Pan American Games
Events at the 2023 Pan American Games
Pan American Games
2023
|
Peter McCarthy may refer to:
Peter McCarthy (American film producer), film producer, director, screenwriter, and actor
Peter J McCarthy, Irish filmmaker, producer, photographer and artist
Peter McCarthy (industrialist) (1845–1919), American manufacturer, businessman and philanthropist from Troy, New York
Pete McCarthy (1951–2004), English comedian, radio and television presenter and travel writer.
Peter McCarthy, drummer with Big Tom and The Mainliners
|
Vanuatu is participating in the 2012 Summer Paralympics in London, United Kingdom, from August 29 to September 9, 2012. The country initially hoped to send athletes to compete in wheelchair tennis and track and field. Ultimately, however, its delegation was to consist in only one athlete, Marcel Houssimoli, in three sprinting events. He was the country's flag-bearer during the Games' opening ceremony.
Athletics
Marcel Houssimoli, a right hand amputee, received a wildcard invitation to compete in the men's 100m and 200m in the T37 disability category, and in the men's 400m T38. As the country's only competitor, he was also the country's opening ceremonies flag bearer.
In heat 1 in the 200m, he finished sixth and last, in 30.12 s. He was the only athlete not to use the starting blocks, and finished more than five seconds behind fifth-placed Rhys Jones of Great Britain.
In heat 1 in the 400m, he finished fifth and last, in 1:09.03, more than fifteen seconds behind the other athletes; the crowd cheered him on to the finish line. He was the only T37 athlete in the race; his opponents, categorised T38, had a lower level of disability. Despite his slow time, he qualified for the final as a fastest loser. He finished seventh and last in the final, improving his time to 1:07.61, fourteen seconds behind sixth-placed Marius Stander of South Africa.
In heat 1 in the 100m, he finished 9th and last, in 14.55.
Men's Track and Road Events
See also
Summer Paralympic disability classification
Vanuatu at the Paralympics
Vanuatu at the 2012 Summer Olympics
Notes
Nations at the 2012 Summer Paralympics
2012
Paralympics
|
```php
<?php
declare(strict_types=1);
namespace Doctrine\DBAL\Types;
use Doctrine\DBAL\Exception;
use function spl_object_id;
/**
* The type registry is responsible for holding a map of all known DBAL types.
* The types are stored using the flyweight pattern so that one type only exists as exactly one instance.
*/
final class TypeRegistry
{
/** @var array<string, Type> Map of type names and their corresponding flyweight objects. */
private array $instances;
/** @var array<int, string> */
private array $instancesReverseIndex;
/** @param array<string, Type> $instances */
public function __construct(array $instances = [])
{
$this->instances = [];
$this->instancesReverseIndex = [];
foreach ($instances as $name => $type) {
$this->register($name, $type);
}
}
/**
* Finds a type by the given name.
*
* @throws Exception
*/
public function get(string $name): Type
{
$type = $this->instances[$name] ?? null;
if ($type === null) {
throw Exception::unknownColumnType($name);
}
return $type;
}
/**
* Finds a name for the given type.
*
* @throws Exception
*/
public function lookupName(Type $type): string
{
$name = $this->findTypeName($type);
if ($name === null) {
throw Exception::typeNotRegistered($type);
}
return $name;
}
/**
* Checks if there is a type of the given name.
*/
public function has(string $name): bool
{
return isset($this->instances[$name]);
}
/**
* Registers a custom type to the type map.
*
* @throws Exception
*/
public function register(string $name, Type $type): void
{
if (isset($this->instances[$name])) {
throw Exception::typeExists($name);
}
if ($this->findTypeName($type) !== null) {
throw Exception::typeAlreadyRegistered($type);
}
$this->instances[$name] = $type;
$this->instancesReverseIndex[spl_object_id($type)] = $name;
}
/**
* Overrides an already defined type to use a different implementation.
*
* @throws Exception
*/
public function override(string $name, Type $type): void
{
$origType = $this->instances[$name] ?? null;
if ($origType === null) {
throw Exception::typeNotFound($name);
}
if (($this->findTypeName($type) ?? $name) !== $name) {
throw Exception::typeAlreadyRegistered($type);
}
unset($this->instancesReverseIndex[spl_object_id($origType)]);
$this->instances[$name] = $type;
$this->instancesReverseIndex[spl_object_id($type)] = $name;
}
/**
* Gets the map of all registered types and their corresponding type instances.
*
* @internal
*
* @return array<string, Type>
*/
public function getMap(): array
{
return $this->instances;
}
private function findTypeName(Type $type): ?string
{
return $this->instancesReverseIndex[spl_object_id($type)] ?? null;
}
}
```
|
```python
"""
Conversion of weight units.
__author__ = "Anubhav Solanki"
__license__ = "MIT"
__version__ = "1.1.0"
__maintainer__ = "Anubhav Solanki"
__email__ = "anubhavsolanki0@gmail.com"
USAGE :
-> Import this file into their respective project.
-> Use the function weight_conversion() for conversion of weight units.
-> Parameters :
-> from_type : From which type you want to convert
-> to_type : To which type you want to convert
-> value : the value which you want to convert
REFERENCES :
-> Wikipedia reference: path_to_url
-> Wikipedia reference: path_to_url
-> Wikipedia reference: path_to_url
-> Wikipedia reference: path_to_url
-> Wikipedia reference: path_to_url
-> Wikipedia reference: path_to_url
-> Wikipedia reference: path_to_url
-> Wikipedia reference: path_to_url
-> Wikipedia reference: path_to_url#Karat
-> Wikipedia reference: path_to_url
-> Wikipedia reference: path_to_url
"""
KILOGRAM_CHART: dict[str, float] = {
"kilogram": 1,
"gram": pow(10, 3),
"milligram": pow(10, 6),
"metric-ton": pow(10, -3),
"long-ton": 0.0009842073,
"short-ton": 0.0011023122,
"pound": 2.2046244202,
"stone": 0.1574731728,
"ounce": 35.273990723,
"carrat": 5000,
"atomic-mass-unit": 6.022136652e26,
}
WEIGHT_TYPE_CHART: dict[str, float] = {
"kilogram": 1,
"gram": pow(10, -3),
"milligram": pow(10, -6),
"metric-ton": pow(10, 3),
"long-ton": 1016.04608,
"short-ton": 907.184,
"pound": 0.453592,
"stone": 6.35029,
"ounce": 0.0283495,
"carrat": 0.0002,
"atomic-mass-unit": 1.660540199e-27,
}
def weight_conversion(from_type: str, to_type: str, value: float) -> float:
"""
Conversion of weight unit with the help of KILOGRAM_CHART
"kilogram" : 1,
"gram" : pow(10, 3),
"milligram" : pow(10, 6),
"metric-ton" : pow(10, -3),
"long-ton" : 0.0009842073,
"short-ton" : 0.0011023122,
"pound" : 2.2046244202,
"stone": 0.1574731728,
"ounce" : 35.273990723,
"carrat" : 5000,
"atomic-mass-unit" : 6.022136652E+26
>>> weight_conversion("kilogram","kilogram",4)
4
>>> weight_conversion("kilogram","gram",1)
1000
>>> weight_conversion("kilogram","milligram",4)
4000000
>>> weight_conversion("kilogram","metric-ton",4)
0.004
>>> weight_conversion("kilogram","long-ton",3)
0.0029526219
>>> weight_conversion("kilogram","short-ton",1)
0.0011023122
>>> weight_conversion("kilogram","pound",4)
8.8184976808
>>> weight_conversion("kilogram","stone",5)
0.7873658640000001
>>> weight_conversion("kilogram","ounce",4)
141.095962892
>>> weight_conversion("kilogram","carrat",3)
15000
>>> weight_conversion("kilogram","atomic-mass-unit",1)
6.022136652e+26
>>> weight_conversion("gram","kilogram",1)
0.001
>>> weight_conversion("gram","gram",3)
3.0
>>> weight_conversion("gram","milligram",2)
2000.0
>>> weight_conversion("gram","metric-ton",4)
4e-06
>>> weight_conversion("gram","long-ton",3)
2.9526219e-06
>>> weight_conversion("gram","short-ton",3)
3.3069366000000003e-06
>>> weight_conversion("gram","pound",3)
0.0066138732606
>>> weight_conversion("gram","stone",4)
0.0006298926912000001
>>> weight_conversion("gram","ounce",1)
0.035273990723
>>> weight_conversion("gram","carrat",2)
10.0
>>> weight_conversion("gram","atomic-mass-unit",1)
6.022136652e+23
>>> weight_conversion("milligram","kilogram",1)
1e-06
>>> weight_conversion("milligram","gram",2)
0.002
>>> weight_conversion("milligram","milligram",3)
3.0
>>> weight_conversion("milligram","metric-ton",3)
3e-09
>>> weight_conversion("milligram","long-ton",3)
2.9526219e-09
>>> weight_conversion("milligram","short-ton",1)
1.1023122e-09
>>> weight_conversion("milligram","pound",3)
6.6138732605999995e-06
>>> weight_conversion("milligram","ounce",2)
7.054798144599999e-05
>>> weight_conversion("milligram","carrat",1)
0.005
>>> weight_conversion("milligram","atomic-mass-unit",1)
6.022136652e+20
>>> weight_conversion("metric-ton","kilogram",2)
2000
>>> weight_conversion("metric-ton","gram",2)
2000000
>>> weight_conversion("metric-ton","milligram",3)
3000000000
>>> weight_conversion("metric-ton","metric-ton",2)
2.0
>>> weight_conversion("metric-ton","long-ton",3)
2.9526219
>>> weight_conversion("metric-ton","short-ton",2)
2.2046244
>>> weight_conversion("metric-ton","pound",3)
6613.8732606
>>> weight_conversion("metric-ton","ounce",4)
141095.96289199998
>>> weight_conversion("metric-ton","carrat",4)
20000000
>>> weight_conversion("metric-ton","atomic-mass-unit",1)
6.022136652e+29
>>> weight_conversion("long-ton","kilogram",4)
4064.18432
>>> weight_conversion("long-ton","gram",4)
4064184.32
>>> weight_conversion("long-ton","milligram",3)
3048138240.0
>>> weight_conversion("long-ton","metric-ton",4)
4.06418432
>>> weight_conversion("long-ton","long-ton",3)
2.999999907217152
>>> weight_conversion("long-ton","short-ton",1)
1.119999989746176
>>> weight_conversion("long-ton","pound",3)
6720.000000049448
>>> weight_conversion("long-ton","ounce",1)
35840.000000060514
>>> weight_conversion("long-ton","carrat",4)
20320921.599999998
>>> weight_conversion("long-ton","atomic-mass-unit",4)
2.4475073353955697e+30
>>> weight_conversion("short-ton","kilogram",3)
2721.5519999999997
>>> weight_conversion("short-ton","gram",3)
2721552.0
>>> weight_conversion("short-ton","milligram",1)
907184000.0
>>> weight_conversion("short-ton","metric-ton",4)
3.628736
>>> weight_conversion("short-ton","long-ton",3)
2.6785713457296
>>> weight_conversion("short-ton","short-ton",3)
2.9999999725344
>>> weight_conversion("short-ton","pound",2)
4000.0000000294335
>>> weight_conversion("short-ton","ounce",4)
128000.00000021611
>>> weight_conversion("short-ton","carrat",4)
18143680.0
>>> weight_conversion("short-ton","atomic-mass-unit",1)
5.463186016507968e+29
>>> weight_conversion("pound","kilogram",4)
1.814368
>>> weight_conversion("pound","gram",2)
907.184
>>> weight_conversion("pound","milligram",3)
1360776.0
>>> weight_conversion("pound","metric-ton",3)
0.001360776
>>> weight_conversion("pound","long-ton",2)
0.0008928571152432
>>> weight_conversion("pound","short-ton",1)
0.0004999999954224
>>> weight_conversion("pound","pound",3)
3.0000000000220752
>>> weight_conversion("pound","ounce",1)
16.000000000027015
>>> weight_conversion("pound","carrat",1)
2267.96
>>> weight_conversion("pound","atomic-mass-unit",4)
1.0926372033015936e+27
>>> weight_conversion("stone","kilogram",5)
31.751450000000002
>>> weight_conversion("stone","gram",2)
12700.58
>>> weight_conversion("stone","milligram",3)
19050870.0
>>> weight_conversion("stone","metric-ton",3)
0.01905087
>>> weight_conversion("stone","long-ton",3)
0.018750005325351003
>>> weight_conversion("stone","short-ton",3)
0.021000006421614002
>>> weight_conversion("stone","pound",2)
28.00000881870372
>>> weight_conversion("stone","ounce",1)
224.00007054835967
>>> weight_conversion("stone","carrat",2)
63502.9
>>> weight_conversion("ounce","kilogram",3)
0.0850485
>>> weight_conversion("ounce","gram",3)
85.0485
>>> weight_conversion("ounce","milligram",4)
113398.0
>>> weight_conversion("ounce","metric-ton",4)
0.000113398
>>> weight_conversion("ounce","long-ton",4)
0.0001116071394054
>>> weight_conversion("ounce","short-ton",4)
0.0001249999988556
>>> weight_conversion("ounce","pound",1)
0.0625000000004599
>>> weight_conversion("ounce","ounce",2)
2.000000000003377
>>> weight_conversion("ounce","carrat",1)
141.7475
>>> weight_conversion("ounce","atomic-mass-unit",1)
1.70724563015874e+25
>>> weight_conversion("carrat","kilogram",1)
0.0002
>>> weight_conversion("carrat","gram",4)
0.8
>>> weight_conversion("carrat","milligram",2)
400.0
>>> weight_conversion("carrat","metric-ton",2)
4.0000000000000003e-07
>>> weight_conversion("carrat","long-ton",3)
5.9052438e-07
>>> weight_conversion("carrat","short-ton",4)
8.818497600000002e-07
>>> weight_conversion("carrat","pound",1)
0.00044092488404000004
>>> weight_conversion("carrat","ounce",2)
0.0141095962892
>>> weight_conversion("carrat","carrat",4)
4.0
>>> weight_conversion("carrat","atomic-mass-unit",4)
4.8177093216e+23
>>> weight_conversion("atomic-mass-unit","kilogram",4)
6.642160796e-27
>>> weight_conversion("atomic-mass-unit","gram",2)
3.321080398e-24
>>> weight_conversion("atomic-mass-unit","milligram",2)
3.3210803980000002e-21
>>> weight_conversion("atomic-mass-unit","metric-ton",3)
4.9816205970000004e-30
>>> weight_conversion("atomic-mass-unit","long-ton",3)
4.9029473573977584e-30
>>> weight_conversion("atomic-mass-unit","short-ton",1)
1.830433719948128e-30
>>> weight_conversion("atomic-mass-unit","pound",3)
1.0982602420317504e-26
>>> weight_conversion("atomic-mass-unit","ounce",2)
1.1714775914938915e-25
>>> weight_conversion("atomic-mass-unit","carrat",2)
1.660540199e-23
>>> weight_conversion("atomic-mass-unit","atomic-mass-unit",2)
1.999999998903455
>>> weight_conversion("slug", "kilogram", 1)
Traceback (most recent call last):
...
ValueError: Invalid 'from_type' or 'to_type' value: 'slug', 'kilogram'
Supported values are: kilogram, gram, milligram, metric-ton, long-ton, short-ton, \
pound, stone, ounce, carrat, atomic-mass-unit
"""
if to_type not in KILOGRAM_CHART or from_type not in WEIGHT_TYPE_CHART:
msg = (
f"Invalid 'from_type' or 'to_type' value: {from_type!r}, {to_type!r}\n"
f"Supported values are: {', '.join(WEIGHT_TYPE_CHART)}"
)
raise ValueError(msg)
return value * KILOGRAM_CHART[to_type] * WEIGHT_TYPE_CHART[from_type]
if __name__ == "__main__":
import doctest
doctest.testmod()
```
|
Vuger Selo is a village in Croatia.
Populated places in the City of Zagreb
|
David Aworawo (born 5 October 1968) is a Nigerian Professor of International Relations and Strategic Studies, and the Head of the Department of History and Strategic Studies, University of Lagos, Nigeria. He specializes in strategic studies, international relations, political history and development studies. He has published widely in the areas of African politics and international relations.
Background
David Aworawo was born on 5 October 1968. Aworawo attended the University of Lagos, where he earned his B.A., M.A. and Ph.D. degrees in history in 1991, 1993 and 2001 respectively. For his doctoral thesis titled "Diplomacy and the Development of Equatorial Guinea, 1900–1990", Aworawo earned the Nigerian Universities Doctoral Theses Award in December 2003. As an undergraduate student, David Aworawo distinguished himself winning several awards from his sophomore years including University of Lagos Scholarship for the Best Students in 1989, 1990 and 1991. Upon graduation in 1992, he also won the Prof. Gabriel Olusanya Prize for the Best Graduating Student in History, and the Chief Ayo Rosiji Prize for the Best Project in History.
Career
Shortly after completing his doctoral programme in 2001, David Aworawo began his teaching career as the Lecturer and Head of the newly established Department of International Relations at the Igbinedion University, Okada, Edo State. The following year, he was appointed as a lecturer at his alma mater, the Department of History and Strategic Studies, University of Lagos and has continued to rise through the ranks until his appointment on August 1, 2020, as the head of the department.
David Aworawo is a Member of the following professional bodies: Historical Society of Nigeria, British Scholar Society, and Nigerian Society of International Affairs.
Beyond academia, Aworawo has served and serves in different public capacities. He is as a Consultant to the following organisations: Foreign Service Academy, Lagos; Presidential Amnesty Programme; and Nigerian Army College of Logistics, Lagos. He also served as a Consultant to ECOWAS and the Frederich Ebert Foundation on the Conflict in Guinea-Bissau in 2018; and as a Rapporteur, Committee on the Drafting of a New Nigerian Foreign Policy in 2011. From 2002 to 2003, Aworawo was a Member of the editorial board of The Comet (Nigeria) Newspaper, Lagos. Aworawo is a frequent guest analyst and sought-after commentator on different socio-political affairs television programmes and newspaper medium in Nigeria.
Selected works
"National Interest and Foreign Policy: The Dynamics of Nigerian-British Relations, 1960-1999," Valahian Journal of Historical Studies 16 (2011): 53–72.
"International Pressure and Domestic Politics: The Crisis of Democratic Values and Stability in Post-Independence Equatorial Guinea," Revista de Historia Actual 10, (2012): 43–54.
"Foreign Policy and the Travails of Nigerian Migrants in Equatorial Guinea", Nigerian Journal of International Affairs 25, no. 2 (1999): 23–45
"Backwards to the Future: Culture, Environmental Management and Sustainable Development in Nigeria since the mid-1970s", The Quint Journal 9, no. 2 (2017): 131–158
"Decisive Thaw: The Changing Pattern of Relations between Nigeria and Equatorial Guinea, 1980–2005" Journal of International and Global Studies 1, no. 2: 89-109
"Deprivation and Resistance: Environmental Crisis, Political Action and Conflict Resolution in the Niger Delta since the 1980s", Journal of International and Global Studies 4, no. 2 (2013): 52–70
"The Road Not Taken: Political Action and the Crisis of Democratic Values and Stability in Post-Independence Equatorial Guinea", Critical Issues in Justice and Politics 5, no. 2 (2012): 71–88
"Development Crisis and Ideological Shift: Africa’s Economic Policy in an Era Global Recession", African Journal of Governance and Development 1, no. 2 (2012): 13–28
"Economic Policy and the Social Context of Africa’s Development: An Analysis of the Experiences of Nigeria and Botswana," Journal of Sustainable Development in Africa 14, no. 3 (2012): 111–126
"Collision and Rapprochement: The Development of Nigerian-Gabonese Relations, 1960-1990," Journal of International Relations 8, no. 1 (2010): 54–73
"The Social and Cultural Dimensions of Nigerian-Jamaican Relations, 1975–2000," ABIBISEM: Journal of Culture and Civilization 1, no.1 (2008): 50–70
References
1968 births
Living people
University of Lagos alumni
Academic staff of the University of Lagos
International relations historians
Political historians
Nigerian academics
|
```javascript
/**
* @license Apache-2.0
*
*
*
* path_to_url
*
* Unless required by applicable law or agreed to in writing, software
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
*/
'use strict';
// MODULES //
var setReadOnly = require( '@stdlib/utils/define-nonenumerable-read-only-property' );
var dnanvariancepn = require( './dnanvariancepn.native.js' );
var ndarray = require( './ndarray.native.js' );
// MAIN //
setReadOnly( dnanvariancepn, 'ndarray', ndarray );
// EXPORTS //
module.exports = dnanvariancepn;
```
|
```swift
//
// SkipUntil.swift
// RxSwift
//
// Created by Yury Korolev on 10/3/15.
//
extension ObservableType {
/**
Returns the elements from the source observable sequence that are emitted after the other observable sequence produces an element.
- seealso: [skipUntil operator on reactivex.io](path_to_url
- parameter other: Observable sequence that starts propagation of elements of the source sequence.
- returns: An observable sequence containing the elements of the source sequence that are emitted after the other sequence emits an item.
*/
public func skipUntil<Source: ObservableType>(_ other: Source)
-> Observable<Element> {
return SkipUntil(source: self.asObservable(), other: other.asObservable())
}
}
final private class SkipUntilSinkOther<Other, Observer: ObserverType>
: ObserverType
, LockOwnerType
, SynchronizedOnType {
typealias Parent = SkipUntilSink<Other, Observer>
typealias Element = Other
fileprivate let _parent: Parent
var _lock: RecursiveLock {
return self._parent._lock
}
let _subscription = SingleAssignmentDisposable()
init(parent: Parent) {
self._parent = parent
#if TRACE_RESOURCES
_ = Resources.incrementTotal()
#endif
}
func on(_ event: Event<Element>) {
self.synchronizedOn(event)
}
func _synchronized_on(_ event: Event<Element>) {
switch event {
case .next:
self._parent._forwardElements = true
self._subscription.dispose()
case .error(let e):
self._parent.forwardOn(.error(e))
self._parent.dispose()
case .completed:
self._subscription.dispose()
}
}
#if TRACE_RESOURCES
deinit {
_ = Resources.decrementTotal()
}
#endif
}
final private class SkipUntilSink<Other, Observer: ObserverType>
: Sink<Observer>
, ObserverType
, LockOwnerType
, SynchronizedOnType {
typealias Element = Observer.Element
typealias Parent = SkipUntil<Element, Other>
let _lock = RecursiveLock()
fileprivate let _parent: Parent
fileprivate var _forwardElements = false
fileprivate let _sourceSubscription = SingleAssignmentDisposable()
init(parent: Parent, observer: Observer, cancel: Cancelable) {
self._parent = parent
super.init(observer: observer, cancel: cancel)
}
func on(_ event: Event<Element>) {
self.synchronizedOn(event)
}
func _synchronized_on(_ event: Event<Element>) {
switch event {
case .next:
if self._forwardElements {
self.forwardOn(event)
}
case .error:
self.forwardOn(event)
self.dispose()
case .completed:
if self._forwardElements {
self.forwardOn(event)
}
self.dispose()
}
}
func run() -> Disposable {
let sourceSubscription = self._parent._source.subscribe(self)
let otherObserver = SkipUntilSinkOther(parent: self)
let otherSubscription = self._parent._other.subscribe(otherObserver)
self._sourceSubscription.setDisposable(sourceSubscription)
otherObserver._subscription.setDisposable(otherSubscription)
return Disposables.create(_sourceSubscription, otherObserver._subscription)
}
}
final private class SkipUntil<Element, Other>: Producer<Element> {
fileprivate let _source: Observable<Element>
fileprivate let _other: Observable<Other>
init(source: Observable<Element>, other: Observable<Other>) {
self._source = source
self._other = other
}
override func run<Observer: ObserverType>(_ observer: Observer, cancel: Cancelable) -> (sink: Disposable, subscription: Disposable) where Observer.Element == Element {
let sink = SkipUntilSink(parent: self, observer: observer, cancel: cancel)
let subscription = sink.run()
return (sink: sink, subscription: subscription)
}
}
```
|
Parc des Sports Michel Hidalgo is a multi-use stadium in Sannois, France. It is currently used mostly for football matches and is the home stadium of Entente SSG. The stadium is able to hold 8,000 people.
References
Michel Hidalgo
Entente SSG
Sports venues in Val-d'Oise
|
Yazd-e Now (, also Romanized as Yazd Now) is a village in Bani Saleh Rural District, Neysan District, Hoveyzeh County, Khuzestan Province, Iran. At the 2006 census, its population was 527, in 97 families.
References
Populated places in Hoveyzeh County
|
```xml
export const GENERAL_SETTINGS = [
{
name: "General Settings",
text: "System Configuration",
icon: "icon-settings",
url: "/settings/general"
},
{
name: "General Settings",
text: "Permissions",
icon: "icon-settings",
url: "/settings/permissions"
},
{
name: "General Settings",
text: "Team Members",
icon: "icon-settings",
url: "/settings/team"
},
{
name: "General Settings",
text: "Brands",
icon: "icon-settings",
url: "/settings/brands"
},
{
name: "General Settings",
text: "Import & Export",
icon: "icon-settings",
url: "/settings/selectMenu"
}
];
export const ACTIONS = [
{
name: "Actions",
text: "Add brand",
icon: "icon-plus",
url: "/settings/brands#showBrandAddModal=true"
},
{
name: "Actions",
text: "Add permission",
icon: "icon-plus",
url: "/settings/permissions#showUserGroupAddModal=true"
},
{
name: "Actions",
text: "Add team member",
icon: "icon-plus",
url: "/settings/team#showMemberInviteModal=true"
},
{
name: "Actions",
text: "New Email",
icon: "icon-plus",
url: "#",
type: "email"
}
];
```
|
```c
/* $OpenBSD: s_log1pl.c,v 1.5 2017/01/21 08:29:13 krw Exp $ */
/*
*
* Permission to use, copy, modify, and distribute this software for any
* purpose with or without fee is hereby granted, provided that the above
* copyright notice and this permission notice appear in all copies.
*
* THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
* WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
* MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
* ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
* WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
* ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
* OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
*/
/* log1pl.c
*
* Relative error logarithm
* Natural logarithm of 1+x, long double precision
*
*
*
* SYNOPSIS:
*
* long double x, y, log1pl();
*
* y = log1pl( x );
*
*
*
* DESCRIPTION:
*
* Returns the base e (2.718...) logarithm of 1+x.
*
* The argument 1+x is separated into its exponent and fractional
* parts. If the exponent is between -1 and +1, the logarithm
* of the fraction is approximated by
*
* log(1+x) = x - 0.5 x^2 + x^3 P(x)/Q(x).
*
* Otherwise, setting z = 2(x-1)/x+1),
*
* log(x) = z + z^3 P(z)/Q(z).
*
*
*
* ACCURACY:
*
* Relative error:
* arithmetic domain # trials peak rms
* IEEE -1.0, 9.0 100000 8.2e-20 2.5e-20
*
* ERROR MESSAGES:
*
* log singularity: x-1 = 0; returns -INFINITY
* log domain: x-1 < 0; returns NAN
*/
#include <math.h>
#include "math_private.h"
/* Coefficients for log(1+x) = x - x^2 / 2 + x^3 P(x)/Q(x)
* 1/sqrt(2) <= x < sqrt(2)
* Theoretical peak relative error = 2.32e-20
*/
static long double P[] = {
4.5270000862445199635215E-5L,
4.9854102823193375972212E-1L,
6.5787325942061044846969E0L,
2.9911919328553073277375E1L,
6.0949667980987787057556E1L,
5.7112963590585538103336E1L,
2.0039553499201281259648E1L,
};
static long double Q[] = {
/* 1.0000000000000000000000E0,*/
1.5062909083469192043167E1L,
8.3047565967967209469434E1L,
2.2176239823732856465394E2L,
3.0909872225312059774938E2L,
2.1642788614495947685003E2L,
6.0118660497603843919306E1L,
};
/* Coefficients for log(x) = z + z^3 P(z^2)/Q(z^2),
* where z = 2(x-1)/(x+1)
* 1/sqrt(2) <= x < sqrt(2)
* Theoretical peak relative error = 6.16e-22
*/
static long double R[4] = {
1.9757429581415468984296E-3L,
-7.1990767473014147232598E-1L,
1.0777257190312272158094E1L,
-3.5717684488096787370998E1L,
};
static long double S[4] = {
/* 1.00000000000000000000E0L,*/
-2.6201045551331104417768E1L,
1.9361891836232102174846E2L,
-4.2861221385716144629696E2L,
};
static const long double C1 = 6.9314575195312500000000E-1L;
static const long double C2 = 1.4286068203094172321215E-6L;
#define SQRTH 0.70710678118654752440L
long double
log1pl(long double xm1)
{
long double x, y, z;
int e;
if( isnan(xm1) )
return(xm1);
if( xm1 == INFINITY )
return(xm1);
if(xm1 == 0.0)
return(xm1);
x = xm1 + 1.0L;
/* Test for domain errors. */
if( x <= 0.0L )
{
if( x == 0.0L )
return( -INFINITY );
else
return( NAN );
}
/* Separate mantissa from exponent.
Use frexp so that denormal numbers will be handled properly. */
x = frexpl( x, &e );
/* logarithm using log(x) = z + z^3 P(z)/Q(z),
where z = 2(x-1)/x+1) */
if( (e > 2) || (e < -2) )
{
if( x < SQRTH )
{ /* 2( 2x-1 )/( 2x+1 ) */
e -= 1;
z = x - 0.5L;
y = 0.5L * z + 0.5L;
}
else
{ /* 2 (x-1)/(x+1) */
z = x - 0.5L;
z -= 0.5L;
y = 0.5L * x + 0.5L;
}
x = z / y;
z = x*x;
z = x * ( z * __polevll( z, R, 3 ) / __p1evll( z, S, 3 ) );
z = z + e * C2;
z = z + x;
z = z + e * C1;
return( z );
}
/* logarithm using log(1+x) = x - .5x**2 + x**3 P(x)/Q(x) */
if( x < SQRTH )
{
e -= 1;
if (e != 0)
x = 2.0 * x - 1.0L;
else
x = xm1;
}
else
{
if (e != 0)
x = x - 1.0L;
else
x = xm1;
}
z = x*x;
y = x * ( z * __polevll( x, P, 6 ) / __p1evll( x, Q, 6 ) );
y = y + e * C2;
z = y - 0.5 * z;
z = z + x;
z = z + e * C1;
return( z );
}
DEF_STD(log1pl);
```
|
Regatta in Venice is a small oil-on canvas-painting executed c. 1770 by Francesco Guardi. It is now in The Frick Collection, New York. The painting was gifted to the museum by Helen Clay Frick, the daughter of Henry Clay Frick, who founded the Frick Collection. Its dimensions are 48.6 x 78.4 cm.
The painting depicts the Grand Canal (Venice). In the distance the Rialto Bridge is visible alongside the bell tower of the church of San Bartolomeo and the dome of the Church of Santi Giovanni e Paolo, Venice. Guardi has included this fifteenth century Italian Gothic Church as well as the more recent seventeenth century bell tower, documenting both historical and contemporary changes in the urban landscape. In the foreground of the painting Guardi paints the Palazzo Balbi built by Alessandro Vittoria from 1582 as the residence of the Venetian patrician family of the Balbi.
Guardi fills the Palazzo Balbi with people pouring onto balconies. This brings the viewer's attention to the regatta, the traditional Venetian boat race. Guardi has depicted the most exciting part of the Regatta race: the paleto. The paleto is a turning post that stands in the middle of the Grand Canal. At this juncture, the boats begin to turn around and the winners normally take the lead. The figures in Guardi’s picture push their oars into the water in different directions in a hurry to spin their boats.
The Venetian regatta race was normally preceded by bissone, traditional gondolier boats which would parade before the race to clear the waters and settle rowdy onlookers. Guardi paints these boats in bright colours with figures in matching costumes. Guardi's subject and style appears heavily Dutch influenced, with water, sky and light, prominent features in this architectural and perspectival composition. The cultural event and iconic architectural view was not uncommon in Guardi's time. Indeed, this very scene was also painted by Guardi's predecessor, Canaletto. Canaletto's The Grand Canal from the Palazzo Balbi in the Uffizi Gallery is painted from a similar viewpoint.
References
1770 paintings
Paintings by Francesco Guardi
Paintings in the Frick Collection
Maritime paintings
Cityscape paintings of Venice
|
During the summer of 2022, parts of Europe experienced drought conditions exacerbated by heat waves. On 9 August, a senior European Commission researcher said it seems to be Europe's worst year in 500 years. A report from the Global Drought Observatory has confirmed this. The drought had serious consequences for hydropower generation and the cooling systems of nuclear power plants, as the drought reduced the amount of river water available for cooling. Agriculture in Europe was also negatively affected by the drought.
France
Much of France experienced a drought. In early August, two-thirds of the country was at crisis alert. It has reportedly been caused by the historic heatwaves that have hit the country. July was reportedly the driest month in France for 60 years. By August, 100 villages had run out of drinking water. Water use was restricted in nearly all metropolitan departments of France. The Prime Minister of France Élisabeth Borne has called it "the country's worst drought in history". On 5 August, she announced the creation of an inter-ministerial crisis unit.
The national corn harvest was expected to be 18.5% lower than 2021. Milk shortages are expected to follow. Conversely, salt farms have benefited from the hot temperatures.
In July and August Gironde experienced numerous wild fires, see 2022 European and Mediterranean wildfires.
Germany
As of August 2022, the River Rhine's water level had fallen so much that shipping was affected. The water level in Emmerich sunk to -3 cm, being 10 cm lower than the previous record from 2018. The normal water level is 239 cm. Due to the low water levels, the cost of transporting goods multiplied because ships were only able to load 25-35% of their usual freight.
On 24 August, 54% of the German area was affected by an extraordinary drought. Further 24.6% by an extreme and further 12.2% by a severe drought.
Many districts and states banned water extraction from creeks, rivers and lakes, the watering of lawns, filling of pools or cleaning cars.
By mid August, the number of forest fires in the state of Brandenburg was three times as high than in all of 2021.
Italy
A state of emergency was declared in July 2022. Drought was blamed for the deaths of dozens of cows. Northern Italy experienced a drying up of important rivers like the Po.
Romania
Water restrictions were introduced in Romania in July 2022 in preparation for drought.
Serbia
Low water levels in the Danube River exposed the wrecks of dozens of German warships, sunk in late 1944 to block passage to the Soviets. The wrecks are still laden with ammunition and explosives, and present a safety hazard.
Spain and Portugal
The Iberian Peninsula experienced a drought. Water shortages were prevalent in Spain, leading to rationing. Portugal has also declared a drought crisis.
United Kingdom
July 2022 was the driest July in England since 1935. According to Sky News, in one in seven counties, it was the driest July since records began in 1836. As a result, hosepipe bans were introduced in some parts of South East England.
Fields and heathland dried up. On 12 August, a hosepipe ban came into force by South East Water. Drought-like conditions also affected South West England.
On 12 August, a drought was declared in eight of the 14 Environment Agency areas: Devon and Cornwall, Solent and South Downs, Kent and South London, Herts and North London, East Anglia, Thames, Lincolnshire and Northamptonshire, and the East Midlands. Electricity supplies are reportedly threatened. Reservoir levels are at a 25-year low. A drought was declared in the West Midlands region on 23 August, with the Environment Agency warning it had been using groundwater resources and reserves from reservoirs in Wales to help maintain the flows of the River Severn, which supplies six million people in the area.
On 15 August, a hosepipe ban was introduced in Cornwall for the first time in 26 years. On 18 August, a hosepipe ban in South West Wales was introduced affecting Pembrokeshire and parts of Carmarthenshire. Dŵr Cymru Welsh Water said that it would be likely to last into September. Hosepipe bans were also declared by Thames Water. On 19 August, a drought was declared in north Ceredigion, Teifi, Pembrokeshire, Carmarthen, Swansea, Llanelli, Neath Port Talbot and Bridgend. The River Black Bourn in Suffolk is reportedly "near dead".
On 30 August, a drought was declared in South West England, covering Bristol, Somerset, South Gloucestershire, Dorset and parts of Wiltshire.
Parts of Yorkshire experienced their driest period on record and emergency pipes were laid. In December 2022, Yorkshire Water lifted the hosepipe ban after three months.
The Cornwall hosepipe ban continued to be active into 2023, and was extended to cover large parts of Devon on 25 April 2023. This was done in an attempt to replenish water levels at the Roadford Reservoir ahead of that year's summer.
See also
Climate change in Europe
1540 European drought
2022 heat waves
2022 European heat waves
2023 European drought
2020–2023 North American drought
References
2022 droughts
Drought
2022 meteorology
2022 drought
Drought
August 2022 events in France
August 2022 events in Germany
August 2022 events in Italy
August 2022 events in Romania
August 2022 events in Spain
August 2022 events in Portugal
August 2022 events in the United Kingdom
|
```c++
//
// This source code is licensed under the BSD-style license found in the
// LICENSE file in the root directory of this source tree.
#include <caffe2/torch/csrc/jit/backends/xnnpack/serialization/serializer.h>
#include <torch/csrc/jit/backends/xnnpack/serialization/schema_generated.h>
#include <sstream>
namespace torch {
namespace jit {
namespace xnnpack {
namespace delegate {
using namespace fb_xnnpack;
void XNNSerializer::serializeAddNode(
uint32_t input1_id,
uint32_t input2_id,
uint32_t output_id,
uint32_t flags) {
const auto addNode =
CreateXNNAdd(_builder, input1_id, input2_id, output_id, flags);
const auto flatbufferNode =
CreateXNode(_builder, XNodeUnion::XNNAdd, addNode.Union());
_nodes.push_back(flatbufferNode);
}
size_t XNNSerializer::serializeData(const uint8_t* data_ptr, size_t num_bytes) {
size_t constant_buffer_idx = 0;
// Handling the tensor _values with data
if (data_ptr != nullptr) {
// steps:
// 1. creating flatbuffer byte-vector for tensor data
auto storage = _builder.CreateVector(data_ptr, num_bytes);
// 2. put it in the common buffer
constant_buffer_idx = _constantBuffer.size();
_constantBuffer.emplace_back(CreateBuffer(_builder, storage));
// 3. record size into bufferSizes
_bufferSizes.push_back(num_bytes);
assert(_bufferSizes.size() == _constantBuffer.size());
}
return constant_buffer_idx;
}
void XNNSerializer::serializeTensorValue(
uint32_t xnn_datatype,
size_t num_dims,
std::vector<size_t> dims,
size_t data_buffer_idx,
uint32_t external_id,
uint32_t flags,
uint32_t id_out) {
std::vector<uint32_t> serialized_dims;
serialized_dims.reserve(dims.size());
for (auto dim : dims) {
serialized_dims.push_back(static_cast<uint32_t>(dim));
}
const auto tensorValue = CreateXNNTensorValueDirect(
_builder,
XNNDatatype(xnn_datatype),
num_dims,
&serialized_dims,
data_buffer_idx,
external_id,
flags,
id_out);
const auto flatbufferValue =
CreateXValue(_builder, XValueUnion::XNNTensorValue, tensorValue.Union());
_values.push_back(flatbufferValue);
}
std::string XNNSerializer::finishAndSerialize(
std::vector<uint32_t> input_ids,
std::vector<uint32_t> output_ids,
size_t num_extern_ids) {
auto xnnGraph = CreateXNNGraphDirect(
_builder,
_version_sha1,
&_nodes,
&_values,
num_extern_ids,
&input_ids,
&output_ids,
&_constantBuffer,
&_bufferSizes);
_builder.Finish(xnnGraph);
std::stringstream ss;
ss.write(
reinterpret_cast<char*>(_builder.GetBufferPointer()), _builder.GetSize());
return ss.str();
}
} // namespace delegate
} // namespace xnnpack
} // namespace jit
} // namespace torch
```
|
Trzebień is a village in the administrative district of Gmina Magnuszew, within Kozienice County, Masovian Voivodeship, in east-central Poland. It lies approximately south of Magnuszew, north-west of Kozienice, and south-east of Warsaw.
References
Villages in Kozienice County
|
```java
/*
*
*
* path_to_url
*
* Unless required by applicable law or agreed to in writing,
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
* specific language governing permissions and limitations
*/
package org.wso2.ballerinalang.compiler.tree.statements;
import org.ballerinalang.model.clauses.OnFailClauseNode;
import org.ballerinalang.model.tree.NodeKind;
import org.ballerinalang.model.tree.statements.RetryNode;
import org.wso2.ballerinalang.compiler.tree.BLangNodeAnalyzer;
import org.wso2.ballerinalang.compiler.tree.BLangNodeTransformer;
import org.wso2.ballerinalang.compiler.tree.BLangNodeVisitor;
import org.wso2.ballerinalang.compiler.tree.BLangRetrySpec;
import org.wso2.ballerinalang.compiler.tree.clauses.BLangOnFailClause;
/**
* {@code BLangRetry} represents a retry statement within a transaction in Ballerina.
*
* @since 0.965.0
*/
public class BLangRetry extends BLangStatement implements RetryNode {
// BLangNodes
public BLangRetrySpec retrySpec;
public BLangBlockStmt retryBody;
public BLangOnFailClause onFailClause;
// Semantic Data
public BLangStatement commonStmtForRetries;
@Override
public BLangRetrySpec getRetrySpec() {
return retrySpec;
}
@Override
public void setRetrySpec(BLangRetrySpec retrySpec) {
this.retrySpec = retrySpec;
}
@Override
public BLangBlockStmt getRetryBody() {
return retryBody;
}
@Override
public void setRetryBody(BLangBlockStmt retryBody) {
this.retryBody = retryBody;
}
@Override
public OnFailClauseNode getOnFailClause() {
return this.onFailClause;
}
@Override
public void setOnFailClause(OnFailClauseNode onFailClause) {
this.onFailClause = (BLangOnFailClause) onFailClause;
}
@Override
public void accept(BLangNodeVisitor visitor) {
visitor.visit(this);
}
@Override
public <T> void accept(BLangNodeAnalyzer<T> analyzer, T props) {
analyzer.visit(this, props);
}
@Override
public <T, R> R apply(BLangNodeTransformer<T, R> modifier, T props) {
return modifier.transform(this, props);
}
@Override
public NodeKind getKind() {
return NodeKind.RETRY;
}
@Override
public String toString() {
return "Retry";
}
}
```
|
Heino Lipp (June 21, 1922 – August 28, 2006) was an Estonian athlete, who was one of the greatest decathlete in the decade of the 1940s, but he was never able to compete in the Olympic Games, because citizens of the Soviet Union were never allowed to travel outside the Soviet Union dominated Iron Curtain countries. He also competed in the shot put, making 6 European records in the event.
Career
Heino Lipp, born in Erra Parish (now Lüganuse Parish) near Kiviõli, Estonia was one of the great decathletes in history, but all his achievements have been obscured in the era of the Cold War politics. He was an Estonian, whose family were prominent advocates of Estonian sovereignty and brother was deemed a disloyal Estonian nationalist and was eventually murdered in a camp in Siberia. Therefore, Lipp was kept as a political prisoner and was periodically jailed by Soviet authorities. He was also not allowed to travel outside the Soviet Union.
In 1948 Track & Field News ranked him No. 1 in the T&FN World Rankings in decathlon. Four days after Bob Mathias won the 1948 Olympic decathlon with a total 7,139 points, Lipp, produced a decathlon score considerably higher than that of Mathias, scored 7,584 at a meeting in Tartu, Estonia and month after Olympics scored personal record 7,780 points in Kharkiv.
Lipp's achievement, however, was discounted or disbelieved in the West, because the Iron Curtain policies of Joseph Stalin did not allow foreign observers, so there was no way to verify the results. The West never saw Lipp perform, and neither did Soviet bloc countries other than the USSR. Lipp, for example, was not allowed to travel to Budapest for the World University Games in 1949. Photos of the physically imposing Lipp were done in the style of the superman image of the new Soviet man, a Stakhanovite.
In 1951 the Soviet Union joined the Olympic movement and participated in the 1952 Summer Olympics. Lipp's absence from the games was explained by the Soviet press as being due to “illness”. The real story is that the KGB had vetoed Lipp's participation in the Olympics even though it was short distance away in Helsinki, Finland. Competing in 1952, he probably would not have challenged eventual gold-medal winner Mathias, but a silver medal was well within the range of possibility. (Lipp's training was hampered when his scholarship was revoked in another Estonian repression in 1950, and he had to stalk deer and track small game animals daily to sustain himself.)
Lipp was a Soviet champion 12 times and set 13 national records, and never gave the Soviet regime any cause of concern, yet his “suspect” family made him a “political unreliable” to the authorities.
After Estonia broke from the Soviets in early 1990s Lipp came to United States for a Goodwill Games in Seattle as a guest of the US Chamber of Commerce.
He was out of favour with the authorities and did not get his chance to appear on an international stage until Barcelona when, at the age of 76, he proudly carried the Estonian flag at the opening ceremony of the 1992 Summer Olympics.
T&FN world rankings
Decathlon: 1947 – 2nd, 1948 – 1st, 1949 – 2nd, 1950 – 4th, 1953 – 4th
Shot put: 1947 – 1st, 1948 – 5th, 1949 – 7th, 1950 – 3 rd, 1951 – 3rd, 1952 – 9th, 1953 – 10th
Discus throw: 1947 – 5th, 1948 – 5th,
Records
European shot put records
16.66 24 May 1947 Tartu
16.72 7 July 1947 Tartu
16.73 3 September 1947 Kharkiv
16.93 6 August 1950 Moscow
16.95 17 June 1951 Põltsamaa
16.98 7 September 1951 Minsk
Estonian decathlon records (points table since 1936)
6631 1946 Tartu (11,2 – 6.23 – 14.72 – 1.65 – 53,3 – 15,6 – 38.90 – 3.10 – 50.06 – 5.04,8 )
7097 1947 Tallinn (11,5 – 6.08 – 15.50 – 1.65 – 51,2 – 15,6 – 45.44 – 3.10 – 52.59 – 4.42,6)
7584 1948 Tartu (11,3 – 6.40 – 16.04 – 1.70 – 51,7 – 15,4 – 46.78 – 3.40 – 59.07 – 4.49,4)
7780 (7072 points table since 1985) 11 September 1948 Kharkiv (11,4 – 6.13 – 16.18 – 1.70 – 50,2 – 15,4 – 47.55 – 3.40 – 61.96 – 4.35,0)
Estonian discus throw records
49.41 5 September 1947 Kharkiv
49.50 31 July 1947 Tartu
52.18 29 August 1948 Moscow
Personal records
100 m – 11,0s; long jump – 6,53m; shot put – 16.98m; high jump – 1,72m; 400 m – 50,2s; 110 m hurdles – 15,0s; discus throw – 52.18m; pole vault – 3.40m; javelin throw – 61.96m; 1,500 m – 4.33,2; decathlon – 7780p
Awards
1954 USSR Master of Sports
1965 USSR Master of Sports of International Class
1991 Honorary member of Estonian Olympic Committee
1992 Estonian Olympic team flag bearer at the Opening ceremony of the 1992 Summer Olympics in Barcelona
1998 Order of the White Star 3 class
1999 City of Tallinn Medal
References
External links
In Memoriam Heino Lipp: June 21, 1922 – August 28, 2006
Heino Lipp – 75 (et icon)
Track & Field News Rankings
1922 births
2006 deaths
People from Lüganuse Parish
Estonian decathletes
Estonian male shot putters
Estonian male discus throwers
Soviet decathletes
Soviet male shot putters
Soviet male discus throwers
Estonian prisoners and detainees
Prisoners and detainees of the Soviet Union
Recipients of the Order of the White Star, 3rd Class
|
Prasauni Bhatha is a [Bindabasini Rural Municipality Ward No.5] in Parsa District in the Narayani Zone southern Nepal. At the time of the 1991 Nepal census it had a population of 3917 people living in 618 individual households.
References
Populated places in Parsa District
|
These monasteries were dissolved by King Henry VIII of England in the Dissolution of the Monasteries. The list is by no means exhaustive, since over 800 religious houses existed before the Reformation, and virtually every town, of any size, had at least one abbey, priory, convent or friary in it. (Often many small houses of monks, nuns, canons or friars.)
See also
Dissolution of the Lesser Monasteries Act
Second Act of Dissolution
List of monastic houses in England
List of monastic houses in Wales
List of monastic houses in Ireland
[[List o manostic casa en du pales de galles
References
Henry VIII
List
|
```xml
import { Entity } from "../../../../src/decorator/entity/Entity"
import { PrimaryGeneratedColumn } from "../../../../src/decorator/columns/PrimaryGeneratedColumn"
import { Index } from "../../../../src/decorator/Index"
import { Column } from "../../../../src/decorator/columns/Column"
@Entity()
export class User {
@PrimaryGeneratedColumn()
id: number
@Column()
@Index()
email: string
@Column()
@Index()
username: string
@Column()
@Index()
privilege: number
}
```
|
```java
// 2016 and later: Unicode, Inc. and others.
/*
*******************************************************************************
* others. All Rights Reserved. *
*******************************************************************************
*/
package com.ibm.icu.dev.test.rbbi;
import java.text.CharacterIterator;
import java.util.Arrays;
import java.util.Locale;
import org.junit.Test;
import org.junit.runner.RunWith;
import org.junit.runners.JUnit4;
import com.ibm.icu.dev.test.CoreTestFmwk;
import com.ibm.icu.text.BreakIterator;
@RunWith(JUnit4.class)
public class BreakIteratorRegTest extends CoreTestFmwk
{
@Test
public void TestRegUnreg() {
Locale thailand_locale = new Locale("th", "TH", "");
Locale foo_locale = new Locale("fu", "FU", "FOO");
BreakIterator jwbi = BreakIterator.getWordInstance(Locale.JAPAN);
BreakIterator uwbi = BreakIterator.getWordInstance(Locale.US);
BreakIterator usbi = BreakIterator.getSentenceInstance(Locale.US);
BreakIterator twbi = BreakIterator.getWordInstance(thailand_locale);
BreakIterator rwbi = BreakIterator.getWordInstance(new Locale("", "", ""));
BreakIterator sbi = (BreakIterator)usbi.clone();
// todo: this will cause the test to fail, no way to set a breakiterator to null text so can't fix yet.
// String text = "This is some test, by golly. Boy, they don't make tests like they used to, do they? This here test ain't worth $2.50. Nope.";
// sbi.setText(text);
assertTrue(!BreakIterator.unregister(""), "unregister before register"); // coverage
Object key0 = BreakIterator.registerInstance((BreakIterator)twbi.clone(), foo_locale, BreakIterator.KIND_WORD);
Object key1 = BreakIterator.registerInstance(sbi, Locale.US, BreakIterator.KIND_WORD);
Object key2 = BreakIterator.registerInstance((BreakIterator)twbi.clone(), Locale.US, BreakIterator.KIND_WORD);
{
BreakIterator test0 = BreakIterator.getWordInstance(Locale.JAPAN);
BreakIterator test1 = BreakIterator.getWordInstance(Locale.US);
BreakIterator test2 = BreakIterator.getSentenceInstance(Locale.US);
BreakIterator test3 = BreakIterator.getWordInstance(thailand_locale);
BreakIterator test4 = BreakIterator.getWordInstance(foo_locale);
assertEqual(test0, jwbi, "japan word == japan word");
assertEqual(test1, twbi, "us word == thai word");
assertEqual(test2, usbi, "us sentence == us sentence");
assertEqual(test3, twbi, "thai word == thai word");
assertEqual(test4, twbi, "foo word == thai word");
}
//Locale[] locales = BreakIterator.getAvailableLocales();
assertTrue(BreakIterator.unregister(key2), "unregister us word (thai word)");
assertTrue(!BreakIterator.unregister(key2), "unregister second time");
boolean error = false;
try {
BreakIterator.unregister(null);
}
catch (IllegalArgumentException e) {
error = true;
}
assertTrue(error, "unregister null");
{
CharacterIterator sci = BreakIterator.getWordInstance(Locale.US).getText();
int len = sci.getEndIndex() - sci.getBeginIndex();
assertEqual(len, 0, "us word text: " + getString(sci));
}
assertTrue(Arrays.asList(BreakIterator.getAvailableLocales()).contains(foo_locale), "foo_locale");
assertTrue(BreakIterator.unregister(key0), "unregister foo word (thai word)");
assertTrue(!Arrays.asList(BreakIterator.getAvailableLocales()).contains(foo_locale), "no foo_locale");
assertEqual(BreakIterator.getWordInstance(Locale.US), usbi, "us word == us sentence");
assertTrue(BreakIterator.unregister(key1), "unregister us word (us sentence)");
{
BreakIterator test0 = BreakIterator.getWordInstance(Locale.JAPAN);
BreakIterator test1 = BreakIterator.getWordInstance(Locale.US);
BreakIterator test2 = BreakIterator.getSentenceInstance(Locale.US);
BreakIterator test3 = BreakIterator.getWordInstance(thailand_locale);
BreakIterator test4 = BreakIterator.getWordInstance(foo_locale);
assertEqual(test0, jwbi, "japanese word break");
assertEqual(test1, uwbi, "us sentence-word break");
assertEqual(test2, usbi, "us sentence break");
assertEqual(test3, twbi, "thai word break");
assertEqual(test4, rwbi, "root word break");
CharacterIterator sci = test1.getText();
int len = sci.getEndIndex() - sci.getBeginIndex();
assertEqual(len, 0, "us sentence-word break text: " + getString(sci));
}
}
private void assertEqual(Object lhs, Object rhs, String msg) {
msg(msg, lhs.equals(rhs) ? LOG : ERR, true, true);
}
private void assertEqual(int lhs, int rhs, String msg) {
msg(msg, lhs == rhs ? LOG : ERR, true, true);
}
private void assertTrue(boolean arg, String msg) {
msg(msg, arg ? LOG : ERR, true, true);
}
private static String getString(CharacterIterator ci) {
StringBuffer buf = new StringBuffer(ci.getEndIndex() - ci.getBeginIndex() + 2);
buf.append("'");
for (char c = ci.first(); c != CharacterIterator.DONE; c = ci.next()) {
buf.append(c);
}
buf.append("'");
return buf.toString();
}
}
```
|
```objective-c
//
// NSString+Dictionary.h
// iOS-Categories (path_to_url
//
// Created by Jakey on 14-6-13.
//
#import <Foundation/Foundation.h>
@interface NSString (DictionaryValue)
/**
* @brief JSONNSDictionary
*
* @return NSDictionary
*/
-(NSDictionary *) dictionaryValue;
@end
```
|
```smalltalk
Extension { #name : 'TextMethodLink' }
{ #category : '*Rubric-Editing-Core' }
TextMethodLink >> rubActOnClick: anEvent for: target in: aParagraph editor: anEditor [
self flag: #pharoTodo. "Complete implementation with class".
browseSenders == anEvent shiftPressed
ifTrue: [ anEditor editor implementorsOf: self selector ]
ifFalse: [ anEditor editor sendersOf: self selector ].
^ true
]
{ #category : '*Rubric-Editing-Core' }
TextMethodLink >> rubMayActOnEvent: anEvent [
^ anEvent isMouseMove or: [ super rubMayActOnEvent: anEvent ]
]
```
|
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.