CompiledCodeObjectSection.st
changeset 10 588414eaacff
parent 9 40f9438e9de3
child 11 cfe5c9d79fbc
equal deleted inserted replaced
9:40f9438e9de3 10:588414eaacff
    14 "{ NameSpace: Smalltalk }"
    14 "{ NameSpace: Smalltalk }"
    15 
    15 
    16 ExternalBytes subclass:#CompiledCodeObjectSection
    16 ExternalBytes subclass:#CompiledCodeObjectSection
    17 	instanceVariableNames:'object name format'
    17 	instanceVariableNames:'object name format'
    18 	classVariableNames:''
    18 	classVariableNames:''
    19 	poolDictionaries:'CompiledCodeObjectSectionType'
    19 	poolDictionaries:'CompiledCodeObjectSectionFormat'
    20 	category:'System-Compiler-Interface'
    20 	category:'System-Compiler-Interface'
    21 !
    21 !
       
    22 
       
    23 !CompiledCodeObjectSection primitiveDefinitions!
       
    24 %{
       
    25 
       
    26 /*
       
    27  * includes, defines, structure definitions
       
    28  * and typedefs come here.
       
    29  */
       
    30 #include "../librun/mcompiler.h"
       
    31 
       
    32 %}
       
    33 ! !
    22 
    34 
    23 !CompiledCodeObjectSection class methodsFor:'documentation'!
    35 !CompiledCodeObjectSection class methodsFor:'documentation'!
    24 
    36 
    25 copyright
    37 copyright
    26 "
    38 "
    36 "
    48 "
    37 ! !
    49 ! !
    38 
    50 
    39 !CompiledCodeObjectSection methodsFor:'accessing'!
    51 !CompiledCodeObjectSection methodsFor:'accessing'!
    40 
    52 
       
    53 format
       
    54     ^ format
       
    55 !
       
    56 
    41 name
    57 name
    42     ^ name
    58     ^ name
    43 !
    59 !
    44 
    60 
    45 object
    61 object
    46     ^ object
    62     ^ object
    47 !
       
    48 
       
    49 format
       
    50     ^ format
       
    51 ! !
    63 ! !
    52 
    64 
    53 !CompiledCodeObjectSection methodsFor:'initialization'!
    65 !CompiledCodeObjectSection methodsFor:'initialization'!
    54 
    66 
    55 setObject: obj name: nm address: addr size: sz format: t
    67 setObject: obj name: nm size: sz format: t
    56     self setAddress: addr size: sz.
    68     self setSize: sz.
    57     object := obj.
    69     object := obj.
    58     name := nm.
    70     name := nm.
    59     format := t
    71     format := t
    60 
    72 
    61     "Created: / 11-12-2015 / 10:04:24 / Jan Vrany <jan.vrany@fit.cvut.cz>"
    73     "Created: / 11-12-2015 / 10:04:24 / Jan Vrany <jan.vrany@fit.cvut.cz>"
    64 !CompiledCodeObjectSection methodsFor:'inspecting'!
    76 !CompiledCodeObjectSection methodsFor:'inspecting'!
    65 
    77 
    66 inspector2TabAssembly
    78 inspector2TabAssembly
    67     <inspector2Tab>
    79     <inspector2Tab>
    68 
    80 
    69     format ~~ SectionTypeText ifTrue:[ ^ nil ].
    81     format ~~ SectionFormatText ifTrue:[ ^ nil ].
    70     (Smalltalk at: #UDIS86) isNil ifTrue:[ 
    82     (Smalltalk at: #UDIS86) isNil ifTrue:[ 
    71         "/ Try to load the package...
    83         "/ Try to load the package...
    72         [ Smalltalk loadPackage: 'jv:dragonfly/udis86sx' ] on: Error do:[ ^ nil ].
    84         [ Smalltalk loadPackage: 'jv:dragonfly/udis86sx' ] on: Error do:[ ^ nil ].
    73     ].
    85     ].
    74     (Smalltalk at: #UDIS86) isNil ifTrue:[ ^ nil ].
    86     (Smalltalk at: #UDIS86) isNil ifTrue:[ ^ nil ].
   113     aStream nextPutAll: ')'.
   125     aStream nextPutAll: ')'.
   114 
   126 
   115     "Modified: / 11-01-2016 / 21:42:38 / Jan Vrany <jan.vrany@fit.cvut.cz>"
   127     "Modified: / 11-01-2016 / 21:42:38 / Jan Vrany <jan.vrany@fit.cvut.cz>"
   116 ! !
   128 ! !
   117 
   129 
       
   130 !CompiledCodeObjectSection methodsFor:'queries'!
       
   131 
       
   132 size
       
   133     "Return logical size. For size in bytes, use #sizeInBytes"
       
   134 
       
   135 %{  
       
   136     if ( __isSmallInteger( __INST(size) ) && __isSmallInteger( __INST(format) ) ) {
       
   137         INT sz = __intVal( __INST(size) );
       
   138         switch ( __intVal(__INST(format) ) ) {
       
   139         case SectionFormatOBJVector:
       
   140             RETURN ( __MKSMALLINT( sz / sizeof(OBJ) ) );
       
   141         case SectionFormatINTVector:
       
   142             RETURN ( __MKSMALLINT( sz / sizeof(INT) ) );
       
   143         case SectionFormatILCVector:
       
   144 #           ifdef __SUPPORT_DIRECT_ILC
       
   145                 RETURN ( __MKSMALLINT( sz / sizeof(struct inlineCacheForDirectCall)  ) );
       
   146 #           else
       
   147                 RETURN ( __MKSMALLINT( sz / sizeof(struct inlineCache) ) );
       
   148 #           endif
       
   149         default:
       
   150             RETURN ( __MKSMALLINT( sz ) );        
       
   151         }  
       
   152     }
       
   153 %}.    
       
   154     self primitiveFailed
       
   155 
       
   156     "Created: / 19-01-2016 / 21:21:02 / Jan Vrany <jan.vrany@fit.cvut.cz>"
       
   157 ! !
       
   158 
   118 !CompiledCodeObjectSection class methodsFor:'documentation'!
   159 !CompiledCodeObjectSection class methodsFor:'documentation'!
   119 
   160 
   120 version_HG
   161 version_HG
   121 
   162 
   122     ^ '$Changeset: <not expanded> $'
   163     ^ '$Changeset: <not expanded> $'