Method.st
changeset 438 6c03b347369f
parent 423 7a4bfd3cc267
child 443 fae13c0f1512
equal deleted inserted replaced
437:a005e97d261e 438:6c03b347369f
    21 
    21 
    22 Method comment:'
    22 Method comment:'
    23 COPYRIGHT (c) 1989 by Claus Gittinger
    23 COPYRIGHT (c) 1989 by Claus Gittinger
    24 	     All Rights Reserved
    24 	     All Rights Reserved
    25 
    25 
    26 $Header: /cvs/stx/stx/libbasic/Method.st,v 1.48 1995-09-08 16:46:11 claus Exp $
    26 $Header: /cvs/stx/stx/libbasic/Method.st,v 1.49 1995-09-17 17:56:43 claus Exp $
    27 '!
    27 '!
    28 
    28 
    29 !Method class methodsFor:'documentation'!
    29 !Method class methodsFor:'documentation'!
    30 
    30 
    31 copyright
    31 copyright
    42 "
    42 "
    43 !
    43 !
    44 
    44 
    45 version
    45 version
    46 "
    46 "
    47 $Header: /cvs/stx/stx/libbasic/Method.st,v 1.48 1995-09-08 16:46:11 claus Exp $
    47 $Header: /cvs/stx/stx/libbasic/Method.st,v 1.49 1995-09-17 17:56:43 claus Exp $
    48 "
    48 "
    49 !
    49 !
    50 
    50 
    51 documentation
    51 documentation
    52 "
    52 "
    68     The flags field defines things like the number of method-locals,
    68     The flags field defines things like the number of method-locals,
    69     method arguments and stack requirements (for interpreted methods).
    69     method arguments and stack requirements (for interpreted methods).
    70     Do not depend on any value in the flags field - it may change without
    70     Do not depend on any value in the flags field - it may change without
    71     notice.
    71     notice.
    72 
    72 
       
    73     Notice, that in ST/X, method can be subclassed; executable code is
       
    74     identified not by being a subclass of Block or Method, but instead by
       
    75     having the executable flag bit set in the class. The VM can execute anything
       
    76     which is identified as executable (assuming that the first instance variable
       
    77     is the machine-code address) - this allows for easy future extension.
       
    78 
    73     Instance variables:
    79     Instance variables:
    74 
    80 
    75 	source          <String>        the source itself (if sourcePosition isNil)
    81 	source          <String>        the source itself (if sourcePosition isNil)
    76 					or the fileName where the source is found
    82 					or the fileName where the source is found
    77 
    83 
   122     what can be deduced by reading PD code).
   128     what can be deduced by reading PD code).
   123     Also, the usability of privacy is still to be tested.
   129     Also, the usability of privacy is still to be tested.
   124     This interface, the implementation and the rules for when a privacy violation
   130     This interface, the implementation and the rules for when a privacy violation
   125     may change (in case of some ANSI standard being defined).
   131     may change (in case of some ANSI standard being defined).
   126     Be warned and send me suggestions & critics (constructive ;-)
   132     Be warned and send me suggestions & critics (constructive ;-)
       
   133 "
       
   134 !
       
   135 
       
   136 dynamicMethods
       
   137 "
       
   138     On systems which support dynamic loading of machine code (SYS5.4, Linux),
       
   139     methods may now be compiled to machine code from within the browser,
       
   140     and the resulting machine code object be loaded in.
       
   141     The ObjectFileLoader keeps (weak) handles to the resulting methods and
       
   142     invalidates the corresponding method objects, if the underlying methods
       
   143     object code is unloaded.
       
   144     Invalid methods will trap into the debugger when executed;
       
   145     also, the browser marks them as '(* not executable *)' in its method list.
   127 "
   146 "
   128 ! !
   147 ! !
   129 
   148 
   130 !Method class methodsFor:'initialization'!
   149 !Method class methodsFor:'initialization'!
   131 
   150 
   949     self ~~ m ifTrue:[
   968     self ~~ m ifTrue:[
   950 	(self code notNil and:[self code = m code]) ifTrue:[^ true].
   969 	(self code notNil and:[self code = m code]) ifTrue:[^ true].
   951 	(byteCode notNil and:[byteCode == m byteCode]) ifTrue:[^ true].
   970 	(byteCode notNil and:[byteCode == m byteCode]) ifTrue:[^ true].
   952     ].
   971     ].
   953     ^ false
   972     ^ false
       
   973 ! !
       
   974 
       
   975 !Method methodsFor:'trap methods'!
       
   976 
       
   977 makeInvalid
       
   978     "make the receiver an invalid method, which raises an invalidCodeObject
       
   979      signal when executed. This is not for public use - it is required for
       
   980      the objectFileLoader to invalidate methods whose code is unloaded."
       
   981 
       
   982     |invldMethod|
       
   983 
       
   984     invldMethod := self class compiledMethodAt:#invalidCodeObject.
       
   985     self code:invldMethod code.
       
   986     self byteCode:invldMethod byteCode.
       
   987 
       
   988     "Created: 17.9.1995 / 15:00:52 / claus"
       
   989 !
       
   990 
       
   991 makeUncompiled
       
   992     "make the receiver an uncompiled method, which raises an invalidCodeObject
       
   993      signal when executed. This is not for public use - it is required for
       
   994      the compiler to invalidate methods which cannot be compiled due to errors
       
   995      after a class definition change (for example: instvars are no longer there)."
       
   996 
       
   997     |invldMethod|
       
   998 
       
   999     invldMethod := self class compiledMethodAt:#uncompiledCodeObject.
       
  1000     self code:invldMethod code.
       
  1001     self byteCode:invldMethod byteCode.
       
  1002 
       
  1003     "Created: 17.9.1995 / 15:01:14 / claus"
   954 ! !
  1004 ! !
   955 
  1005 
   956 !Method methodsFor:'error handling'!
  1006 !Method methodsFor:'error handling'!
   957 
  1007 
   958 invalidCodeObject
  1008 invalidCodeObject