src/JavaClass.st
branchjk_new_structure
changeset 1526 286949064e0c
parent 1523 f5ffdad83ab9
child 1527 c12b45a59659
equal deleted inserted replaced
1525:4463b11f29f4 1526:286949064e0c
  1352 classInit
  1352 classInit
  1353     "call the classes JAVA clinit function"
  1353     "call the classes JAVA clinit function"
  1354     
  1354     
  1355     | m |
  1355     | m |
  1356     (accessFlags bitAnd: ACX_INITIALIZED) ~~ 0 ifTrue: [ ^ self ].
  1356     (accessFlags bitAnd: ACX_INITIALIZED) ~~ 0 ifTrue: [ ^ self ].
  1357     accessFlags := accessFlags bitOr: ACX_INITIALIZED.
  1357     (accessFlags bitAnd: ACX_INITIALIZING) ~~ 0 ifTrue: [ ^ self ].
       
  1358     accessFlags := accessFlags bitOr: ACX_INITIALIZING.
  1358     superclass ~~ JavaObject ifTrue: [ superclass classInit ].
  1359     superclass ~~ JavaObject ifTrue: [ superclass classInit ].
  1359      "JV@2011-12-03: Also call initializeStaticFields"
  1360      "JV@2011-12-03: Also call initializeStaticFields"
  1360     self initializeStaticFields.
  1361     self initializeStaticFields.
  1361     m := self compiledMethodAt: #'<clinit>()V'.
  1362     m := self compiledMethodAt: #'<clinit>()V'.
  1362     m notNil ifTrue: [
  1363     m notNil ifTrue: [         
  1363         "/'calling <clinit>() of ' print. self fullName printNL.
  1364             "/Logger log: ('calling <clinit>()V of %1' bindWith: self name) severity: #trace facility: 'JVM'.
  1364         [
       
  1365             OrderOfClassInits notNil ifTrue: [ OrderOfClassInits add: self. ].
  1365             OrderOfClassInits notNil ifTrue: [ OrderOfClassInits add: self. ].
  1366             m 
  1366             m 
  1367                 valueWithReceiver: self
  1367                 valueWithReceiver: self
  1368                 arguments: #()
  1368                 arguments: #()
  1369                 selector: #'<clinit>()V'
  1369                 selector: #'<clinit>()V'
  1370                 search: self class
  1370                 search: self class
  1371                 sender: nil
  1371                 sender: nil.						      
  1372         ] valueOnUnwindDo: [ accessFlags := accessFlags bitXor: ACX_INITIALIZED. ].
  1372            "/Logger log: ('calling <clinit>()V of %1 done' bindWith: self name) severity: #trace facility: 'JVM'.
  1373         
  1373     ].
  1374         "/'calling <clinit>() done ' print. self fullName printNL.
  1374     accessFlags := accessFlags bitOr:  ACX_INITIALIZED. 
  1375     ] ifFalse: [
  1375     accessFlags := accessFlags bitAnd: ACX_INITIALIZING bitInvert32.
  1376         "/        self fullName print. ' has no clinit()' printNL.
  1376 
  1377     ].
       
  1378     (JavaVM booted and: [JavaVM eagerResolvingEnabled] )ifTrue: [
  1377     (JavaVM booted and: [JavaVM eagerResolvingEnabled] )ifTrue: [
  1379         JavaClassReader classLoaderQuerySignal answer: classLoader
  1378         JavaClassReader classLoaderQuerySignal answer: classLoader
  1380             do: [ self resolveAll. ]
  1379             do: [ self resolveAll. ]
  1381     ].
  1380     ].
  1382 
  1381 
  1395     "Modified: / 03-12-2011 / 12:19:52 / Jan Vrany <jan.vrany@fit.cvut.cz>"
  1394     "Modified: / 03-12-2011 / 12:19:52 / Jan Vrany <jan.vrany@fit.cvut.cz>"
  1396     "Modified: / 08-12-2011 / 21:05:21 / Marcel Hlopko <hlopkmar@fel.cvut.cz>"
  1395     "Modified: / 08-12-2011 / 21:05:21 / Marcel Hlopko <hlopkmar@fel.cvut.cz>"
  1397 !
  1396 !
  1398 
  1397 
  1399 classInitSpecial
  1398 classInitSpecial
       
  1399     Logger log: ('calling classInitSpecial of %1' bindWith: self name) severity: #trace facility: 'JVM'.
  1400     self classInit.
  1400     self classInit.
  1401 
  1401 
  1402     "Created: / 08-02-2012 / 23:43:57 / mh <hlopik@gmail.com>"
  1402     "Created: / 08-02-2012 / 23:43:57 / mh <hlopik@gmail.com>"
  1403 !
  1403 !
  1404 
  1404