const_shared_ptr<Symbol> MaybeType::GetSymbol(const TypeTable& type_table, const_shared_ptr<TypeSpecifier> type_specifier, const_shared_ptr<void> value) const { auto cast = static_pointer_cast<const Sum>(value); const_shared_ptr<MaybeTypeSpecifier> specifier = make_shared< MaybeTypeSpecifier>(m_base_type_specifier, GetDefaultLocation()); return make_shared<Symbol>(specifier, cast); }
NS_IMETHODIMP nsImportGenericMail::WantsProgress(bool *_retval) { NS_PRECONDITION(_retval != nullptr, "null ptr"); if (!_retval) return NS_ERROR_NULL_POINTER; if (m_pThreadData) { m_pThreadData->DriverAbort(); m_pThreadData = nullptr; } if (!m_pMailboxes) { GetDefaultLocation(); GetDefaultMailboxes(); } if (!m_pDestFolder) { GetDefaultDestination(); } uint32_t totalSize = 0; bool result = false; if (m_pMailboxes) { uint32_t i; bool import; uint32_t count = 0; nsresult rv; uint32_t size; rv = m_pMailboxes->Count(&count); for (i = 0; i < count; i++) { nsCOMPtr<nsIImportMailboxDescriptor> box = do_QueryElementAt(m_pMailboxes, i); if (box) { import = false; size = 0; rv = box->GetImport(&import); if (import) { rv = box->GetSize(&size); result = true; } totalSize += size; } } m_totalSize = totalSize; } m_doImport = result; *_retval = result; return NS_OK; }
void FPURegCache::DiscardR(int i) { _assert_msg_(JIT, !regs[i].location.IsImm(), "FPU can't handle imm yet."); if (regs[i].away) { X64Reg xr = regs[i].location.GetSimpleReg(); _assert_msg_(JIT, xr >= 0 && xr < NUM_X_FPREGS, "DiscardR: MipsReg had bad X64Reg"); // Note that we DO NOT write it back here. That's the whole point of Discard. if (regs[i].lane != 0) { // But we can't just discard all of them in SIMD, just the one lane. // TODO: Potentially this could be more optimal (MOVQ or etc.) xregs[xr].mipsRegs[regs[i].lane - 1] = -1; regs[i].lane = 0; for (int j = 0; j < 4; ++j) { int mr = xregs[xr].mipsRegs[j]; if (mr == -1) { continue; } if (j != 0 && xregs[xr].dirty) { emit->SHUFPS(xr, Gen::R(xr), MMShuffleSwapTo0(j)); } OpArg newLoc = GetDefaultLocation(mr); if (xregs[xr].dirty) { emit->MOVSS(newLoc, xr); } regs[mr].location = newLoc; regs[mr].away = false; regs[mr].lane = 0; xregs[xr].mipsRegs[j] = -1; } } else { xregs[xr].mipsReg = -1; } xregs[xr].dirty = false; regs[i].location = GetDefaultLocation(i); regs[i].away = false; regs[i].tempLocked = false; } else { // _assert_msg_(DYNA_REC,0,"already stored"); regs[i].tempLocked = false; } Invariant(); }
NS_IMETHODIMP nsImportGenericMail::GetData(const char *dataId, nsISupports **_retval) { nsresult rv = NS_OK; NS_PRECONDITION(_retval != nullptr, "null ptr"); if (!_retval) return NS_ERROR_NULL_POINTER; *_retval = nullptr; if (!PL_strcasecmp(dataId, "mailInterface")) { *_retval = m_pInterface; NS_IF_ADDREF(m_pInterface); } if (!PL_strcasecmp(dataId, "mailBoxes")) { if (!m_pMailboxes) GetDefaultMailboxes(); *_retval = m_pMailboxes; NS_IF_ADDREF(m_pMailboxes); } if (!PL_strcasecmp(dataId, "mailLocation")) { if (!m_pSrcLocation) GetDefaultLocation(); NS_IF_ADDREF(*_retval = m_pSrcLocation); } if (!PL_strcasecmp(dataId, "mailDestination")) { if (!m_pDestFolder) GetDefaultDestination(); NS_IF_ADDREF(*_retval = m_pDestFolder); } if (!PL_strcasecmp(dataId, "migration")) { nsCOMPtr<nsISupportsPRBool> migrationString = do_CreateInstance(NS_SUPPORTS_PRBOOL_CONTRACTID, &rv); NS_ENSURE_SUCCESS(rv, rv); migrationString->SetData(m_performingMigration); NS_IF_ADDREF(*_retval = migrationString); } if (!PL_strcasecmp(dataId, "currentMailbox")) { // create an nsISupportsString, get the current mailbox // name being imported and put it in the string nsCOMPtr<nsISupportsString> data = do_CreateInstance(NS_SUPPORTS_STRING_CONTRACTID, &rv); if (NS_FAILED(rv)) return rv; if (m_pThreadData) { GetMailboxName(m_pThreadData->currentMailbox, data); } NS_ADDREF(*_retval = data); } return rv; }
void FPURegCache::SetupInitialRegs() { for (int i = 0; i < NUM_X_FPREGS; i++) { memset(xregsInitial[i].mipsRegs, -1, sizeof(xregsInitial[i].mipsRegs)); xregsInitial[i].dirty = false; } memset(regsInitial, 0, sizeof(regsInitial)); OpArg base = GetDefaultLocation(0); for (int i = 0; i < 32; i++) { regsInitial[i].location = base; base.IncreaseOffset(sizeof(float)); } for (int i = 32; i < 32 + 128; i++) { regsInitial[i].location = GetDefaultLocation(i); } base = GetDefaultLocation(32 + 128); for (int i = 32 + 128; i < NUM_MIPS_FPRS; i++) { regsInitial[i].location = base; base.IncreaseOffset(sizeof(float)); } }
ComplexInstantiationStatement::ComplexInstantiationStatement( const yy::location position, const_shared_ptr<ComplexTypeSpecifier> type_specifier, const yy::location type_specifier_location, const_shared_ptr<string> name, const yy::location name_position, const_shared_ptr<Expression> initializer_expression) : DeclarationStatement(position, name, name_position, initializer_expression, ModifierList::GetTerminator(), GetDefaultLocation()), m_type_specifier(type_specifier), m_type_specifier_location( type_specifier_location) { }
void FPURegCache::Start(MIPSState *mips, MIPSAnalyst::AnalysisResults &stats) { this->mips = mips; for (int i = 0; i < NUM_X_FPREGS; i++) { xregs[i].mipsReg = -1; xregs[i].dirty = false; } for (int i = 0; i < NUM_MIPS_FPRS; i++) { regs[i].location = GetDefaultLocation(i); regs[i].away = false; regs[i].locked = false; } }
NS_IMETHODIMP nsImportGenericMail::GetStatus(const char *statusKind, int32_t *_retval) { NS_PRECONDITION(statusKind != nullptr, "null ptr"); NS_PRECONDITION(_retval != nullptr, "null ptr"); if (!statusKind || !_retval) return NS_ERROR_NULL_POINTER; *_retval = 0; if (!PL_strcasecmp(statusKind, "isInstalled")) { GetDefaultLocation(); *_retval = (int32_t) m_found; } if (!PL_strcasecmp(statusKind, "canUserSetLocation")) { GetDefaultLocation(); *_retval = (int32_t) m_userVerify; } return NS_OK; }
const_shared_ptr<Result> FunctionDeclaration::FromTypeSpecifier( const FunctionTypeSpecifier& type_specifier, const TypeTable& type_table) { ErrorListRef errors = ErrorList::GetTerminator(); TypeSpecifierListRef subject = type_specifier.GetParameterTypeList(); DeclarationListRef result = DeclarationList::GetTerminator(); int count = 1; while (!TypeSpecifierList::IsTerminator(subject)) { ostringstream buf; const_shared_ptr<TypeSpecifier> data = subject->GetData(); buf << "Arg" << count; auto parameter_type_result = data->GetType(type_table); auto parameter_errors = parameter_type_result->GetErrors(); if (ErrorList::IsTerminator(parameter_errors)) { auto parameter_type = parameter_type_result->GetData<TypeDefinition>(); result = DeclarationList::From( parameter_type->GetDeclarationStatement( GetDefaultLocation(), data, GetDefaultLocation(), const_shared_ptr<string>(new string(buf.str())), GetDefaultLocation(), nullptr), result); } else { errors = ErrorList::Concatenate(errors, parameter_errors); } count++; subject = subject->GetNext(); } plain_shared_ptr<FunctionDeclaration> declaration = nullptr; if (ErrorList::IsTerminator(errors)) { DeclarationListRef declaration_list = DeclarationList::Reverse(result); declaration = make_shared<FunctionDeclaration>(declaration_list, type_specifier.GetReturnTypeSpecifier(), type_specifier.GetLocation()); } return make_shared<Result>(declaration, errors); }
NS_IMETHODIMP nsImportGenericAddressBooks::GetStatus(const char *statusKind, int32_t *_retval) { NS_PRECONDITION(statusKind != nullptr, "null ptr"); NS_PRECONDITION(_retval != nullptr, "null ptr"); if (!statusKind || !_retval) return NS_ERROR_NULL_POINTER; *_retval = 0; if (!PL_strcasecmp(statusKind, "isInstalled")) { GetDefaultLocation(); *_retval = (int32_t) m_found; } if (!PL_strcasecmp(statusKind, "canUserSetLocation")) { GetDefaultLocation(); *_retval = (int32_t) m_userVerify; } if (!PL_strcasecmp(statusKind, "autoFind")) { GetDefaultLocation(); *_retval = (int32_t) m_autoFind; } if (!PL_strcasecmp(statusKind, "supportsMultiple")) { bool multi = false; if (m_pInterface) m_pInterface->GetSupportsMultiple(&multi); *_retval = (int32_t) multi; } if (!PL_strcasecmp(statusKind, "needsFieldMap")) { bool needs = false; if (m_pInterface && m_pLocation) m_pInterface->GetNeedsFieldMap(m_pLocation, &needs); *_retval = (int32_t) needs; } return NS_OK; }
void FPURegCache::StoreFromRegister(int i) { _assert_msg_(DYNA_REC, !regs[i].location.IsImm(), "WTF - store - imm"); if (regs[i].away) { X64Reg xr = regs[i].location.GetSimpleReg(); _assert_msg_(DYNA_REC, xr < NUM_X_FPREGS, "WTF - store - invalid reg"); xregs[xr].dirty = false; xregs[xr].mipsReg = -1; OpArg newLoc = GetDefaultLocation(i); emit->MOVSS(newLoc, xr); regs[i].location = newLoc; regs[i].away = false; } else { // _assert_msg_(DYNA_REC,0,"already stored"); } }
NS_IMETHODIMP nsImportGenericAddressBooks::WantsProgress(PRBool *_retval) { NS_PRECONDITION(_retval != nsnull, "null ptr"); if (!_retval) return NS_ERROR_NULL_POINTER; if (m_pThreadData) { m_pThreadData->DriverAbort(); m_pThreadData = nsnull; } GetDefaultLocation(); GetDefaultBooks(); PRUint32 totalSize = 0; PRBool result = PR_FALSE; if (m_pBooks) { PRUint32 count = 0; nsresult rv = m_pBooks->Count( &count); PRUint32 i; PRBool import; PRUint32 size; for (i = 0; i < count; i++) { nsCOMPtr<nsIImportABDescriptor> book = do_QueryElementAt(m_pBooks, i); if (book) { import = PR_FALSE; size = 0; rv = book->GetImport( &import); if (import) { rv = book->GetSize( &size); result = PR_TRUE; } totalSize += size; } } m_totalSize = totalSize; } m_doImport = result; *_retval = result; return( NS_OK); }
void FPURegCache::DiscardR(int i) { _assert_msg_(JIT, !regs[i].location.IsImm(), "FPU can't handle imm yet."); if (regs[i].away) { X64Reg xr = regs[i].location.GetSimpleReg(); _assert_msg_(JIT, xr >= 0 && xr < NUM_X_FPREGS, "DiscardR: MipsReg had bad X64Reg"); // Note that we DO NOT write it back here. That's the whole point of Discard. xregs[xr].dirty = false; xregs[xr].mipsReg = -1; regs[i].location = GetDefaultLocation(i); regs[i].away = false; regs[i].tempLocked = false; } else { // _assert_msg_(DYNA_REC,0,"already stored"); regs[i].tempLocked = false; } }
NS_IMETHODIMP nsImportGenericAddressBooks::WantsProgress(bool *_retval) { NS_PRECONDITION(_retval != nullptr, "null ptr"); NS_ENSURE_ARG_POINTER(_retval); GetDefaultLocation(); GetDefaultBooks(); bool result = false; if (m_Books) { uint32_t count = 0; uint32_t i; bool import; uint32_t size; uint32_t totalSize = 0; m_Books->GetLength(&count); for (i = 0; i < count; i++) { nsCOMPtr<nsIImportABDescriptor> book = do_QueryElementAt(m_Books, i); if (book) { import = false; size = 0; nsresult rv = book->GetImport(&import); if (NS_SUCCEEDED(rv) && import) { (void) book->GetSize(&size); result = true; } totalSize += size; } } m_totalSize = totalSize; } m_doImport = result; *_retval = result; return NS_OK; }
const ErrorListRef ComplexType::Instantiate( const std::shared_ptr<ExecutionContext> execution_context, const_shared_ptr<ComplexTypeSpecifier> type_specifier, const_shared_ptr<std::string> instance_name, const_shared_ptr<Expression> initializer) const { ErrorListRef errors = ErrorList::GetTerminator(); SetResult set_result = SetResult::NO_SET_RESULT; yy::location location = GetDefaultLocation(); plain_shared_ptr<TypeSpecifier> initializer_type_specifier = nullptr; if (initializer && !initializer->IsConstant()) { location = initializer->GetLocation(); auto initializer_type_specifier_result = initializer->GetTypeSpecifier( execution_context); errors = initializer_type_specifier_result.GetErrors(); if (ErrorList::IsTerminator(errors)) { auto initializer_type_specifier = initializer_type_specifier_result.GetData(); auto result = initializer->Evaluate(execution_context, execution_context); errors = result->GetErrors(); if (ErrorList::IsTerminator(errors)) { set_result = InstantiateCore(execution_context, type_specifier, initializer_type_specifier, *instance_name, result->GetData<void>()); } } } if (set_result) { errors = ToErrorListRef(set_result, location, instance_name, execution_context->GetSymbol(*instance_name)->GetTypeSpecifier(), initializer_type_specifier); //initializer_type will be null if initializer is not set } return errors; }
void FPURegCache::DiscardVS(int vreg) { _assert_msg_(JIT, !vregs[vreg].location.IsImm(), "FPU can't handle imm yet."); if (vregs[vreg].away) { _assert_msg_(JIT, vregs[vreg].lane != 0, "VS expects a SIMD reg."); X64Reg xr = vregs[vreg].location.GetSimpleReg(); _assert_msg_(JIT, xr >= 0 && xr < NUM_X_FPREGS, "DiscardR: MipsReg had bad X64Reg"); // Note that we DO NOT write it back here. That's the whole point of Discard. for (int i = 0; i < 4; ++i) { int mr = xregs[xr].mipsRegs[i]; if (mr != -1) { regs[mr].location = GetDefaultLocation(mr); regs[mr].away = false; regs[mr].tempLocked = false; } xregs[xr].mipsRegs[i] = -1; } xregs[xr].dirty = false; } else { vregs[vreg].tempLocked = false; } Invariant(); }
void FPURegCache::StoreFromRegister(int i) { _assert_msg_(JIT, !regs[i].location.IsImm(), "WTF - store - imm"); if (regs[i].away) { X64Reg xr = regs[i].location.GetSimpleReg(); _assert_msg_(JIT, xr >= 0 && xr < NUM_X_FPREGS, "WTF - store - invalid reg"); if (regs[i].lane != 0) { const int *mri = xregs[xr].mipsRegs; int seq = 1; for (int i = 1; i < 4; ++i) { if (mri[i] == -1) { break; } if (voffset[mri[i] - 32] == voffset[mri[i - 1] - 32] + 1) { seq++; } else { break; } } // If we can do a multistore... if (seq == 2 || seq == 4) { OpArg newLoc = GetDefaultLocation(mri[0]); if (xregs[xr].dirty) { if (seq == 4) emit->MOVAPS(newLoc, xr); else emit->MOVQ_xmm(newLoc, xr); } for (int j = 0; j < seq; ++j) { int mr = xregs[xr].mipsRegs[j]; if (mr == -1) { continue; } OpArg newLoc = GetDefaultLocation(mr); regs[mr].location = newLoc; regs[mr].away = false; regs[mr].lane = 0; xregs[xr].mipsRegs[j] = -1; } } else { seq = 0; } // Store the rest. for (int j = seq; j < 4; ++j) { int mr = xregs[xr].mipsRegs[j]; if (mr == -1) { continue; } if (j != 0 && xregs[xr].dirty) { emit->SHUFPS(xr, Gen::R(xr), MMShuffleSwapTo0(j)); } OpArg newLoc = GetDefaultLocation(mr); if (xregs[xr].dirty) { emit->MOVSS(newLoc, xr); } regs[mr].location = newLoc; regs[mr].away = false; regs[mr].lane = 0; xregs[xr].mipsRegs[j] = -1; } } else { OpArg newLoc = GetDefaultLocation(i); xregs[xr].mipsReg = -1; if (xregs[xr].dirty) { emit->MOVSS(newLoc, xr); } regs[i].location = newLoc; } xregs[xr].dirty = false; regs[i].away = false; } else { // _assert_msg_(DYNA_REC,0,"already stored"); } Invariant(); }
NS_IMETHODIMP nsImportGenericAddressBooks::GetData(const char *dataId, nsISupports **_retval) { NS_PRECONDITION(_retval != nullptr, "null ptr"); if (!_retval) return NS_ERROR_NULL_POINTER; nsresult rv; *_retval = nullptr; if (!PL_strcasecmp(dataId, "addressInterface")) { *_retval = m_pInterface; NS_IF_ADDREF(m_pInterface); } if (!PL_strcasecmp(dataId, "addressLocation")) { if (!m_pLocation) GetDefaultLocation(); NS_IF_ADDREF(*_retval = m_pLocation); } if (!PL_strcasecmp(dataId, "addressBooks")) { if (!m_pLocation) GetDefaultLocation(); if (!m_Books) GetDefaultBooks(); *_retval = m_Books; } if (!PL_strcasecmp(dataId, "addressDestination")) { if (m_pDestinationUri) { nsCOMPtr<nsISupportsCString> abString = do_CreateInstance(NS_SUPPORTS_CSTRING_CONTRACTID, &rv); NS_ENSURE_SUCCESS(rv, rv); abString->SetData(nsDependentCString(m_pDestinationUri)); NS_IF_ADDREF(*_retval = abString); } } if (!PL_strcasecmp(dataId, "fieldMap")) { if (m_pFieldMap) { *_retval = m_pFieldMap; m_pFieldMap->AddRef(); } else { if (m_pInterface && m_pLocation) { bool needsIt = false; m_pInterface->GetNeedsFieldMap(m_pLocation, &needsIt); if (needsIt) { GetDefaultFieldMap(); if (m_pFieldMap) { *_retval = m_pFieldMap; m_pFieldMap->AddRef(); } } } } } if (!PL_strncasecmp(dataId, "sampleData-", 11)) { // extra the record number const char *pNum = dataId + 11; int32_t rNum = 0; while (*pNum) { rNum *= 10; rNum += (*pNum - '0'); pNum++; } IMPORT_LOG1("Requesting sample data #: %ld\n", (long)rNum); if (m_pInterface) { nsCOMPtr<nsISupportsString> data = do_CreateInstance(NS_SUPPORTS_STRING_CONTRACTID, &rv); if (NS_FAILED(rv)) return rv; char16_t * pData = nullptr; bool found = false; rv = m_pInterface->GetSampleData(rNum, &found, &pData); if (NS_FAILED(rv)) return rv; if (found) { data->SetData(nsDependentString(pData)); *_retval = data; NS_ADDREF(*_retval); } NS_Free(pData); } } return NS_OK; }