-
Notifications
You must be signed in to change notification settings - Fork 65
/
SistaMethodZone.class.st
64 lines (56 loc) · 1.62 KB
/
SistaMethodZone.class.st
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
Class {
#name : #SistaMethodZone,
#superclass : #CogMethodZone,
#instVars : [
'allocationThreshold',
'thresholdRatio'
],
#category : #'VMMaker-JIT'
}
{ #category : #translation }
SistaMethodZone class >> declareCVarsIn: aCCodeGenerator [
aCCodeGenerator
declareVar: 'allocationThreshold' type: #usqInt;
var: 'thresholdRatio' declareC: (BytesPerWord = 8 ifTrue: ['double thresholdRatio = 0.5'] ifFalse: ['float thresholdRatio = 0.5f'])
]
{ #category : #allocating }
SistaMethodZone >> allocationLimit [
<inline: true>
^super allocationLimit min: allocationThreshold
]
{ #category : #initialization }
SistaMethodZone >> computeAllocationThreshold [
<inline: true>
allocationThreshold := ((limitAddress - baseAddress * thresholdRatio) asUnsignedInteger + (self zoneAlignment - 1) truncateTo: self zoneAlignment) + baseAddress
]
{ #category : #allocating }
SistaMethodZone >> effectiveLimit [
<inline: true>
^super effectiveLimit min: allocationThreshold
]
{ #category : #accessing }
SistaMethodZone >> getCogCodeZoneThreshold [
<api>
<returnTypeC: #double>
^thresholdRatio
]
{ #category : #initialization }
SistaMethodZone >> initialize [
super initialize.
thresholdRatio := 0.5
]
{ #category : #initialization }
SistaMethodZone >> manageFrom: theStartAddress to: theLimitAddress [
super manageFrom: theStartAddress to: theLimitAddress.
self computeAllocationThreshold
]
{ #category : #accessing }
SistaMethodZone >> setCogCodeZoneThreshold: ratio [
<api>
<var: #ratio type: #double>
(ratio >= 0.1 and: [ratio <= 1.0]) ifFalse:
[^PrimErrBadArgument].
thresholdRatio := ratio.
self computeAllocationThreshold.
^0
]