asm/AJRoutinePrologue.st
author Jan Vrany <jan.vrany@fit.cvut.cz>
Fri, 17 Jun 2016 17:25:15 +0100
changeset 26 8eb6716029aa
parent 23 d2d9a2d4d6bf
permissions -rw-r--r--
Merge
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
23
d2d9a2d4d6bf Added README, licenses and copyright notices.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 3
diff changeset
     1
"
d2d9a2d4d6bf Added README, licenses and copyright notices.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 3
diff changeset
     2
    Copyright (c) 2012-2016 Igor Stasenko
d2d9a2d4d6bf Added README, licenses and copyright notices.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 3
diff changeset
     3
                            Martin McClure
d2d9a2d4d6bf Added README, licenses and copyright notices.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 3
diff changeset
     4
                            Damien Pollet
d2d9a2d4d6bf Added README, licenses and copyright notices.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 3
diff changeset
     5
                            Camillo Bruni
d2d9a2d4d6bf Added README, licenses and copyright notices.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 3
diff changeset
     6
                            Guido Chari
d2d9a2d4d6bf Added README, licenses and copyright notices.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 3
diff changeset
     7
                   2016-now Jan Vrany <jan.vrany [at] fit . cvut . cz>
d2d9a2d4d6bf Added README, licenses and copyright notices.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 3
diff changeset
     8
d2d9a2d4d6bf Added README, licenses and copyright notices.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 3
diff changeset
     9
    Permission is hereby granted, free of charge, to any person obtaining a copy
d2d9a2d4d6bf Added README, licenses and copyright notices.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 3
diff changeset
    10
    of this software and associated documentation files (the 'Software'), to deal
d2d9a2d4d6bf Added README, licenses and copyright notices.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 3
diff changeset
    11
    in the Software without restriction, including without limitation the rights
d2d9a2d4d6bf Added README, licenses and copyright notices.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 3
diff changeset
    12
    to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
d2d9a2d4d6bf Added README, licenses and copyright notices.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 3
diff changeset
    13
    copies of the Software, and to permit persons to whom the Software is
d2d9a2d4d6bf Added README, licenses and copyright notices.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 3
diff changeset
    14
    furnished to do so, subject to the following conditions:
d2d9a2d4d6bf Added README, licenses and copyright notices.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 3
diff changeset
    15
d2d9a2d4d6bf Added README, licenses and copyright notices.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 3
diff changeset
    16
    The above copyright notice and this permission notice shall be included in all
d2d9a2d4d6bf Added README, licenses and copyright notices.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 3
diff changeset
    17
    copies or substantial portions of the Software.
d2d9a2d4d6bf Added README, licenses and copyright notices.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 3
diff changeset
    18
d2d9a2d4d6bf Added README, licenses and copyright notices.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 3
diff changeset
    19
    THE SOFTWARE IS PROVIDED 'AS IS', WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
d2d9a2d4d6bf Added README, licenses and copyright notices.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 3
diff changeset
    20
    IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
d2d9a2d4d6bf Added README, licenses and copyright notices.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 3
diff changeset
    21
    FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
d2d9a2d4d6bf Added README, licenses and copyright notices.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 3
diff changeset
    22
    AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
d2d9a2d4d6bf Added README, licenses and copyright notices.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 3
diff changeset
    23
    LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
d2d9a2d4d6bf Added README, licenses and copyright notices.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 3
diff changeset
    24
    OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
d2d9a2d4d6bf Added README, licenses and copyright notices.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 3
diff changeset
    25
    SOFTWARE.
d2d9a2d4d6bf Added README, licenses and copyright notices.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 3
diff changeset
    26
"
3
483729eb4432 Initial port ot Igor Stasenko's AsmJit
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
    27
"{ Package: 'jv:dragonfly/asm' }"
483729eb4432 Initial port ot Igor Stasenko's AsmJit
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
    28
483729eb4432 Initial port ot Igor Stasenko's AsmJit
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
    29
"{ NameSpace: Smalltalk }"
483729eb4432 Initial port ot Igor Stasenko's AsmJit
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
    30
483729eb4432 Initial port ot Igor Stasenko's AsmJit
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
    31
AJInstruction subclass:#AJRoutinePrologue
483729eb4432 Initial port ot Igor Stasenko's AsmJit
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
    32
	instanceVariableNames:''
483729eb4432 Initial port ot Igor Stasenko's AsmJit
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
    33
	classVariableNames:''
483729eb4432 Initial port ot Igor Stasenko's AsmJit
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
    34
	poolDictionaries:''
483729eb4432 Initial port ot Igor Stasenko's AsmJit
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
    35
	category:'AsmJit-Instructions'
483729eb4432 Initial port ot Igor Stasenko's AsmJit
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
    36
!
483729eb4432 Initial port ot Igor Stasenko's AsmJit
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
    37
483729eb4432 Initial port ot Igor Stasenko's AsmJit
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
    38
AJRoutinePrologue comment:'This is a pseudo-instruction to indicate a place in native code for routine prologue.
It is later replaced by real instructions which contain code for initializing stack frame & extra stack space required by routine.'
483729eb4432 Initial port ot Igor Stasenko's AsmJit
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
    39
!
483729eb4432 Initial port ot Igor Stasenko's AsmJit
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
    40
23
d2d9a2d4d6bf Added README, licenses and copyright notices.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 3
diff changeset
    41
!AJRoutinePrologue class methodsFor:'documentation'!
d2d9a2d4d6bf Added README, licenses and copyright notices.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 3
diff changeset
    42
d2d9a2d4d6bf Added README, licenses and copyright notices.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 3
diff changeset
    43
copyright
d2d9a2d4d6bf Added README, licenses and copyright notices.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 3
diff changeset
    44
"
d2d9a2d4d6bf Added README, licenses and copyright notices.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 3
diff changeset
    45
    Copyright (c) 2012-2016 Igor Stasenko
d2d9a2d4d6bf Added README, licenses and copyright notices.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 3
diff changeset
    46
                            Martin McClure
d2d9a2d4d6bf Added README, licenses and copyright notices.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 3
diff changeset
    47
                            Damien Pollet
d2d9a2d4d6bf Added README, licenses and copyright notices.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 3
diff changeset
    48
                            Camillo Bruni
d2d9a2d4d6bf Added README, licenses and copyright notices.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 3
diff changeset
    49
                            Guido Chari
d2d9a2d4d6bf Added README, licenses and copyright notices.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 3
diff changeset
    50
                   2016-now Jan Vrany <jan.vrany [at] fit . cvut . cz>
d2d9a2d4d6bf Added README, licenses and copyright notices.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 3
diff changeset
    51
d2d9a2d4d6bf Added README, licenses and copyright notices.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 3
diff changeset
    52
    Permission is hereby granted, free of charge, to any person obtaining a copy
d2d9a2d4d6bf Added README, licenses and copyright notices.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 3
diff changeset
    53
    of this software and associated documentation files (the 'Software'), to deal
d2d9a2d4d6bf Added README, licenses and copyright notices.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 3
diff changeset
    54
    in the Software without restriction, including without limitation the rights
d2d9a2d4d6bf Added README, licenses and copyright notices.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 3
diff changeset
    55
    to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
d2d9a2d4d6bf Added README, licenses and copyright notices.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 3
diff changeset
    56
    copies of the Software, and to permit persons to whom the Software is
d2d9a2d4d6bf Added README, licenses and copyright notices.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 3
diff changeset
    57
    furnished to do so, subject to the following conditions:
d2d9a2d4d6bf Added README, licenses and copyright notices.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 3
diff changeset
    58
d2d9a2d4d6bf Added README, licenses and copyright notices.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 3
diff changeset
    59
    The above copyright notice and this permission notice shall be included in all
d2d9a2d4d6bf Added README, licenses and copyright notices.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 3
diff changeset
    60
    copies or substantial portions of the Software.
d2d9a2d4d6bf Added README, licenses and copyright notices.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 3
diff changeset
    61
d2d9a2d4d6bf Added README, licenses and copyright notices.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 3
diff changeset
    62
    THE SOFTWARE IS PROVIDED 'AS IS', WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
d2d9a2d4d6bf Added README, licenses and copyright notices.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 3
diff changeset
    63
    IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
d2d9a2d4d6bf Added README, licenses and copyright notices.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 3
diff changeset
    64
    FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
d2d9a2d4d6bf Added README, licenses and copyright notices.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 3
diff changeset
    65
    AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
d2d9a2d4d6bf Added README, licenses and copyright notices.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 3
diff changeset
    66
    LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
d2d9a2d4d6bf Added README, licenses and copyright notices.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 3
diff changeset
    67
    OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
d2d9a2d4d6bf Added README, licenses and copyright notices.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 3
diff changeset
    68
    SOFTWARE.
d2d9a2d4d6bf Added README, licenses and copyright notices.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 3
diff changeset
    69
d2d9a2d4d6bf Added README, licenses and copyright notices.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 3
diff changeset
    70
"
d2d9a2d4d6bf Added README, licenses and copyright notices.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 3
diff changeset
    71
! !
d2d9a2d4d6bf Added README, licenses and copyright notices.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 3
diff changeset
    72
3
483729eb4432 Initial port ot Igor Stasenko's AsmJit
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
    73
!AJRoutinePrologue methodsFor:'accessing'!
483729eb4432 Initial port ot Igor Stasenko's AsmJit
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
    74
483729eb4432 Initial port ot Igor Stasenko's AsmJit
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
    75
name
483729eb4432 Initial port ot Igor Stasenko's AsmJit
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
    76
    ^ 'prologue' 
483729eb4432 Initial port ot Igor Stasenko's AsmJit
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
    77
! !
483729eb4432 Initial port ot Igor Stasenko's AsmJit
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
    78
483729eb4432 Initial port ot Igor Stasenko's AsmJit
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
    79
!AJRoutinePrologue methodsFor:'emitting code'!
483729eb4432 Initial port ot Igor Stasenko's AsmJit
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
    80
483729eb4432 Initial port ot Igor Stasenko's AsmJit
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
    81
emitCode: asm
483729eb4432 Initial port ot Igor Stasenko's AsmJit
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
    82
    machineCode := #[]
483729eb4432 Initial port ot Igor Stasenko's AsmJit
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
    83
! !
483729eb4432 Initial port ot Igor Stasenko's AsmJit
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
    84
483729eb4432 Initial port ot Igor Stasenko's AsmJit
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
    85
!AJRoutinePrologue methodsFor:'visitor'!
483729eb4432 Initial port ot Igor Stasenko's AsmJit
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
    86
483729eb4432 Initial port ot Igor Stasenko's AsmJit
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
    87
accept: anObject
483729eb4432 Initial port ot Igor Stasenko's AsmJit
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
    88
    ^ anObject visitRoutinePrologue: self
483729eb4432 Initial port ot Igor Stasenko's AsmJit
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
    89
!
483729eb4432 Initial port ot Igor Stasenko's AsmJit
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
    90
483729eb4432 Initial port ot Igor Stasenko's AsmJit
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
    91
setPrologue: anInstructions
483729eb4432 Initial port ot Igor Stasenko's AsmJit
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
    92
    "do nothing"
483729eb4432 Initial port ot Igor Stasenko's AsmJit
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
    93
    | old |
483729eb4432 Initial port ot Igor Stasenko's AsmJit
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
    94
    old := next.
483729eb4432 Initial port ot Igor Stasenko's AsmJit
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
    95
    next := anInstructions.
483729eb4432 Initial port ot Igor Stasenko's AsmJit
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
    96
    anInstructions last next: old 
483729eb4432 Initial port ot Igor Stasenko's AsmJit
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
    97
! !
483729eb4432 Initial port ot Igor Stasenko's AsmJit
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
    98