Pointer analysis

In computer science, pointer analysis, or points-to analysis, is a static code analysis technique that establishes which pointers, or heap references, can point to which variables, or storage locations. It is often a component of more complex analyses such as escape analysis. A closely related technique is shape analysis.

This is the most common colloquial use of the term. A secondary use has pointer analysis be the collective name for both points-to analysis, defined as above, and alias analysis. Points-to and alias analysis are closely related but not always equivalent problems.

Example

Consider the following C program:

int *id(int* p) {
  return p;
}
void main(void) {
  int x;
  int y;
  int *u = id(&x);
  int *v = id(&y);
}

A pointer analysis computes a mapping from pointer expressions to a set of allocation sites of objects they may point to. For the above program, an idealized, fully precise analysis would compute the following results:

Pointer expression Allocation site
&x main::x
&y main::y
u main::x
v main::y
p main::x, main::y

(Where X::Y represents the stack allocation holding the local variable Y in the function X.)

However, a context-insensitive analysis such as Andersen's or Steensgaard's algorithm would lose precision when analyzing the calls to id, and compute the following result:

Pointer expression Allocation site
&x main::x
&y main::y
u main::x, main::y
v main::x, main::y
p main::x, main::y

Introduction

As a form of static analysis, fully precise pointer analysis can be shown to be undecidable.[1] Most approaches are sound, but range widely in performance and precision. Many design decisions impact both the precision and performance of an analysis; often (but not always) lower precision yields higher performance. These choices include:[2][3]

  • Field sensitivity (also known as structure sensitivity): An analysis can either treat each field of a struct or object separately, or merge them.
  • Array sensitivity: An array-sensitive pointer analysis models each index in an array separately. Other choices include modelling just the first entry separately and the rest together, or merging all array entries.
  • Context sensitivity or polyvariance: Pointer analyses may qualify points-to information with a summary of the control flow leading to each program point.
  • Flow sensitivity: An analysis can model the impact of intraprocedural control flow on points-to facts.
  • Heap modeling: Run-time allocations may be abstracted by:
    • their allocation sites (the statement or instruction that performs the allocation, e.g., a call to malloc or an object constructor),
    • a more complex model based on a shape analysis,
    • the type of the allocation, or
    • one single allocation (this is called heap-insensitivity).
  • Heap cloning: Heap- and context-sensitive analyses may further qualify each allocation site by a summary of the control flow leading to the instruction or statement performing the allocation.
  • Subset constraints or equality constraints: When propagating points-to facts, different program statements may induce different constraints on a variable's points-to sets. Equality constraints (like those used in Steensgaard's algorithm) can be tracked with a union-find data structure, leading to high performance at the expense of the precision of a subset-constraint based analysis (e.g., Andersen's algorithm).

Context-insensitive, flow-insensitive algorithms

Pointer analysis algorithms are used to convert collected raw pointer usages (assignments of one pointer to another or assigning a pointer to point to another one) to a useful graph of what each pointer can point to.[4]

Steensgaard's algorithm and Andersen's algorithm are common context-insensitive, flow-insensitive algorithms for pointer analysis. They are often used in compilers, and have implementations in SVF [5] and LLVM.

Flow-insensitive approaches

Many approaches to flow-insensitive pointer analysis can be understood as forms of abstract interpretation, where heap allocations are abstracted by their allocation site (i.e., a program location).[6]

A diagram showing how pointer analysis abstracts runtime memory
Flow-insensitive pointer analyses often abstract possible runtime allocations by their allocation site. At runtime, this program creates three separate heap allocations. A flow-insensitive pointer analysis would treat these as a single abstract memory location, leading to a loss of precision.

Many flow-insensitive algorithms are specified in Datalog, including those in the Soot analysis framework for Java.[7]

Context-sensitive, flow-sensitive algorithms achieve higher precision, generally at the cost of some performance, by analyzing each procedure several times, once per context.[8] Most analyses use a "context-string" approach, where contexts consist of a list of entries (common choices of context entry include call sites, allocation sites, and types).[9] To ensure termination (and more generally, scalability), such analyses generally use a k-limiting approach, where the context has a fixed maximum size, and the least recently added elements are removed as needed.[10] Three common variants of context-sensitive, flow-insensitive analysis are:[11]

  • Call-site sensitivity
  • Object sensitivity
  • Type sensitivity

Call-site sensitivity

In call-site sensitivity, the points-to set of each variable (the set of abstract heap allocations each variable could point to) is further qualified by a context consisting of a list of callsites in the program. These contexts abstract the control-flow of the program.

The following program demonstrates how call-site sensitivity can achieve higher precision than a flow-insensitive, context-insensitive analysis.

int *id(int* p) {
  return p;
}
void main(void) {
  int x;
  int y;
  int *u = id(&x);  // main.3
  int *v = id(&y);  // main.4
}

For this program, a context-insensitive analysis would (soundly but imprecisely) conclude that p can point to either the allocation holding x or that of y, so u and v may alias, and both could point to either allocation:

Pointer expression Allocation site
&x main::x
&y main::y
u main::x, main::y
v main::x, main::y
p main::x, main::y

A callsite-sensitive analysis would analyze id twice, once for main.3 and once for main.4, and the points-to facts for p would be qualified by the call-site, enabling the analysis to deduce that when main returns, u can only point to the allocation holding x and v can only point to the allocation holding y:

Context Pointer expression Allocation site
[] &x main::x
[] &y main::y
[] u main::x
[] v main::y
[main.3] p main::x
[main.4] p main::y

Object sensitivity

In an object sensitive analysis, the points-to set of each variable is qualified by the abstract heap allocation of the receiver object of the method call. Unlike call-site sensitivity, object-sensitivity is non-syntactic or non-local: the context entries are derived during the points-to analysis itself.[12]

Type sensitivity

Type sensitivity is a variant of object sensitivity where the allocation site of the receiver object is replaced by the class/type containing the method containing the allocation site of the receiver object.[13] This results in strictly fewer contexts than would be used in an object-sensitive analysis, which generally means better performance.

References

  1. ^ Reps, Thomas (2000-01-01). "Undecidability of context-sensitive data-dependence analysis". ACM Transactions on Programming Languages and Systems. 22 (1): 162–186. doi:10.1145/345099.345137. ISSN 0164-0925. S2CID 2956433.
  2. ^ Barbara G. Ryder (2003). "Dimensions of Precision in Reference Analysis of Object-Oriented Programming Languages". Compiler Construction, 12th International Conference, CC 2003 Held as Part of the Joint European Conferences on Theory and Practice of Software, ETAPS 2003 Warsaw, Poland, April 7–11, 2003 Proceedings. pp. 126–137. doi:10.1007/3-540-36579-6_10.
  3. ^ (Hind)
  4. ^ Zyrianov, Vlas; Newman, Christian D.; Guarnera, Drew T.; Collard, Michael L.; Maletic, Jonathan I. (2019). "srcPtr: A Framework for Implementing Static Pointer Analysis Approaches" (PDF). ICPC '19: Proceedings of the 27th IEEE International Conference on Program Comprehension. Montreal, Canada: IEEE.
  5. ^ Sui, Yulei; Xue, Jingling (2016). "SVF: interprocedural static value-flow analysis in LLVM" (PDF). CC'16: Proceedings of the 25th international conference on compiler construction. ACM.
  6. ^ Smaragdakis, Yannis; Bravenboer, Martin; Lhoták, Ondrej (2011-01-26). "Pick your contexts well". Proceedings of the 38th annual ACM SIGPLAN-SIGACT symposium on Principles of programming languages. POPL '11. Austin, Texas, USA: Association for Computing Machinery. pp. 17–30. doi:10.1145/1926385.1926390. ISBN 978-1-4503-0490-0. S2CID 6451826.
  7. ^ Antoniadis, Tony; Triantafyllou, Konstantinos; Smaragdakis, Yannis (2017-06-18). "Porting doop to Soufflé". Proceedings of the 6th ACM SIGPLAN International Workshop on State of the Art in Program Analysis. SOAP 2017. Barcelona, Spain: Association for Computing Machinery. pp. 25–30. doi:10.1145/3088515.3088522. ISBN 978-1-4503-5072-3. S2CID 3074689.
  8. ^ (Smaragdakis & Balatsouras, p. 29)
  9. ^ Thiessen, Rei; Lhoták, Ondřej (2017-06-14). "Context transformations for pointer analysis". ACM SIGPLAN Notices. 52 (6): 263–277. doi:10.1145/3140587.3062359. ISSN 0362-1340.
  10. ^ (Li et al., pp. 1:4)
  11. ^ (Smaragdakis & Balatsouras)
  12. ^ (Smaragdakis & Balatsouras, p. 37)
  13. ^ (Smaragdakis & Balatsouras, p. 39)

Bibliography


Read other articles:

Scottish football player and manager (1934–2015) For other people named Dave Mackay, see David McKay. Dave Mackay Mackay in 2006Personal informationFull name David Craig Mackay[1]Date of birth (1934-11-14)14 November 1934Place of birth Edinburgh, ScotlandDate of death 2 March 2015(2015-03-02) (aged 80)Place of death Nottingham, EnglandHeight 5 ft 8 in (1.73 m)[2][3][4]Position(s) Left-half / SweeperSenior career*Years Team Apps (Gls)1953...

 

Surface-to-surface cruise missile SM-62 Snark TypeSurface-to-surface cruise missilePlace of originUnited StatesService historyIn service1959–61Used byUnited States Air ForceProduction historyManufacturerNorthrop CorporationProduced1958–61SpecificationsMass48,150 pounds (21,840 kg) without boosters; 60,000 pounds (27,000 kg) with boostersLength67 feet 2 inches (20.47 m)Wingspan42 feet 3 inches (12.88 m)WarheadW39 thermonuclear war...

 

Бальтазар Народився 54 до н. е.Помер 6 січня 55[1][2][3]Національність чорношкірі[d][4]Діяльність астролог, правительЧленство Три царя  Медіафайли у Вікісховищі Святий Бальтазар (також званий Бальтазар, Бальтасар і Бітісарія[5]) — згідно з західною

Fort Lauderdale–Hollywood International Airport Bandara Internasional Fort Lauderdale-HollywoodIATA: FLLICAO: KFLLFAA LID: FLL FLLLokasi di FloridaInformasiJenisPublikPemilikBroward CountyPengelolaBroward CountyMelayaniFlorida SelatanLokasiBroward County, FloridaMaskapai penghubung Spirit Airlines Yellow Air Taxi Maskapai utamaAllegiant AirKetinggian dpl3 mdplSitus webwww.broward.org/airportLandasan pacu Arah Panjang Permukaan kaki m 9L/27R 9,000 2,743 Aspal 9R/27L 5,276 1,608 Asp...

 

Diskografi Rieka RoslanRieka Roslan bersama The Groove dalam acara ESPOSE 2012 di venue Sabuga, 28 April 2012Album studio3Album kompilasi0Video musik5Extended play1Singel1Album soundtrack0 Berikut adalah diskografi lengkap dari penyanyi jazz dan soul berkebangsaan Indonesia, Rieka Roslan, yang juga merupakan vokalis The Groove. Album Album studio Tahun Rincian album 2005 Mata Ketiga Album studio pertama Label: (independen) Format: CD, digital download 2006 Bercerita Album studio kedua Label: ...

 

Artikel ini perlu diwikifikasi agar memenuhi standar kualitas Wikipedia. Anda dapat memberikan bantuan berupa penambahan pranala dalam, atau dengan merapikan tata letak dari artikel ini. Untuk keterangan lebih lanjut, klik [tampil] di bagian kanan. Mengganti markah HTML dengan markah wiki bila dimungkinkan. Tambahkan pranala wiki. Bila dirasa perlu, buatlah pautan ke artikel wiki lainnya dengan cara menambahkan [[ dan ]] pada kata yang bersangkutan (lihat WP:LINK untuk keterangan lebih lanjut...

Simon Mathew Simon Mathew (2008) Data i miejsce urodzenia 17 maja 1984 Hirtshals Gatunki pop, R&B, blues Zawód piosenkarz, autor piosenek Aktywność od 2005 Multimedia w Wikimedia Commons Strona internetowa Simon Mathew (ur. 17 maja 1984) – duński piosenkarz, reprezentant Danii w 53. Konkursie Piosenki Eurowizji w 2008 roku. Dyskografia Albumy studyjne Simon Mathew (2005) All for Fame (2008) Single „These Arms” (2005) „You Are the Music in” (2007) „All Night Long” (2...

 

Lighthouse in Maine, US LighthouseThe Cuckolds Light LocationBoothbay Harbor, MaineCoordinates43°46′46.2″N 69°39′0.017″W / 43.779500°N 69.65000472°W / 43.779500; -69.65000472TowerConstructed1892Automated1975Height14.5 m (48 ft) ShapeOctagonal Tower on DwellingMarkingsWhiteHeritageNational Register of Historic Places listed place Fog signalHORN: 1 every 15sLightFirst lit1907 (current structure)Focal height59 feet (18 m)Lens4th or...

 

Prasetiya HalimKomandan Lanud SupadioMasa jabatan4 November 2022 – 17 November 2023PendahuluDeni Hasoloan SimanjuntakPenggantiReka Budiarsa Informasi pribadiLahir15 Mei 1973 (umur 50)Padang Pariaman, Sumatera BaratKebangsaanIndonesiaAlma materAkademi Angkatan Udara (1994)Karier militerPihak IndonesiaDinas/cabang TNI Angkatan UdaraMasa dinas1994—sekarangPangkat Marsekal Pertama TNISatuanKorps PenerbangSunting kotak info • L • B Marsekal Pertama TNI Pra...

Artikel ini sebatang kara, artinya tidak ada artikel lain yang memiliki pranala balik ke halaman ini.Bantulah menambah pranala ke artikel ini dari artikel yang berhubungan atau coba peralatan pencari pranala.Tag ini diberikan pada April 2012. Accordéon MélancoliqueInformasi latar belakangAsalDriebergen-Rijsenburg, BelandaGenreBlues ChansonFilmKlasikLatinTangoMusik duniaInstrumenAkordeon, NyanyianTahun aktif1984 - sekarangLabelSterkenburg RecordsSitus webwww.acmel.nlAnggotaCherie de BoerJean...

 

This article is about the newspaper. For the 2011 film, see The Oregonian (film). For other uses, see Oregonian. Daily newspaper published in Portland, Oregon, U.S. The OregonianTypeDaily newspaperFormatTabloid (since April 2, 2014)Owner(s)Advance Publications[1]PublisherOregonian Media Group[2][3]EditorTherese Bottomly[4]Staff writers288/75 (full-time/part-time)[5]Founded1850Headquarters1500 SW First Avenue[6]Portland, Oregon97201CirculationSun...

 

Localização de Hong Kong e Macau As relações Hong Kong-Macau referem-se às relações bilaterais entre Hong Kong e Macau. História Hong Kong e Macau estão localizadas a leste e oeste do Delta do Rio das Pérolas, respectivamente, com uma distância aproximada de 64 km entre eles. As relações bilaterais de Hong Kong e Macau podem ser rastreadas desde o Neolítico Médio. Hong Kong e Macau estavam sob a influência do mesmo tipo de cultura neolítica. Ferramentas e ornamentos usados em...

Love VibesGenreYuri MangaPengarangErica SakurazawaPenerbitShueishaMajalahYoung YouTerbit19 September 1996Volume1 Film laga hidupKakera: A Piece of Our Life (カケラcode: ja is deprecated )Tayang3 April 2010  Portal anime dan manga Love Vibes adalah serial manga Jepang karya Erica Sakurazawa. Manga ini telah diadaptasikan ke film live-action pada tahun 2010. Manga Love Vibes dimulai sebagai sebuah serial manga yang ditulis dan diilustrasikan oleh Erica Sakurazawa, yang dimulai seria...

 

Japanese long-distance runner Yuma HattoriHattori at the 2019 Marathon Grand ChampionshipPersonal informationBorn (1993-11-13) 13 November 1993 (age 30)Tōkamachi, JapanHeight1.76 m (5 ft 9 in)Weight61 kg (134 lb)SportSportAthleticsEvents10000 metresHalf marathonMarathonUniversity teamToyo University Yuma Hattori (Japanese: 服部勇馬, romanized: Hattori Yūma; born 13 November 1993) is a Japanese long-distance runner.[1] In 2018, he won the Fukuok...

 

For the journalist by the same name see British journalism scandals. For the fictional character in J. R. R. Tolkien's legendarium, see Forlong the Fat Forlong in an 18th cεntury costume James George Roche Forlong (6 November 1824 – 29 March 1904[1]) was a Major General of the Indian Army who trained as a civil engineer in Scotland and England. He was renowned for his road-building skills through the jungles of India and Burma[2] and for his studies on comparative religion....

Campeonato Paulista de Futebol Feminino de 2020 Paulista Feminino 2020 Dados Participantes 12 Organização FPF Anfitrião São Paulo Período 17 de outubro – 20 de dezembro Gol(o)s 238 Partidas 49 Média 4,86 gol(o)s por partida Campeã Corinthians Vice-campeã Ferroviária Melhor marcadora Gabi Nunes (Corinthians) – 11 gols Maior goleada (diferença) Taboão da Serra 0–29 São PauloArena Barueri, Barueri21 de outubro, 2ª rodada ◄◄ 2019 2021 ►► O Campeonato Paulista de Fu...

 

Paroki Santo PetrusLokasiPastoran Katolik Kalirejo, 34174 Kabupaten Lampung TengahSejarahDidirikan3 Desember 1966[1]DedikasiSanto PetrusAdministrasiKeuskupanKeuskupan TanjungkarangImam yang bertugasRD. Andreas Basuki Wagiman RD. Stephanus Widiyanto [2] Paroki Santo Petrus, Kalirejo adalah salah satu paroki dalam Gereja Katolik Roma di bawah naungan Keuskupan Tanjungkarang. Gereja ini terletak di Pastoran Katolik Kalirejo, 34174, Lampung Tengah. Pelindung gereja dan paroki ini ...

 

Multi-purpose arena in Missouri Hearnes CenterLocation600 E Stadium Blvd Columbia, MO 65211OwnerUniv. of MissouriOperatorUniv. of MissouriCapacity13,611 (1972-present)ConstructionBroke ground1969OpenedAugust 4, 1972Construction cost$10.75 millionArchitectSverdrup & ParcelTenantsMissouri Tigers (NCAA)Men's basketball (1972–2004)Wrestling (1972–present)Track and field (fieldhouse annex) (1973–present)Women's basketball (1974–2004)Women's volleyball (1975–present)Women's gymnastics...

Idaho affiliate of the Democratic Party Idaho Democratic Party ChairpersonLauren NecocheaSenate Minority LeaderMelissa WintrowHouse Minority LeaderIlana RubelFounded1860sHeadquartersBoise, IdahoMembership (2021)145,479[1]IdeologyModern liberalismProgressivismNational affiliationDemocratic PartyColors  BlueSeats in the U.S. Senate0 / 2Seats in the United States House of Representatives0 / 2Seats in the Idaho Senate7 / 35Seats in the Idaho House of Representatives11 / 70Websitewww....

 

Un parque eólico es una agrupación de aerogeneradores que transforman la energía eólica en energía eléctrica. Estreno mundial: 11 aerogeneradores de 7,5 MW Enercon E126 de viento Estinnes, Bélgica, 10 de octubre de 2010. Parque eólico en el mar, en Copenhague. Los parques eólicos se pueden situar en tierra o en el mar («ultramar»), siendo los primeros los más habituales, aunque los parques marinos han experimentado un crecimiento importante en Europa en los últimos años. El núm...

 

Strategi Solo vs Squad di Free Fire: Cara Menang Mudah!