Commit 5951aeb5 authored by Stewart Brodie's avatar Stewart Brodie
Browse files

Added a test program and profiling for messages.

Detail:
  The kernel can now disable all substitutions into error messages that
    it generates and count the number of times each error is looked up.
    The ErrorCount BASIC program then displays that information so that
    you can see if any odd errors are occurring or weird errors that you
    would not be expecting.
  It is not sensible to build a release with countmsgusage enabled.
Admin:
  Tested in Ursula build.

Version 5.32. Not tagged
parent 3976268c
......@@ -11,8 +11,8 @@
Module_MajorVersion SETS "5.32"
Module_Version SETA 532
Module_MinorVersion SETS ""
Module_Date SETS "17 Aug 2000"
Module_ApplicationDate2 SETS "17-Aug-00"
Module_ApplicationDate4 SETS "17-Aug-2000"
Module_Date SETS "18 Aug 2000"
Module_ApplicationDate2 SETS "18-Aug-00"
Module_ApplicationDate4 SETS "18-Aug-2000"
Module_FullVersion SETS "5.32"
END
......@@ -5,14 +5,14 @@
*/
#define Module_MajorVersion_CMHG 5.32
#define Module_MinorVersion_CMHG
#define Module_Date_CMHG 17 Aug 2000
#define Module_Date_CMHG 18 Aug 2000
#define Module_MajorVersion "5.32"
#define Module_Version 532
#define Module_MinorVersion ""
#define Module_Date "17 Aug 2000"
#define Module_Date "18 Aug 2000"
#define Module_ApplicationDate2 "17-Aug-00"
#define Module_ApplicationDate4 "17-Aug-2000"
#define Module_ApplicationDate2 "18-Aug-00"
#define Module_ApplicationDate4 "18-Aug-2000"
#define Module_FullVersion "5.32"
......@@ -27,6 +27,13 @@
; returned.
; V Set.
;
GBLL countmsgusage
countmsgusage SETL {FALSE}
[ countmsgusage
! 0, "*** WARNING: Cacheing *ALL* messages - even those with substitutions"
]
TranslateError_VClear ROUT
Push "r4,LR"
MOV r4,#0
......@@ -101,10 +108,121 @@ TranslateError_UseR4
[ CacheCommonErrors
; This block MUST not be empty
CommonErrorAddresses
& ErrorBlock_BadNumb
& ErrorBlock_BuffOverflow
[ countmsgusage
& ErrorBlock_RCExc
& ErrorBlock_RCNegative
& ErrorBlock_BadString
& ErrorBlock_VarCantFind
& ErrorBlock_BadVarType
& ErrorBlock_BadVarNam
& ErrorBlock_VarTooLong
& ErrorBlock_BadMacVal
& ErrorBlock_VarNoRoom
& ErrorBlock_BadBra
& ErrorBlock_StkOFlo
& ErrorBlock_MissOpn
& ErrorBlock_MissOpr
& ErrorBlock_BadInt
& ErrorBlock_StrOFlo
& ErrorBlock_NaffItm
& ErrorBlock_DivZero
& ErrorBlock_BadBase
& ErrorBlock_NumbTooBig
& ErrorBlock_BadClaimNum
& ErrorBlock_SysHeapFull
& ErrorBlock_BadDynamicArea
& ErrorBlock_AreaAlreadyExists
& ErrorBlock_AreaNotOnPageBdy
& ErrorBlock_OverlappingAreas
& ErrorBlock_CantAllocateArea
& ErrorBlock_CantAllocateLevel2
& ErrorBlock_UnknownAreaHandler
& ErrorBlock_CantGetPhysMem
& ErrorBlock_AplWSpaceInUse
& ErrorBlock_ChDynamCAO
& ErrorBlock_RAMFsUnchangeable
& ErrorBlock_HeapBadReason
& ErrorBlock_HeapFail_Init
& ErrorBlock_HeapFail_BadDesc
& ErrorBlock_HeapFail_BadLink
& ErrorBlock_HeapFail_Alloc
& ErrorBlock_HeapFail_NotABlock
& ErrorBlock_HeapFail_BadExtend
& ErrorBlock_HeapFail_ExcessiveShrink
& ErrorBlock_NoSuchSWI1
& ErrorBlock_NoSuchSWI
& ErrorBlock_UndefinedInstruction
& ErrorBlock_InstructionAbort
& ErrorBlock_DataAbort
& ErrorBlock_AddressException
& ErrorBlock_BranchThrough0
& ErrorBlock_BadEnvNumber
& ErrorBlock_BadReadSysInfo
& ErrorBlock_BadModuleReason
& ErrorBlock_NoMoreModules
& ErrorBlock_NoMoreIncarnations
& ErrorBlock_PostfixNeeded
& ErrorBlock_IncarnationExists
& ErrorBlock_ChunkNotRM
& ErrorBlock_MHNoRoom
& ErrorBlock_ModulePostfix
& ErrorBlock_NotMod
& ErrorBlock_BadRMHeaderField
& ErrorBlock_CantKill
& ErrorBlock_RMNotFound
& ErrorBlock_IncarnationNotFound
& ErrorBlock_RMNotFoundInROM
& ErrorBlock_ModuleTooOld
& ErrorBlock_BadParameters
& ErrorBlock_ArgRepeated
& ErrorBlock_NaffDevNo
& ErrorBlock_BadDevVecRel
& ErrorBlock_RedirectFail
& ErrorBlock_StackFull
& ErrorBlock_OscliLongLine
& ErrorBlock_NoOscliSpecials
& ErrorBlock_OscliTooHard
& ErrorBlock_BadParmString
& ErrorBlock_CoreNotWriteable
& ErrorBlock_CoreNotReadable
& ErrorBlock_BadCommand
& ErrorBlock_NoSuchSWI2
& ErrorBlock_TooManyParms
& ErrorBlock_BadKey
& ErrorBlock_BadAddress
& ErrorBlock_OutsideFile
& ErrorBlock_Escape
& ErrorBlock_BadTime
& ErrorBlock_BadMODE
& ErrorBlock_ModeNotAvailable
& ErrorBlock_BadPixelDepth
& ErrorBlock_Sprite_BadDPI
& ErrorBlock_BadMSFlags
& SpriteErr_NoWorkSpace
& SpriteErr_NoRoom
& SpriteErr_DoesntExist
& SpriteErr_NoSprites
& SpriteErr_NotGraphics
& SpriteErr_NotEnoughRoom
& SpriteErr_BadSpriteFile
& SpriteErr_NoRoomToMerge
& SpriteErr_Bad2ndPtr
& SpriteErr_InvalidRowOrCol
& SpriteErr_InvalidHeight
& SpriteErr_InvalidWidth
& SpriteErr_NoRoomToInsert
& SpriteErr_SpriteAlreadyExists
& SpriteErr_InvalidSpriteMode
& SpriteErr_BadReasonCode
& SpriteErr_CantInTeletext
& SpriteErr_InvalidSaveArea
& SpriteErr_SpriteIsCurrentDest
& SpriteErr_NoMaskOrPaletteAllowedInThisDepth
]
& ErrorBlock_ChDynamNotAllMoved
& ErrorBlock_NaffRelease
& ErrorBlock_BuffOverflow
& ErrorBlock_BadNumb
EndCommonErrorAddresses
GBLA ECEACount
......@@ -113,15 +231,20 @@ ECEACount SETA (EndCommonErrorAddresses-CommonErrorAddresses)/4
! 0, "Requiring ":CC:(:STR:(ECEACount*256)):CC:" bytes for error cache"
! 0, "Cached error block pointer at ":CC::STR:CachedErrorBlocks
! 0, "Cacheing ":CC:(:STR:ECEACount):CC:" error messages"
; This routine exits with Z clear if it can supply a cached translation; else must set Z
; so that the TranslateError_UseR4 routine continues to function and set R9 to the cache
; block to use for the result (or set R9 to zero to indicate no cacheing for this error)
CheckCommonErrorCache ROUT
Entry "r1-r3"
[ countmsgusage
MOV r4, #0 ; prevents substitutions
|
CMP r4, #1 ; is R4 = 0? If so, clear C for next instruction
SBCS r9, r4, r4 ; R9=0,Z set - if R4 was >0, else R9=-1, Z clear
EXIT EQ
]
LDR r9, [r4, #KernelMessagesBlock] ; R4 guaranteed zero from above
TEQ r9, #0
EXIT EQ ; not initialised messages yet! Exit R9=0, Z set
......@@ -143,6 +266,12 @@ CheckCommonErrorCache ROUT
MOVS r9, #0
EXIT
20
[ countmsgusage
ADD r3, r9, #ECEACount*256
LDR r1, [r3, r2, LSL #2]
ADD r1, r1, #1
STR r1, [r3, r2, LSL #2]
]
; Read the cached error number (0 = we don't have this cached or we have uncached it)
; Update R9 to point to the actual error buffer at the same time.
LDR r1, [r9, r2, LSL #8]!
......@@ -158,7 +287,11 @@ CommonErrorCacheInit ROUT
Entry "r0-r8"
MOVS r2, r9 ; copy R9 to R2 - only claim memory if it was 0
BNE %FT10
[ countmsgusage
LDR r3, =ECEACount*260 ; size of block required
|
LDR r3, =ECEACount*256 ; size of block required
]
BL ClaimSysHeapNode
MOVS r9, #0 ; set Z for STREQ below and for return
EXIT VS
......@@ -168,10 +301,18 @@ CommonErrorCacheInit ROUT
GBLA CECLoop
CECLoop SETA 0
[ countmsgusage
LDR r4, =ECEACount*260
90
SUBS r4, r4, #4
STR r3, [r2, r4]
BNE %BT90
|
WHILE CECLoop < ECEACount
STR r3, [r2, #CECLoop * 256]
CECLoop SETA CECLoop+1
WEND
]
MOVS r9, r2 ; set up R9; clear Z
EXIT
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment