395 |
395 |
396 "Modified: / 07-08-2011 / 15:34:09 / cg" |
396 "Modified: / 07-08-2011 / 15:34:09 / cg" |
397 "Modified (comment): / 30-09-2011 / 12:16:05 / cg" |
397 "Modified (comment): / 30-09-2011 / 12:16:05 / cg" |
398 ! |
398 ! |
399 |
399 |
400 statementListRewriteHookFor:firstStatement |
400 statementListRewriteHookFor:firstStatementArg |
401 "invoked whenever a statement list node has been generated" |
401 "invoked whenever a statement list node has been generated" |
402 |
402 |
403 "/ care for blocks which return... |
403 "/ care for blocks which return... |
404 |thisStatement prevStatement countStatement mustInsertExecutionInfo| |
404 |thisStatement prevStatement countStatement mustInsertExecutionInfo statementInfo firstStatement | |
405 |
405 |
406 mustInsertExecutionInfo := false. |
406 mustInsertExecutionInfo := false. |
407 prevStatement := nil. |
407 prevStatement := nil. |
408 |
408 |
409 thisStatement := firstStatement. |
409 thisStatement := firstStatementArg. |
410 thisStatement isNil ifTrue:[^ firstStatement]. |
410 thisStatement isNil ifTrue:[^ firstStatementArg]. |
|
411 firstStatement := self statementCounterBefore:thisStatement. |
|
412 statementInfo := firstStatement expression receiver value. |
|
413 statementInfo endPosition: thisStatement endPosition. |
|
414 |
411 |
415 |
412 [true] whileTrue:[ |
416 [true] whileTrue:[ |
413 mustInsertExecutionInfo ifTrue:[ |
417 mustInsertExecutionInfo ifTrue:[ |
414 "/ prev-stat had a return in it (a block with a return); |
418 "/ prev-stat had a return in it (a block with a return); |
415 "/ insert a statement-entry here. |
419 "/ insert a statement-entry here. |
416 thisStatement notNil ifTrue:[ |
420 thisStatement notNil ifTrue:[ |
417 countStatement := self statementCounterBefore:thisStatement. |
421 countStatement := self statementCounterBefore:thisStatement. |
|
422 statementInfo := countStatement expression receiver value. |
|
423 statementInfo endPosition: thisStatement endPosition. |
418 prevStatement nextStatement:countStatement. |
424 prevStatement nextStatement:countStatement. |
419 mustInsertExecutionInfo := false. |
425 mustInsertExecutionInfo := false. |
420 prevStatement := countStatement. |
426 prevStatement := countStatement. |
421 ] |
427 ] |
422 ]. |
428 ]. |
423 thisStatement isNil ifTrue:[^ firstStatement]. |
429 thisStatement isNil ifTrue:[ ^ firstStatement ]. |
424 |
430 |
425 thisStatement isReturnNode ifFalse:[ |
431 thisStatement isReturnNode ifFalse:[ |
426 thisStatement containsReturn ifTrue:[ |
432 thisStatement containsReturn ifTrue:[ |
427 mustInsertExecutionInfo := true |
433 mustInsertExecutionInfo := true |
428 ] |
434 ] |
429 ]. |
435 ]. |
430 prevStatement := thisStatement. |
436 prevStatement := thisStatement. |
|
437 statementInfo notNil ifTrue:[ |
|
438 statementInfo endPosition: prevStatement endPosition. |
|
439 ]. |
431 thisStatement := thisStatement nextStatement. |
440 thisStatement := thisStatement nextStatement. |
432 ]. |
441 ]. |
433 |
442 |
434 "Modified (comment): / 30-09-2011 / 12:15:52 / cg" |
443 "Modified (comment): / 30-09-2011 / 12:15:52 / cg" |
|
444 "Modified: / 29-07-2013 / 00:11:03 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
435 ! |
445 ! |
436 |
446 |
437 variableReadRewriteHookFor:aVariableNode |
447 variableReadRewriteHookFor:aVariableNode |
438 "invoked whenever a variable access node has been generated" |
448 "invoked whenever a variable access node has been generated" |
439 |
449 |
507 ^ count ? 0 |
517 ^ count ? 0 |
508 |
518 |
509 "Created: / 23-06-2006 / 13:31:28 / cg" |
519 "Created: / 23-06-2006 / 13:31:28 / cg" |
510 ! |
520 ! |
511 |
521 |
|
522 endPosition |
|
523 ^ endPosition |
|
524 |
|
525 "Created: / 28-04-2010 / 15:57:14 / cg" |
|
526 ! |
|
527 |
|
528 endPosition:anInteger |
|
529 endPosition := anInteger. |
|
530 ! |
|
531 |
512 startPosition |
532 startPosition |
513 ^ startPosition |
533 ^ startPosition |
514 |
534 |
515 "Created: / 28-04-2010 / 15:54:26 / cg" |
535 "Created: / 28-04-2010 / 15:54:26 / cg" |
516 ! |
536 ! |
517 |
537 |
518 startPosition:something |
538 startPosition:anInteger |
519 startPosition := something. |
539 startPosition := anInteger. |
|
540 ! |
|
541 |
|
542 startPosition:startArg endPosition:endArg |
|
543 startPosition := startArg. |
|
544 endPosition := endArg. |
|
545 |
|
546 "Created: / 28-04-2010 / 15:54:47 / cg" |
520 ! ! |
547 ! ! |
521 |
548 |
522 !InstrumentingCompiler::StatementExecutionInfo methodsFor:'cleanup'! |
549 !InstrumentingCompiler::StatementExecutionInfo methodsFor:'cleanup'! |
523 |
550 |
524 cleanInfoWithChange:withChange |
551 cleanInfoWithChange:withChange |
527 Smalltalk changed:#methodCoverageInfo with:owningMethod. |
554 Smalltalk changed:#methodCoverageInfo with:owningMethod. |
528 ]. |
555 ]. |
529 |
556 |
530 "Modified: / 20-07-2011 / 17:55:49 / cg" |
557 "Modified: / 20-07-2011 / 17:55:49 / cg" |
531 "Created: / 20-07-2011 / 18:59:01 / cg" |
558 "Created: / 20-07-2011 / 18:59:01 / cg" |
|
559 ! ! |
|
560 |
|
561 !InstrumentingCompiler::StatementExecutionInfo methodsFor:'debugging'! |
|
562 |
|
563 inspector2TabSource |
|
564 |
|
565 | source | |
|
566 |
|
567 source := owningMethod source asText. |
|
568 startPosition isNil ifTrue:[ |
|
569 source colorizeAllWith: Color red. |
|
570 ] ifFalse:[ |
|
571 endPosition isNil ifTrue:[ |
|
572 source emphasizeFrom:startPosition to:source string size with: #bold. |
|
573 source emphasizeFrom:startPosition to:source string size with: #color -> Color red. |
|
574 ] ifFalse:[ |
|
575 source emphasizeFrom:startPosition to: endPosition with: #bold. |
|
576 source emphasizeFrom:startPosition to: endPosition with: #color -> Color blue. |
|
577 ]. |
|
578 ]. |
|
579 |
|
580 ^self newInspector2Tab |
|
581 label: 'Source'; |
|
582 priority: 50; |
|
583 view: ((ScrollableView for:EditTextView) contents: source; yourself) |
|
584 |
|
585 "Created: / 28-07-2013 / 23:16:28 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
|
586 ! |
|
587 |
|
588 inspector2Tabs |
|
589 ^ #( inspector2TabForBasicInspect inspector2TabSource ) |
|
590 |
|
591 "Created: / 28-07-2013 / 23:18:21 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
532 ! ! |
592 ! ! |
533 |
593 |
534 !InstrumentingCompiler::StatementExecutionInfo methodsFor:'instrumentation calls'! |
594 !InstrumentingCompiler::StatementExecutionInfo methodsFor:'instrumentation calls'! |
535 |
595 |
536 entry:callingContext |
596 entry:callingContext |
994 " |
1054 " |
995 (sub)instances of me are updated by instrumented code when a block is executed. |
1055 (sub)instances of me are updated by instrumented code when a block is executed. |
996 " |
1056 " |
997 ! ! |
1057 ! ! |
998 |
1058 |
999 !InstrumentingCompiler::BlockExecutionInfo methodsFor:'accessing'! |
|
1000 |
|
1001 endPosition |
|
1002 ^ endPosition |
|
1003 |
|
1004 "Created: / 28-04-2010 / 15:57:14 / cg" |
|
1005 ! |
|
1006 |
|
1007 startPosition:startArg endPosition:endArg |
|
1008 startPosition := startArg. |
|
1009 endPosition := endArg. |
|
1010 |
|
1011 "Created: / 28-04-2010 / 15:54:47 / cg" |
|
1012 ! ! |
|
1013 |
|
1014 !InstrumentingCompiler::BlockExecutionInfo methodsFor:'entry'! |
1059 !InstrumentingCompiler::BlockExecutionInfo methodsFor:'entry'! |
1015 |
1060 |
1016 changeClassToAlreadyEntered |
1061 changeClassToAlreadyEntered |
1017 self class == InstrumentingCompiler::BlockExecutionInfo ifTrue:[ |
1062 self class == InstrumentingCompiler::BlockExecutionInfo ifTrue:[ |
1018 self changeClassTo: BlockExecutionInfoInAlreadyEnteredState |
1063 self changeClassTo: BlockExecutionInfoInAlreadyEnteredState |