oops.h (3460B)
1 // 2 // oops.h 3 // Smalltalk-80 4 // 5 // Created by Dan Banay on 3/5/20; 6 // Copyright © 2020 Dan Banay; All rights reserved; 7 // 8 // MIT License 9 // Permission is hereby granted, free of charge, to any person obtaining a copy 10 // of this software and associated documentation files (the "Software"), to deal 11 // in the Software without restriction, including without limitation the rights 12 // to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 13 // copies of the Software, and to permit persons to whom the Software is 14 // furnished to do so, subject to the following conditions: 15 // 16 // The above copyright notice and this permission notice shall be included in all 17 // copies or substantial portions of the Software. 18 // 19 // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 20 // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 21 // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 22 // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 23 // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 24 // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 25 // SOFTWARE. 26 // 27 28 29 #pragma once 30 31 // Well known oops for various objects in an image 32 33 // initializeGuaranteedPointers G&R pg. 576 34 35 // UndefinedObject and Booleans 36 static const int NilPointer = 2; 37 static const int FalsePointer = 4; 38 static const int TruePointer = 6; 39 40 // Root 41 static const int SchedulerAssociationPointer = 8; 42 static const int SmalltalkPointer = 25286; // SystemDictionary 43 44 // Classes 45 46 static const int ClassSmallInteger = 12; 47 static const int ClassStringPointer = 14; 48 static const int ClassArrayPointer = 16; 49 static const int ClassMethodContextPointer = 22; 50 static const int ClassBlockContextPointer = 24; 51 static const int ClassPointPointer = 26; 52 static const int ClassLargePositiveIntegerPointer = 28; 53 static const int ClassMessagePointer = 32; 54 static const int ClassCharacterPointer = 40; 55 static const int ClassCompiledMethod = 34; 56 static const int ClassSymbolPointer = 56; 57 58 static const int ClassFloatPointer = 20; 59 60 static const int ClassSemaphorePointer = 38; 61 static const int ClassDisplayScreenPointer = 834; 62 static const int ClassUndefinedObject = 25728; 63 64 // Selectors 65 static const int DoesNotUnderstandSelector = 42; 66 static const int CannotReturnSelector = 44; 67 static const int MustBeBooleanSelector = 52; 68 69 // Tables 70 static const int SpecialSelectorsPointer = 48; 71 static const int CharacterTablePointer = 50; 72 73 /* 74 dbanay - first oops 2..52 are special oops... see this from SystemTracer: 75 76 If using GC make sure these are roots 77 specialObjects _ 78 "1:" (Array with: nil with: false with: true with: (Smalltalk associationAt: #Processor)) 79 , "5:" (Array with: Symbol table with: SmallInteger with: String with: Array) 80 , "9:" (Array with: (Smalltalk associationAt: #Smalltalk) with: Float 81 with: MethodContext with: BlockContext) 82 , "13:" (Array with: Point with: LargePositiveInteger with: DisplayBitmap with: Message) 83 , "17:" (Array with: CompiledMethod with: #unusedOop18 with: Semaphore with: Character) 84 , "21:" (Array with: #doesNotUnderstand: with: #cannotReturn: 85 with: #monitor: with: Smalltalk specialSelectors) 86 , "25:" (Array with: Character characterTable with: #mustBeBoolean). 87 specialObjects size = 26 ifFalse: [self error: 'try again!!']. 88 */