SlideShare ist ein Scribd-Unternehmen logo
1 von 11
S.Ducasse 1
QuickTime™ and aTIFF (Uncompressed) decompressorare needed to see this picture.
StĂŠphane Ducasse
Stephane.Ducasse@univ-savoie.fr
http://www.listic.univ-savoie.fr/~ducasse/
Smalltalk gives to the programmer the illusion of
uniformity for example SmallIntegers are defined
as any other object but in memory they are
different than objects. In that case the object
The Internal Structure of
Objects in VW
S.Ducasse 2
License: CC-Attribution-ShareAlike 2.0
http://creativecommons.org/licenses/by-sa/2.0/
S.Ducasse 3
• Non indexable, pointer
Object subclass: #Packet
instanceVariableNames: 'contents addressee originator '
classVariableNames: ''
poolDictionaries: ''
category: 'Demo-LAN'
• Indexable pointer
• ArrayedCollection variableSubclass: #Array
• instanceVariableNames: ''
• classVariableNames: ''
• poolDictionaries: ''
• category: 'Collections-Arrayed'
Three Ways to Create Classes (VW30 Sq)
S.Ducasse 4
• Indexable, non pointer
•
LimitedPrecisionReal variableByteSubclass: #Float
instanceVariableNames: ''
classVariableNames: 'Pi RadiansPerDegree '
poolDictionaries: ''
category: 'Magnitude-Numbers'
It is not possible to define named instance variables
Three Ways to Create Classes
S.Ducasse 5
• Identifying subclass:
| collection |
collection := SortedCollection new.
Smalltalk allBehaviorsDo: [:each ||boolean|
boolean := each isMeta not and: [each isObsolete not].
boolean := boolean and: [each isFixed].
boolean ifTrue: [collection add: each name]].
^collection
Let there be Code
S.Ducasse 6
• Identifying variableSubclass:
boolean := each isMeta not and: [each isObsolete not].
boolean := boolean and: [each isPointers].
boolean := boolean and: [each isVariable].
boolean ifTrue: [collection add: each name]]
• Identifying variableByteSubclass:
boolean := each isMeta not and: [each isObsolete not].
boolean := boolean and: [each isBits].
boolean := boolean and: [each isVariable].
boolean ifTrue: [collection add: each name]]
Let there be Code
S.Ducasse 7
• The information for distinguishing between these three
type is stored in the format instance variable of Behavior.
• Behavior>>isBits
• "Answer whether the receiver contains just bits (not
pointers)."
• ^format noMask: self pointersMask
• Behavior>>hasImmediateInstances
immediate type object?
• Behavior>>isFixed
non-indexable type object?
• Behavior>>isPointers
pointers type object?
• Behavior>>isVariable
Format and other
S.Ducasse 8
pointer type [isPointers]
indexable type [isVariable] variableSubclass:
non-index type [isFixed] subclass:
non-pointer [isBits]
index type [isVariable] variableByteSubclass:
non-index type [isFixed] subclass:
immediate [hasImmediateInstances] subclass:
Format and other (ii)
S.Ducasse 9
• objectSizeInBytes: anObject
• |bytesInOTE bytesInOOP aClass indexableFieldSize instVarFieldSize size|
• bytesInOTE := ObjectMemory current bytesPerOTE.
• bytesInOOP := ObjectMemory current bytesPerOOP.
• aClass := anObject class.
• aClass isPointers
• ifTrue: [instVarFieldSize := aClass instSize * bytesInOOP.
• aClass isVariable
• ifTrue: [indexableFieldSize := anObject basicSize * bytesInOOP]
• ifFalse: [indexableFieldSize := 0]]
• ifFalse: [instVarFieldSize := 0.
• aClass isVariable
• ifTrue: [indexableFieldSize := anObject basicSize +
• (bytesInOOP -1) bitAnd: bytesInOOP
negated]
• ifFalse:[indexableFieldSize := 0]].
• size := bytesInOTE + instVarFieldSize + indexableFieldSize.
• ^size
Object size in bytes
S.Ducasse 10
• OTE (ObjectTable Entry) = 12 bytes: OTE is a description of an Object (class,
iv, hash, gc flags, ....)
• OOP (Object Oriented Pointer) = 4 bytes
• Pointers Type
• Internals new objectSizeInBytes:WorkStation new
• pointer, instSize = 3 (dependents name nextNode) * 4 = 12 not indexable
• Internals new objectSizeInBytes: (WorkStation new name: #abc)
• idem, because not recursive
• Internals new objectSizeInBytes: 1@2
• 12 + 2 * 4 = 20 bytes
• Indexable and Pointers Type
• Internals new objectSizeInBytes: (OrderedCollection new: 10)
• OrderedCollection new: 10
• = 2 inst variable and 10 indexes
• class instSize = 2 * 4
• basicSize = 10 * 4
• = 60 bytes
Analysis
S.Ducasse 11
• Indexable pure
• Internals new objectSizeInBytes: Float pi
• 4 indexed variable * 4 = 16 bytes
• Non pointer, non Index = immediate, but an
immediate type object has no object table entry.The
immediate object is stored into the OOP.
• Internals new objectSizeInBytes: 1
• = 12 bytes, but the code should use isImmediate
Analysis (ii)

Weitere ähnliche Inhalte

Andere mochten auch (20)

Stoop 423-some designpatterns
Stoop 423-some designpatternsStoop 423-some designpatterns
Stoop 423-some designpatterns
 
Stoop 303-advanced blocks
Stoop 303-advanced blocksStoop 303-advanced blocks
Stoop 303-advanced blocks
 
06 debugging
06 debugging06 debugging
06 debugging
 
12 - Conditions and Loops
12 - Conditions and Loops12 - Conditions and Loops
12 - Conditions and Loops
 
Stoop 390-instruction stream
Stoop 390-instruction streamStoop 390-instruction stream
Stoop 390-instruction stream
 
Stoop sed-smells
Stoop sed-smellsStoop sed-smells
Stoop sed-smells
 
Stoop 436-strategy
Stoop 436-strategyStoop 436-strategy
Stoop 436-strategy
 
15 - Streams
15 - Streams15 - Streams
15 - Streams
 
Stoop ed-class forreuse
Stoop ed-class forreuseStoop ed-class forreuse
Stoop ed-class forreuse
 
Debugging VisualWorks
Debugging VisualWorksDebugging VisualWorks
Debugging VisualWorks
 
Stoop sed-sharing ornot
Stoop sed-sharing ornotStoop sed-sharing ornot
Stoop sed-sharing ornot
 
07 bestpractice
07 bestpractice07 bestpractice
07 bestpractice
 
Stoop metaclasses
Stoop metaclassesStoop metaclasses
Stoop metaclasses
 
Stoop ed-dual interface
Stoop ed-dual interfaceStoop ed-dual interface
Stoop ed-dual interface
 
09 metaclasses
09 metaclasses09 metaclasses
09 metaclasses
 
Stoop 305-reflective programming5
Stoop 305-reflective programming5Stoop 305-reflective programming5
Stoop 305-reflective programming5
 
03 standardclasses
03 standardclasses03 standardclasses
03 standardclasses
 
5 - OOP - Smalltalk in a Nutshell (c)
5 - OOP - Smalltalk in a Nutshell (c)5 - OOP - Smalltalk in a Nutshell (c)
5 - OOP - Smalltalk in a Nutshell (c)
 
14 - Exceptions
14 - Exceptions14 - Exceptions
14 - Exceptions
 
Stoop ed-lod
Stoop ed-lodStoop ed-lod
Stoop ed-lod
 

Ähnlich wie Stoop 301-internal objectstructureinvw

iPhone dev intro
iPhone dev introiPhone dev intro
iPhone dev introVonbo
 
Beginning to iPhone development
Beginning to iPhone developmentBeginning to iPhone development
Beginning to iPhone developmentVonbo
 
Drupalcon cph
Drupalcon cphDrupalcon cph
Drupalcon cphcyberswat
 
MFF UK - Introduction to iOS
MFF UK - Introduction to iOSMFF UK - Introduction to iOS
MFF UK - Introduction to iOSPetr Dvorak
 
FI MUNI 2012 - iOS Basics
FI MUNI 2012 - iOS BasicsFI MUNI 2012 - iOS Basics
FI MUNI 2012 - iOS BasicsPetr Dvorak
 
Lecture 3-ARC
Lecture 3-ARCLecture 3-ARC
Lecture 3-ARCZiku Spartan
 
How and Where in GLORP
How and Where in GLORPHow and Where in GLORP
How and Where in GLORPESUG
 
Connect.Tech- Swift Memory Management
Connect.Tech- Swift Memory ManagementConnect.Tech- Swift Memory Management
Connect.Tech- Swift Memory Managementstable|kernel
 
Objective-C Is Not Java
Objective-C Is Not JavaObjective-C Is Not Java
Objective-C Is Not JavaChris Adamson
 
Real World MVC
Real World MVCReal World MVC
Real World MVCJames Johnson
 
JavaScript!
JavaScript!JavaScript!
JavaScript!RTigger
 
Evolve your coding with some BDD
Evolve your coding with some BDDEvolve your coding with some BDD
Evolve your coding with some BDDOrtus Solutions, Corp
 
fuser interface-development-using-jquery
fuser interface-development-using-jqueryfuser interface-development-using-jquery
fuser interface-development-using-jqueryKostas Mavridis
 
Slot Composition
Slot CompositionSlot Composition
Slot CompositionMarcus Denker
 
Slot Composition
Slot CompositionSlot Composition
Slot CompositionESUG
 
[OOP - Lec 13,14,15] Constructors / Destructor and its Types
[OOP - Lec 13,14,15] Constructors / Destructor and its Types[OOP - Lec 13,14,15] Constructors / Destructor and its Types
[OOP - Lec 13,14,15] Constructors / Destructor and its TypesMuhammad Hammad Waseem
 
[2015/2016] Require JS and Handlebars JS
[2015/2016] Require JS and Handlebars JS[2015/2016] Require JS and Handlebars JS
[2015/2016] Require JS and Handlebars JSIvano Malavolta
 

Ähnlich wie Stoop 301-internal objectstructureinvw (20)

iPhone dev intro
iPhone dev introiPhone dev intro
iPhone dev intro
 
Beginning to iPhone development
Beginning to iPhone developmentBeginning to iPhone development
Beginning to iPhone development
 
Drupalcon cph
Drupalcon cphDrupalcon cph
Drupalcon cph
 
MFF UK - Introduction to iOS
MFF UK - Introduction to iOSMFF UK - Introduction to iOS
MFF UK - Introduction to iOS
 
FI MUNI 2012 - iOS Basics
FI MUNI 2012 - iOS BasicsFI MUNI 2012 - iOS Basics
FI MUNI 2012 - iOS Basics
 
Lecture 3-ARC
Lecture 3-ARCLecture 3-ARC
Lecture 3-ARC
 
How and Where in GLORP
How and Where in GLORPHow and Where in GLORP
How and Where in GLORP
 
Connect.Tech- Swift Memory Management
Connect.Tech- Swift Memory ManagementConnect.Tech- Swift Memory Management
Connect.Tech- Swift Memory Management
 
Objective-C Is Not Java
Objective-C Is Not JavaObjective-C Is Not Java
Objective-C Is Not Java
 
Introduction to java and oop
Introduction to java and oopIntroduction to java and oop
Introduction to java and oop
 
Real World MVC
Real World MVCReal World MVC
Real World MVC
 
About Python
About PythonAbout Python
About Python
 
2CPP16 - STL
2CPP16 - STL2CPP16 - STL
2CPP16 - STL
 
JavaScript!
JavaScript!JavaScript!
JavaScript!
 
Evolve your coding with some BDD
Evolve your coding with some BDDEvolve your coding with some BDD
Evolve your coding with some BDD
 
fuser interface-development-using-jquery
fuser interface-development-using-jqueryfuser interface-development-using-jquery
fuser interface-development-using-jquery
 
Slot Composition
Slot CompositionSlot Composition
Slot Composition
 
Slot Composition
Slot CompositionSlot Composition
Slot Composition
 
[OOP - Lec 13,14,15] Constructors / Destructor and its Types
[OOP - Lec 13,14,15] Constructors / Destructor and its Types[OOP - Lec 13,14,15] Constructors / Destructor and its Types
[OOP - Lec 13,14,15] Constructors / Destructor and its Types
 
[2015/2016] Require JS and Handlebars JS
[2015/2016] Require JS and Handlebars JS[2015/2016] Require JS and Handlebars JS
[2015/2016] Require JS and Handlebars JS
 

Mehr von The World of Smalltalk (20)

05 seaside canvas
05 seaside canvas05 seaside canvas
05 seaside canvas
 
99 questions
99 questions99 questions
99 questions
 
13 traits
13 traits13 traits
13 traits
 
12 virtualmachine
12 virtualmachine12 virtualmachine
12 virtualmachine
 
11 bytecode
11 bytecode11 bytecode
11 bytecode
 
10 reflection
10 reflection10 reflection
10 reflection
 
08 refactoring
08 refactoring08 refactoring
08 refactoring
 
05 seaside
05 seaside05 seaside
05 seaside
 
04 idioms
04 idioms04 idioms
04 idioms
 
02 basics
02 basics02 basics
02 basics
 
01 intro
01 intro01 intro
01 intro
 
Stoop sed-class initialization
Stoop sed-class initializationStoop sed-class initialization
Stoop sed-class initialization
 
Stoop sed-class initialization
Stoop sed-class initializationStoop sed-class initialization
Stoop sed-class initialization
 
Stoop ed-unit ofreuse
Stoop ed-unit ofreuseStoop ed-unit ofreuse
Stoop ed-unit ofreuse
 
Stoop ed-subtyping subclassing
Stoop ed-subtyping subclassingStoop ed-subtyping subclassing
Stoop ed-subtyping subclassing
 
Stoop ed-some principles
Stoop ed-some principlesStoop ed-some principles
Stoop ed-some principles
 
Stoop ed-inheritance composition
Stoop ed-inheritance compositionStoop ed-inheritance composition
Stoop ed-inheritance composition
 
Stoop ed-frameworks
Stoop ed-frameworksStoop ed-frameworks
Stoop ed-frameworks
 
Stoop 450-s unit
Stoop 450-s unitStoop 450-s unit
Stoop 450-s unit
 
Stoop 440-adaptor
Stoop 440-adaptorStoop 440-adaptor
Stoop 440-adaptor
 

KĂźrzlich hochgeladen

MINDCTI Revenue Release Quarter One 2024
MINDCTI Revenue Release Quarter One 2024MINDCTI Revenue Release Quarter One 2024
MINDCTI Revenue Release Quarter One 2024MIND CTI
 
🐬 The future of MySQL is Postgres 🐘
🐬  The future of MySQL is Postgres   🐘🐬  The future of MySQL is Postgres   🐘
🐬 The future of MySQL is Postgres 🐘RTylerCroy
 
Powerful Google developer tools for immediate impact! (2023-24 C)
Powerful Google developer tools for immediate impact! (2023-24 C)Powerful Google developer tools for immediate impact! (2023-24 C)
Powerful Google developer tools for immediate impact! (2023-24 C)wesley chun
 
Scaling API-first – The story of a global engineering organization
Scaling API-first – The story of a global engineering organizationScaling API-first – The story of a global engineering organization
Scaling API-first – The story of a global engineering organizationRadu Cotescu
 
Top 10 Most Downloaded Games on Play Store in 2024
Top 10 Most Downloaded Games on Play Store in 2024Top 10 Most Downloaded Games on Play Store in 2024
Top 10 Most Downloaded Games on Play Store in 2024SynarionITSolutions
 
Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...
Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...
Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...apidays
 
A Year of the Servo Reboot: Where Are We Now?
A Year of the Servo Reboot: Where Are We Now?A Year of the Servo Reboot: Where Are We Now?
A Year of the Servo Reboot: Where Are We Now?Igalia
 
Partners Life - Insurer Innovation Award 2024
Partners Life - Insurer Innovation Award 2024Partners Life - Insurer Innovation Award 2024
Partners Life - Insurer Innovation Award 2024The Digital Insurer
 
Bajaj Allianz Life Insurance Company - Insurer Innovation Award 2024
Bajaj Allianz Life Insurance Company - Insurer Innovation Award 2024Bajaj Allianz Life Insurance Company - Insurer Innovation Award 2024
Bajaj Allianz Life Insurance Company - Insurer Innovation Award 2024The Digital Insurer
 
Polkadot JAM Slides - Token2049 - By Dr. Gavin Wood
Polkadot JAM Slides - Token2049 - By Dr. Gavin WoodPolkadot JAM Slides - Token2049 - By Dr. Gavin Wood
Polkadot JAM Slides - Token2049 - By Dr. Gavin WoodJuan lago vĂĄzquez
 
Apidays New York 2024 - Scaling API-first by Ian Reasor and Radu Cotescu, Adobe
Apidays New York 2024 - Scaling API-first by Ian Reasor and Radu Cotescu, AdobeApidays New York 2024 - Scaling API-first by Ian Reasor and Radu Cotescu, Adobe
Apidays New York 2024 - Scaling API-first by Ian Reasor and Radu Cotescu, Adobeapidays
 
Bajaj Allianz Life Insurance Company - Insurer Innovation Award 2024
Bajaj Allianz Life Insurance Company - Insurer Innovation Award 2024Bajaj Allianz Life Insurance Company - Insurer Innovation Award 2024
Bajaj Allianz Life Insurance Company - Insurer Innovation Award 2024The Digital Insurer
 
Apidays New York 2024 - The value of a flexible API Management solution for O...
Apidays New York 2024 - The value of a flexible API Management solution for O...Apidays New York 2024 - The value of a flexible API Management solution for O...
Apidays New York 2024 - The value of a flexible API Management solution for O...apidays
 
Apidays New York 2024 - The Good, the Bad and the Governed by David O'Neill, ...
Apidays New York 2024 - The Good, the Bad and the Governed by David O'Neill, ...Apidays New York 2024 - The Good, the Bad and the Governed by David O'Neill, ...
Apidays New York 2024 - The Good, the Bad and the Governed by David O'Neill, ...apidays
 
HTML Injection Attacks: Impact and Mitigation Strategies
HTML Injection Attacks: Impact and Mitigation StrategiesHTML Injection Attacks: Impact and Mitigation Strategies
HTML Injection Attacks: Impact and Mitigation StrategiesBoston Institute of Analytics
 
Strategize a Smooth Tenant-to-tenant Migration and Copilot Takeoff
Strategize a Smooth Tenant-to-tenant Migration and Copilot TakeoffStrategize a Smooth Tenant-to-tenant Migration and Copilot Takeoff
Strategize a Smooth Tenant-to-tenant Migration and Copilot Takeoffsammart93
 
Workshop - Best of Both Worlds_ Combine KG and Vector search for enhanced R...
Workshop - Best of Both Worlds_ Combine  KG and Vector search for  enhanced R...Workshop - Best of Both Worlds_ Combine  KG and Vector search for  enhanced R...
Workshop - Best of Both Worlds_ Combine KG and Vector search for enhanced R...Neo4j
 
Boost Fertility New Invention Ups Success Rates.pdf
Boost Fertility New Invention Ups Success Rates.pdfBoost Fertility New Invention Ups Success Rates.pdf
Boost Fertility New Invention Ups Success Rates.pdfsudhanshuwaghmare1
 
Artificial Intelligence Chap.5 : Uncertainty
Artificial Intelligence Chap.5 : UncertaintyArtificial Intelligence Chap.5 : Uncertainty
Artificial Intelligence Chap.5 : UncertaintyKhushali Kathiriya
 

KĂźrzlich hochgeladen (20)

MINDCTI Revenue Release Quarter One 2024
MINDCTI Revenue Release Quarter One 2024MINDCTI Revenue Release Quarter One 2024
MINDCTI Revenue Release Quarter One 2024
 
🐬 The future of MySQL is Postgres 🐘
🐬  The future of MySQL is Postgres   🐘🐬  The future of MySQL is Postgres   🐘
🐬 The future of MySQL is Postgres 🐘
 
Powerful Google developer tools for immediate impact! (2023-24 C)
Powerful Google developer tools for immediate impact! (2023-24 C)Powerful Google developer tools for immediate impact! (2023-24 C)
Powerful Google developer tools for immediate impact! (2023-24 C)
 
Scaling API-first – The story of a global engineering organization
Scaling API-first – The story of a global engineering organizationScaling API-first – The story of a global engineering organization
Scaling API-first – The story of a global engineering organization
 
Top 10 Most Downloaded Games on Play Store in 2024
Top 10 Most Downloaded Games on Play Store in 2024Top 10 Most Downloaded Games on Play Store in 2024
Top 10 Most Downloaded Games on Play Store in 2024
 
Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...
Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...
Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...
 
A Year of the Servo Reboot: Where Are We Now?
A Year of the Servo Reboot: Where Are We Now?A Year of the Servo Reboot: Where Are We Now?
A Year of the Servo Reboot: Where Are We Now?
 
Partners Life - Insurer Innovation Award 2024
Partners Life - Insurer Innovation Award 2024Partners Life - Insurer Innovation Award 2024
Partners Life - Insurer Innovation Award 2024
 
Bajaj Allianz Life Insurance Company - Insurer Innovation Award 2024
Bajaj Allianz Life Insurance Company - Insurer Innovation Award 2024Bajaj Allianz Life Insurance Company - Insurer Innovation Award 2024
Bajaj Allianz Life Insurance Company - Insurer Innovation Award 2024
 
Polkadot JAM Slides - Token2049 - By Dr. Gavin Wood
Polkadot JAM Slides - Token2049 - By Dr. Gavin WoodPolkadot JAM Slides - Token2049 - By Dr. Gavin Wood
Polkadot JAM Slides - Token2049 - By Dr. Gavin Wood
 
Apidays New York 2024 - Scaling API-first by Ian Reasor and Radu Cotescu, Adobe
Apidays New York 2024 - Scaling API-first by Ian Reasor and Radu Cotescu, AdobeApidays New York 2024 - Scaling API-first by Ian Reasor and Radu Cotescu, Adobe
Apidays New York 2024 - Scaling API-first by Ian Reasor and Radu Cotescu, Adobe
 
Bajaj Allianz Life Insurance Company - Insurer Innovation Award 2024
Bajaj Allianz Life Insurance Company - Insurer Innovation Award 2024Bajaj Allianz Life Insurance Company - Insurer Innovation Award 2024
Bajaj Allianz Life Insurance Company - Insurer Innovation Award 2024
 
Apidays New York 2024 - The value of a flexible API Management solution for O...
Apidays New York 2024 - The value of a flexible API Management solution for O...Apidays New York 2024 - The value of a flexible API Management solution for O...
Apidays New York 2024 - The value of a flexible API Management solution for O...
 
Apidays New York 2024 - The Good, the Bad and the Governed by David O'Neill, ...
Apidays New York 2024 - The Good, the Bad and the Governed by David O'Neill, ...Apidays New York 2024 - The Good, the Bad and the Governed by David O'Neill, ...
Apidays New York 2024 - The Good, the Bad and the Governed by David O'Neill, ...
 
HTML Injection Attacks: Impact and Mitigation Strategies
HTML Injection Attacks: Impact and Mitigation StrategiesHTML Injection Attacks: Impact and Mitigation Strategies
HTML Injection Attacks: Impact and Mitigation Strategies
 
Strategize a Smooth Tenant-to-tenant Migration and Copilot Takeoff
Strategize a Smooth Tenant-to-tenant Migration and Copilot TakeoffStrategize a Smooth Tenant-to-tenant Migration and Copilot Takeoff
Strategize a Smooth Tenant-to-tenant Migration and Copilot Takeoff
 
Workshop - Best of Both Worlds_ Combine KG and Vector search for enhanced R...
Workshop - Best of Both Worlds_ Combine  KG and Vector search for  enhanced R...Workshop - Best of Both Worlds_ Combine  KG and Vector search for  enhanced R...
Workshop - Best of Both Worlds_ Combine KG and Vector search for enhanced R...
 
+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...
+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...
+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...
 
Boost Fertility New Invention Ups Success Rates.pdf
Boost Fertility New Invention Ups Success Rates.pdfBoost Fertility New Invention Ups Success Rates.pdf
Boost Fertility New Invention Ups Success Rates.pdf
 
Artificial Intelligence Chap.5 : Uncertainty
Artificial Intelligence Chap.5 : UncertaintyArtificial Intelligence Chap.5 : Uncertainty
Artificial Intelligence Chap.5 : Uncertainty
 

Stoop 301-internal objectstructureinvw

  • 1. S.Ducasse 1 QuickTime™ and aTIFF (Uncompressed) decompressorare needed to see this picture. StĂŠphane Ducasse Stephane.Ducasse@univ-savoie.fr http://www.listic.univ-savoie.fr/~ducasse/ Smalltalk gives to the programmer the illusion of uniformity for example SmallIntegers are defined as any other object but in memory they are different than objects. In that case the object The Internal Structure of Objects in VW
  • 2. S.Ducasse 2 License: CC-Attribution-ShareAlike 2.0 http://creativecommons.org/licenses/by-sa/2.0/
  • 3. S.Ducasse 3 • Non indexable, pointer Object subclass: #Packet instanceVariableNames: 'contents addressee originator ' classVariableNames: '' poolDictionaries: '' category: 'Demo-LAN' • Indexable pointer • ArrayedCollection variableSubclass: #Array • instanceVariableNames: '' • classVariableNames: '' • poolDictionaries: '' • category: 'Collections-Arrayed' Three Ways to Create Classes (VW30 Sq)
  • 4. S.Ducasse 4 • Indexable, non pointer • LimitedPrecisionReal variableByteSubclass: #Float instanceVariableNames: '' classVariableNames: 'Pi RadiansPerDegree ' poolDictionaries: '' category: 'Magnitude-Numbers' It is not possible to define named instance variables Three Ways to Create Classes
  • 5. S.Ducasse 5 • Identifying subclass: | collection | collection := SortedCollection new. Smalltalk allBehaviorsDo: [:each ||boolean| boolean := each isMeta not and: [each isObsolete not]. boolean := boolean and: [each isFixed]. boolean ifTrue: [collection add: each name]]. ^collection Let there be Code
  • 6. S.Ducasse 6 • Identifying variableSubclass: boolean := each isMeta not and: [each isObsolete not]. boolean := boolean and: [each isPointers]. boolean := boolean and: [each isVariable]. boolean ifTrue: [collection add: each name]] • Identifying variableByteSubclass: boolean := each isMeta not and: [each isObsolete not]. boolean := boolean and: [each isBits]. boolean := boolean and: [each isVariable]. boolean ifTrue: [collection add: each name]] Let there be Code
  • 7. S.Ducasse 7 • The information for distinguishing between these three type is stored in the format instance variable of Behavior. • Behavior>>isBits • "Answer whether the receiver contains just bits (not pointers)." • ^format noMask: self pointersMask • Behavior>>hasImmediateInstances immediate type object? • Behavior>>isFixed non-indexable type object? • Behavior>>isPointers pointers type object? • Behavior>>isVariable Format and other
  • 8. S.Ducasse 8 pointer type [isPointers] indexable type [isVariable] variableSubclass: non-index type [isFixed] subclass: non-pointer [isBits] index type [isVariable] variableByteSubclass: non-index type [isFixed] subclass: immediate [hasImmediateInstances] subclass: Format and other (ii)
  • 9. S.Ducasse 9 • objectSizeInBytes: anObject • |bytesInOTE bytesInOOP aClass indexableFieldSize instVarFieldSize size| • bytesInOTE := ObjectMemory current bytesPerOTE. • bytesInOOP := ObjectMemory current bytesPerOOP. • aClass := anObject class. • aClass isPointers • ifTrue: [instVarFieldSize := aClass instSize * bytesInOOP. • aClass isVariable • ifTrue: [indexableFieldSize := anObject basicSize * bytesInOOP] • ifFalse: [indexableFieldSize := 0]] • ifFalse: [instVarFieldSize := 0. • aClass isVariable • ifTrue: [indexableFieldSize := anObject basicSize + • (bytesInOOP -1) bitAnd: bytesInOOP negated] • ifFalse:[indexableFieldSize := 0]]. • size := bytesInOTE + instVarFieldSize + indexableFieldSize. • ^size Object size in bytes
  • 10. S.Ducasse 10 • OTE (ObjectTable Entry) = 12 bytes: OTE is a description of an Object (class, iv, hash, gc flags, ....) • OOP (Object Oriented Pointer) = 4 bytes • Pointers Type • Internals new objectSizeInBytes:WorkStation new • pointer, instSize = 3 (dependents name nextNode) * 4 = 12 not indexable • Internals new objectSizeInBytes: (WorkStation new name: #abc) • idem, because not recursive • Internals new objectSizeInBytes: 1@2 • 12 + 2 * 4 = 20 bytes • Indexable and Pointers Type • Internals new objectSizeInBytes: (OrderedCollection new: 10) • OrderedCollection new: 10 • = 2 inst variable and 10 indexes • class instSize = 2 * 4 • basicSize = 10 * 4 • = 60 bytes Analysis
  • 11. S.Ducasse 11 • Indexable pure • Internals new objectSizeInBytes: Float pi • 4 indexed variable * 4 = 16 bytes • Non pointer, non Index = immediate, but an immediate type object has no object table entry.The immediate object is stored into the OOP. • Internals new objectSizeInBytes: 1 • = 12 bytes, but the code should use isImmediate Analysis (ii)