diff --git a/src/bin/jbc2mpl b/src/bin/jbc2mpl index 745812e6c888ca39ac100e8c22bacd394ce67803..aee412a93af74206de4d8a8009ff55bfee4ca3f6 100755 Binary files a/src/bin/jbc2mpl and b/src/bin/jbc2mpl differ diff --git a/src/bin/maple b/src/bin/maple index 5a8f245b538c63a13b2d8719b4a97853b6bf9c75..618b90d182143618036632551d86c72417c6677a 100755 Binary files a/src/bin/maple and b/src/bin/maple differ diff --git a/src/deplibs/libmplphase.a b/src/deplibs/libmplphase.a index a75aedde6f3cffa44eb0c0c83d8cca2a17e35c09..47985003e41955818b7965894c26531c1474013d 100644 Binary files a/src/deplibs/libmplphase.a and b/src/deplibs/libmplphase.a differ diff --git a/src/deplibs/libmplutil.a b/src/deplibs/libmplutil.a index 616bd74788991ca6745a376b51ddd5676bee9818..fb345169d0763720bd6f77a3623afdcc03c466e1 100644 Binary files a/src/deplibs/libmplutil.a and b/src/deplibs/libmplutil.a differ diff --git a/src/maple_ir/include/metadata_layout.h b/src/maple_ir/include/metadata_layout.h index 491509be78437d83e02df77365407cda8d75263f..e531698d1c6c78669bce3f3183d940a539259519 100644 --- a/src/maple_ir/include/metadata_layout.h +++ b/src/maple_ir/include/metadata_layout.h @@ -255,7 +255,7 @@ struct ClassMetadataRO { static constexpr size_t kPageSize = 4096; static constexpr size_t kCacheLine = 64; -// according to kSpaceAnchor and kFireBreak defined in bpallocator.cpp +// according to kSpaceAnchor and kFireBreak defined in bp_allocator.cpp // the address of this readable page is set as kProtectedMemoryStart for java class static constexpr uintptr_t kClInitStateAddrBase = 0xc0000000 - (1u << 20) * 2; diff --git a/src/maple_ir/include/mir_nodes.h b/src/maple_ir/include/mir_nodes.h index 1789f2ed1973dbb9632f67ee4c8c2c5605acb39c..f7693c3dc7a485ccf47bdd0188084860852a834d 100644 --- a/src/maple_ir/include/mir_nodes.h +++ b/src/maple_ir/include/mir_nodes.h @@ -460,16 +460,8 @@ class IreadNode : public UnaryNode { return *base; } - bool IsVolatile() const { - MIRType *type = GlobalTables::GetTypeTable().GetTypeFromTyIdx(tyIdx); - ASSERT(type != nullptr, "null ptr check"); - if (fieldID == 0) { - return (type->HasVolatileField()); - } - ASSERT(type->IsStructType(), "Agg type check"); - auto *structType = static_cast(type); - return structType->IsFieldVolatile(fieldID); - } + bool IsVolatile() const; + protected: TyIdx tyIdx = TyIdx(0); FieldID fieldID = 0; @@ -1554,6 +1546,8 @@ class IassignNode : public StmtNode { rhs = node; } + bool AssigningVolatile() const; + private: TyIdx tyIdx; FieldID fieldID; @@ -2026,6 +2020,8 @@ class DassignNode : public UnaryStmtNode { fieldID = f; } + bool AssigningVolatile(const MIRModule &mod) const; + private: StIdx stIdx; FieldID fieldID = 0; diff --git a/src/maple_ir/src/mir_nodes.cpp b/src/maple_ir/src/mir_nodes.cpp index 7327a0bf056f95075ecc18e3535dd564e337feef..7f4f79f455733e0be763b1f210ecbb6f37231e52 100644 --- a/src/maple_ir/src/mir_nodes.cpp +++ b/src/maple_ir/src/mir_nodes.cpp @@ -133,12 +133,32 @@ bool AddrofNode::CheckNode(const MIRModule &mod) const { } } +bool IreadNode::IsVolatile() const { + MIRType *type = GlobalTables::GetTypeTable().GetTypeFromTyIdx(tyIdx); + ASSERT(type != nullptr, "null ptr check"); + ASSERT(type->IsMIRPtrType(), "type of iread should be pointer type"); + return static_cast(type)->IsPointedTypeVolatile(fieldID); +} + bool AddrofNode::IsVolatile(const MIRModule &mod) const { auto *symbol = mod.CurFunction()->GetLocalOrGlobalSymbol(stIdx); ASSERT(symbol != nullptr, "null ptr check on symbol"); return symbol->IsVolatile(); } +bool DassignNode::AssigningVolatile(const MIRModule &mod) const { + auto *symbol = mod.CurFunction()->GetLocalOrGlobalSymbol(stIdx); + ASSERT(symbol != nullptr, "null ptr check on symbol"); + return symbol->IsVolatile(); +} + +bool IassignNode::AssigningVolatile() const { + MIRType *type = GlobalTables::GetTypeTable().GetTypeFromTyIdx(tyIdx); + ASSERT(type != nullptr, "null ptr check"); + ASSERT(type->IsMIRPtrType(), "type of iassign should be pointer type"); + return static_cast(type)->IsPointedTypeVolatile(fieldID); +} + void BlockNode::AddStatement(StmtNode *stmt) { ASSERT(stmt != nullptr, "null ptr check"); stmtNodeList.push_back(stmt); diff --git a/src/maple_me/src/me_lower_globals.cpp b/src/maple_me/src/me_lower_globals.cpp index 2a664fc79521eff846ded557cf37a76ea9e91948..60431956a57e5e5b29503498bfaae6cf0896c643 100644 --- a/src/maple_me/src/me_lower_globals.cpp +++ b/src/maple_me/src/me_lower_globals.cpp @@ -66,6 +66,11 @@ void MeLowerGlobals::LowerGlobalDreads(MeStmt &stmt, MeExpr &expr) { } auto *addrofExpr = static_cast(irMap->CreateAddrofMeExpr(varExpr)); MIRPtrType ptrType(baseOst->GetTyIdx(), PTY_ptr); + if (ost->IsVolatile()) { + TypeAttrs attrs; + attrs.SetAttr(ATTR_volatile); + ptrType.SetTypeAttrs(attrs); + } TyIdx addrTyIdx = GlobalTables::GetTypeTable().GetOrCreateMIRType(&ptrType); auto *ivarExpr = static_cast(irMap->CreateIvarMeExpr(varExpr, addrTyIdx, *addrofExpr)); (void)irMap->ReplaceMeExprStmt(stmt, varExpr, *ivarExpr); @@ -119,6 +124,11 @@ void MeLowerGlobals::Run() { } MeExpr *addrof = irMap->CreateAddrofMeExpr(baseOst->GetIndex()); MIRPtrType ptrType(baseOst->GetTyIdx(), PTY_ptr); + if (ost->IsVolatile()) { + TypeAttrs attrs; + attrs.SetAttr(ATTR_volatile); + ptrType.SetTypeAttrs(attrs); + } TyIdx addrTyIdx = GlobalTables::GetTypeTable().GetOrCreateMIRType(&ptrType); MeExpr *lhs = dass.GetLHS(); CHECK_NULL_FATAL(lhs);