SlideShare a Scribd company logo
1 of 18
Download to read offline
Global Destruction
Thursday, May 8, 14
in 5 minutes
There’s another talk:
Global Destruction
in 20 Minutes
Thursday, May 8, 14
What is global
destruction?
Thursday, May 8, 14
What is global
destruction?
• Perl has a couple of run-time phases:
BEGIN, CHECK, UNITCHECK, INIT,
runloop, END, DESTRUCT
• perldoc perlmod
Thursday, May 8, 14
What is global
destruction?
• BEGIN, CHECK, UNITCHECK, INIT,
runloop, END, DESTRUCT
• DESTRUCT cannot be called by
DESTRUCT {} blocks.
Thursday, May 8, 14
What is global
destruction?
• BEGIN, CHECK, UNITCHECK, INIT,
runloop, END, DESTRUCT
• DESTRUCT cannot be called by
DESTRUCT {} blocks.
• the runloop neither
Thursday, May 8, 14
DESTRUCT
• DESTRUCT is executed after
PerlIO_destruct and before PerlIO_clean
• DESTRUCT calls DESTROY methods on all
objects which do have a DESTROY method
(sv_clean_obj)
Thursday, May 8, 14
package FINALE;
{
$ref3 = bless ["ok - package destruction"];
my $ref2 = bless ["ok - lexical destructionn"];
local $ref1 = bless ["ok - dynamic destructionn"];
1;
}
DESTROY {
print $_[0][0];
}
DEMO t/testc.sh -A -O3 -k 197
DESTRUCT
Thursday, May 8, 14
DESTRUCT
• Beware! Our current perlcc compiler does
not do global destruction.
• 2nd warning: our variables behave like
globals! Use only my, not our
Thursday, May 8, 14
package FINALE;
{
$ref3 = bless ["ok - package destructionn"];
my $ref2 = bless ["ok - lexical destructionn"];
our $ref4 = bless ["ok - our destructionn"];
local $ref1 = bless ["ok - dynamic destructionn"];
1;
}
DESTROY {
print $_[0][0];
}
=>
ok - dynamic destruction
ok - lexical destruction
ok - package destruction
ok - our destruction
DESTRUCT
Thursday, May 8, 14
perl debugging: -DD (-D? => D Cleaning up)
$ ./ccode197_o3 -DD
EXECUTING...
ok - dynamic destruction
ok - lexical destruction
Cursing named global static sv_arena:
Calling FINALE::DESTROY
ok - package destruction
sv_arena: 0x7ff9b982f600 - 0x7ff9b98305f0 (170)
sv_arena: 0x7ff9b982ae00 - 0x7ff9b982bdf0 (170)
sv_arena: 0x7ff9b9807800 - 0x7ff9b98087f0 (170)
Cleaning named glob IO object:
SV = PVIO(0x7ff9b982ce00) at 0x7ff9b982b7a8
REFCNT = 2
FLAGS = (OBJECT)
STASH = 0x7ff9b982b268! "IO::File"
...
DESTRUCT
Thursday, May 8, 14
ok - dynamic destruction
ok - lexical destruction
Cursing named global static sv_arena:
Calling FINALE::DESTROY
ok - package destruction
Cleaning object ref:
SV = IV(0x10076dce8) at 0x10076dcf8
REFCNT = 1
FLAGS = (ROK)
RV = 0x7fc549802aa8
SV = PVAV(0x7fc549005530) at 0x7fc549802aa8
FLAGS = (OBJECT)
STASH = 0x7fc5490287f8! "FINALE"
FLAGS = (REAL)
Elt No. 0
SV = PV(0x7fc549002780) at 0x7fc549802ac0
REFCNT = 1
FLAGS = (POK,pPOK)
PV = 0x7fc548d0ab50 "ok - our destructionn"0
CUR = 21
LEN = 32
ok - our destruction
DESTRUCT
Thursday, May 8, 14
Thursday, May 8, 14
DESTRUCT
• Beware! Our current perlcc compiler does
not do global destruction.
• The new 5.14 compiler can do global
destruction, but this is not stable yet
Thursday, May 8, 14
Takeaway
package FINALE;
{
$ref3 = bless ["ok - package destructionn"];
my $ref2 = bless ["ok - lexical destructionn"];
our $ref4 = bless ["ok - our destructionn"];
local $ref1 = bless ["ok - dynamic destructionn"];
1;
}
DESTROY {
print $_[0][0];
}
Never use global destruction
Thursday, May 8, 14
Takeaway
package FINALE;
{
$ref3 = bless ["ok - package destructionn"];
my $ref2 = bless ["ok - lexical destructionn"];
our $ref4 = bless ["ok - our destructionn"];
local $ref1 = bless ["ok - dynamic destructionn"];
1;
}
DESTROY {
print $_[0][0];
}
Never use global destruction
Never use our objects, always my
Thursday, May 8, 14
Why?
• With old perlcc DESTROY methods of
global or our objects are not called.
Thursday, May 8, 14
Questions?
Thursday, May 8, 14

More Related Content

What's hot

Introduction to Grails
Introduction to Grails Introduction to Grails
Introduction to Grails Avi Perez
 
using Virtualbox NAT and shared folder
using Virtualbox NAT and shared folderusing Virtualbox NAT and shared folder
using Virtualbox NAT and shared folderYingshiuan Pan
 
it's only abuse if it crashes
it's only abuse if it crashesit's only abuse if it crashes
it's only abuse if it crashesEleanor McHugh
 
Ceph OSD Op trace
Ceph OSD Op traceCeph OSD Op trace
Ceph OSD Op trace畅 刘
 
Raspberry Pi for IPRUG
Raspberry Pi for IPRUGRaspberry Pi for IPRUG
Raspberry Pi for IPRUGFrank Carver
 
Hudson以外の何か with 任意
Hudson以外の何か with 任意Hudson以外の何か with 任意
Hudson以外の何か with 任意bleis tift
 
シェル芸でライフハック(特論)
シェル芸でライフハック(特論)シェル芸でライフハック(特論)
シェル芸でライフハック(特論)Yuki Shimazaki
 
Os Practical Assignment 1
Os Practical Assignment 1Os Practical Assignment 1
Os Practical Assignment 1Emmanuel Garcia
 
Mikhail Belopuhov: OpenBSD: Where is crypto headed?
Mikhail Belopuhov: OpenBSD: Where is crypto headed?Mikhail Belopuhov: OpenBSD: Where is crypto headed?
Mikhail Belopuhov: OpenBSD: Where is crypto headed?Yandex
 
Devoxx Ukraine 2018 - Kotlin DSL in under an hour
Devoxx Ukraine 2018 - Kotlin DSL in under an hourDevoxx Ukraine 2018 - Kotlin DSL in under an hour
Devoxx Ukraine 2018 - Kotlin DSL in under an hourAnton Arhipov
 
GeeCON Prague 2018 - Kotlin DSL in under an hour
GeeCON Prague 2018 - Kotlin DSL in under an hourGeeCON Prague 2018 - Kotlin DSL in under an hour
GeeCON Prague 2018 - Kotlin DSL in under an hourAnton Arhipov
 
Tutorial to make sure of nginx files starterpack.
Tutorial to make sure of nginx files starterpack.Tutorial to make sure of nginx files starterpack.
Tutorial to make sure of nginx files starterpack.Takashi Yoshioka
 

What's hot (14)

Introduction to Grails
Introduction to Grails Introduction to Grails
Introduction to Grails
 
using Virtualbox NAT and shared folder
using Virtualbox NAT and shared folderusing Virtualbox NAT and shared folder
using Virtualbox NAT and shared folder
 
gemdiff
gemdiffgemdiff
gemdiff
 
it's only abuse if it crashes
it's only abuse if it crashesit's only abuse if it crashes
it's only abuse if it crashes
 
Ceph OSD Op trace
Ceph OSD Op traceCeph OSD Op trace
Ceph OSD Op trace
 
Raspberry Pi for IPRUG
Raspberry Pi for IPRUGRaspberry Pi for IPRUG
Raspberry Pi for IPRUG
 
Hudson以外の何か with 任意
Hudson以外の何か with 任意Hudson以外の何か with 任意
Hudson以外の何か with 任意
 
シェル芸でライフハック(特論)
シェル芸でライフハック(特論)シェル芸でライフハック(特論)
シェル芸でライフハック(特論)
 
Os Practical Assignment 1
Os Practical Assignment 1Os Practical Assignment 1
Os Practical Assignment 1
 
Mikhail Belopuhov: OpenBSD: Where is crypto headed?
Mikhail Belopuhov: OpenBSD: Where is crypto headed?Mikhail Belopuhov: OpenBSD: Where is crypto headed?
Mikhail Belopuhov: OpenBSD: Where is crypto headed?
 
Devoxx Ukraine 2018 - Kotlin DSL in under an hour
Devoxx Ukraine 2018 - Kotlin DSL in under an hourDevoxx Ukraine 2018 - Kotlin DSL in under an hour
Devoxx Ukraine 2018 - Kotlin DSL in under an hour
 
GeeCON Prague 2018 - Kotlin DSL in under an hour
GeeCON Prague 2018 - Kotlin DSL in under an hourGeeCON Prague 2018 - Kotlin DSL in under an hour
GeeCON Prague 2018 - Kotlin DSL in under an hour
 
Vim再入門
Vim再入門Vim再入門
Vim再入門
 
Tutorial to make sure of nginx files starterpack.
Tutorial to make sure of nginx files starterpack.Tutorial to make sure of nginx files starterpack.
Tutorial to make sure of nginx files starterpack.
 

Viewers also liked

Gold - global initiative against COPD
Gold - global initiative against COPDGold - global initiative against COPD
Gold - global initiative against COPDadithya2115
 
Mechanical Ventilation in ARDS vs COPD
Mechanical Ventilation in ARDS vs COPDMechanical Ventilation in ARDS vs COPD
Mechanical Ventilation in ARDS vs COPDcairo1957
 
Role of Inhaled Corticosteroids in COPD
Role of Inhaled Corticosteroids  in COPDRole of Inhaled Corticosteroids  in COPD
Role of Inhaled Corticosteroids in COPDGamal Agmy
 
COPD (Chronic obstructive Pulmonary Disease) PowerPoint Presentation -aslam
COPD  (Chronic obstructive Pulmonary Disease) PowerPoint Presentation -aslamCOPD  (Chronic obstructive Pulmonary Disease) PowerPoint Presentation -aslam
COPD (Chronic obstructive Pulmonary Disease) PowerPoint Presentation -aslamDr.Aslam calicut
 

Viewers also liked (7)

Gold - global initiative against COPD
Gold - global initiative against COPDGold - global initiative against COPD
Gold - global initiative against COPD
 
Nebulizer
NebulizerNebulizer
Nebulizer
 
Mechanical Ventilation in ARDS vs COPD
Mechanical Ventilation in ARDS vs COPDMechanical Ventilation in ARDS vs COPD
Mechanical Ventilation in ARDS vs COPD
 
Role of Inhaled Corticosteroids in COPD
Role of Inhaled Corticosteroids  in COPDRole of Inhaled Corticosteroids  in COPD
Role of Inhaled Corticosteroids in COPD
 
ppok
ppokppok
ppok
 
COPD
COPDCOPD
COPD
 
COPD (Chronic obstructive Pulmonary Disease) PowerPoint Presentation -aslam
COPD  (Chronic obstructive Pulmonary Disease) PowerPoint Presentation -aslamCOPD  (Chronic obstructive Pulmonary Disease) PowerPoint Presentation -aslam
COPD (Chronic obstructive Pulmonary Disease) PowerPoint Presentation -aslam
 

Similar to Global destruction (in 5 minutes)

Naughty And Nice Bash Features
Naughty And Nice Bash FeaturesNaughty And Nice Bash Features
Naughty And Nice Bash FeaturesNati Cohen
 
Kernel Recipes 2016 - Why you need a test strategy for your kernel development
Kernel Recipes 2016 - Why you need a test strategy for your kernel developmentKernel Recipes 2016 - Why you need a test strategy for your kernel development
Kernel Recipes 2016 - Why you need a test strategy for your kernel developmentAnne Nicolas
 
Kotlin coroutine - the next step for RxJava developer?
Kotlin coroutine - the next step for RxJava developer?Kotlin coroutine - the next step for RxJava developer?
Kotlin coroutine - the next step for RxJava developer?Artur Latoszewski
 
Hands-On Session Docker
Hands-On Session DockerHands-On Session Docker
Hands-On Session DockerLinetsChile
 
Dockerize everything TopConf Tallinn
Dockerize everything TopConf TallinnDockerize everything TopConf Tallinn
Dockerize everything TopConf TallinnThomas Einwaller
 
Complementing Docker with Puppet
Complementing Docker with PuppetComplementing Docker with Puppet
Complementing Docker with PuppetDocker, Inc.
 
The Next Step in AS3 Framework Evolution - FITC Amsterdam 2013
The Next Step in AS3 Framework Evolution - FITC Amsterdam 2013The Next Step in AS3 Framework Evolution - FITC Amsterdam 2013
The Next Step in AS3 Framework Evolution - FITC Amsterdam 2013Raimundas Banevičius
 
Использование Docker в CI / Александр Акбашев (HERE Technologies)
Использование Docker в CI / Александр Акбашев (HERE Technologies)Использование Docker в CI / Александр Акбашев (HERE Technologies)
Использование Docker в CI / Александр Акбашев (HERE Technologies)Ontico
 
Agile Iphone Development
Agile Iphone DevelopmentAgile Iphone Development
Agile Iphone DevelopmentGiordano Scalzo
 
Everything you wanted to know about Stack Traces and Heap Dumps
Everything you wanted to know about Stack Traces and Heap DumpsEverything you wanted to know about Stack Traces and Heap Dumps
Everything you wanted to know about Stack Traces and Heap DumpsAndrei Pangin
 

Similar to Global destruction (in 5 minutes) (11)

Naughty And Nice Bash Features
Naughty And Nice Bash FeaturesNaughty And Nice Bash Features
Naughty And Nice Bash Features
 
Kernel Recipes 2016 - Why you need a test strategy for your kernel development
Kernel Recipes 2016 - Why you need a test strategy for your kernel developmentKernel Recipes 2016 - Why you need a test strategy for your kernel development
Kernel Recipes 2016 - Why you need a test strategy for your kernel development
 
Kotlin coroutine - the next step for RxJava developer?
Kotlin coroutine - the next step for RxJava developer?Kotlin coroutine - the next step for RxJava developer?
Kotlin coroutine - the next step for RxJava developer?
 
Hands-On Session Docker
Hands-On Session DockerHands-On Session Docker
Hands-On Session Docker
 
Dockerize everything TopConf Tallinn
Dockerize everything TopConf TallinnDockerize everything TopConf Tallinn
Dockerize everything TopConf Tallinn
 
Complementing Docker with Puppet
Complementing Docker with PuppetComplementing Docker with Puppet
Complementing Docker with Puppet
 
The Next Step in AS3 Framework Evolution - FITC Amsterdam 2013
The Next Step in AS3 Framework Evolution - FITC Amsterdam 2013The Next Step in AS3 Framework Evolution - FITC Amsterdam 2013
The Next Step in AS3 Framework Evolution - FITC Amsterdam 2013
 
Использование Docker в CI / Александр Акбашев (HERE Technologies)
Использование Docker в CI / Александр Акбашев (HERE Technologies)Использование Docker в CI / Александр Акбашев (HERE Technologies)
Использование Docker в CI / Александр Акбашев (HERE Technologies)
 
Agile Iphone Development
Agile Iphone DevelopmentAgile Iphone Development
Agile Iphone Development
 
Current State of Coroutines
Current State of CoroutinesCurrent State of Coroutines
Current State of Coroutines
 
Everything you wanted to know about Stack Traces and Heap Dumps
Everything you wanted to know about Stack Traces and Heap DumpsEverything you wanted to know about Stack Traces and Heap Dumps
Everything you wanted to know about Stack Traces and Heap Dumps
 

Recently uploaded

Call for Papers - African Journal of Biological Sciences, E-ISSN: 2663-2187, ...
Call for Papers - African Journal of Biological Sciences, E-ISSN: 2663-2187, ...Call for Papers - African Journal of Biological Sciences, E-ISSN: 2663-2187, ...
Call for Papers - African Journal of Biological Sciences, E-ISSN: 2663-2187, ...Christo Ananth
 
Processing & Properties of Floor and Wall Tiles.pptx
Processing & Properties of Floor and Wall Tiles.pptxProcessing & Properties of Floor and Wall Tiles.pptx
Processing & Properties of Floor and Wall Tiles.pptxpranjaldaimarysona
 
Introduction to Multiple Access Protocol.pptx
Introduction to Multiple Access Protocol.pptxIntroduction to Multiple Access Protocol.pptx
Introduction to Multiple Access Protocol.pptxupamatechverse
 
High Profile Call Girls Nagpur Isha Call 7001035870 Meet With Nagpur Escorts
High Profile Call Girls Nagpur Isha Call 7001035870 Meet With Nagpur EscortsHigh Profile Call Girls Nagpur Isha Call 7001035870 Meet With Nagpur Escorts
High Profile Call Girls Nagpur Isha Call 7001035870 Meet With Nagpur Escortsranjana rawat
 
Software Development Life Cycle By Team Orange (Dept. of Pharmacy)
Software Development Life Cycle By  Team Orange (Dept. of Pharmacy)Software Development Life Cycle By  Team Orange (Dept. of Pharmacy)
Software Development Life Cycle By Team Orange (Dept. of Pharmacy)Suman Mia
 
Introduction to IEEE STANDARDS and its different types.pptx
Introduction to IEEE STANDARDS and its different types.pptxIntroduction to IEEE STANDARDS and its different types.pptx
Introduction to IEEE STANDARDS and its different types.pptxupamatechverse
 
MANUFACTURING PROCESS-II UNIT-2 LATHE MACHINE
MANUFACTURING PROCESS-II UNIT-2 LATHE MACHINEMANUFACTURING PROCESS-II UNIT-2 LATHE MACHINE
MANUFACTURING PROCESS-II UNIT-2 LATHE MACHINESIVASHANKAR N
 
UNIT - IV - Air Compressors and its Performance
UNIT - IV - Air Compressors and its PerformanceUNIT - IV - Air Compressors and its Performance
UNIT - IV - Air Compressors and its Performancesivaprakash250
 
OSVC_Meta-Data based Simulation Automation to overcome Verification Challenge...
OSVC_Meta-Data based Simulation Automation to overcome Verification Challenge...OSVC_Meta-Data based Simulation Automation to overcome Verification Challenge...
OSVC_Meta-Data based Simulation Automation to overcome Verification Challenge...Soham Mondal
 
Microscopic Analysis of Ceramic Materials.pptx
Microscopic Analysis of Ceramic Materials.pptxMicroscopic Analysis of Ceramic Materials.pptx
Microscopic Analysis of Ceramic Materials.pptxpurnimasatapathy1234
 
Top Rated Pune Call Girls Budhwar Peth ⟟ 6297143586 ⟟ Call Me For Genuine Se...
Top Rated  Pune Call Girls Budhwar Peth ⟟ 6297143586 ⟟ Call Me For Genuine Se...Top Rated  Pune Call Girls Budhwar Peth ⟟ 6297143586 ⟟ Call Me For Genuine Se...
Top Rated Pune Call Girls Budhwar Peth ⟟ 6297143586 ⟟ Call Me For Genuine Se...Call Girls in Nagpur High Profile
 
Sheet Pile Wall Design and Construction: A Practical Guide for Civil Engineer...
Sheet Pile Wall Design and Construction: A Practical Guide for Civil Engineer...Sheet Pile Wall Design and Construction: A Practical Guide for Civil Engineer...
Sheet Pile Wall Design and Construction: A Practical Guide for Civil Engineer...Dr.Costas Sachpazis
 
AKTU Computer Networks notes --- Unit 3.pdf
AKTU Computer Networks notes ---  Unit 3.pdfAKTU Computer Networks notes ---  Unit 3.pdf
AKTU Computer Networks notes --- Unit 3.pdfankushspencer015
 
College Call Girls Nashik Nehal 7001305949 Independent Escort Service Nashik
College Call Girls Nashik Nehal 7001305949 Independent Escort Service NashikCollege Call Girls Nashik Nehal 7001305949 Independent Escort Service Nashik
College Call Girls Nashik Nehal 7001305949 Independent Escort Service NashikCall Girls in Nagpur High Profile
 
KubeKraft presentation @CloudNativeHooghly
KubeKraft presentation @CloudNativeHooghlyKubeKraft presentation @CloudNativeHooghly
KubeKraft presentation @CloudNativeHooghlysanyuktamishra911
 
Java Programming :Event Handling(Types of Events)
Java Programming :Event Handling(Types of Events)Java Programming :Event Handling(Types of Events)
Java Programming :Event Handling(Types of Events)simmis5
 
Call Girls in Nagpur Suman Call 7001035870 Meet With Nagpur Escorts
Call Girls in Nagpur Suman Call 7001035870 Meet With Nagpur EscortsCall Girls in Nagpur Suman Call 7001035870 Meet With Nagpur Escorts
Call Girls in Nagpur Suman Call 7001035870 Meet With Nagpur EscortsCall Girls in Nagpur High Profile
 
SPICE PARK APR2024 ( 6,793 SPICE Models )
SPICE PARK APR2024 ( 6,793 SPICE Models )SPICE PARK APR2024 ( 6,793 SPICE Models )
SPICE PARK APR2024 ( 6,793 SPICE Models )Tsuyoshi Horigome
 

Recently uploaded (20)

Call for Papers - African Journal of Biological Sciences, E-ISSN: 2663-2187, ...
Call for Papers - African Journal of Biological Sciences, E-ISSN: 2663-2187, ...Call for Papers - African Journal of Biological Sciences, E-ISSN: 2663-2187, ...
Call for Papers - African Journal of Biological Sciences, E-ISSN: 2663-2187, ...
 
Processing & Properties of Floor and Wall Tiles.pptx
Processing & Properties of Floor and Wall Tiles.pptxProcessing & Properties of Floor and Wall Tiles.pptx
Processing & Properties of Floor and Wall Tiles.pptx
 
DJARUM4D - SLOT GACOR ONLINE | SLOT DEMO ONLINE
DJARUM4D - SLOT GACOR ONLINE | SLOT DEMO ONLINEDJARUM4D - SLOT GACOR ONLINE | SLOT DEMO ONLINE
DJARUM4D - SLOT GACOR ONLINE | SLOT DEMO ONLINE
 
Introduction to Multiple Access Protocol.pptx
Introduction to Multiple Access Protocol.pptxIntroduction to Multiple Access Protocol.pptx
Introduction to Multiple Access Protocol.pptx
 
High Profile Call Girls Nagpur Isha Call 7001035870 Meet With Nagpur Escorts
High Profile Call Girls Nagpur Isha Call 7001035870 Meet With Nagpur EscortsHigh Profile Call Girls Nagpur Isha Call 7001035870 Meet With Nagpur Escorts
High Profile Call Girls Nagpur Isha Call 7001035870 Meet With Nagpur Escorts
 
Software Development Life Cycle By Team Orange (Dept. of Pharmacy)
Software Development Life Cycle By  Team Orange (Dept. of Pharmacy)Software Development Life Cycle By  Team Orange (Dept. of Pharmacy)
Software Development Life Cycle By Team Orange (Dept. of Pharmacy)
 
Introduction to IEEE STANDARDS and its different types.pptx
Introduction to IEEE STANDARDS and its different types.pptxIntroduction to IEEE STANDARDS and its different types.pptx
Introduction to IEEE STANDARDS and its different types.pptx
 
MANUFACTURING PROCESS-II UNIT-2 LATHE MACHINE
MANUFACTURING PROCESS-II UNIT-2 LATHE MACHINEMANUFACTURING PROCESS-II UNIT-2 LATHE MACHINE
MANUFACTURING PROCESS-II UNIT-2 LATHE MACHINE
 
UNIT - IV - Air Compressors and its Performance
UNIT - IV - Air Compressors and its PerformanceUNIT - IV - Air Compressors and its Performance
UNIT - IV - Air Compressors and its Performance
 
OSVC_Meta-Data based Simulation Automation to overcome Verification Challenge...
OSVC_Meta-Data based Simulation Automation to overcome Verification Challenge...OSVC_Meta-Data based Simulation Automation to overcome Verification Challenge...
OSVC_Meta-Data based Simulation Automation to overcome Verification Challenge...
 
Microscopic Analysis of Ceramic Materials.pptx
Microscopic Analysis of Ceramic Materials.pptxMicroscopic Analysis of Ceramic Materials.pptx
Microscopic Analysis of Ceramic Materials.pptx
 
Top Rated Pune Call Girls Budhwar Peth ⟟ 6297143586 ⟟ Call Me For Genuine Se...
Top Rated  Pune Call Girls Budhwar Peth ⟟ 6297143586 ⟟ Call Me For Genuine Se...Top Rated  Pune Call Girls Budhwar Peth ⟟ 6297143586 ⟟ Call Me For Genuine Se...
Top Rated Pune Call Girls Budhwar Peth ⟟ 6297143586 ⟟ Call Me For Genuine Se...
 
Roadmap to Membership of RICS - Pathways and Routes
Roadmap to Membership of RICS - Pathways and RoutesRoadmap to Membership of RICS - Pathways and Routes
Roadmap to Membership of RICS - Pathways and Routes
 
Sheet Pile Wall Design and Construction: A Practical Guide for Civil Engineer...
Sheet Pile Wall Design and Construction: A Practical Guide for Civil Engineer...Sheet Pile Wall Design and Construction: A Practical Guide for Civil Engineer...
Sheet Pile Wall Design and Construction: A Practical Guide for Civil Engineer...
 
AKTU Computer Networks notes --- Unit 3.pdf
AKTU Computer Networks notes ---  Unit 3.pdfAKTU Computer Networks notes ---  Unit 3.pdf
AKTU Computer Networks notes --- Unit 3.pdf
 
College Call Girls Nashik Nehal 7001305949 Independent Escort Service Nashik
College Call Girls Nashik Nehal 7001305949 Independent Escort Service NashikCollege Call Girls Nashik Nehal 7001305949 Independent Escort Service Nashik
College Call Girls Nashik Nehal 7001305949 Independent Escort Service Nashik
 
KubeKraft presentation @CloudNativeHooghly
KubeKraft presentation @CloudNativeHooghlyKubeKraft presentation @CloudNativeHooghly
KubeKraft presentation @CloudNativeHooghly
 
Java Programming :Event Handling(Types of Events)
Java Programming :Event Handling(Types of Events)Java Programming :Event Handling(Types of Events)
Java Programming :Event Handling(Types of Events)
 
Call Girls in Nagpur Suman Call 7001035870 Meet With Nagpur Escorts
Call Girls in Nagpur Suman Call 7001035870 Meet With Nagpur EscortsCall Girls in Nagpur Suman Call 7001035870 Meet With Nagpur Escorts
Call Girls in Nagpur Suman Call 7001035870 Meet With Nagpur Escorts
 
SPICE PARK APR2024 ( 6,793 SPICE Models )
SPICE PARK APR2024 ( 6,793 SPICE Models )SPICE PARK APR2024 ( 6,793 SPICE Models )
SPICE PARK APR2024 ( 6,793 SPICE Models )
 

Global destruction (in 5 minutes)

  • 2. in 5 minutes There’s another talk: Global Destruction in 20 Minutes Thursday, May 8, 14
  • 4. What is global destruction? • Perl has a couple of run-time phases: BEGIN, CHECK, UNITCHECK, INIT, runloop, END, DESTRUCT • perldoc perlmod Thursday, May 8, 14
  • 5. What is global destruction? • BEGIN, CHECK, UNITCHECK, INIT, runloop, END, DESTRUCT • DESTRUCT cannot be called by DESTRUCT {} blocks. Thursday, May 8, 14
  • 6. What is global destruction? • BEGIN, CHECK, UNITCHECK, INIT, runloop, END, DESTRUCT • DESTRUCT cannot be called by DESTRUCT {} blocks. • the runloop neither Thursday, May 8, 14
  • 7. DESTRUCT • DESTRUCT is executed after PerlIO_destruct and before PerlIO_clean • DESTRUCT calls DESTROY methods on all objects which do have a DESTROY method (sv_clean_obj) Thursday, May 8, 14
  • 8. package FINALE; { $ref3 = bless ["ok - package destruction"]; my $ref2 = bless ["ok - lexical destructionn"]; local $ref1 = bless ["ok - dynamic destructionn"]; 1; } DESTROY { print $_[0][0]; } DEMO t/testc.sh -A -O3 -k 197 DESTRUCT Thursday, May 8, 14
  • 9. DESTRUCT • Beware! Our current perlcc compiler does not do global destruction. • 2nd warning: our variables behave like globals! Use only my, not our Thursday, May 8, 14
  • 10. package FINALE; { $ref3 = bless ["ok - package destructionn"]; my $ref2 = bless ["ok - lexical destructionn"]; our $ref4 = bless ["ok - our destructionn"]; local $ref1 = bless ["ok - dynamic destructionn"]; 1; } DESTROY { print $_[0][0]; } => ok - dynamic destruction ok - lexical destruction ok - package destruction ok - our destruction DESTRUCT Thursday, May 8, 14
  • 11. perl debugging: -DD (-D? => D Cleaning up) $ ./ccode197_o3 -DD EXECUTING... ok - dynamic destruction ok - lexical destruction Cursing named global static sv_arena: Calling FINALE::DESTROY ok - package destruction sv_arena: 0x7ff9b982f600 - 0x7ff9b98305f0 (170) sv_arena: 0x7ff9b982ae00 - 0x7ff9b982bdf0 (170) sv_arena: 0x7ff9b9807800 - 0x7ff9b98087f0 (170) Cleaning named glob IO object: SV = PVIO(0x7ff9b982ce00) at 0x7ff9b982b7a8 REFCNT = 2 FLAGS = (OBJECT) STASH = 0x7ff9b982b268! "IO::File" ... DESTRUCT Thursday, May 8, 14
  • 12. ok - dynamic destruction ok - lexical destruction Cursing named global static sv_arena: Calling FINALE::DESTROY ok - package destruction Cleaning object ref: SV = IV(0x10076dce8) at 0x10076dcf8 REFCNT = 1 FLAGS = (ROK) RV = 0x7fc549802aa8 SV = PVAV(0x7fc549005530) at 0x7fc549802aa8 FLAGS = (OBJECT) STASH = 0x7fc5490287f8! "FINALE" FLAGS = (REAL) Elt No. 0 SV = PV(0x7fc549002780) at 0x7fc549802ac0 REFCNT = 1 FLAGS = (POK,pPOK) PV = 0x7fc548d0ab50 "ok - our destructionn"0 CUR = 21 LEN = 32 ok - our destruction DESTRUCT Thursday, May 8, 14
  • 14. DESTRUCT • Beware! Our current perlcc compiler does not do global destruction. • The new 5.14 compiler can do global destruction, but this is not stable yet Thursday, May 8, 14
  • 15. Takeaway package FINALE; { $ref3 = bless ["ok - package destructionn"]; my $ref2 = bless ["ok - lexical destructionn"]; our $ref4 = bless ["ok - our destructionn"]; local $ref1 = bless ["ok - dynamic destructionn"]; 1; } DESTROY { print $_[0][0]; } Never use global destruction Thursday, May 8, 14
  • 16. Takeaway package FINALE; { $ref3 = bless ["ok - package destructionn"]; my $ref2 = bless ["ok - lexical destructionn"]; our $ref4 = bless ["ok - our destructionn"]; local $ref1 = bless ["ok - dynamic destructionn"]; 1; } DESTROY { print $_[0][0]; } Never use global destruction Never use our objects, always my Thursday, May 8, 14
  • 17. Why? • With old perlcc DESTROY methods of global or our objects are not called. Thursday, May 8, 14