max_stars_repo_path stringlengths 4 261 | max_stars_repo_name stringlengths 6 106 | max_stars_count int64 0 38.8k | id stringlengths 1 6 | text stringlengths 7 1.05M |
|---|---|---|---|---|
libsrc/rex/syscall1p.asm | meesokim/z88dk | 0 | 1051 | <gh_stars>0
;
; System Call for REX6000
;
; I've never tested this function, hope it works. Daniel
;
; $Id: syscall1p.asm,v 1.4 2015/01/19 01:33:06 pauloscustodio Exp $
PUBLIC syscall1p
.syscall1p
pop bc
pop de ;parameter
pop hl ;call number
push hl
push de
push bc
ld ($c000),hl
ld ($c002),de
ld a,h
ld hl,0
and a,$e0 ; compare if points to $8000-$9FFF
add a,$80
jp Z, syscall1p_1
in a,(1) ; load mem page of addin code
ld l,a
.syscall1p_1
ld ($c004),hl ;par 2
rst $10
ld hl,($c00e)
ret
|
libsrc/_DEVELOPMENT/arch/cpm/z80/asm_cpm_get_offset.asm | jpoikela/z88dk | 640 | 787 | <reponame>jpoikela/z88dk
; ===============================================================
; 2015
; ===============================================================
;
; unsigned long cpm_get_offset(void *p)
;
; Return the three-byte little endian value at address p.
;
; ===============================================================
SECTION code_clib
SECTION code_arch
PUBLIC asm_cpm_get_offset
asm_cpm_get_offset:
; enter : hl = void *p
;
; exit : dehl = three-byte little endian value at p
;
; uses : de, hl
ld e,(hl)
inc hl
ld d,(hl)
inc hl
ld l,(hl)
ld h,0
ex de,hl
ret
|
source/encodings-line_endings-generic_add_cr.ads | Vovanium/Encodings | 0 | 21193 | <filename>source/encodings-line_endings-generic_add_cr.ads
generic
type Character_Type is (<>); -- Character, Wide_Character, Wide_Wide_Character (or whatever)
type String_Type is array(Positive range <>) of Character_Type;
Carriage_Return: in Character_Type; -- CR in the corresponding type
Line_Feed: in Character_Type; -- LF in the corresponding type
type Coder_Base is abstract tagged private; -- Type to derive
package Encodings.Line_Endings.Generic_Add_CR is
type Coder is new Coder_Base with private;
procedure Convert(
This: in out Coder; -- Coder state
Source: in String_Type; -- String to be converted
Source_Last: out Natural; -- Last index of source string read (length if string is starting at 1)
Target: out String_Type; -- Converted string
Target_Last: out Natural -- Last Index of destination string written
);
private
type Coder_State is (
Initial,
Have_CR,
Need_LF
);
type Coder is new Coder_Base with record
State: Coder_State := Initial;
end record;
end Encodings.Line_Endings.Generic_Add_CR;
|
programs/oeis/005/A005378.asm | jmorken/loda | 1 | 93521 | ; A005378: The female of a pair of recurrences.
; 1,1,2,2,3,3,4,5,5,6,6,7,8,8,9,9,10,11,11,12,13,13,14,14,15,16,16,17,17,18,19,19,20,21,21,22,22,23,24,24,25,25,26,27,27,28,29,29,30,30,31,32,32,33,34,34,35,35,36,37,37,38,38,39,40,40,41,42,42,43,43,44,45,45,46,46,47,48,48,49,50,50,51,51,52,53,53,54,55,55,56,56,57,58,58,59,59,60,61,61,62,63,63,64,64,65,66,66,67,67,68,69,69,70,71,71,72,72,73,74,74,75,76,76,77,77,78,79,79,80,80,81,82,82,83,84,84,85,85,86,87,87,88,89,89,90,90,91,92,92,93,93,94,95,95,96,97,97,98,98,99,100,100,101,101,102,103,103,104,105,105,106,106,107,108,108,109,110,110,111,111,112,113,113,114,114,115,116,116,117,118,118,119,119,120,121,121,122,122,123,124,124,125,126,126,127,127,128,129,129,130,131,131,132,132,133,134,134,135,135,136,137,137,138,139,139,140,140,141,142,142,143,144,144,145,145,146,147,147,148,148,149,150,150,151,152,152,153,153,154
mov $2,$0
add $2,1
mov $0,$2
cal $0,293407 ; Least integer k such that k/n^2 > (-1 + sqrt(5))/2 (the golden ratio).
div $0,$2
mov $1,$0
|
bssn/code/src/bssnbase-initial.ads | leo-brewin/adm-bssn-numerical | 1 | 15549 | package BSSNBase.Initial is
procedure create_data;
procedure create_grid;
end BSSNBase.Initial;
|
Transynther/x86/_processed/NONE/_xt_/i9-9900K_12_0xa0_notsx.log_21829_1107.asm | ljhsiun2/medusa | 9 | 177826 | .global s_prepare_buffers
s_prepare_buffers:
push %r15
push %r9
push %rax
push %rbx
push %rcx
push %rdi
push %rsi
lea addresses_WC_ht+0x1de48, %rsi
lea addresses_D_ht+0xb488, %rdi
clflush (%rdi)
nop
cmp %rbx, %rbx
mov $32, %rcx
rep movsw
nop
nop
nop
nop
sub $52485, %rax
lea addresses_normal_ht+0xdd88, %r9
nop
nop
dec %rdi
movw $0x6162, (%r9)
nop
nop
nop
and $37976, %rbx
lea addresses_WT_ht+0x59e8, %rsi
nop
xor %r15, %r15
mov $0x6162636465666768, %rbx
movq %rbx, %xmm4
movups %xmm4, (%rsi)
nop
nop
nop
nop
cmp %rcx, %rcx
lea addresses_WT_ht+0xf124, %r9
nop
nop
nop
nop
nop
lfence
movb (%r9), %r15b
nop
nop
nop
nop
add $45664, %r15
pop %rsi
pop %rdi
pop %rcx
pop %rbx
pop %rax
pop %r9
pop %r15
ret
.global s_faulty_load
s_faulty_load:
push %r11
push %r12
push %r14
push %rdx
push %rsi
// Faulty Load
lea addresses_WT+0x1cf88, %rdx
add $37726, %r11
vmovups (%rdx), %ymm0
vextracti128 $0, %ymm0, %xmm0
vpextrq $1, %xmm0, %rsi
lea oracles, %rdx
and $0xff, %rsi
shlq $12, %rsi
mov (%rdx,%rsi,1), %rsi
pop %rsi
pop %rdx
pop %r14
pop %r12
pop %r11
ret
/*
<gen_faulty_load>
[REF]
{'src': {'type': 'addresses_WT', 'AVXalign': False, 'size': 2, 'NT': False, 'same': False, 'congruent': 0}, 'OP': 'LOAD'}
[Faulty Load]
{'src': {'type': 'addresses_WT', 'AVXalign': False, 'size': 32, 'NT': False, 'same': True, 'congruent': 0}, 'OP': 'LOAD'}
<gen_prepare_buffer>
{'src': {'type': 'addresses_WC_ht', 'congruent': 6, 'same': True}, 'OP': 'REPM', 'dst': {'type': 'addresses_D_ht', 'congruent': 8, 'same': False}}
{'OP': 'STOR', 'dst': {'type': 'addresses_normal_ht', 'AVXalign': False, 'size': 2, 'NT': True, 'same': False, 'congruent': 9}}
{'OP': 'STOR', 'dst': {'type': 'addresses_WT_ht', 'AVXalign': False, 'size': 16, 'NT': False, 'same': False, 'congruent': 5}}
{'src': {'type': 'addresses_WT_ht', 'AVXalign': False, 'size': 1, 'NT': False, 'same': False, 'congruent': 2}, 'OP': 'LOAD'}
{'39': 21829}
39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39
*/
|
src/commands.asm | LessNick/CLi-for-WildCommander | 8 | 103624 | <reponame>LessNick/CLi-for-WildCommander
;---------------------------------------------
; Command's table below with all jump vectors
;---------------------------------------------
cmdTable
;--- A ---
;--- B ---
;--- C ---
db "cd"
db "*"
dw changeDir
db "cls"
db "*"
dw clearScreen
;--- D ---
db "dir"
db "*"
dw listDir
;--- E ---
db "echo"
db "*"
dw echoString
db "exec"
db "*"
dw executeApp
db "exit"
db "*"
dw closeCli
;--- F ---
;--- G ---
db "gfxborder"
db "*"
dw gfxBorder
db "gfxcls"
db "*"
dw gfxCls
db "gfxloadpal"
db "*"
dw loadGfxPal
;--- H ---
db "help"
db "*"
dw showHelp
;--- I ---
;--- J ---
;--- K ---
;--- L ---
db "loadfnt"
db "*"
dw loadTxtFnt
db "loadpal"
db "*"
dw loadTxtPal
db "ls"
db "*"
dw listDir
; db "loadmod"
; db "*"
; dw modLoad
;--- M ---
; db "modload"
; db "*"
; dw modLoad
; db "modplay"
; db "*"
; dw playModule
; db "modstop"
; db "*"
; dw stopModule
;--- N ---
;db "gsreset"
;db "*"
;dw resetGS
;--- O ---
;--- P ---
db "pwd"
db "*"
dw pathWorkDir
;--- Q ---
;--- R ---
db "rehash"
db "*"
dw scopeBinary
;--- S ---
db "screen"
db "*"
dw switchScreen
db "sh"
db "*"
dw shellExecute
db "sleep"
db "*"
dw sleepSeconds
;--- T ---
; db "test"
; db "*"
; dw testCmd
;--- U ---
;--- V ---
;--- W ---
;--- X ---
;--- Y ---
;--- Z ---
;--- table end marker ---
db #00
|
002/source.asm | Guilherme-De-Marchi/curso-assembly-wr-kits | 0 | 162714 | <gh_stars>0
; ========================================================================
;
; Curso de Assembly para Microcontroladores PIC 002
; Link do curso: https://www.youtube.com/channel/UCazAvTtoRlOrFDWDJDB2DKQ
;
; MCU: PIC16F84A Clock: 4MHz
;
; Autor: https://github.com/Guilherme-De-Marchi
; Data: 10-21
;
; ========================================================================
list p=16f84a ; PIC16F84A
; --- Includes ---
#include <p16f84a.inc>
; --- Fuse bits ---
__config _XT_OSC & _WDT_OFF & _PWRTE_ON & _CP_OFF
; --- Memory pagination ---
#define bank0 bcf STATUS,RP0 ; Select memory bank 0
#define bank1 bsf STATUS,RP0 ; Select memory bank 1
; --- Inputs ---
#define btn1 PORTA,RA0 ; RA0 pin from PORTA
; --- Outputs ---
#define led1 PORTB,RB0 ; RB0 pin from PORTB
; --- Reset vector ---
org H'0000'
goto main ; Program starts here
; --- Interruption vector ---
org H'0004'
retfie
; --- Main ---
main:
bank1 ; Select bank 1
movlw H'FF' ; Binary: 1111 1111
movwf TRISA ; All PORTA -> INPUT
movlw H'FE' ; Binary: 1111 1110
movwf TRISB ; PORTB RB0 -> OUTPUT
bank0 ; Select bank 0
movlw H'FF' ; Binary: 1111 1111
movwf PORTB ; PORTB RB0 -> HIGH
goto $ ; Infinite loop
end |
firmware/coreboot/3rdparty/libgfxinit/common/haswell/hw-gfx-gma-plls-wrpll.adb | fabiojna02/OpenCellular | 1 | 4047 | <gh_stars>1-10
--
-- Copyright (C) 2015 secunet Security Networks AG
--
-- This program is free software; you can redistribute it and/or modify
-- it under the terms of the GNU General Public License as published by
-- the Free Software Foundation; either version 2 of the License, or
-- (at your option) any later version.
--
-- This program is distributed in the hope that it will be useful,
-- but WITHOUT ANY WARRANTY; without even the implied warranty of
-- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-- GNU General Public License for more details.
--
with HW.Time;
with HW.GFX.GMA.Registers;
package body HW.GFX.GMA.PLLs.WRPLL is
----------------------------------------------------------------------------
--
-- Divider calculation as found in Linux' i915 driver
--
-- Copyright (C) 2012 Intel Corporation
--
-- Permission is hereby granted, free of charge, to any person obtaining a
-- copy of this software and associated documentation files (the "Software"),
-- to deal in the Software without restriction, including without limitation
-- the rights to use, copy, modify, merge, publish, distribute, sublicense,
-- and/or sell copies of the Software, and to permit persons to whom the
-- Software is furnished to do so, subject to the following conditions:
--
-- The above copyright notice and this permission notice (including the next
-- paragraph) shall be included in all copies or substantial portions of the
-- Software.
--
-- THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
-- IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
-- FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
-- THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
-- LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
-- FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS
-- IN THE SOFTWARE.
--
-- Authors:
-- <NAME> <<EMAIL>>
--
LC_FREQ : constant := 2700; -- in MHz
LC_FREQ_2K : constant := LC_FREQ * 2000; -- in 500Hz
P_MIN : constant := 2;
P_MAX : constant := 62; -- i915 says 64, but this would overflow 6-bit
P_INC : constant := 2;
-- Constraints for PLL good behavior
REF_MIN : constant := 48;
REF_MAX : constant := 400;
VCO_MIN : constant := 2400;
VCO_MAX : constant := 4800;
type R2_Range is new Natural range 0 .. LC_FREQ * 2 / REF_MIN;
type N2_Range is new Natural range 0 .. VCO_MAX * Natural (R2_Range'Last) / LC_FREQ;
type P_Range is new Natural range 0 .. P_MAX;
type RNP is record
P : P_Range;
N2 : N2_Range;
R2 : R2_Range;
end record;
Invalid_RNP : constant RNP := RNP'(0, 0, 0);
function Get_Budget_For_Freq
(Clock : HW.GFX.Frequency_Type)
return Word64
is
Result : Word64;
begin
case Clock is
when 25175000 |
25200000 |
27000000 |
27027000 |
37762500 |
37800000 |
40500000 |
40541000 |
54000000 |
54054000 |
59341000 |
59400000 |
72000000 |
74176000 |
74250000 |
81000000 |
81081000 |
89012000 |
89100000 |
108000000 |
108108000 |
111264000 |
111375000 |
148352000 |
148500000 |
162000000 |
162162000 |
222525000 |
222750000 |
296703000 |
297000000 =>
Result := 0;
when 233500000 |
245250000 |
247750000 |
253250000 |
298000000 =>
Result := 1500;
when 169128000 |
169500000 |
179500000 |
202000000 =>
Result := 2000;
when 256250000 |
262500000 |
270000000 |
272500000 |
273750000 |
280750000 |
281250000 |
286000000 |
291750000 =>
Result := 4000;
when 267250000 |
268500000 =>
Result := 5000;
when others =>
Result := 1000;
end case;
return Result;
end Get_Budget_For_Freq;
procedure Update_RNP
(Freq_2K : in Word64;
Budget : in Word64;
R2 : in R2_Range;
N2 : in N2_Range;
P : in P_Range;
Best : in out RNP)
with
Depends => (Best =>+ (Freq_2K, Budget, R2, N2, P))
is
use type HW.Word64;
function Abs_Diff (A, B : Word64) return Word64
is
Result : Word64;
begin
if A > B then
Result := A - B;
else
Result := B - A;
end if;
return Result;
end Abs_Diff;
A, B, C, D, Diff, Diff_Best : Word64;
begin
-- No best (r,n,p) yet */
if Best.P = 0 then
Best.P := P;
Best.N2 := N2;
Best.R2 := R2;
else
-- Config clock is (LC_FREQ_2K / 2000) * N / (P * R), which compares to
-- freq2k.
--
-- delta = 1e6 *
-- abs(freq2k - (LC_FREQ_2K * n2/(p * r2))) /
-- freq2k;
--
-- and we would like delta <= budget.
--
-- If the discrepancy is above the PPM-based budget, always prefer to
-- improve upon the previous solution. However, if you're within the
-- budget, try to maximize Ref * VCO, that is N / (P * R^2).
A := Freq_2K * Budget * Word64 (P) * Word64 (R2);
B := Freq_2K * Budget * Word64 (Best.P) * Word64 (Best.R2);
Diff := Abs_Diff
(Freq_2K * Word64 (P) * Word64 (R2),
LC_FREQ_2K * Word64 (N2));
Diff_Best := Abs_Diff
(Freq_2K * Word64 (Best.P) * Word64 (Best.R2),
LC_FREQ_2K * Word64 (Best.N2));
C := 1000000 * Diff;
D := 1000000 * Diff_Best;
if A < C and B < D then
-- If both are above the Budget, pick the closer
if Word64 (Best.P) * Word64 (Best.R2) * Diff
< Word64 (P) * Word64 (R2) * Diff_Best
then
Best.P := P;
Best.N2 := N2;
Best.R2 := R2;
end if;
elsif A >= C and B < D then
-- If A is below the threshold but B is above it? Update.
Best.P := P;
Best.N2 := N2;
Best.R2 := R2;
elsif A >= C and B >= D then
-- Both are below the limit, so pick the higher N2/(R2*R2)
if Word64 (N2) * Word64 (Best.R2) * Word64 (Best.R2)
> Word64 (Best.N2) * Word64 (R2) * Word64 (R2)
then
Best.P := P;
Best.N2 := N2;
Best.R2 := R2;
end if;
end if;
-- Otherwise A < C && B >= D, do nothing
end if;
end Update_RNP;
procedure Calculate_WRPLL
(Clock : in HW.GFX.Frequency_Type;
R2_Out : out R2_Range;
N2_Out : out N2_Range;
P_Out : out P_Range)
with
Global => null,
Pre => True,
Post => True
is
use type HW.Word64;
Freq_2K : Word64;
Budget : Word64;
Best : RNP := Invalid_RNP;
begin
Freq_2K := Word64 (Clock) / 100; -- PLL output should be 5x
-- the pixel clock
Budget := Get_Budget_For_Freq (Clock);
-- Special case handling for 540MHz pixel clock: bypass WR PLL entirely
-- and directly pass the LC PLL to it. */
if Freq_2K = 5400000 then
N2_Out := 2;
P_Out := 1;
R2_Out := 2;
else
-- Ref = LC_FREQ / R, where Ref is the actual reference input seen by
-- the WR PLL.
--
-- We want R so that REF_MIN <= Ref <= REF_MAX.
-- Injecting R2 = 2 * R gives:
-- REF_MAX * r2 > LC_FREQ * 2 and
-- REF_MIN * r2 < LC_FREQ * 2
--
-- Which means the desired boundaries for r2 are:
-- LC_FREQ * 2 / REF_MAX < r2 < LC_FREQ * 2 / REF_MIN
--
for R2 in R2_Range range
LC_FREQ * 2 / REF_MAX + 1 .. LC_FREQ * 2 / REF_MIN
loop
-- VCO = N * Ref, that is: VCO = N * LC_FREQ / R
--
-- Once again we want VCO_MIN <= VCO <= VCO_MAX.
-- Injecting R2 = 2 * R and N2 = 2 * N, we get:
-- VCO_MAX * r2 > n2 * LC_FREQ and
-- VCO_MIN * r2 < n2 * LC_FREQ)
--
-- Which means the desired boundaries for n2 are:
-- VCO_MIN * r2 / LC_FREQ < n2 < VCO_MAX * r2 / LC_FREQ
for N2 in N2_Range range
N2_Range (VCO_MIN * Natural (R2) / LC_FREQ + 1)
.. N2_Range (VCO_MAX * Natural (R2) / LC_FREQ)
loop
for P_Fract in Natural range P_MIN / P_INC .. P_MAX / P_INC
loop
Update_RNP
(Freq_2K, Budget, R2, N2, P_Range (P_Fract * P_INC), Best);
end loop;
end loop;
end loop;
N2_Out := Best.N2;
P_Out := Best.P;
R2_Out := Best.R2;
end if;
end Calculate_WRPLL;
--
----------------------------------------------------------------------------
type Regs is array (WRPLLs) of Registers.Registers_Index;
WRPLL_CTL : constant Regs := Regs'(Registers.WRPLL_CTL_1, Registers.WRPLL_CTL_2);
WRPLL_CTL_PLL_ENABLE : constant := 1 * 2 ** 31;
WRPLL_CTL_SELECT_LCPLL : constant := 3 * 2 ** 28;
function WRPLL_CTL_DIVIDER_FEEDBACK (N2 : N2_Range) return Word32
is
begin
return Word32 (N2) * 2 ** 16;
end WRPLL_CTL_DIVIDER_FEEDBACK;
function WRPLL_CTL_DIVIDER_POST (P : P_Range) return Word32
is
begin
return Word32 (P) * 2 ** 8;
end WRPLL_CTL_DIVIDER_POST;
function WRPLL_CTL_DIVIDER_REFERENCE (R2 : R2_Range) return Word32
is
begin
return Word32 (R2) * 2 ** 0;
end WRPLL_CTL_DIVIDER_REFERENCE;
----------------------------------------------------------------------------
procedure On
(PLL : in WRPLLs;
Target_Clock : in Frequency_Type;
Success : out Boolean)
is
R2 : R2_Range;
N2 : N2_Range;
P : P_Range;
begin
Calculate_WRPLL (Target_Clock, R2, N2, P);
Registers.Write
(Register => WRPLL_CTL (PLL),
Value => WRPLL_CTL_PLL_ENABLE or
WRPLL_CTL_SELECT_LCPLL or
WRPLL_CTL_DIVIDER_FEEDBACK (N2) or
WRPLL_CTL_DIVIDER_POST (P) or
WRPLL_CTL_DIVIDER_REFERENCE (R2));
Registers.Posting_Read (WRPLL_CTL (PLL));
Time.U_Delay (20);
Success := True;
end On;
procedure Off (PLL : WRPLLs)
is
begin
Registers.Unset_Mask (WRPLL_CTL (PLL), WRPLL_CTL_PLL_ENABLE);
end Off;
end HW.GFX.GMA.PLLs.WRPLL;
|
QuantitativeAlloy/models/alloy/bibliometrics/bibliometrics.als | pf7/QAlloy | 0 | 2997 | sig Keyword, Medium{}
sig Author{
Q : set Keyword
}
sig Paper{
//c0 C c means c0 is cited by c or c cites c0
C : set Paper,
//k K p means that paper p has keyword k
K : set Keyword,
//a A p means a is among the authors of paper p.
A : set Author,
//m p is the publication medium of paper p (a function)
m : one Medium,
R : set Keyword,
//k S p means paper p is cited by at least another (btw different) paper q "in the same area" (keyword k).
S : set Keyword
}
//Papers cannot cite themselves
fact{ no C & iden }
fact{
R = K & C.K
S = K & ~C.K
Q = ~A.S
}
run{
//Every author has published something
all a : Author | some p : Paper | a in p.A
//Every paper has at least one author and at least one keyword
all p : Paper | some p.K and some a : Author | a in p.A
some Q
} for exactly 3 Paper, exactly 3 Author, exactly 1 Medium, exactly 1 Keyword
|
programs/oeis/280/A280737.asm | karttu/loda | 1 | 90849 | <reponame>karttu/loda
; A280737: a(n) = A007302(n)-1.
; 0,0,1,0,1,1,1,0,1,1,2,1,2,1,1,0,1,1,2,1,2,2,2,1,2,2,2,1,2,1,1,0,1,1,2,1,2,2,2,1,2,2,3,2,3,2,2,1,2,2,3,2,3,2,2,1,2,2,2,1,2,1,1,0,1,1,2,1,2,2,2,1,2,2,3,2,3,2,2,1,2,2,3,2,3,3,3,2,3,3,3,2,3,2,2,1,2,2,3,2,3,3,3,2,3,3,3,2,3,2,2,1,2,2,3,2,3,2,2,1,2,2,2,1,2,1,1,0,1,1,2,1,2,2,2,1,2,2,3,2,3,2,2,1,2,2,3,2,3,3,3,2,3,3,3,2,3,2,2,1,2,2,3,2,3,3,3,2,3,3,4,3,4,3,3,2,3,3,4,3,4,3,3,2,3,3,3,2,3,2,2,1,2,2,3,2,3,3,3,2,3,3,4,3,4,3,3,2,3,3,4,3,4,3,3,2,3,3,3,2,3,2,2,1,2,2,3,2,3,3,3,2,3,3,3,2,3,2,2,1,2,2,3,2,3,2,2,1,2,2
cal $0,216195 ; Abelian complexity function of the period-doubling sequence (A096268).
mov $1,$0
sub $1,2
|
Cubical/Categories/Instances/Semilattice.agda | FernandoLarrain/cubical | 1 | 11735 | {-# OPTIONS --safe #-}
module Cubical.Categories.Instances.Semilattice where
open import Cubical.Foundations.Prelude
open import Cubical.Algebra.Semilattice
open import Cubical.Categories.Category
open import Cubical.Categories.Instances.Poset
open Category
module _ {ℓ} (L : Semilattice ℓ) where
open JoinSemilattice L
JoinSemilatticeCategory : Category ℓ ℓ
JoinSemilatticeCategory = PosetCategory IndPoset
module _ {ℓ} (L : Semilattice ℓ) where
open MeetSemilattice L
MeetSemilatticeCategory : Category ℓ ℓ
MeetSemilatticeCategory = PosetCategory IndPoset
|
src/Equivalence/Path-split.agda | nad/equality | 3 | 11528 | ------------------------------------------------------------------------
-- Some alternative definitions of the concept of being an equivalence
------------------------------------------------------------------------
-- Partly based on the blog post "Universal properties without
-- function extensionality" by <NAME>
-- (https://homotopytypetheory.org/2014/11/02/universal-properties-without-function-extensionality/),
-- and the corresponding code in the Coq HoTT library
-- (https://github.com/HoTT/HoTT).
{-# OPTIONS --without-K --safe #-}
open import Equality
module Equivalence.Path-split
{e⁺} (eq : ∀ {a p} → Equality-with-J a p e⁺) where
open Derived-definitions-and-properties eq
open import Logical-equivalence using (_⇔_)
open import Prelude
open import Bijection eq as B using (_↔_)
open import Embedding eq using (Embedding)
open import Equality.Decision-procedures eq
open import Equivalence eq as Eq using (_≃_; Is-equivalence)
open import Equivalence.Erased.Basics eq using (Is-equivalenceᴱ)
open import Function-universe eq as F hiding (id; _∘_)
open import H-level eq as H-level
open import H-level.Closure eq
open import Surjection eq using (Split-surjective; _↠_)
private
variable
a b c d p : Level
A B : Type a
x y : A
f : A → B
k : Kind
n : ℕ
------------------------------------------------------------------------
-- Path-split
-- An alternative definition of "Is-equivalence".
Path-split : {A : Type a} {B : Type b} → ℕ → (A → B) → Type (a ⊔ b)
Path-split zero f = ↑ _ ⊤
Path-split (suc n) f =
Split-surjective f ×
(∀ x y → Path-split n (cong {x = x} {y = y} f))
private
-- A lemma.
eq→emb : Is-equivalence f → Is-equivalence (cong {x = x} {y = y} f)
eq→emb eq =
Embedding.is-embedding (from-isomorphism Eq.⟨ _ , eq ⟩) _ _
-- Equivalences are path-split.
Is-equivalence→Path-split : Is-equivalence f → Path-split n f
Is-equivalence→Path-split {n = zero} eq = _
Is-equivalence→Path-split {n = suc n} eq =
_≃_.split-surjective Eq.⟨ _ , eq ⟩
, λ x y → Is-equivalence→Path-split (eq→emb eq)
private
-- Path-split n f holds, for n ≥ 2, iff f is an equivalence.
Path-split⇔Is-equivalence :
Path-split (2 + n) f ⇔ Is-equivalence f
Path-split⇔Is-equivalence {f = f} = record
{ to = λ (s , p) →
let inv = proj₁ ∘ s
is-inv = proj₂ ∘ s
in _≃_.is-equivalence $ Eq.↔⇒≃ (record
{ surjection = record
{ right-inverse-of = is-inv
}
; left-inverse-of = λ x → $⟨ is-inv (f x) ⟩
f (inv (f x)) ≡ f x ↝⟨ proj₁ ∘ proj₁ (p _ _) ⟩
inv (f x) ≡ x □
})
; from = Is-equivalence→Path-split
}
-- If f is an equivalence, then Split-surjective f is contractible
-- (assuming extensionality).
Split-surjective-contractible-for-equivalences :
∀ {a b} {A : Type a} {B : Type b} {f : A → B} →
Extensionality b (a ⊔ b) →
Is-equivalence f →
Contractible (Split-surjective f)
Split-surjective-contractible-for-equivalences
{A = A} {B = B} {f = f} ext eq =
propositional⇒inhabited⇒contractible
(Π-closure ext 1 λ y →
let surj : (∃ λ x → x ≡ _≃_.from A≃B y) ↠ (∃ λ x → f x ≡ y)
surj = ∃-cong λ x →
x ≡ _≃_.from A≃B y ↔⟨ inverse $ Eq.≃-≡ A≃B ⟩
f x ≡ f (_≃_.from A≃B y) ↝⟨ ≡⇒↝ _ $ cong (_ ≡_) $ _≃_.right-inverse-of A≃B _ ⟩□
f x ≡ y □
in
H-level.respects-surjection surj 1 $
mono₁ 0 $
singleton-contractible _)
(_≃_.split-surjective A≃B)
where
A≃B : A ≃ B
A≃B = Eq.⟨ _ , eq ⟩
-- If f is an equivalence, then Path-split n f is contractible
-- (assuming extensionality).
Path-split-contractible-for-equivalences :
{A : Type a} {B : Type b} {f : A → B} →
Extensionality (a ⊔ b) (a ⊔ b) →
Is-equivalence f →
Contractible (Path-split n f)
Path-split-contractible-for-equivalences {n = zero} _ _ =
↑-closure 0 $
⊤-contractible
Path-split-contractible-for-equivalences
{a = a} {b = b} {n = suc n} {A = A} {B = B} {f = f} ext eq =
×-closure 0
(Split-surjective-contractible-for-equivalences
(lower-extensionality a lzero ext) eq)
(Π-closure (lower-extensionality b lzero ext) 0 λ _ →
Π-closure (lower-extensionality b lzero ext) 0 λ _ →
Path-split-contractible-for-equivalences
ext (eq→emb eq))
-- Path-split n is pointwise propositional for n ≥ 2 (assuming
-- extensionality).
Path-split-propositional :
{A : Type a} {B : Type b} {f : A → B} →
Extensionality (a ⊔ b) (a ⊔ b) →
Is-proposition (Path-split (2 + n) f)
Path-split-propositional ext =
[inhabited⇒contractible]⇒propositional λ p →
Path-split-contractible-for-equivalences ext $
_⇔_.to Path-split⇔Is-equivalence p
-- There is a bijection between Path-split n f, for n ≥ 2, and
-- Is-equivalence f (assuming extensionality).
Path-split↔Is-equivalence :
{A : Type a} {B : Type b} {f : A → B} →
Path-split (2 + n) f ↝[ a ⊔ b ∣ a ⊔ b ] Is-equivalence f
Path-split↔Is-equivalence =
generalise-ext?-prop
Path-split⇔Is-equivalence
Path-split-propositional
(λ ext → Eq.propositional ext _)
-- Another alternative definition of "Is-equivalence".
Path-split-∞ : {A : Type a} {B : Type b} → (A → B) → Type (a ⊔ b)
Path-split-∞ f = ∀ n → Path-split n f
-- Path-split-∞ is pointwise propositional (assuming extensionality).
Path-split-∞-propositional :
{A : Type a} {B : Type b} {f : A → B} →
Extensionality (a ⊔ b) (a ⊔ b) →
Is-proposition (Path-split-∞ f)
Path-split-∞-propositional ext =
[inhabited⇒contractible]⇒propositional λ p →
Π-closure (lower-extensionality _ lzero ext) 0 λ _ →
Path-split-contractible-for-equivalences ext $
_⇔_.to Path-split⇔Is-equivalence (p 2)
-- There is a bijection between Path-split-∞ f and Is-equivalence f
-- (assuming extensionality).
Path-split-∞↔Is-equivalence :
{A : Type a} {B : Type b} {f : A → B} →
Path-split-∞ f ↝[ a ⊔ b ∣ a ⊔ b ] Is-equivalence f
Path-split-∞↔Is-equivalence =
generalise-ext?-prop
(record
{ to = λ p → _⇔_.to Path-split⇔Is-equivalence (p 2)
; from = λ eq _ → Is-equivalence→Path-split eq
})
Path-split-∞-propositional
(λ ext → Eq.propositional ext _)
-- A preservation lemma for Path-split.
Path-split-cong :
{A : Type a} {B : Type b} {C : Type c} {D : Type d}
{f : A → B} {g : C → D} →
Extensionality? k (a ⊔ b ⊔ c ⊔ d) (a ⊔ b ⊔ c ⊔ d) →
(A≃C : A ≃ C) (B≃D : B ≃ D) →
(∀ x → g (_≃_.to A≃C x) ≡ _≃_.to B≃D (f x)) →
∀ n → Path-split n f ↝[ k ] Path-split n g
Path-split-cong
{a = a} {b = b} {c = c} {d = d} {k = k} {f = f} {g = g}
ext A≃C B≃D hyp = λ where
zero →
↑ _ ⊤ ↔⟨ B.↑↔ ⟩
⊤ ↔⟨ inverse B.↑↔ ⟩□
↑ _ ⊤ □
(suc n) →
(Split-surjective f ↔⟨⟩
(∀ y → ∃ λ x → f x ≡ y) ↝⟨ (Π-cong (lower-extensionality? k (a ⊔ c) lzero ext) B≃D λ y →
Σ-cong A≃C λ x →
(f x ≡ y) ↔⟨ inverse $ Eq.≃-≡ B≃D ⟩
(_≃_.to B≃D (f x) ≡ _≃_.to B≃D y) ↝⟨ ≡⇒↝ _ $ cong (_≡ _) $ sym $ hyp x ⟩□
(g (_≃_.to A≃C x) ≡ _≃_.to B≃D y) □) ⟩
(∀ y → ∃ λ x → g x ≡ y) ↔⟨⟩
Split-surjective g □)
×-cong
(Π-cong (lower-extensionality? k (b ⊔ d) lzero ext) A≃C λ x →
Π-cong (lower-extensionality? k (b ⊔ d) lzero ext) A≃C λ y →
Path-split-cong ext
(x ≡ y ↝⟨ inverse $ Eq.≃-≡ A≃C ⟩□
_≃_.to A≃C x ≡ _≃_.to A≃C y □)
(f x ≡ f y ↝⟨ inverse $ Eq.≃-≡ B≃D ⟩
_≃_.to B≃D (f x) ≡ _≃_.to B≃D (f y) ↝⟨ ≡⇒↝ _ $ cong₂ _≡_ (sym $ hyp x) (sym $ hyp y) ⟩□
g (_≃_.to A≃C x) ≡ g (_≃_.to A≃C y) □)
(λ x≡y →
cong g (cong (_≃_.to A≃C) x≡y) ≡⟨ cong-∘ _ _ _ ⟩
cong (g ∘ _≃_.to A≃C) x≡y ≡⟨ elim¹
(λ {y} x≡y →
cong (g ∘ _≃_.to A≃C) x≡y ≡
trans (trans (hyp x) (cong (_≃_.to B≃D ∘ f) x≡y))
(sym $ hyp y))
(
cong (g ∘ _≃_.to A≃C) (refl _) ≡⟨ cong-refl _ ⟩
refl _ ≡⟨ sym $ trans-symʳ _ ⟩
trans (hyp x) (sym $ hyp x) ≡⟨ cong (flip trans _) $
trans (sym $ trans-reflʳ _) $
cong (trans _) $ sym $ cong-refl _ ⟩∎
trans (trans (hyp x) (cong (_≃_.to B≃D ∘ f) (refl _)))
(sym $ hyp x) ∎)
_ ⟩
trans (trans (hyp x) (cong (_≃_.to B≃D ∘ f) x≡y))
(sym $ hyp y) ≡⟨ trans (cong (flip trans _) $ sym $
subst-trans _) $
trans-subst ⟩
subst (_ ≡_) (sym $ hyp y)
(subst (_≡ _) (sym $ hyp x)
(cong (_≃_.to B≃D ∘ f) x≡y)) ≡⟨ trans (cong (subst _ _) $
subst-in-terms-of-≡⇒↝ equivalence _ _ _) $
subst-in-terms-of-≡⇒↝ equivalence _ _ _ ⟩
_≃_.to (≡⇒↝ _ (cong (_ ≡_) (sym $ hyp y)))
(_≃_.to (≡⇒↝ _ (cong (_≡ _) (sym $ hyp x)))
(cong (_≃_.to B≃D ∘ f) x≡y)) ≡⟨ cong (_$ cong (_≃_.to B≃D ∘ f) x≡y) $ sym $
≡⇒↝-trans equivalence ⟩
_≃_.to
(≡⇒↝ _ $
trans (cong (_≡ _) (sym $ hyp x))
(cong (_ ≡_) (sym $ hyp y)))
(cong (_≃_.to B≃D ∘ f) x≡y) ≡⟨⟩
_≃_.to (≡⇒↝ _ $ cong₂ _≡_ (sym $ hyp x) (sym $ hyp y))
(cong (_≃_.to B≃D ∘ f) x≡y) ≡⟨ cong (_≃_.to (≡⇒↝ _ _)) $ sym $
cong-∘ _ _ _ ⟩∎
_≃_.to (≡⇒↝ _ $ cong₂ _≡_ (sym $ hyp x) (sym $ hyp y))
(cong (_≃_.to B≃D) (cong f x≡y)) ∎)
n)
------------------------------------------------------------------------
-- Extendable along
-- Is-[ n ]-extendable-along-[ f ] P means that P is n-extendable
-- along f.
Is-[_]-extendable-along-[_] :
{A : Type a} {B : Type b} →
ℕ → (A → B) → (B → Type c) → Type (a ⊔ b ⊔ c)
Is-[ zero ]-extendable-along-[ f ] P = ↑ _ ⊤
Is-[ suc n ]-extendable-along-[ f ] P =
((g : ∀ x → P (f x)) →
∃ λ (h : ∀ x → P x) → ∀ x → h (f x) ≡ g x) ×
((g h : ∀ x → P x) →
Is-[ n ]-extendable-along-[ f ] (λ x → g x ≡ h x))
-- Is-∞-extendable-along-[ f ] P means that P is ∞-extendable along f.
Is-∞-extendable-along-[_] :
{A : Type a} {B : Type b} →
(A → B) → (B → Type c) → Type (a ⊔ b ⊔ c)
Is-∞-extendable-along-[ f ] P =
∀ n → Is-[ n ]-extendable-along-[ f ] P
-- In the presence of extensionality Is-[_]-extendable-along-[_] can
-- be expressed using Path-split.
Is-extendable-along≃Path-split :
{A : Type a} {B : Type b} {P : B → Type p} {f : A → B} →
Extensionality (a ⊔ b ⊔ p) (a ⊔ b ⊔ p) →
∀ n →
Is-[ n ]-extendable-along-[ f ] P ≃
Path-split n (λ (g : ∀ x → P x) → g ∘ f)
Is-extendable-along≃Path-split {a = a} {b = b} {p = p} {f = f} ext =
λ where
zero → Eq.id
(suc n) →
(∀-cong (lower-extensionality b lzero ext) λ g →
∃-cong λ h →
(∀ x → h (f x) ≡ g x) ↝⟨ Eq.extensionality-isomorphism
(lower-extensionality (b ⊔ p) (a ⊔ b) ext) ⟩□
h ∘ f ≡ g □)
×-cong
(∀-cong (lower-extensionality a lzero ext) λ g →
∀-cong (lower-extensionality a lzero ext) λ h →
Is-[ n ]-extendable-along-[ f ] (λ x → g x ≡ h x) ↝⟨ Is-extendable-along≃Path-split ext n ⟩
Path-split n (_∘ f) ↝⟨ Path-split-cong ext
(Eq.extensionality-isomorphism ext₁)
(Eq.extensionality-isomorphism ext₂)
(λ eq →
cong (_∘ f) (apply-ext (Eq.good-ext ext₁) eq) ≡⟨ Eq.cong-pre-∘-good-ext ext₂ ext₁ _ ⟩∎
apply-ext (Eq.good-ext ext₂) (eq ∘ f) ∎)
n ⟩□
Path-split n (cong (_∘ f)) □)
where
ext₁ = lower-extensionality (a ⊔ p) (a ⊔ b) ext
ext₂ = lower-extensionality (b ⊔ p) (a ⊔ b) ext
-- In the presence of extensionality Is-∞-extendable-along-[_] can
-- be expressed using Path-split-∞.
Is-∞-extendable-along≃Path-split-∞ :
{A : Type a} {B : Type b} {P : B → Type p} {f : A → B} →
Extensionality (a ⊔ b ⊔ p) (a ⊔ b ⊔ p) →
Is-∞-extendable-along-[ f ] P ≃
Path-split-∞ (λ (g : ∀ x → P x) → g ∘ f)
Is-∞-extendable-along≃Path-split-∞ ext =
∀-cong (lower-extensionality _ lzero ext) $
Is-extendable-along≃Path-split ext
-- Is-[ 2 + n ]-extendable-along-[ f ] P is propositional (assuming
-- extensionality).
Is-extendable-along-propositional :
{A : Type a} {B : Type b} {P : B → Type p} {f : A → B} →
Extensionality (a ⊔ b ⊔ p) (a ⊔ b ⊔ p) →
Is-proposition (Is-[ 2 + n ]-extendable-along-[ f ] P)
Is-extendable-along-propositional ext =
H-level-cong _ 1 (inverse $ Is-extendable-along≃Path-split ext _) $
Path-split-propositional ext
-- Is-∞-extendable-along-[ f ] P is propositional (assuming
-- extensionality).
Is-∞-extendable-along-propositional :
{A : Type a} {B : Type b} {P : B → Type p} {f : A → B} →
Extensionality (a ⊔ b ⊔ p) (a ⊔ b ⊔ p) →
Is-proposition (Is-∞-extendable-along-[ f ] P)
Is-∞-extendable-along-propositional ext =
H-level-cong _ 1 (inverse $ Is-∞-extendable-along≃Path-split-∞ ext) $
Path-split-∞-propositional ext
-- In the presence of extensionality Is-∞-extendable-along-[_] can be
-- expressed using Is-equivalence.
Is-∞-extendable-along≃Is-equivalence :
{A : Type a} {B : Type b} {P : B → Type p} {f : A → B} →
Extensionality (a ⊔ b ⊔ p) (a ⊔ b ⊔ p) →
Is-∞-extendable-along-[ f ] P ≃
Is-equivalence (λ (g : ∀ x → P x) → g ∘ f)
Is-∞-extendable-along≃Is-equivalence {P = P} {f = f} ext =
Is-∞-extendable-along-[ f ] P ↝⟨ Is-∞-extendable-along≃Path-split-∞ ext ⟩
Path-split-∞ (_∘ f) ↝⟨ Path-split-∞↔Is-equivalence ext ⟩□
Is-equivalence (_∘ f) □
-- The definitions below are not taken directly from "Universal
-- properties without function extensionality".
-- A type B is P-null for a predicate P of type A → Type p if the
-- function const of type B → P x → B is an equivalence for each x.
--
-- This definition is based on one from "Modalities in Homotopy Type
-- Theory" by Rijke, Shulman and Spitters.
_-Null_ : {A : Type a} → (A → Type p) → Type b → Type (a ⊔ b ⊔ p)
P -Null B = ∀ x → Is-equivalence (const ⦂ (B → P x → B))
-- A variant of _-Null_ with erased proofs.
_-Nullᴱ_ : {A : Type a} → (A → Type p) → Type b → Type (a ⊔ b ⊔ p)
P -Nullᴱ B = ∀ x → Is-equivalenceᴱ (const ⦂ (B → P x → B))
-- Is-∞-extendable-along-[_] can sometimes be replaced by
-- Is-equivalence const.
Is-∞-extendable-along≃Is-equivalence-const :
{A : Type a} {B : Type b} →
Extensionality (a ⊔ b) (a ⊔ b) →
Is-∞-extendable-along-[ (λ (_ : A) → lift tt) ] (λ (_ : ↑ a ⊤) → B) ≃
Is-equivalence (const ⦂ (B → A → B))
Is-∞-extendable-along≃Is-equivalence-const {a = a} {A = A} {B = B} ext =
Is-∞-extendable-along-[ (λ _ → lift tt) ] (λ (_ : ↑ a ⊤) → B) ↝⟨ Is-∞-extendable-along≃Is-equivalence ext ⟩
Is-equivalence (_∘ (λ _ → lift tt) ⦂ ((↑ a ⊤ → B) → (A → B))) ↝⟨ inverse $
Is-equivalence≃Is-equivalence-∘ʳ
(_≃_.is-equivalence $ Eq.↔→≃ (_$ lift tt) const refl refl) ext ⟩□
Is-equivalence (const ⦂ (B → A → B)) □
-- A corollary of Is-∞-extendable-along≃Is-equivalence-const.
Π-Is-∞-extendable-along≃Null :
{A : Type a} {P : A → Type p} {B : Type b} →
Extensionality (a ⊔ b ⊔ p) (b ⊔ p) →
(∀ x → Is-∞-extendable-along-[ (λ (_ : P x) → lift tt) ]
(λ (_ : ↑ p ⊤) → B)) ≃
P -Null B
Π-Is-∞-extendable-along≃Null {a = a} {p = p} {b = b} ext =
∀-cong (lower-extensionality (b ⊔ p) lzero ext) λ _ →
Is-∞-extendable-along≃Is-equivalence-const
(lower-extensionality a lzero ext)
private
-- If const is an equivalence from Bool to B → Bool, then B is not
-- not inhabited (assuming extensionality).
Is-equivalence-const→¬¬ :
{B : Type b} →
Extensionality b lzero →
Is-equivalence (const ⦂ (Bool → B → Bool)) →
¬ ¬ B
Is-equivalence-const→¬¬ {B = B} ext =
curry
(Is-equivalence (const ⦂ (Bool → B → Bool)) × ¬ B →⟨ Σ-map Eq.⟨ _ ,_⟩ (Eq.↔⇒≃ ∘ inverse ∘ B.⊥↔uninhabited) ⟩
Bool ≃ (B → Bool) × B ≃ ⊥ →⟨ (λ (≃B→ , B≃) → →-cong ext B≃ F.id F.∘ ≃B→) ⟩
Bool ≃ (⊥ → Bool) →⟨ Π⊥↔⊤ ext F.∘_ ⟩
Bool ≃ ⊤ →⟨ (λ eq → _≃_.to (Eq.≃-≡ eq) (refl _)) ⟩
true ≡ false →⟨ Bool.true≢false ⟩□
⊥ □)
-- If const is an equivalence from Bool to B → Bool, and equality is
-- decidable for B, then B is a proposition.
Is-equivalence-const→Decidable-equality→Is-proposition :
Is-equivalence (const ⦂ (Bool → B → Bool)) →
Decidable-equality B →
Is-proposition B
Is-equivalence-const→Decidable-equality→Is-proposition
{B = B} eq _≟_ x y = x≡y
where
lemma :
(f g : B → Bool) → f ≢ g →
(h : B → Bool) → f ≡ h ⊎ g ≡ h
lemma = $⟨ helper ⟩
((x y : Bool) → x ≢ y → (z : Bool) → x ≡ z ⊎ y ≡ z) →⟨ (Π-cong _ equiv λ x → Π-cong _ equiv λ y →
→-cong-→ (→-cong-→ (_≃_.from (Eq.≃-≡ equiv)) id) $
Π-cong _ equiv λ z →
_≃_.from (Eq.≃-≡ equiv ⊎-cong Eq.≃-≡ equiv)) ⟩□
((f g : B → Bool) → f ≢ g → (h : B → Bool) → f ≡ h ⊎ g ≡ h) □
where
equiv : Bool ≃ (B → Bool)
equiv = Eq.⟨ _ , eq ⟩
true≡⊎false≡ : (b : Bool) → true ≡ b ⊎ false ≡ b
true≡⊎false≡ true = inj₁ (refl _)
true≡⊎false≡ false = inj₂ (refl _)
helper : (x y : Bool) → x ≢ y → (z : Bool) → x ≡ z ⊎ y ≡ z
helper true true t≢t = ⊥-elim $ t≢t (refl _)
helper true false _ = true≡⊎false≡
helper false true _ = _↔_.to ⊎-comm ∘ true≡⊎false≡
helper false false f≢f = ⊥-elim $ f≢f (refl _)
f₁ f₂ f₃ : B → Bool
f₁ _ = true
f₂ _ = false
f₃ z = if x ≟ z then true else false
f₁≢f₂ : f₁ ≢ f₂
f₁≢f₂ f₁≡f₂ = Bool.true≢false $ cong (_$ x) f₁≡f₂
f₁≡f₃→x≡y : f₁ ≡ f₃ → x ≡ y
f₁≡f₃→x≡y f₁≡f₃ = helper (x ≟ y) (cong (_$ y) f₁≡f₃)
where
helper :
(d : Dec (x ≡ y)) →
true ≡ if d then true else false →
x ≡ y
helper (yes x≡y) _ = x≡y
helper (no _) true≡false =
⊥-elim $ Bool.true≢false true≡false
f₂≢f₃ : f₂ ≢ f₃
f₂≢f₃ =
f₂ ≡ f₃ →⟨ cong (_$ x) ⟩
false ≡ if x ≟ x then true else false →⟨ flip trans (helper (x ≟ x)) ⟩
false ≡ true →⟨ Bool.true≢false ∘ sym ⟩□
⊥ □
where
helper :
(d : Dec (x ≡ x)) →
if d then true else false ≡ true
helper (yes _) = refl _
helper (no x≢x) = ⊥-elim $ x≢x $ refl _
f₁≡⊎f₂≡ : (f : B → Bool) → f₁ ≡ f ⊎ f₂ ≡ f
f₁≡⊎f₂≡ = lemma f₁ f₂ f₁≢f₂
x≡y : x ≡ y
x≡y with f₁≡⊎f₂≡ f₃
… | inj₁ f₁≡f₃ = f₁≡f₃→x≡y f₁≡f₃
… | inj₂ f₂≡f₃ = ⊥-elim $ f₂≢f₃ f₂≡f₃
-- If f is an equivalence, then n-extendability along f is
-- contractible (assuming extensionality).
Is-extendable-along-contractible-for-equivalences :
{A : Type a} {B : Type b} {f : A → B} {P : B → Type p} →
Extensionality (a ⊔ b ⊔ p) (a ⊔ b ⊔ p) →
Is-equivalence f →
∀ n → Contractible (Is-[ n ]-extendable-along-[ f ] P)
Is-extendable-along-contractible-for-equivalences _ _ zero =
↑-closure 0 ⊤-contractible
Is-extendable-along-contractible-for-equivalences
{a = a} {b = b} {p = p} {f = f} {P = P} ext eq (suc n) =
×-closure 0
(Π-closure (lower-extensionality b lzero ext) 0 λ g →
$⟨ singleton-contractible _ ⟩
Contractible (∃ λ h → h ≡ subst P (inv _) ∘ g ∘ f⁻¹) ↝⟨ H-level-cong _ 0 (lemma g) ⦂ (_ → _) ⟩□
Contractible (∃ λ h → ∀ x → h (f x) ≡ g x) □)
(Π-closure (lower-extensionality a lzero ext) 0 λ _ →
Π-closure (lower-extensionality a lzero ext) 0 λ _ →
Is-extendable-along-contractible-for-equivalences ext eq n)
where
f⁻¹ = _≃_.from Eq.⟨ _ , eq ⟩
inv = _≃_.left-inverse-of (inverse Eq.⟨ _ , eq ⟩)
lemma : ∀ _ → _ ≃ _
lemma g =
(∃ λ h → h ≡ subst P (inv _) ∘ g ∘ f⁻¹) ↔⟨ (∃-cong λ h → inverse $
∘from≡↔≡∘to′ (lower-extensionality p (a ⊔ b) ext) (inverse Eq.⟨ _ , eq ⟩)) ⟩
(∃ λ h → h ∘ f ≡ g) ↝⟨ (∃-cong λ _ → inverse $
Eq.extensionality-isomorphism (lower-extensionality (b ⊔ p) (a ⊔ b) ext)) ⟩□
(∃ λ h → ∀ x → h (f x) ≡ g x) □
-- If f is an equivalence, then ∞-extendability along f is
-- contractible (assuming extensionality).
Is-∞-extendable-along-contractible-for-equivalences :
{A : Type a} {B : Type b} {f : A → B} {P : B → Type p} →
Extensionality (a ⊔ b ⊔ p) (a ⊔ b ⊔ p) →
Is-equivalence f →
Contractible (Is-∞-extendable-along-[ f ] P)
Is-∞-extendable-along-contractible-for-equivalences ext eq =
Π-closure (lower-extensionality _ lzero ext) 0 λ n →
Is-extendable-along-contractible-for-equivalences ext eq n
------------------------------------------------------------------------
-- Alternatives to Is-[_]-extendable-along-[_] and
-- Is-∞-extendable-along-[_]
-- A variant of Is-[_]-extendable-along-[_].
Is-[_]-extendable-along-const-tt-[_] :
ℕ → Type a → Type b → Type (a ⊔ b)
Is-[ zero ]-extendable-along-const-tt-[ A ] B = ↑ _ ⊤
Is-[ suc n ]-extendable-along-const-tt-[ A ] B =
((g : A → B) → ∃ λ (x : B) → ∀ y → x ≡ g y) ×
((x y : B) → Is-[ n ]-extendable-along-const-tt-[ A ] (x ≡ y))
-- A variant of Is-∞-extendable-along-[_].
Is-∞-extendable-along-const-tt-[_] :
Type a → Type b → Type (a ⊔ b)
Is-∞-extendable-along-const-tt-[ A ] B =
∀ n → Is-[ n ]-extendable-along-const-tt-[ A ] B
-- In some cases Is-[_]-extendable-along-[_] and
-- Is-∞-extendable-along-[_] can be replaced by the variants.
≃Is-extendable-along-const-tt :
{A : Type a} {B : Type b} →
Extensionality? k (a ⊔ b) (a ⊔ b) →
∀ n →
Is-[ n ]-extendable-along-[ (λ (_ : A) → lift tt) ]
(λ (_ : ↑ a ⊤) → B) ↝[ k ]
Is-[ n ]-extendable-along-const-tt-[ A ] B
≃Is-extendable-along-const-tt _ zero = F.id
≃Is-extendable-along-const-tt {a = a} {k = k} ext (suc n) =
(∀-cong ext λ _ →
Σ-cong (Eq.↔→≃ (_$ lift tt) const refl refl) λ _ →
F.id)
×-cong
Π-cong ext′ (Eq.↔→≃ (_$ lift tt) const refl refl) λ _ →
Π-cong ext′ (Eq.↔→≃ (_$ lift tt) const refl refl) λ _ →
≃Is-extendable-along-const-tt ext n
where
ext′ = lower-extensionality? k a lzero ext
≃Is-∞-extendable-along-const-tt :
{A : Type a} {B : Type b} →
Extensionality? k (a ⊔ b) (a ⊔ b) →
Is-∞-extendable-along-[ (λ (_ : A) → lift tt) ] (λ (_ : ↑ a ⊤) → B)
↝[ k ]
Is-∞-extendable-along-const-tt-[ A ] B
≃Is-∞-extendable-along-const-tt {k = k} ext =
∀-cong (lower-extensionality? k _ lzero ext) λ n →
≃Is-extendable-along-const-tt ext n
-- Preservation lemmas for Is-[_]-extendable-along-[_] and
-- Is-∞-extendable-along-[_].
Is-extendable-along-const-tt-cong :
{A : Type a} {B : Type b} {C : Type c} →
Extensionality? k (a ⊔ b ⊔ c) (a ⊔ b ⊔ c) →
(A≃B : A ≃ B)
(A→≃B→ : {C : Type c} → (A → C) ≃ (B → C)) →
({C : Type c} (f : A → C) (x : A) →
_≃_.to A→≃B→ f (_≃_.to A≃B x) ≡ f x) →
∀ n →
Is-[ n ]-extendable-along-const-tt-[ A ] C ↝[ k ]
Is-[ n ]-extendable-along-const-tt-[ B ] C
Is-extendable-along-const-tt-cong _ _ _ _ zero =
↑ _ ⊤ ↔⟨ B.↑↔ ⟩
⊤ ↔⟨ inverse B.↑↔ ⟩□
↑ _ ⊤ □
Is-extendable-along-const-tt-cong
{a = a} {b = b} {c = c} {k = k} ext A≃B A→≃B→ hyp (suc n) =
(Π-cong ext A→≃B→ λ g →
∃-cong λ x →
Π-cong (lower-extensionality? k c (a ⊔ b) ext) A≃B λ y →
x ≡ g y ↝⟨ ≡⇒↝ _ $ cong (_ ≡_) $ sym $ hyp g y ⟩□
x ≡ _≃_.to A→≃B→ g (_≃_.to A≃B y) □)
×-cong
(∀-cong (lower-extensionality? k (a ⊔ b) lzero ext) λ x →
∀-cong (lower-extensionality? k (a ⊔ b) lzero ext) λ y →
Is-extendable-along-const-tt-cong ext A≃B A→≃B→ hyp n)
Is-∞-extendable-along-const-tt-cong :
{A : Type a} {B : Type b} {C : Type c} →
Extensionality? k (a ⊔ b ⊔ c) (a ⊔ b ⊔ c) →
(A≃B : A ≃ B)
(A→≃B→ : {C : Type c} → (A → C) ≃ (B → C)) →
({C : Type c} (f : A → C) (x : A) →
_≃_.to A→≃B→ f (_≃_.to A≃B x) ≡ f x) →
Is-∞-extendable-along-const-tt-[ A ] C ↝[ k ]
Is-∞-extendable-along-const-tt-[ B ] C
Is-∞-extendable-along-const-tt-cong {k = k} ext A≃B A→≃B→ hyp =
∀-cong (lower-extensionality? k _ lzero ext) λ n →
Is-extendable-along-const-tt-cong ext A≃B A→≃B→ hyp n
|
ti-f28004x-resources-and-examples/examples_driverlib/examples/fsi/vcu_crc/vcu0_crc_8.asm | UOSupermileage/BLDC-F280049C | 2 | 179050 | ;;*****************************************************************************
;;! \file source/vcu0/vcu0_crc_8.asm
;;!
;;! \brief 8-bit CRC that uses the polynomial 0x07
;;
;; \date Apr 7, 2011
;;!
;;
;; Group: C2000
;; Target Family: F28004x
;;
;;#############################################################################
;; $TI Release: F28004x Support Library v1.10.00.00 $
;; $Release Date: Tue May 26 17:06:03 IST 2020 $
;; $Copyright:
;// Copyright (C) 2020 Texas Instruments Incorporated - http://www.ti.com/
;//
;// Redistribution and use in source and binary forms, with or without
;// modification, are permitted provided that the following conditions
;// are met:
;//
;// Redistributions of source code must retain the above copyright
;// notice, this list of conditions and the following disclaimer.
;//
;// Redistributions in binary form must reproduce the above copyright
;// notice, this list of conditions and the following disclaimer in the
;// documentation and/or other materials provided with the
;// distribution.
;//
;// Neither the name of Texas Instruments Incorporated nor the names of
;// its contributors may be used to endorse or promote products derived
;// from this software without specific prior written permission.
;//
;// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
;// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
;// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
;// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
;// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
;// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
;// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
;// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
;// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
;// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
;// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
;// $
;;#############################################################################
;;
;;*****************************************************************************
;; includes
;;*****************************************************************************
;;
;;*****************************************************************************
;; global defines
;;*****************************************************************************
;; CRC Routine defines
;
;/*! ASM- function to get the 8-bit CRC
; *
; * \param ACC = The initial value of crc, in case the message has been
; * chopped into several parts, you can use the crc8 of the previous
; * segment as the init value for the current segment crc8 calculation
; * until the final crc is derived.
; * \param *+XAR4 = Address of the message buffer
; * \param AR5 = Parity of the first message byte, i.e. whether its on an even
; * or odd address
; * \param *-SP[1]/AR0 = Length of the message in bytes
; *
; * Calculate the 8-bit CRC of a message buffer by using the VCU instructions,
; * VCRC8L_1 and VCRC8H_1
; *
; * \return CRC result in AL
; */
.if __TI_EABI__
.asg getCRC8_vcu , _getCRC8_vcu
.endif
.def _getCRC8_vcu
_getCRC8_vcu:
PUSH XAR0
PUSH XAR1
MOVZ AR0, *-SP[7] ; load rxLen
ADDB SP, #4 ; allocate 4 words for local
VMOV32 *-SP[2], VCRC ; Store current CRC
VCRCCLR
MOV *-SP[4], ACC
VMOV32 VCRC,*-SP[4] ; VCRC = Inital value
MOV AL, AR5 ; check the parity
SBF _CRC8_loop_prep, EQ
VCRC8H_1 *XAR4++ ; if parity=1, calculate high byte first
DEC AR0
SBF _CRC8done, EQ
_CRC8_loop_prep:
MOV AL, AR0
MOV AH, AR0
AND AL, #0xFFF8 ; check to see if the length is greater than 8 bytes
BF _CRC8_LSB,EQ
LSR AL, #3 ; loop in 8 bytes
MOV AR1, AL
SUB AR1, #1
.align (2) ; align at 32-bit boundary to remove penalty
RPTB _CRC8_post, AR1 ; loop for the middle part of the packet
VCRC8L_1 *XAR4
VCRC8H_1 *XAR4++
VCRC8L_1 *XAR4
VCRC8H_1 *XAR4++
VCRC8L_1 *XAR4
VCRC8H_1 *XAR4++
VCRC8L_1 *XAR4
VCRC8H_1 *XAR4++
_CRC8_post
LSL AL, #3 ; calculating remaining number of bytes
SUB AH, AL
SBF _CRC8done, EQ ; if multiple of 8, done
MOV AR0, AH
_CRC8_LSB
VCRC8L_1 *XAR4 ; if parity=0, calculate the low byte
DEC AR0
SBF _CRC8done, EQ
VCRC8H_1 *XAR4++
DEC AR0
SBF _CRC8_LSB, NEQ
_CRC8done
VMOV32 *-SP[4], VCRC ; Store CRC
MOV AL, *-SP[4] ; return AL
VMOV32 VCRC, *-SP[2] ; Restore VCRC
SUBB SP, #4 ; restore stack pointer
POP XAR1
POP XAR0
LRETR
;; End of file
|
programs/oeis/291/A291307.asm | neoneye/loda | 22 | 11885 | <gh_stars>10-100
; A291307: The arithmetic function v_6(n,2).
; 0,0,1,2,0,3,3,3,4,5,3,6,6,6,7,8,6,9,9,9,10,11,9,12,12,12,13,14,12,15,15,15,16,17,15,18,18,18,19,20,18,21,21,21,22,23,21,24,24,24,25,26,24,27,27,27,28,29,27,30,30,30,31,32,30,33,33,33,34
add $0,2
mov $1,$0
gcd $1,262146
sub $0,$1
div $0,2
|
Transynther/x86/_processed/NONE/_xt_/i7-7700_9_0x48.log_21829_1956.asm | ljhsiun2/medusa | 9 | 245006 | <filename>Transynther/x86/_processed/NONE/_xt_/i7-7700_9_0x48.log_21829_1956.asm
.global s_prepare_buffers
s_prepare_buffers:
push %r8
push %rax
push %rbp
push %rcx
push %rdi
push %rdx
push %rsi
lea addresses_WC_ht+0x148b8, %rsi
lea addresses_D_ht+0xb118, %rdi
dec %r8
mov $89, %rcx
rep movsl
nop
and %rbp, %rbp
lea addresses_WT_ht+0x1b0d8, %rax
nop
nop
nop
sub %rdx, %rdx
mov $0x6162636465666768, %rbp
movq %rbp, %xmm7
movups %xmm7, (%rax)
nop
nop
nop
cmp $811, %rbp
lea addresses_D_ht+0x12aa8, %rax
nop
nop
nop
inc %rdx
mov (%rax), %cx
cmp $56862, %rdi
lea addresses_A_ht+0x1cb14, %rsi
lea addresses_normal_ht+0x18f58, %rdi
nop
nop
nop
nop
dec %rax
mov $66, %rcx
rep movsq
nop
nop
nop
nop
dec %rcx
lea addresses_WC_ht+0x18228, %r8
nop
nop
nop
nop
sub $46115, %rdi
movb (%r8), %al
nop
nop
nop
sub $47797, %rdi
lea addresses_D_ht+0x4228, %rbp
add $11665, %rax
mov (%rbp), %di
nop
nop
nop
nop
nop
sub %rbp, %rbp
lea addresses_normal_ht+0xc1a8, %rsi
nop
nop
nop
nop
nop
inc %rdx
movb $0x61, (%rsi)
nop
nop
xor %rcx, %rcx
lea addresses_D_ht+0xed14, %rbp
xor $48796, %rax
mov $0x6162636465666768, %r8
movq %r8, %xmm3
vmovups %ymm3, (%rbp)
and $62823, %rdi
lea addresses_D_ht+0x46e8, %rdx
nop
nop
nop
and %rcx, %rcx
movb $0x61, (%rdx)
nop
nop
nop
nop
and %rdi, %rdi
lea addresses_A_ht+0x628, %rbp
nop
nop
xor $52441, %rdx
mov (%rbp), %edi
and $24326, %rbp
lea addresses_A_ht+0x9fe8, %rax
nop
xor $12473, %rsi
movb $0x61, (%rax)
nop
nop
nop
sub %rcx, %rcx
lea addresses_D_ht+0x1cb28, %rsi
lea addresses_A_ht+0x3fa8, %rdi
dec %r8
mov $55, %rcx
rep movsb
nop
nop
nop
nop
add $47272, %rdx
lea addresses_WT_ht+0x228, %rax
xor $2450, %r8
movups (%rax), %xmm7
vpextrq $1, %xmm7, %rdx
nop
nop
nop
dec %r8
lea addresses_D_ht+0x1bdc8, %rdi
nop
nop
nop
nop
xor $14044, %rax
movb $0x61, (%rdi)
nop
nop
nop
nop
nop
add %rcx, %rcx
lea addresses_normal_ht+0xc38, %rax
clflush (%rax)
xor $6696, %rdx
mov $0x6162636465666768, %rcx
movq %rcx, %xmm0
movups %xmm0, (%rax)
nop
nop
nop
nop
nop
xor %r8, %r8
pop %rsi
pop %rdx
pop %rdi
pop %rcx
pop %rbp
pop %rax
pop %r8
ret
.global s_faulty_load
s_faulty_load:
push %r13
push %r15
push %r8
push %rax
push %rbp
push %rbx
push %rdi
// Store
lea addresses_UC+0x13a28, %rdi
nop
nop
nop
cmp $1331, %rbx
mov $0x5152535455565758, %r8
movq %r8, (%rdi)
nop
nop
nop
nop
nop
dec %rbp
// Faulty Load
lea addresses_PSE+0x10228, %r15
and %r13, %r13
mov (%r15), %bp
lea oracles, %rbx
and $0xff, %rbp
shlq $12, %rbp
mov (%rbx,%rbp,1), %rbp
pop %rdi
pop %rbx
pop %rbp
pop %rax
pop %r8
pop %r15
pop %r13
ret
/*
<gen_faulty_load>
[REF]
{'OP': 'LOAD', 'src': {'type': 'addresses_PSE', 'AVXalign': False, 'congruent': 0, 'size': 32, 'same': False, 'NT': False}}
{'OP': 'STOR', 'dst': {'type': 'addresses_UC', 'AVXalign': False, 'congruent': 11, 'size': 8, 'same': False, 'NT': False}}
[Faulty Load]
{'OP': 'LOAD', 'src': {'type': 'addresses_PSE', 'AVXalign': False, 'congruent': 0, 'size': 2, 'same': True, 'NT': False}}
<gen_prepare_buffer>
{'OP': 'REPM', 'src': {'type': 'addresses_WC_ht', 'congruent': 4, 'same': False}, 'dst': {'type': 'addresses_D_ht', 'congruent': 4, 'same': False}}
{'OP': 'STOR', 'dst': {'type': 'addresses_WT_ht', 'AVXalign': False, 'congruent': 0, 'size': 16, 'same': False, 'NT': False}}
{'OP': 'LOAD', 'src': {'type': 'addresses_D_ht', 'AVXalign': False, 'congruent': 7, 'size': 2, 'same': False, 'NT': False}}
{'OP': 'REPM', 'src': {'type': 'addresses_A_ht', 'congruent': 1, 'same': False}, 'dst': {'type': 'addresses_normal_ht', 'congruent': 4, 'same': False}}
{'OP': 'LOAD', 'src': {'type': 'addresses_WC_ht', 'AVXalign': False, 'congruent': 11, 'size': 1, 'same': False, 'NT': False}}
{'OP': 'LOAD', 'src': {'type': 'addresses_D_ht', 'AVXalign': False, 'congruent': 11, 'size': 2, 'same': False, 'NT': False}}
{'OP': 'STOR', 'dst': {'type': 'addresses_normal_ht', 'AVXalign': False, 'congruent': 7, 'size': 1, 'same': False, 'NT': False}}
{'OP': 'STOR', 'dst': {'type': 'addresses_D_ht', 'AVXalign': False, 'congruent': 0, 'size': 32, 'same': False, 'NT': False}}
{'OP': 'STOR', 'dst': {'type': 'addresses_D_ht', 'AVXalign': False, 'congruent': 5, 'size': 1, 'same': False, 'NT': False}}
{'OP': 'LOAD', 'src': {'type': 'addresses_A_ht', 'AVXalign': False, 'congruent': 9, 'size': 4, 'same': False, 'NT': False}}
{'OP': 'STOR', 'dst': {'type': 'addresses_A_ht', 'AVXalign': False, 'congruent': 5, 'size': 1, 'same': False, 'NT': False}}
{'OP': 'REPM', 'src': {'type': 'addresses_D_ht', 'congruent': 8, 'same': False}, 'dst': {'type': 'addresses_A_ht', 'congruent': 4, 'same': False}}
{'OP': 'LOAD', 'src': {'type': 'addresses_WT_ht', 'AVXalign': False, 'congruent': 11, 'size': 16, 'same': False, 'NT': False}}
{'OP': 'STOR', 'dst': {'type': 'addresses_D_ht', 'AVXalign': False, 'congruent': 5, 'size': 1, 'same': False, 'NT': False}}
{'OP': 'STOR', 'dst': {'type': 'addresses_normal_ht', 'AVXalign': False, 'congruent': 2, 'size': 16, 'same': True, 'NT': False}}
{'33': 21829}
33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33
*/
|
perspective-sql/src/main/antlr4/org/meridor/perspective/sql/SQLParser.g4 | vania-pooh/perspective-backend | 19 | 7909 |
parser grammar SQLParser;
options
{ tokenVocab = SQLLexer; }
query
: select_query
| explain_query
;
//Entities
table_name
: ID
;
alias
: ID
;
column_name
: ( table_name DOT )? ( ID | MULTIPLY )
| ( alias DOT )? ( ID | MULTIPLY )
;
// Explain query
explain_query
: EXPLAIN select_query
;
// Select query
select_query
: select_clause ( from_clause )? ( where_clause )? ( group_clause )? ( having_clause )? ( order_clause )? ( limit_clause )? ( SEMICOLON )?
;
//subquery
// : LPAREN select_query RPAREN
// ;
select_clause
: SELECT select_expression
;
from_clause
: FROM table_references
;
where_clause
: WHERE complex_boolean_expression
;
group_clause
: GROUP BY expressions
;
having_clause
: HAVING complex_boolean_expression
;
order_clause
: ORDER BY order_expressions
;
offset : INT;
row_count: INT;
limit_clause
: LIMIT ( ( offset COMMA )? row_count | row_count OFFSET offset )
;
alias_clause
: ( AS )? alias
;
aliased_expression
: expression ( alias_clause )?
;
select_expression
: aliased_expression ( COMMA aliased_expression )*
;
columns_list
: column_name ( COMMA column_name )*
;
complex_boolean_expression
: simple_boolean_expression
| unary_boolean_operator complex_boolean_expression
| complex_boolean_expression (binary_boolean_operator complex_boolean_expression)+
| LPAREN complex_boolean_expression RPAREN
;
expressions
: expression ( COMMA expression )*
;
order_expressions
: order_expression ( COMMA order_expression )*
;
order_expression
: expression ( ASC | DESC )?
;
function_call
: ID LPAREN (expressions)? RPAREN
;
literal
: STRING
| INT
| FLOAT
| TRUE
| FALSE
| NULL
;
expression
: literal
| column_name
| function_call
| expression binary_arithmetic_operator expression
| unary_arithmetic_operator expression
// | subquery
;
relational_operator
: EQ
| LT
| GT
| NOT_EQ
| LTE
| GTE
;
binary_arithmetic_operator
: PLUS
| MINUS
| MULTIPLY
| DIVIDE
| MOD
| BIT_AND
| BIT_OR
| BIT_XOR
| SHIFT_LEFT
| SHIFT_RIGHT
;
unary_arithmetic_operator
: PLUS
| MINUS
| BIT_NOT
;
binary_boolean_operator
: AND
| XOR
| OR
;
unary_boolean_operator
: NOT
;
simple_boolean_expression
: expression relational_operator expression
| expression (NOT)? BETWEEN expression AND expression
| expression IS (NOT)? NULL
| expression (NOT)? LIKE expression
| expression (NOT)? REGEXP expression
| expression (NOT)? IN LPAREN expression (COMMA expression)* RPAREN
| TRUE
| FALSE
;
table_references
: table_reference ( COMMA table_reference )*
;
table_reference
: table_atom
| table_join
;
table_join
: table_atom ( join_clause )+
;
inner_join_clause
: ( INNER | CROSS )? JOIN table_atom ( join_condition )?
;
outer_join_clause
: ( LEFT | RIGHT ) ( OUTER )? JOIN table_atom join_condition
;
natural_join_clause
: NATURAL ( LEFT | RIGHT )? ( OUTER )? JOIN table_atom
;
join_clause
: inner_join_clause
| outer_join_clause
| natural_join_clause
;
table_atom
: table_name ( alias_clause )?
// | subquery alias_clause
| LPAREN table_references RPAREN
;
join_condition
: ON complex_boolean_expression
| USING LPAREN columns_list RPAREN
;
|
Cats/Category/Zero.agda | alessio-b-zak/cats | 0 | 12797 | <reponame>alessio-b-zak/cats<gh_stars>0
module Cats.Category.Zero where
open import Data.Empty using (⊥ ; ⊥-elim)
open import Level
open import Cats.Category
Zero : ∀ lo la l≈ → Category lo la l≈
Zero lo la l≈ = record
{ Obj = Lift lo ⊥
; _⇒_ = λ()
; _≈_ = λ {}
; id = λ{}
; _∘_ = λ{}
; equiv = λ{}
; ∘-resp = λ{}
; id-r = λ{}
; id-l = λ{}
; assoc = λ{}
}
|
oeis/215/A215541.asm | neoneye/loda-programs | 11 | 29749 | <filename>oeis/215/A215541.asm
; A215541: a(n) = binomial(5*n,n)*(3*n+1)/(4*n+1).
; Submitted by <NAME>
; 1,4,35,350,3705,40480,451269,5101360,58261125,670609940,7766844470,90404916420,1056658719675,12393263030400,145787921878840,1719353829326880,20322351313767965,240674861588534100,2855214354095519625,33924757188414045330,403641797464597415570,4808595302021208938240,57349888062294383542350,684692285781454680198000,8182172905321337419544775,97863049078460342838112380,1171429501810563753650331120,14032488421411191377224224800,168209686844348860326028853000,2017642405297432515470699142400
mov $2,5
mul $2,$0
mov $1,$2
bin $1,$0
sub $0,1
bin $2,$0
sub $1,$2
mov $0,$1
|
thirdparty/adasdl/thin/adasdl/AdaSDL_framebuff/sdltests/testtimer_sprogs.adb | Lucretia/old_nehe_ada95 | 0 | 6413 |
-- ----------------------------------------------------------------- --
-- --
-- This is free software; you can redistribute it and/or --
-- modify it under the terms of the GNU General Public --
-- License as published by the Free Software Foundation; either --
-- version 2 of the License, or (at your option) any later version. --
-- --
-- This software is distributed in the hope that it will be useful, --
-- but WITHOUT ANY WARRANTY; without even the implied warranty of --
-- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU --
-- General Public License for more details. --
-- --
-- You should have received a copy of the GNU General Public --
-- License along with this library; if not, write to the --
-- Free Software Foundation, Inc., 59 Temple Place - Suite 330, --
-- Boston, MA 02111-1307, USA. --
-- --
-- ----------------------------------------------------------------- --
-- ----------------------------------------------------------------- --
-- This is a translation, to the Ada programming language, of the --
-- original C test files written by <NAME> - www.libsdl.org --
-- translation made by <NAME> - www.adapower.net/~avargas --
-- ----------------------------------------------------------------- --
with Ada.Unchecked_Conversion;
with Ada.Text_IO; use Ada.Text_IO;
package body TestTimer_Sprogs is
use type C.int;
function To_int is new Ada.Unchecked_Conversion (System.Address, C.int);
-- ======================================
function ticktock (interval : Uint32) return Uint32 is
begin
ticks := ticks + 1;
return interval;
end ticktock;
-- ======================================
function callback (interval : Uint32; param : System.Address) return Uint32 is
begin
Put_Line ("Timer " & Uint32'Image (interval) &
" : param = " & C.int'Image (To_int (param)));
return interval;
end callback;
-- ======================================
end TestTimer_Sprogs;
|
Ada/Backup/utilities.ads | fintatarta/fakedsp | 0 | 17543 | <filename>Ada/Backup/utilities.ads
--
-- Many consider a "Utilities" package bad style and maybe it is true.
-- However, often you need some "odds and ends" stuff that is not
-- strictly related to the main code.
--
with Ada.Streams.Stream_IO;
use Ada;
package Utilities is
-- A generic function and a generic procedure to write "stuff" to
-- a stream. Maybe the usual stream functions would suffice.
generic
type Chunk_Type is private;
function Read_Chunk (From : Streams.Stream_IO.File_Type) return Chunk_Type;
generic
type Chunk_Type is private;
procedure Write_Chunk (To : Streams.Stream_IO.File_Type;
Item : Chunk_Type);
end Utilities;
|
Task/Combinations/AppleScript/combinations-1.applescript | LaudateCorpus1/RosettaCodeData | 1 | 432 | on comb(n, k)
set c to {}
repeat with i from 1 to k
set end of c to i's contents
end repeat
set r to {c's contents}
repeat while my next_comb(c, k, n)
set end of r to c's contents
end repeat
return r
end comb
on next_comb(c, k, n)
set i to k
set c's item i to (c's item i) + 1
repeat while (i > 1 and c's item i ≥ n - k + 1 + i)
set i to i - 1
set c's item i to (c's item i) + 1
end repeat
if (c's item 1 > n - k + 1) then return false
repeat with i from i + 1 to k
set c's item i to (c's item (i - 1)) + 1
end repeat
return true
end next_comb
return comb(5, 3)
|
programs/oeis/060/A060471.asm | karttu/loda | 0 | 84486 | ; A060471: Smallest positive a(n) such that number of solutions to a(n)=a(j)+a(k) j<k<n is three or less.
; 1,2,3,4,5,6,7,8,10,12,14,16,19,21,23,25,30,32,34,36,41,43,45,47,52,54,56,58,63,65,67,69,74,76,78,80,85,87,89,91,96,98,100,102,107,109,111,113,118,120,122,124,129,131,133,135,140,142,144,146,151,153,155,157
mov $4,$0
trn $0,7
mov $2,$0
trn $0,4
add $2,4
mov $1,$2
lpb $0,1
trn $0,4
add $1,$3
add $1,1
mov $3,2
lpe
lpb $4,1
add $1,1
sub $4,1
lpe
sub $1,3
|
orka_simd/src/x86/gnat/orka-simd-sse2-integers-shift.ads | onox/orka | 52 | 25516 | <filename>orka_simd/src/x86/gnat/orka-simd-sse2-integers-shift.ads<gh_stars>10-100
-- SPDX-License-Identifier: Apache-2.0
--
-- Copyright (c) 2021 onox <<EMAIL>>
--
-- Licensed under the Apache License, Version 2.0 (the "License");
-- you may not use this file except in compliance with the License.
-- You may obtain a copy of the License at
--
-- http://www.apache.org/licenses/LICENSE-2.0
--
-- Unless required by applicable law or agreed to in writing, software
-- distributed under the License is distributed on an "AS IS" BASIS,
-- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-- See the License for the specific language governing permissions and
-- limitations under the License.
package Orka.SIMD.SSE2.Integers.Shift is
pragma Pure;
function Shift_Bits_Left_Zeros (Elements, Bits : m128i) return m128i
with Import, Convention => Intrinsic, External_Name => "__builtin_ia32_pslld128";
-- Shift each element to the left by the given amount of bits from the
-- first Double of the Count register
function Shift_Bits_Right_Zeros (Elements, Bits : m128i) return m128i
with Import, Convention => Intrinsic, External_Name => "__builtin_ia32_psrld128";
-- Shift each element to the right by the given amount of bits from the
-- first Double of the Count register, shifting in zeros
function Shift_Bits_Right_Signs (Elements, Bits : m128i) return m128i
with Import, Convention => Intrinsic, External_Name => "__builtin_ia32_psrad128";
-- Shift each element to the right by the given amount of bits from the
-- first Double of the Count register, shifting in sign bits
--
-- If the value of the Double is > 31, then the elements will be either 16#FFFF_FFFF# or 0.
----------------------------------------------------------------------------
type Bits_Count is new Integer range 1 .. 32;
function Shift_Bits_Left_Zeros (Elements : m128i; Bits : Bits_Count) return m128i
with Import, Convention => Intrinsic, External_Name => "__builtin_ia32_pslldi128";
-- Shift each element to the left by the given amount of bits from the
-- first Double of the Count register, shifting in zeros
function Shift_Bits_Right_Zeros (Elements : m128i; Bits : Bits_Count) return m128i
with Import, Convention => Intrinsic, External_Name => "__builtin_ia32_psrldi128";
-- Shift each element to the right by the given amount of bits from the
-- first Double of the Count register, shifting in zeros
function Shift_Bits_Right_Signs (Elements : m128i; Bits : Bits_Count) return m128i
with Import, Convention => Intrinsic, External_Name => "__builtin_ia32_psradi128";
-- Shift each element to the right by the given amount of bits, shifting in
-- sign bits
--
-- If Bits is > 31, then the elements will be either 16#FFFF_FFFF# or 0.
end Orka.SIMD.SSE2.Integers.Shift;
|
src/Prelude/String.agda | L-TChen/agda-prelude | 111 | 4084 | module Prelude.String where
open import Agda.Primitive
open import Prelude.Unit
open import Prelude.Char
open import Prelude.Bool
open import Prelude.Nat
open import Prelude.List
open import Prelude.Maybe
open import Prelude.Equality
open import Prelude.Equality.Unsafe
open import Prelude.Decidable
open import Prelude.Ord
open import Prelude.Function
open import Prelude.Monad
open import Prelude.Semiring
open import Agda.Builtin.String public
open import Agda.Builtin.FromString public
unpackString = primStringToList
packString = primStringFromList
unpackString-inj : ∀ {x y} → unpackString x ≡ unpackString y → x ≡ y
unpackString-inj {x} p with unpackString x
unpackString-inj refl | ._ = unsafeEqual
infixr 5 _&_
_&_ = primStringAppend
-- Eq --
instance
EqString : Eq String
_==_ {{EqString}} x y with primStringEquality x y
... | true = yes unsafeEqual
... | false = no unsafeNotEqual
-- Ord --
instance
OrdString : Ord String
OrdString = OrdBy unpackString-inj
OrdLawsString : Ord/Laws String
OrdLawsString = OrdLawsBy unpackString-inj
-- Overloaded literals --
instance
StringIsString : IsString String
IsString.Constraint StringIsString _ = ⊤
IsString.fromString StringIsString s = s
ListIsString : IsString (List Char)
IsString.Constraint ListIsString _ = ⊤
IsString.fromString ListIsString s = unpackString s
-- Monoid --
instance
open import Prelude.Monoid
SemigroupString : Semigroup String
_<>_ {{SemigroupString}} = primStringAppend
MonoidString : Monoid String
Monoid.super MonoidString = it
mempty {{MonoidString}} = ""
-- More functions --
parseNat : String → Maybe Nat
parseNat = parseNat′ ∘ unpackString
where
pDigit : Char → Maybe Nat
pDigit c =
if isDigit c then just (charToNat c - charToNat '0')
else nothing
pNat : Nat → List Char → Maybe Nat
pNat n [] = just n
pNat n (c ∷ s) = pDigit c >>= λ d → pNat (n * 10 + d) s
parseNat′ : List Char → Maybe Nat
parseNat′ [] = nothing
parseNat′ (c ∷ s) = pDigit c >>= λ d → pNat d s
onChars : (List Char → List Char) → String → String
onChars f = packString ∘ f ∘ unpackString
words : String → List String
words = map packString ∘ wordsBy isSpace ∘ unpackString
ltrim : String → String
ltrim = onChars (dropWhile isSpace)
rtrim : String → String
rtrim = onChars (reverse ∘ dropWhile isSpace ∘ reverse)
trim : String → String
trim = rtrim ∘ ltrim
strTake : Nat → String → String
strTake n = onChars (take n)
strDrop : Nat → String → String
strDrop n = onChars (drop n)
strLength : String → Nat
strLength = length ∘ unpackString
strIsPrefixOf? : String → String → Bool
strIsPrefixOf? = isPrefixOf? on unpackString
strCommonPrefix : String → String → String
strCommonPrefix s₁ s₂ = packString $ (commonPrefix! on unpackString) s₁ s₂
|
tools-src/gnu/gcc/gcc/ada/layout.adb | enfoTek/tomato.linksys.e2000.nvram-mod | 80 | 3404 | <reponame>enfoTek/tomato.linksys.e2000.nvram-mod
------------------------------------------------------------------------------
-- --
-- GNAT COMPILER COMPONENTS --
-- --
-- L A Y O U T --
-- --
-- B o d y --
-- --
-- $Revision$
-- --
-- Copyright (C) 2001 Free Software Foundation, Inc. --
-- --
-- GNAT is free software; you can redistribute it and/or modify it under --
-- terms of the GNU General Public License as published by the Free Soft- --
-- ware Foundation; either version 2, or (at your option) any later ver- --
-- sion. GNAT is distributed in the hope that it will be useful, but WITH- --
-- OUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY --
-- or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License --
-- for more details. You should have received a copy of the GNU General --
-- Public License distributed with GNAT; see file COPYING. If not, write --
-- to the Free Software Foundation, 59 Temple Place - Suite 330, Boston, --
-- MA 02111-1307, USA. --
-- --
-- GNAT was originally developed by the GNAT team at New York University. --
-- Extensive contributions were provided by Ada Core Technologies Inc. --
-- --
------------------------------------------------------------------------------
with Atree; use Atree;
with Checks; use Checks;
with Debug; use Debug;
with Einfo; use Einfo;
with Errout; use Errout;
with Exp_Ch3; use Exp_Ch3;
with Exp_Util; use Exp_Util;
with Nlists; use Nlists;
with Nmake; use Nmake;
with Repinfo; use Repinfo;
with Sem; use Sem;
with Sem_Ch13; use Sem_Ch13;
with Sem_Eval; use Sem_Eval;
with Sem_Util; use Sem_Util;
with Sinfo; use Sinfo;
with Snames; use Snames;
with Stand; use Stand;
with Targparm; use Targparm;
with Tbuild; use Tbuild;
with Ttypes; use Ttypes;
with Uintp; use Uintp;
package body Layout is
------------------------
-- Local Declarations --
------------------------
SSU : constant Int := Ttypes.System_Storage_Unit;
-- Short hand for System_Storage_Unit
Vname : constant Name_Id := Name_uV;
-- Formal parameter name used for functions generated for size offset
-- values that depend on the discriminant. All such functions have the
-- following form:
--
-- function xxx (V : vtyp) return Unsigned is
-- begin
-- return ... expression involving V.discrim
-- end xxx;
-----------------------
-- Local Subprograms --
-----------------------
procedure Adjust_Esize_Alignment (E : Entity_Id);
-- E is the entity for a type or object. This procedure checks that the
-- size and alignment are compatible, and if not either gives an error
-- message if they cannot be adjusted or else adjusts them appropriately.
function Assoc_Add
(Loc : Source_Ptr;
Left_Opnd : Node_Id;
Right_Opnd : Node_Id)
return Node_Id;
-- This is like Make_Op_Add except that it optimizes some cases knowing
-- that associative rearrangement is allowed for constant folding if one
-- of the operands is a compile time known value.
function Assoc_Multiply
(Loc : Source_Ptr;
Left_Opnd : Node_Id;
Right_Opnd : Node_Id)
return Node_Id;
-- This is like Make_Op_Multiply except that it optimizes some cases
-- knowing that associative rearrangement is allowed for constant
-- folding if one of the operands is a compile time known value
function Assoc_Subtract
(Loc : Source_Ptr;
Left_Opnd : Node_Id;
Right_Opnd : Node_Id)
return Node_Id;
-- This is like Make_Op_Subtract except that it optimizes some cases
-- knowing that associative rearrangement is allowed for constant
-- folding if one of the operands is a compile time known value
function Compute_Length (Lo : Node_Id; Hi : Node_Id) return Node_Id;
-- Given expressions for the low bound (Lo) and the high bound (Hi),
-- Build an expression for the value hi-lo+1, converted to type
-- Standard.Unsigned. Takes care of the case where the operands
-- are of an enumeration type (so that the subtraction cannot be
-- done directly) by applying the Pos operator to Hi/Lo first.
function Expr_From_SO_Ref
(Loc : Source_Ptr;
D : SO_Ref)
return Node_Id;
-- Given a value D from a size or offset field, return an expression
-- representing the value stored. If the value is known at compile time,
-- then an N_Integer_Literal is returned with the appropriate value. If
-- the value references a constant entity, then an N_Identifier node
-- referencing this entity is returned. The Loc value is used for the
-- Sloc value of constructed notes.
function SO_Ref_From_Expr
(Expr : Node_Id;
Ins_Type : Entity_Id;
Vtype : Entity_Id := Empty)
return Dynamic_SO_Ref;
-- This routine is used in the case where a size/offset value is dynamic
-- and is represented by the expression Expr. SO_Ref_From_Expr checks if
-- the Expr contains a reference to the identifier V, and if so builds
-- a function depending on discriminants of the formal parameter V which
-- is of type Vtype. If not, then a constant entity with the value Expr
-- is built. The result is a Dynamic_SO_Ref to the created entity. Note
-- that Vtype can be omitted if Expr does not contain any reference to V.
-- the created entity. The declaration created is inserted in the freeze
-- actions of Ins_Type, which also supplies the Sloc for created nodes.
-- This function also takes care of making sure that the expression is
-- properly analyzed and resolved (which may not be the case yet if we
-- build the expression in this unit).
function Get_Max_Size (E : Entity_Id) return Node_Id;
-- E is an array type or subtype that has at least one index bound that
-- is the value of a record discriminant. For such an array, the function
-- computes an expression that yields the maximum possible size of the
-- array in storage units. The result is not defined for any other type,
-- or for arrays that do not depend on discriminants, and it is a fatal
-- error to call this unless Size_Depends_On_Discrminant (E) is True.
procedure Layout_Array_Type (E : Entity_Id);
-- Front end layout of non-bit-packed array type or subtype
procedure Layout_Record_Type (E : Entity_Id);
-- Front end layout of record type
-- Variant records not handled yet ???
procedure Rewrite_Integer (N : Node_Id; V : Uint);
-- Rewrite node N with an integer literal whose value is V. The Sloc
-- for the new node is taken from N, and the type of the literal is
-- set to a copy of the type of N on entry.
procedure Set_And_Check_Static_Size
(E : Entity_Id;
Esiz : SO_Ref;
RM_Siz : SO_Ref);
-- This procedure is called to check explicit given sizes (possibly
-- stored in the Esize and RM_Size fields of E) against computed
-- Object_Size (Esiz) and Value_Size (RM_Siz) values. Appropriate
-- errors and warnings are posted if specified sizes are inconsistent
-- with specified sizes. On return, the Esize and RM_Size fields of
-- E are set (either from previously given values, or from the newly
-- computed values, as appropriate).
----------------------------
-- Adjust_Esize_Alignment --
----------------------------
procedure Adjust_Esize_Alignment (E : Entity_Id) is
Abits : Int;
Esize_Set : Boolean;
begin
-- Nothing to do if size unknown
if Unknown_Esize (E) then
return;
end if;
-- Determine if size is constrained by an attribute definition clause
-- which must be obeyed. If so, we cannot increase the size in this
-- routine.
-- For a type, the issue is whether an object size clause has been
-- set. A normal size clause constrains only the value size (RM_Size)
if Is_Type (E) then
Esize_Set := Has_Object_Size_Clause (E);
-- For an object, the issue is whether a size clause is present
else
Esize_Set := Has_Size_Clause (E);
end if;
-- If size is known it must be a multiple of the byte size
if Esize (E) mod SSU /= 0 then
-- If not, and size specified, then give error
if Esize_Set then
Error_Msg_NE
("size for& not a multiple of byte size", Size_Clause (E), E);
return;
-- Otherwise bump up size to a byte boundary
else
Set_Esize (E, (Esize (E) + SSU - 1) / SSU * SSU);
end if;
end if;
-- Now we have the size set, it must be a multiple of the alignment
-- nothing more we can do here if the alignment is unknown here.
if Unknown_Alignment (E) then
return;
end if;
-- At this point both the Esize and Alignment are known, so we need
-- to make sure they are consistent.
Abits := UI_To_Int (Alignment (E)) * SSU;
if Esize (E) mod Abits = 0 then
return;
end if;
-- Here we have a situation where the Esize is not a multiple of
-- the alignment. We must either increase Esize or reduce the
-- alignment to correct this situation.
-- The case in which we can decrease the alignment is where the
-- alignment was not set by an alignment clause, and the type in
-- question is a discrete type, where it is definitely safe to
-- reduce the alignment. For example:
-- t : integer range 1 .. 2;
-- for t'size use 8;
-- In this situation, the initial alignment of t is 4, copied from
-- the Integer base type, but it is safe to reduce it to 1 at this
-- stage, since we will only be loading a single byte.
if Is_Discrete_Type (Etype (E))
and then not Has_Alignment_Clause (E)
then
loop
Abits := Abits / 2;
exit when Esize (E) mod Abits = 0;
end loop;
Init_Alignment (E, Abits / SSU);
return;
end if;
-- Now the only possible approach left is to increase the Esize
-- but we can't do that if the size was set by a specific clause.
if Esize_Set then
Error_Msg_NE
("size for& is not a multiple of alignment",
Size_Clause (E), E);
-- Otherwise we can indeed increase the size to a multiple of alignment
else
Set_Esize (E, ((Esize (E) + (Abits - 1)) / Abits) * Abits);
end if;
end Adjust_Esize_Alignment;
---------------
-- Assoc_Add --
---------------
function Assoc_Add
(Loc : Source_Ptr;
Left_Opnd : Node_Id;
Right_Opnd : Node_Id)
return Node_Id
is
L : Node_Id;
R : Uint;
begin
-- Case of right operand is a constant
if Compile_Time_Known_Value (Right_Opnd) then
L := Left_Opnd;
R := Expr_Value (Right_Opnd);
-- Case of left operand is a constant
elsif Compile_Time_Known_Value (Left_Opnd) then
L := Right_Opnd;
R := Expr_Value (Left_Opnd);
-- Neither operand is a constant, do the addition with no optimization
else
return Make_Op_Add (Loc, Left_Opnd, Right_Opnd);
end if;
-- Case of left operand is an addition
if Nkind (L) = N_Op_Add then
-- (C1 + E) + C2 = (C1 + C2) + E
if Compile_Time_Known_Value (Sinfo.Left_Opnd (L)) then
Rewrite_Integer
(Sinfo.Left_Opnd (L),
Expr_Value (Sinfo.Left_Opnd (L)) + R);
return L;
-- (E + C1) + C2 = E + (C1 + C2)
elsif Compile_Time_Known_Value (Sinfo.Right_Opnd (L)) then
Rewrite_Integer
(Sinfo.Right_Opnd (L),
Expr_Value (Sinfo.Right_Opnd (L)) + R);
return L;
end if;
-- Case of left operand is a subtraction
elsif Nkind (L) = N_Op_Subtract then
-- (C1 - E) + C2 = (C1 + C2) + E
if Compile_Time_Known_Value (Sinfo.Left_Opnd (L)) then
Rewrite_Integer
(Sinfo.Left_Opnd (L),
Expr_Value (Sinfo.Left_Opnd (L)) + R);
return L;
-- (E - C1) + C2 = E - (C1 - C2)
elsif Compile_Time_Known_Value (Sinfo.Right_Opnd (L)) then
Rewrite_Integer
(Sinfo.Right_Opnd (L),
Expr_Value (Sinfo.Right_Opnd (L)) - R);
return L;
end if;
end if;
-- Not optimizable, do the addition
return Make_Op_Add (Loc, Left_Opnd, Right_Opnd);
end Assoc_Add;
--------------------
-- Assoc_Multiply --
--------------------
function Assoc_Multiply
(Loc : Source_Ptr;
Left_Opnd : Node_Id;
Right_Opnd : Node_Id)
return Node_Id
is
L : Node_Id;
R : Uint;
begin
-- Case of right operand is a constant
if Compile_Time_Known_Value (Right_Opnd) then
L := Left_Opnd;
R := Expr_Value (Right_Opnd);
-- Case of left operand is a constant
elsif Compile_Time_Known_Value (Left_Opnd) then
L := Right_Opnd;
R := Expr_Value (Left_Opnd);
-- Neither operand is a constant, do the multiply with no optimization
else
return Make_Op_Multiply (Loc, Left_Opnd, Right_Opnd);
end if;
-- Case of left operand is an multiplication
if Nkind (L) = N_Op_Multiply then
-- (C1 * E) * C2 = (C1 * C2) + E
if Compile_Time_Known_Value (Sinfo.Left_Opnd (L)) then
Rewrite_Integer
(Sinfo.Left_Opnd (L),
Expr_Value (Sinfo.Left_Opnd (L)) * R);
return L;
-- (E * C1) * C2 = E * (C1 * C2)
elsif Compile_Time_Known_Value (Sinfo.Right_Opnd (L)) then
Rewrite_Integer
(Sinfo.Right_Opnd (L),
Expr_Value (Sinfo.Right_Opnd (L)) * R);
return L;
end if;
end if;
-- Not optimizable, do the multiplication
return Make_Op_Multiply (Loc, Left_Opnd, Right_Opnd);
end Assoc_Multiply;
--------------------
-- Assoc_Subtract --
--------------------
function Assoc_Subtract
(Loc : Source_Ptr;
Left_Opnd : Node_Id;
Right_Opnd : Node_Id)
return Node_Id
is
L : Node_Id;
R : Uint;
begin
-- Case of right operand is a constant
if Compile_Time_Known_Value (Right_Opnd) then
L := Left_Opnd;
R := Expr_Value (Right_Opnd);
-- Right operand is a constant, do the subtract with no optimization
else
return Make_Op_Subtract (Loc, Left_Opnd, Right_Opnd);
end if;
-- Case of left operand is an addition
if Nkind (L) = N_Op_Add then
-- (C1 + E) - C2 = (C1 - C2) + E
if Compile_Time_Known_Value (Sinfo.Left_Opnd (L)) then
Rewrite_Integer
(Sinfo.Left_Opnd (L),
Expr_Value (Sinfo.Left_Opnd (L)) - R);
return L;
-- (E + C1) - C2 = E + (C1 - C2)
elsif Compile_Time_Known_Value (Sinfo.Right_Opnd (L)) then
Rewrite_Integer
(Sinfo.Right_Opnd (L),
Expr_Value (Sinfo.Right_Opnd (L)) - R);
return L;
end if;
-- Case of left operand is a subtraction
elsif Nkind (L) = N_Op_Subtract then
-- (C1 - E) - C2 = (C1 - C2) + E
if Compile_Time_Known_Value (Sinfo.Left_Opnd (L)) then
Rewrite_Integer
(Sinfo.Left_Opnd (L),
Expr_Value (Sinfo.Left_Opnd (L)) + R);
return L;
-- (E - C1) - C2 = E - (C1 + C2)
elsif Compile_Time_Known_Value (Sinfo.Right_Opnd (L)) then
Rewrite_Integer
(Sinfo.Right_Opnd (L),
Expr_Value (Sinfo.Right_Opnd (L)) + R);
return L;
end if;
end if;
-- Not optimizable, do the subtraction
return Make_Op_Subtract (Loc, Left_Opnd, Right_Opnd);
end Assoc_Subtract;
--------------------
-- Compute_Length --
--------------------
function Compute_Length (Lo : Node_Id; Hi : Node_Id) return Node_Id is
Loc : constant Source_Ptr := Sloc (Lo);
Typ : constant Entity_Id := Etype (Lo);
Lo_Op : Node_Id;
Hi_Op : Node_Id;
begin
Lo_Op := New_Copy_Tree (Lo);
Hi_Op := New_Copy_Tree (Hi);
-- If type is enumeration type, then use Pos attribute to convert
-- to integer type for which subtraction is a permitted operation.
if Is_Enumeration_Type (Typ) then
Lo_Op :=
Make_Attribute_Reference (Loc,
Prefix => New_Occurrence_Of (Typ, Loc),
Attribute_Name => Name_Pos,
Expressions => New_List (Lo_Op));
Hi_Op :=
Make_Attribute_Reference (Loc,
Prefix => New_Occurrence_Of (Typ, Loc),
Attribute_Name => Name_Pos,
Expressions => New_List (Hi_Op));
end if;
return
Assoc_Add (Loc,
Left_Opnd =>
Assoc_Subtract (Loc,
Left_Opnd => Hi_Op,
Right_Opnd => Lo_Op),
Right_Opnd => Make_Integer_Literal (Loc, 1));
end Compute_Length;
----------------------
-- Expr_From_SO_Ref --
----------------------
function Expr_From_SO_Ref
(Loc : Source_Ptr;
D : SO_Ref)
return Node_Id
is
Ent : Entity_Id;
begin
if Is_Dynamic_SO_Ref (D) then
Ent := Get_Dynamic_SO_Entity (D);
if Is_Discrim_SO_Function (Ent) then
return
Make_Function_Call (Loc,
Name => New_Occurrence_Of (Ent, Loc),
Parameter_Associations => New_List (
Make_Identifier (Loc, Chars => Vname)));
else
return New_Occurrence_Of (Ent, Loc);
end if;
else
return Make_Integer_Literal (Loc, D);
end if;
end Expr_From_SO_Ref;
------------------
-- Get_Max_Size --
------------------
function Get_Max_Size (E : Entity_Id) return Node_Id is
Loc : constant Source_Ptr := Sloc (E);
Indx : Node_Id;
Ityp : Entity_Id;
Lo : Node_Id;
Hi : Node_Id;
S : Uint;
Len : Node_Id;
type Val_Status_Type is (Const, Dynamic);
type Val_Type (Status : Val_Status_Type := Const) is
record
case Status is
when Const => Val : Uint;
when Dynamic => Nod : Node_Id;
end case;
end record;
-- Shows the status of the value so far. Const means that the value
-- is constant, and Val is the current constant value. Dynamic means
-- that the value is dynamic, and in this case Nod is the Node_Id of
-- the expression to compute the value.
Size : Val_Type;
-- Calculated value so far if Size.Status = Const,
-- or expression value so far if Size.Status = Dynamic.
SU_Convert_Required : Boolean := False;
-- This is set to True if the final result must be converted from
-- bits to storage units (rounding up to a storage unit boundary).
-----------------------
-- Local Subprograms --
-----------------------
procedure Max_Discrim (N : in out Node_Id);
-- If the node N represents a discriminant, replace it by the maximum
-- value of the discriminant.
procedure Min_Discrim (N : in out Node_Id);
-- If the node N represents a discriminant, replace it by the minimum
-- value of the discriminant.
-----------------
-- Max_Discrim --
-----------------
procedure Max_Discrim (N : in out Node_Id) is
begin
if Nkind (N) = N_Identifier
and then Ekind (Entity (N)) = E_Discriminant
then
N := Type_High_Bound (Etype (N));
end if;
end Max_Discrim;
-----------------
-- Min_Discrim --
-----------------
procedure Min_Discrim (N : in out Node_Id) is
begin
if Nkind (N) = N_Identifier
and then Ekind (Entity (N)) = E_Discriminant
then
N := Type_Low_Bound (Etype (N));
end if;
end Min_Discrim;
-- Start of processing for Get_Max_Size
begin
pragma Assert (Size_Depends_On_Discriminant (E));
-- Initialize status from component size
if Known_Static_Component_Size (E) then
Size := (Const, Component_Size (E));
else
Size := (Dynamic, Expr_From_SO_Ref (Loc, Component_Size (E)));
end if;
-- Loop through indices
Indx := First_Index (E);
while Present (Indx) loop
Ityp := Etype (Indx);
Lo := Type_Low_Bound (Ityp);
Hi := Type_High_Bound (Ityp);
Min_Discrim (Lo);
Max_Discrim (Hi);
-- Value of the current subscript range is statically known
if Compile_Time_Known_Value (Lo)
and then Compile_Time_Known_Value (Hi)
then
S := Expr_Value (Hi) - Expr_Value (Lo) + 1;
-- If known flat bound, entire size of array is zero!
if S <= 0 then
return Make_Integer_Literal (Loc, 0);
end if;
-- Current value is constant, evolve value
if Size.Status = Const then
Size.Val := Size.Val * S;
-- Current value is dynamic
else
-- An interesting little optimization, if we have a pending
-- conversion from bits to storage units, and the current
-- length is a multiple of the storage unit size, then we
-- can take the factor out here statically, avoiding some
-- extra dynamic computations at the end.
if SU_Convert_Required and then S mod SSU = 0 then
S := S / SSU;
SU_Convert_Required := False;
end if;
Size.Nod :=
Assoc_Multiply (Loc,
Left_Opnd => Size.Nod,
Right_Opnd =>
Make_Integer_Literal (Loc, Intval => S));
end if;
-- Value of the current subscript range is dynamic
else
-- If the current size value is constant, then here is where we
-- make a transition to dynamic values, which are always stored
-- in storage units, However, we do not want to convert to SU's
-- too soon, consider the case of a packed array of single bits,
-- we want to do the SU conversion after computing the size in
-- this case.
if Size.Status = Const then
-- If the current value is a multiple of the storage unit,
-- then most certainly we can do the conversion now, simply
-- by dividing the current value by the storage unit value.
-- If this works, we set SU_Convert_Required to False.
if Size.Val mod SSU = 0 then
Size :=
(Dynamic, Make_Integer_Literal (Loc, Size.Val / SSU));
SU_Convert_Required := False;
-- Otherwise, we go ahead and convert the value in bits,
-- and set SU_Convert_Required to True to ensure that the
-- final value is indeed properly converted.
else
Size := (Dynamic, Make_Integer_Literal (Loc, Size.Val));
SU_Convert_Required := True;
end if;
end if;
-- Length is hi-lo+1
Len := Compute_Length (Lo, Hi);
-- Check possible range of Len
declare
OK : Boolean;
LLo : Uint;
LHi : Uint;
begin
Set_Parent (Len, E);
Determine_Range (Len, OK, LLo, LHi);
Len := Convert_To (Standard_Unsigned, Len);
-- If we cannot verify that range cannot be super-flat,
-- we need a max with zero, since length must be non-neg.
if not OK or else LLo < 0 then
Len :=
Make_Attribute_Reference (Loc,
Prefix =>
New_Occurrence_Of (Standard_Unsigned, Loc),
Attribute_Name => Name_Max,
Expressions => New_List (
Make_Integer_Literal (Loc, 0),
Len));
end if;
end;
end if;
Next_Index (Indx);
end loop;
-- Here after processing all bounds to set sizes. If the value is
-- a constant, then it is bits, and we just return the value.
if Size.Status = Const then
return Make_Integer_Literal (Loc, Size.Val);
-- Case where the value is dynamic
else
-- Do convert from bits to SU's if needed
if SU_Convert_Required then
-- The expression required is (Size.Nod + SU - 1) / SU
Size.Nod :=
Make_Op_Divide (Loc,
Left_Opnd =>
Make_Op_Add (Loc,
Left_Opnd => Size.Nod,
Right_Opnd => Make_Integer_Literal (Loc, SSU - 1)),
Right_Opnd => Make_Integer_Literal (Loc, SSU));
end if;
return Size.Nod;
end if;
end Get_Max_Size;
-----------------------
-- Layout_Array_Type --
-----------------------
procedure Layout_Array_Type (E : Entity_Id) is
Loc : constant Source_Ptr := Sloc (E);
Ctyp : constant Entity_Id := Component_Type (E);
Indx : Node_Id;
Ityp : Entity_Id;
Lo : Node_Id;
Hi : Node_Id;
S : Uint;
Len : Node_Id;
Insert_Typ : Entity_Id;
-- This is the type with which any generated constants or functions
-- will be associated (i.e. inserted into the freeze actions). This
-- is normally the type being layed out. The exception occurs when
-- we are laying out Itype's which are local to a record type, and
-- whose scope is this record type. Such types do not have freeze
-- nodes (because we have no place to put them).
------------------------------------
-- How An Array Type is Layed Out --
------------------------------------
-- Here is what goes on. We need to multiply the component size of
-- the array (which has already been set) by the length of each of
-- the indexes. If all these values are known at compile time, then
-- the resulting size of the array is the appropriate constant value.
-- If the component size or at least one bound is dynamic (but no
-- discriminants are present), then the size will be computed as an
-- expression that calculates the proper size.
-- If there is at least one discriminant bound, then the size is also
-- computed as an expression, but this expression contains discriminant
-- values which are obtained by selecting from a function parameter, and
-- the size is given by a function that is passed the variant record in
-- question, and whose body is the expression.
type Val_Status_Type is (Const, Dynamic, Discrim);
type Val_Type (Status : Val_Status_Type := Const) is
record
case Status is
when Const =>
Val : Uint;
-- Calculated value so far if Val_Status = Const
when Dynamic | Discrim =>
Nod : Node_Id;
-- Expression value so far if Val_Status /= Const
end case;
end record;
-- Records the value or expression computed so far. Const means that
-- the value is constant, and Val is the current constant value.
-- Dynamic means that the value is dynamic, and in this case Nod is
-- the Node_Id of the expression to compute the value, and Discrim
-- means that at least one bound is a discriminant, in which case Nod
-- is the expression so far (which will be the body of the function).
Size : Val_Type;
-- Value of size computed so far. See comments above.
Vtyp : Entity_Id := Empty;
-- Variant record type for the formal parameter of the
-- discriminant function V if Status = Discrim.
SU_Convert_Required : Boolean := False;
-- This is set to True if the final result must be converted from
-- bits to storage units (rounding up to a storage unit boundary).
procedure Discrimify (N : in out Node_Id);
-- If N represents a discriminant, then the Size.Status is set to
-- Discrim, and Vtyp is set. The parameter N is replaced with the
-- proper expression to extract the discriminant value from V.
----------------
-- Discrimify --
----------------
procedure Discrimify (N : in out Node_Id) is
Decl : Node_Id;
Typ : Entity_Id;
begin
if Nkind (N) = N_Identifier
and then Ekind (Entity (N)) = E_Discriminant
then
Set_Size_Depends_On_Discriminant (E);
if Size.Status /= Discrim then
Decl := Parent (Parent (Entity (N)));
Size := (Discrim, Size.Nod);
Vtyp := Defining_Identifier (Decl);
end if;
Typ := Etype (N);
N :=
Make_Selected_Component (Loc,
Prefix => Make_Identifier (Loc, Chars => Vname),
Selector_Name => New_Occurrence_Of (Entity (N), Loc));
-- Set the Etype attributes of the selected name and its prefix.
-- Analyze_And_Resolve can't be called here because the Vname
-- entity denoted by the prefix will not yet exist (it's created
-- by SO_Ref_From_Expr, called at the end of Layout_Array_Type).
Set_Etype (Prefix (N), Vtyp);
Set_Etype (N, Typ);
end if;
end Discrimify;
-- Start of processing for Layout_Array_Type
begin
-- Default alignment is component alignment
if Unknown_Alignment (E) then
Set_Alignment (E, Alignment (Ctyp));
end if;
-- Calculate proper type for insertions
if Is_Record_Type (Scope (E)) then
Insert_Typ := Scope (E);
else
Insert_Typ := E;
end if;
-- Cannot do anything if Esize of component type unknown
if Unknown_Esize (Ctyp) then
return;
end if;
-- Set component size if not set already
if Unknown_Component_Size (E) then
Set_Component_Size (E, Esize (Ctyp));
end if;
-- (RM 13.3 (48)) says that the size of an unconstrained array
-- is implementation defined. We choose to leave it as Unknown
-- here, and the actual behavior is determined by the back end.
if not Is_Constrained (E) then
return;
end if;
-- Initialize status from component size
if Known_Static_Component_Size (E) then
Size := (Const, Component_Size (E));
else
Size := (Dynamic, Expr_From_SO_Ref (Loc, Component_Size (E)));
end if;
-- Loop to process array indices
Indx := First_Index (E);
while Present (Indx) loop
Ityp := Etype (Indx);
Lo := Type_Low_Bound (Ityp);
Hi := Type_High_Bound (Ityp);
-- Value of the current subscript range is statically known
if Compile_Time_Known_Value (Lo)
and then Compile_Time_Known_Value (Hi)
then
S := Expr_Value (Hi) - Expr_Value (Lo) + 1;
-- If known flat bound, entire size of array is zero!
if S <= 0 then
Set_Esize (E, Uint_0);
Set_RM_Size (E, Uint_0);
return;
end if;
-- If constant, evolve value
if Size.Status = Const then
Size.Val := Size.Val * S;
-- Current value is dynamic
else
-- An interesting little optimization, if we have a pending
-- conversion from bits to storage units, and the current
-- length is a multiple of the storage unit size, then we
-- can take the factor out here statically, avoiding some
-- extra dynamic computations at the end.
if SU_Convert_Required and then S mod SSU = 0 then
S := S / SSU;
SU_Convert_Required := False;
end if;
-- Now go ahead and evolve the expression
Size.Nod :=
Assoc_Multiply (Loc,
Left_Opnd => Size.Nod,
Right_Opnd =>
Make_Integer_Literal (Loc, Intval => S));
end if;
-- Value of the current subscript range is dynamic
else
-- If the current size value is constant, then here is where we
-- make a transition to dynamic values, which are always stored
-- in storage units, However, we do not want to convert to SU's
-- too soon, consider the case of a packed array of single bits,
-- we want to do the SU conversion after computing the size in
-- this case.
if Size.Status = Const then
-- If the current value is a multiple of the storage unit,
-- then most certainly we can do the conversion now, simply
-- by dividing the current value by the storage unit value.
-- If this works, we set SU_Convert_Required to False.
if Size.Val mod SSU = 0 then
Size :=
(Dynamic, Make_Integer_Literal (Loc, Size.Val / SSU));
SU_Convert_Required := False;
-- Otherwise, we go ahead and convert the value in bits,
-- and set SU_Convert_Required to True to ensure that the
-- final value is indeed properly converted.
else
Size := (Dynamic, Make_Integer_Literal (Loc, Size.Val));
SU_Convert_Required := True;
end if;
end if;
Discrimify (Lo);
Discrimify (Hi);
-- Length is hi-lo+1
Len := Compute_Length (Lo, Hi);
-- Check possible range of Len
declare
OK : Boolean;
LLo : Uint;
LHi : Uint;
begin
Set_Parent (Len, E);
Determine_Range (Len, OK, LLo, LHi);
Len := Convert_To (Standard_Unsigned, Len);
-- If range definitely flat or superflat, result size is zero
if OK and then LHi <= 0 then
Set_Esize (E, Uint_0);
Set_RM_Size (E, Uint_0);
return;
end if;
-- If we cannot verify that range cannot be super-flat, we
-- need a maximum with zero, since length cannot be negative.
if not OK or else LLo < 0 then
Len :=
Make_Attribute_Reference (Loc,
Prefix =>
New_Occurrence_Of (Standard_Unsigned, Loc),
Attribute_Name => Name_Max,
Expressions => New_List (
Make_Integer_Literal (Loc, 0),
Len));
end if;
end;
-- At this stage, Len has the expression for the length
Size.Nod :=
Assoc_Multiply (Loc,
Left_Opnd => Size.Nod,
Right_Opnd => Len);
end if;
Next_Index (Indx);
end loop;
-- Here after processing all bounds to set sizes. If the value is
-- a constant, then it is bits, and the only thing we need to do
-- is to check against explicit given size and do alignment adjust.
if Size.Status = Const then
Set_And_Check_Static_Size (E, Size.Val, Size.Val);
Adjust_Esize_Alignment (E);
-- Case where the value is dynamic
else
-- Do convert from bits to SU's if needed
if SU_Convert_Required then
-- The expression required is (Size.Nod + SU - 1) / SU
Size.Nod :=
Make_Op_Divide (Loc,
Left_Opnd =>
Make_Op_Add (Loc,
Left_Opnd => Size.Nod,
Right_Opnd => Make_Integer_Literal (Loc, SSU - 1)),
Right_Opnd => Make_Integer_Literal (Loc, SSU));
end if;
-- Now set the dynamic size (the Value_Size is always the same
-- as the Object_Size for arrays whose length is dynamic).
-- ??? If Size.Status = Dynamic, Vtyp will not have been set.
-- The added initialization sets it to Empty now, but is this
-- correct?
Set_Esize (E, SO_Ref_From_Expr (Size.Nod, Insert_Typ, Vtyp));
Set_RM_Size (E, Esize (E));
end if;
end Layout_Array_Type;
-------------------
-- Layout_Object --
-------------------
procedure Layout_Object (E : Entity_Id) is
T : constant Entity_Id := Etype (E);
begin
-- Nothing to do if backend does layout
if not Frontend_Layout_On_Target then
return;
end if;
-- Set size if not set for object and known for type. Use the
-- RM_Size if that is known for the type and Esize is not.
if Unknown_Esize (E) then
if Known_Esize (T) then
Set_Esize (E, Esize (T));
elsif Known_RM_Size (T) then
Set_Esize (E, RM_Size (T));
end if;
end if;
-- Set alignment from type if unknown and type alignment known
if Unknown_Alignment (E) and then Known_Alignment (T) then
Set_Alignment (E, Alignment (T));
end if;
-- Make sure size and alignment are consistent
Adjust_Esize_Alignment (E);
-- Final adjustment, if we don't know the alignment, and the Esize
-- was not set by an explicit Object_Size attribute clause, then
-- we reset the Esize to unknown, since we really don't know it.
if Unknown_Alignment (E)
and then not Has_Size_Clause (E)
then
Set_Esize (E, Uint_0);
end if;
end Layout_Object;
------------------------
-- Layout_Record_Type --
------------------------
procedure Layout_Record_Type (E : Entity_Id) is
Loc : constant Source_Ptr := Sloc (E);
Decl : Node_Id;
Comp : Entity_Id;
-- Current component being layed out
Prev_Comp : Entity_Id;
-- Previous layed out component
procedure Get_Next_Component_Location
(Prev_Comp : Entity_Id;
Align : Uint;
New_Npos : out SO_Ref;
New_Fbit : out SO_Ref;
New_NPMax : out SO_Ref;
Force_SU : Boolean);
-- Given the previous component in Prev_Comp, which is already laid
-- out, and the alignment of the following component, lays out the
-- following component, and returns its starting position in New_Npos
-- (Normalized_Position value), New_Fbit (Normalized_First_Bit value),
-- and New_NPMax (Normalized_Position_Max value). If Prev_Comp is empty
-- (no previous component is present), then New_Npos, New_Fbit and
-- New_NPMax are all set to zero on return. This procedure is also
-- used to compute the size of a record or variant by giving it the
-- last component, and the record alignment. Force_SU is used to force
-- the new component location to be aligned on a storage unit boundary,
-- even in a packed record, False means that the new position does not
-- need to be bumped to a storage unit boundary, True means a storage
-- unit boundary is always required.
procedure Layout_Component (Comp : Entity_Id; Prev_Comp : Entity_Id);
-- Lays out component Comp, given Prev_Comp, the previously laid-out
-- component (Prev_Comp = Empty if no components laid out yet). The
-- alignment of the record itself is also updated if needed. Both
-- Comp and Prev_Comp can be either components or discriminants. A
-- special case is when Comp is Empty, this is used at the end
-- to determine the size of the entire record. For this special
-- call the resulting offset is placed in Final_Offset.
procedure Layout_Components
(From : Entity_Id;
To : Entity_Id;
Esiz : out SO_Ref;
RM_Siz : out SO_Ref);
-- This procedure lays out the components of the given component list
-- which contains the components starting with From, and ending with To.
-- The Next_Entity chain is used to traverse the components. On entry
-- Prev_Comp is set to the component preceding the list, so that the
-- list is layed out after this component. Prev_Comp is set to Empty if
-- the component list is to be layed out starting at the start of the
-- record. On return, the components are all layed out, and Prev_Comp is
-- set to the last layed out component. On return, Esiz is set to the
-- resulting Object_Size value, which is the length of the record up
-- to and including the last layed out entity. For Esiz, the value is
-- adjusted to match the alignment of the record. RM_Siz is similarly
-- set to the resulting Value_Size value, which is the same length, but
-- not adjusted to meet the alignment. Note that in the case of variant
-- records, Esiz represents the maximum size.
procedure Layout_Non_Variant_Record;
-- Procedure called to layout a non-variant record type or subtype
procedure Layout_Variant_Record;
-- Procedure called to layout a variant record type. Decl is set to the
-- full type declaration for the variant record.
---------------------------------
-- Get_Next_Component_Location --
---------------------------------
procedure Get_Next_Component_Location
(Prev_Comp : Entity_Id;
Align : Uint;
New_Npos : out SO_Ref;
New_Fbit : out SO_Ref;
New_NPMax : out SO_Ref;
Force_SU : Boolean)
is
begin
-- No previous component, return zero position
if No (Prev_Comp) then
New_Npos := Uint_0;
New_Fbit := Uint_0;
New_NPMax := Uint_0;
return;
end if;
-- Here we have a previous component
declare
Loc : constant Source_Ptr := Sloc (Prev_Comp);
Old_Npos : constant SO_Ref := Normalized_Position (Prev_Comp);
Old_Fbit : constant SO_Ref := Normalized_First_Bit (Prev_Comp);
Old_NPMax : constant SO_Ref := Normalized_Position_Max (Prev_Comp);
Old_Esiz : constant SO_Ref := Esize (Prev_Comp);
Old_Maxsz : Node_Id;
-- Expression representing maximum size of previous component
begin
-- Case where previous field had a dynamic size
if Is_Dynamic_SO_Ref (Esize (Prev_Comp)) then
-- If the previous field had a dynamic length, then it is
-- required to occupy an integral number of storage units,
-- and start on a storage unit boundary. This means that
-- the Normalized_First_Bit value is zero in the previous
-- component, and the new value is also set to zero.
New_Fbit := Uint_0;
-- In this case, the new position is given by an expression
-- that is the sum of old normalized position and old size.
New_Npos :=
SO_Ref_From_Expr
(Assoc_Add (Loc,
Left_Opnd => Expr_From_SO_Ref (Loc, Old_Npos),
Right_Opnd => Expr_From_SO_Ref (Loc, Old_Esiz)),
Ins_Type => E,
Vtype => E);
-- Get maximum size of previous component
if Size_Depends_On_Discriminant (Etype (Prev_Comp)) then
Old_Maxsz := Get_Max_Size (Etype (Prev_Comp));
else
Old_Maxsz := Expr_From_SO_Ref (Loc, Old_Esiz);
end if;
-- Now we can compute the new max position. If the max size
-- is static and the old position is static, then we can
-- compute the new position statically.
if Nkind (Old_Maxsz) = N_Integer_Literal
and then Known_Static_Normalized_Position_Max (Prev_Comp)
then
New_NPMax := Old_NPMax + Intval (Old_Maxsz);
-- Otherwise new max position is dynamic
else
New_NPMax :=
SO_Ref_From_Expr
(Assoc_Add (Loc,
Left_Opnd => Expr_From_SO_Ref (Loc, Old_NPMax),
Right_Opnd => Old_Maxsz),
Ins_Type => E,
Vtype => E);
end if;
-- Previous field has known static Esize
else
New_Fbit := Old_Fbit + Old_Esiz;
-- Bump New_Fbit to storage unit boundary if required
if New_Fbit /= 0 and then Force_SU then
New_Fbit := (New_Fbit + SSU - 1) / SSU * SSU;
end if;
-- If old normalized position is static, we can go ahead
-- and compute the new normalized position directly.
if Known_Static_Normalized_Position (Prev_Comp) then
New_Npos := Old_Npos;
if New_Fbit >= SSU then
New_Npos := New_Npos + New_Fbit / SSU;
New_Fbit := New_Fbit mod SSU;
end if;
-- Bump alignment if stricter than prev
if Align > Alignment (Prev_Comp) then
New_Npos := (New_Npos + Align - 1) / Align * Align;
end if;
-- The max position is always equal to the position if
-- the latter is static, since arrays depending on the
-- values of discriminants never have static sizes.
New_NPMax := New_Npos;
return;
-- Case of old normalized position is dynamic
else
-- If new bit position is within the current storage unit,
-- we can just copy the old position as the result position
-- (we have already set the new first bit value).
if New_Fbit < SSU then
New_Npos := Old_Npos;
New_NPMax := Old_NPMax;
-- If new bit position is past the current storage unit, we
-- need to generate a new dynamic value for the position
-- ??? need to deal with alignment
else
New_Npos :=
SO_Ref_From_Expr
(Assoc_Add (Loc,
Left_Opnd => Expr_From_SO_Ref (Loc, Old_Npos),
Right_Opnd =>
Make_Integer_Literal (Loc,
Intval => New_Fbit / SSU)),
Ins_Type => E,
Vtype => E);
New_NPMax :=
SO_Ref_From_Expr
(Assoc_Add (Loc,
Left_Opnd => Expr_From_SO_Ref (Loc, Old_NPMax),
Right_Opnd =>
Make_Integer_Literal (Loc,
Intval => New_Fbit / SSU)),
Ins_Type => E,
Vtype => E);
New_Fbit := New_Fbit mod SSU;
end if;
end if;
end if;
end;
end Get_Next_Component_Location;
----------------------
-- Layout_Component --
----------------------
procedure Layout_Component (Comp : Entity_Id; Prev_Comp : Entity_Id) is
Ctyp : constant Entity_Id := Etype (Comp);
Npos : SO_Ref;
Fbit : SO_Ref;
NPMax : SO_Ref;
Forc : Boolean;
begin
-- Parent field is always at start of record, this will overlap
-- the actual fields that are part of the parent, and that's fine
if Chars (Comp) = Name_uParent then
Set_Normalized_Position (Comp, Uint_0);
Set_Normalized_First_Bit (Comp, Uint_0);
Set_Normalized_Position_Max (Comp, Uint_0);
Set_Component_Bit_Offset (Comp, Uint_0);
Set_Esize (Comp, Esize (Ctyp));
return;
end if;
-- Check case of type of component has a scope of the record we
-- are laying out. When this happens, the type in question is an
-- Itype that has not yet been layed out (that's because such
-- types do not get frozen in the normal manner, because there
-- is no place for the freeze nodes).
if Scope (Ctyp) = E then
Layout_Type (Ctyp);
end if;
-- Increase alignment of record if necessary. Note that we do not
-- do this for packed records, which have an alignment of one by
-- default, or for records for which an explicit alignment was
-- specified with an alignment clause.
if not Is_Packed (E)
and then not Has_Alignment_Clause (E)
and then Alignment (Ctyp) > Alignment (E)
then
Set_Alignment (E, Alignment (Ctyp));
end if;
-- If component already laid out, then we are done
if Known_Normalized_Position (Comp) then
return;
end if;
-- Set size of component from type. We use the Esize except in a
-- packed record, where we use the RM_Size (since that is exactly
-- what the RM_Size value, as distinct from the Object_Size is
-- useful for!)
if Is_Packed (E) then
Set_Esize (Comp, RM_Size (Ctyp));
else
Set_Esize (Comp, Esize (Ctyp));
end if;
-- Compute the component position from the previous one. See if
-- current component requires being on a storage unit boundary.
-- If record is not packed, we always go to a storage unit boundary
if not Is_Packed (E) then
Forc := True;
-- Packed cases
else
-- Elementary types do not need SU boundary in packed record
if Is_Elementary_Type (Ctyp) then
Forc := False;
-- Packed array types with a modular packed array type do not
-- force a storage unit boundary (since the code generation
-- treats these as equivalent to the underlying modular type),
elsif Is_Array_Type (Ctyp)
and then Is_Bit_Packed_Array (Ctyp)
and then Is_Modular_Integer_Type (Packed_Array_Type (Ctyp))
then
Forc := False;
-- Record types with known length less than or equal to the length
-- of long long integer can also be unaligned, since they can be
-- treated as scalars.
elsif Is_Record_Type (Ctyp)
and then not Is_Dynamic_SO_Ref (Esize (Ctyp))
and then Esize (Ctyp) <= Esize (Standard_Long_Long_Integer)
then
Forc := False;
-- All other cases force a storage unit boundary, even when packed
else
Forc := True;
end if;
end if;
-- Now get the next component location
Get_Next_Component_Location
(Prev_Comp, Alignment (Ctyp), Npos, Fbit, NPMax, Forc);
Set_Normalized_Position (Comp, Npos);
Set_Normalized_First_Bit (Comp, Fbit);
Set_Normalized_Position_Max (Comp, NPMax);
-- Set Component_Bit_Offset in the static case
if Known_Static_Normalized_Position (Comp)
and then Known_Normalized_First_Bit (Comp)
then
Set_Component_Bit_Offset (Comp, SSU * Npos + Fbit);
end if;
end Layout_Component;
-----------------------
-- Layout_Components --
-----------------------
procedure Layout_Components
(From : Entity_Id;
To : Entity_Id;
Esiz : out SO_Ref;
RM_Siz : out SO_Ref)
is
End_Npos : SO_Ref;
End_Fbit : SO_Ref;
End_NPMax : SO_Ref;
begin
-- Only layout components if there are some to layout!
if Present (From) then
-- Layout components with no component clauses
Comp := From;
loop
if (Ekind (Comp) = E_Component
or else Ekind (Comp) = E_Discriminant)
and then No (Component_Clause (Comp))
then
Layout_Component (Comp, Prev_Comp);
Prev_Comp := Comp;
end if;
exit when Comp = To;
Next_Entity (Comp);
end loop;
end if;
-- Set size fields, both are zero if no components
if No (Prev_Comp) then
Esiz := Uint_0;
RM_Siz := Uint_0;
else
-- First the object size, for which we align past the last
-- field to the alignment of the record (the object size
-- is required to be a multiple of the alignment).
Get_Next_Component_Location
(Prev_Comp,
Alignment (E),
End_Npos,
End_Fbit,
End_NPMax,
Force_SU => True);
-- If the resulting normalized position is a dynamic reference,
-- then the size is dynamic, and is stored in storage units.
-- In this case, we set the RM_Size to the same value, it is
-- simply not worth distinguishing Esize and RM_Size values in
-- the dynamic case, since the RM has nothing to say about them.
-- Note that a size cannot have been given in this case, since
-- size specifications cannot be given for variable length types.
declare
Align : constant Uint := Alignment (E);
begin
if Is_Dynamic_SO_Ref (End_Npos) then
RM_Siz := End_Npos;
-- Set the Object_Size allowing for alignment. In the
-- dynamic case, we have to actually do the runtime
-- computation. We can skip this in the non-packed
-- record case if the last component has a smaller
-- alignment than the overall record alignment.
if Is_Dynamic_SO_Ref (End_NPMax) then
Esiz := End_NPMax;
if Is_Packed (E)
or else Alignment (Prev_Comp) < Align
then
-- The expression we build is
-- (expr + align - 1) / align * align
Esiz :=
SO_Ref_From_Expr
(Expr =>
Make_Op_Multiply (Loc,
Left_Opnd =>
Make_Op_Divide (Loc,
Left_Opnd =>
Make_Op_Add (Loc,
Left_Opnd =>
Expr_From_SO_Ref (Loc, Esiz),
Right_Opnd =>
Make_Integer_Literal (Loc,
Intval => Align - 1)),
Right_Opnd =>
Make_Integer_Literal (Loc, Align)),
Right_Opnd =>
Make_Integer_Literal (Loc, Align)),
Ins_Type => E,
Vtype => E);
end if;
-- Here Esiz is static, so we can adjust the alignment
-- directly go give the required aligned value.
else
Esiz := (End_NPMax + Align - 1) / Align * Align * SSU;
end if;
-- Case where computed size is static
else
-- The ending size was computed in Npos in storage units,
-- but the actual size is stored in bits, so adjust
-- accordingly. We also adjust the size to match the
-- alignment here.
Esiz := (End_NPMax + Align - 1) / Align * Align * SSU;
-- Compute the resulting Value_Size (RM_Size). For this
-- purpose we do not force alignment of the record or
-- storage size alignment of the result.
Get_Next_Component_Location
(Prev_Comp,
Uint_0,
End_Npos,
End_Fbit,
End_NPMax,
Force_SU => False);
RM_Siz := End_Npos * SSU + End_Fbit;
Set_And_Check_Static_Size (E, Esiz, RM_Siz);
end if;
end;
end if;
end Layout_Components;
-------------------------------
-- Layout_Non_Variant_Record --
-------------------------------
procedure Layout_Non_Variant_Record is
Esiz : SO_Ref;
RM_Siz : SO_Ref;
begin
Layout_Components (First_Entity (E), Last_Entity (E), Esiz, RM_Siz);
Set_Esize (E, Esiz);
Set_RM_Size (E, RM_Siz);
end Layout_Non_Variant_Record;
---------------------------
-- Layout_Variant_Record --
---------------------------
procedure Layout_Variant_Record is
Tdef : constant Node_Id := Type_Definition (Decl);
Dlist : constant List_Id := Discriminant_Specifications (Decl);
Esiz : SO_Ref;
RM_Siz : SO_Ref;
RM_Siz_Expr : Node_Id := Empty;
-- Expression for the evolving RM_Siz value. This is typically a
-- conditional expression which involves tests of discriminant
-- values that are formed as references to the entity V. At
-- the end of scanning all the components, a suitable function
-- is constructed in which V is the parameter.
-----------------------
-- Local Subprograms --
-----------------------
procedure Layout_Component_List
(Clist : Node_Id;
Esiz : out SO_Ref;
RM_Siz_Expr : out Node_Id);
-- Recursive procedure, called to layout one component list
-- Esiz and RM_Siz_Expr are set to the Object_Size and Value_Size
-- values respectively representing the record size up to and
-- including the last component in the component list (including
-- any variants in this component list). RM_Siz_Expr is returned
-- as an expression which may in the general case involve some
-- references to the discriminants of the current record value,
-- referenced by selecting from the entity V.
---------------------------
-- Layout_Component_List --
---------------------------
procedure Layout_Component_List
(Clist : Node_Id;
Esiz : out SO_Ref;
RM_Siz_Expr : out Node_Id)
is
Citems : constant List_Id := Component_Items (Clist);
Vpart : constant Node_Id := Variant_Part (Clist);
Prv : Node_Id;
Var : Node_Id;
RM_Siz : Uint;
RMS_Ent : Entity_Id;
begin
if Is_Non_Empty_List (Citems) then
Layout_Components
(From => Defining_Identifier (First (Citems)),
To => Defining_Identifier (Last (Citems)),
Esiz => Esiz,
RM_Siz => RM_Siz);
else
Layout_Components (Empty, Empty, Esiz, RM_Siz);
end if;
-- Case where no variants are present in the component list
if No (Vpart) then
-- The Esiz value has been correctly set by the call to
-- Layout_Components, so there is nothing more to be done.
-- For RM_Siz, we have an SO_Ref value, which we must convert
-- to an appropriate expression.
if Is_Static_SO_Ref (RM_Siz) then
RM_Siz_Expr :=
Make_Integer_Literal (Loc,
Intval => RM_Siz);
else
RMS_Ent := Get_Dynamic_SO_Entity (RM_Siz);
-- If the size is represented by a function, then we
-- create an appropriate function call using V as
-- the parameter to the call.
if Is_Discrim_SO_Function (RMS_Ent) then
RM_Siz_Expr :=
Make_Function_Call (Loc,
Name => New_Occurrence_Of (RMS_Ent, Loc),
Parameter_Associations => New_List (
Make_Identifier (Loc, Chars => Vname)));
-- If the size is represented by a constant, then the
-- expression we want is a reference to this constant
else
RM_Siz_Expr := New_Occurrence_Of (RMS_Ent, Loc);
end if;
end if;
-- Case where variants are present in this component list
else
declare
EsizV : SO_Ref;
RM_SizV : Node_Id;
Dchoice : Node_Id;
Discrim : Node_Id;
Dtest : Node_Id;
begin
RM_Siz_Expr := Empty;
Prv := Prev_Comp;
Var := Last (Variants (Vpart));
while Present (Var) loop
Prev_Comp := Prv;
Layout_Component_List
(Component_List (Var), EsizV, RM_SizV);
-- Set the Object_Size. If this is the first variant,
-- we just set the size of this first variant.
if Var = Last (Variants (Vpart)) then
Esiz := EsizV;
-- Otherwise the Object_Size is formed as a maximum
-- of Esiz so far from previous variants, and the new
-- Esiz value from the variant we just processed.
-- If both values are static, we can just compute the
-- maximum directly to save building junk nodes.
elsif not Is_Dynamic_SO_Ref (Esiz)
and then not Is_Dynamic_SO_Ref (EsizV)
then
Esiz := UI_Max (Esiz, EsizV);
-- If either value is dynamic, then we have to generate
-- an appropriate Standard_Unsigned'Max attribute call.
else
Esiz :=
SO_Ref_From_Expr
(Make_Attribute_Reference (Loc,
Attribute_Name => Name_Max,
Prefix =>
New_Occurrence_Of (Standard_Unsigned, Loc),
Expressions => New_List (
Expr_From_SO_Ref (Loc, Esiz),
Expr_From_SO_Ref (Loc, EsizV))),
Ins_Type => E,
Vtype => E);
end if;
-- Now deal with Value_Size (RM_Siz). We are aiming at
-- an expression that looks like:
-- if xxDx (V.disc) then rmsiz1
-- else if xxDx (V.disc) then rmsiz2
-- else ...
-- Where rmsiz1, rmsiz2... are the RM_Siz values for the
-- individual variants, and xxDx are the discriminant
-- checking functions generated for the variant type.
-- If this is the first variant, we simply set the
-- result as the expression. Note that this takes
-- care of the others case.
if No (RM_Siz_Expr) then
RM_Siz_Expr := RM_SizV;
-- Otherwise construct the appropriate test
else
-- Discriminant to be tested
Discrim :=
Make_Selected_Component (Loc,
Prefix =>
Make_Identifier (Loc, Chars => Vname),
Selector_Name =>
New_Occurrence_Of
(Entity (Name (Vpart)), Loc));
-- The test to be used in general is a call to the
-- discriminant checking function. However, it is
-- definitely worth special casing the very common
-- case where a single value is involved.
Dchoice := First (Discrete_Choices (Var));
if No (Next (Dchoice))
and then Nkind (Dchoice) /= N_Range
then
Dtest :=
Make_Op_Eq (Loc,
Left_Opnd => Discrim,
Right_Opnd => New_Copy (Dchoice));
else
Dtest :=
Make_Function_Call (Loc,
Name =>
New_Occurrence_Of
(Dcheck_Function (Var), Loc),
Parameter_Associations => New_List (Discrim));
end if;
RM_Siz_Expr :=
Make_Conditional_Expression (Loc,
Expressions =>
New_List (Dtest, RM_SizV, RM_Siz_Expr));
end if;
Prev (Var);
end loop;
end;
end if;
end Layout_Component_List;
-- Start of processing for Layout_Variant_Record
begin
-- We need the discriminant checking functions, since we generate
-- calls to these functions for the RM_Size expression, so make
-- sure that these functions have been constructed in time.
Build_Discr_Checking_Funcs (Decl);
-- Layout the discriminants
Layout_Components
(From => Defining_Identifier (First (Dlist)),
To => Defining_Identifier (Last (Dlist)),
Esiz => Esiz,
RM_Siz => RM_Siz);
-- Layout the main component list (this will make recursive calls
-- to layout all component lists nested within variants).
Layout_Component_List (Component_List (Tdef), Esiz, RM_Siz_Expr);
Set_Esize (E, Esiz);
-- If the RM_Size is a literal, set its value
if Nkind (RM_Siz_Expr) = N_Integer_Literal then
Set_RM_Size (E, Intval (RM_Siz_Expr));
-- Otherwise we construct a dynamic SO_Ref
else
Set_RM_Size (E,
SO_Ref_From_Expr
(RM_Siz_Expr,
Ins_Type => E,
Vtype => E));
end if;
end Layout_Variant_Record;
-- Start of processing for Layout_Record_Type
begin
-- If this is a cloned subtype, just copy the size fields from the
-- original, nothing else needs to be done in this case, since the
-- components themselves are all shared.
if (Ekind (E) = E_Record_Subtype
or else Ekind (E) = E_Class_Wide_Subtype)
and then Present (Cloned_Subtype (E))
then
Set_Esize (E, Esize (Cloned_Subtype (E)));
Set_RM_Size (E, RM_Size (Cloned_Subtype (E)));
Set_Alignment (E, Alignment (Cloned_Subtype (E)));
-- Another special case, class-wide types. The RM says that the size
-- of such types is implementation defined (RM 13.3(48)). What we do
-- here is to leave the fields set as unknown values, and the backend
-- determines the actual behavior.
elsif Ekind (E) = E_Class_Wide_Type then
null;
-- All other cases
else
-- Initialize aligment conservatively to 1. This value will
-- be increased as necessary during processing of the record.
if Unknown_Alignment (E) then
Set_Alignment (E, Uint_1);
end if;
-- Initialize previous component. This is Empty unless there
-- are components which have already been laid out by component
-- clauses. If there are such components, we start our layout of
-- the remaining components following the last such component
Prev_Comp := Empty;
Comp := First_Entity (E);
while Present (Comp) loop
if (Ekind (Comp) = E_Component
or else Ekind (Comp) = E_Discriminant)
and then Present (Component_Clause (Comp))
then
if No (Prev_Comp)
or else
Component_Bit_Offset (Comp) >
Component_Bit_Offset (Prev_Comp)
then
Prev_Comp := Comp;
end if;
end if;
Next_Entity (Comp);
end loop;
-- We have two separate circuits, one for non-variant records and
-- one for variant records. For non-variant records, we simply go
-- through the list of components. This handles all the non-variant
-- cases including those cases of subtypes where there is no full
-- type declaration, so the tree cannot be used to drive the layout.
-- For variant records, we have to drive the layout from the tree
-- since we need to understand the variant structure in this case.
if Present (Full_View (E)) then
Decl := Declaration_Node (Full_View (E));
else
Decl := Declaration_Node (E);
end if;
-- Scan all the components
if Nkind (Decl) = N_Full_Type_Declaration
and then Has_Discriminants (E)
and then Nkind (Type_Definition (Decl)) = N_Record_Definition
and then
Present (Variant_Part (Component_List (Type_Definition (Decl))))
then
Layout_Variant_Record;
else
Layout_Non_Variant_Record;
end if;
end if;
end Layout_Record_Type;
-----------------
-- Layout_Type --
-----------------
procedure Layout_Type (E : Entity_Id) is
begin
-- For string literal types, for now, kill the size always, this
-- is because gigi does not like or need the size to be set ???
if Ekind (E) = E_String_Literal_Subtype then
Set_Esize (E, Uint_0);
Set_RM_Size (E, Uint_0);
return;
end if;
-- For access types, set size/alignment. This is system address
-- size, except for fat pointers (unconstrained array access types),
-- where the size is two times the address size, to accommodate the
-- two pointers that are required for a fat pointer (data and
-- template). Note that E_Access_Protected_Subprogram_Type is not
-- an access type for this purpose since it is not a pointer but is
-- equivalent to a record. For access subtypes, copy the size from
-- the base type since Gigi represents them the same way.
if Is_Access_Type (E) then
-- If Esize already set (e.g. by a size clause), then nothing
-- further to be done here.
if Known_Esize (E) then
null;
-- Access to subprogram is a strange beast, and we let the
-- backend figure out what is needed (it may be some kind
-- of fat pointer, including the static link for example.
elsif Ekind (E) = E_Access_Protected_Subprogram_Type then
null;
-- For access subtypes, copy the size information from base type
elsif Ekind (E) = E_Access_Subtype then
Set_Size_Info (E, Base_Type (E));
Set_RM_Size (E, RM_Size (Base_Type (E)));
-- For other access types, we use either address size, or, if
-- a fat pointer is used (pointer-to-unconstrained array case),
-- twice the address size to accommodate a fat pointer.
else
declare
Desig : Entity_Id := Designated_Type (E);
begin
if Is_Private_Type (Desig)
and then Present (Full_View (Desig))
then
Desig := Full_View (Desig);
end if;
if (Is_Array_Type (Desig)
and then not Is_Constrained (Desig)
and then not Has_Completion_In_Body (Desig)
and then not Debug_Flag_6)
then
Init_Size (E, 2 * System_Address_Size);
-- Check for bad convention set
if Convention (E) = Convention_C
or else
Convention (E) = Convention_CPP
then
Error_Msg_N
("?this access type does not " &
"correspond to C pointer", E);
end if;
else
Init_Size (E, System_Address_Size);
end if;
end;
end if;
Set_Prim_Alignment (E);
-- Scalar types: set size and alignment
elsif Is_Scalar_Type (E) then
-- For discrete types, the RM_Size and Esize must be set
-- already, since this is part of the earlier processing
-- and the front end is always required to layout the
-- sizes of such types (since they are available as static
-- attributes). All we do is to check that this rule is
-- indeed obeyed!
if Is_Discrete_Type (E) then
-- If the RM_Size is not set, then here is where we set it.
-- Note: an RM_Size of zero looks like not set here, but this
-- is a rare case, and we can simply reset it without any harm.
if not Known_RM_Size (E) then
Set_Discrete_RM_Size (E);
end if;
-- If Esize for a discrete type is not set then set it
if not Known_Esize (E) then
declare
S : Int := 8;
begin
loop
-- If size is big enough, set it and exit
if S >= RM_Size (E) then
Init_Esize (E, S);
exit;
-- If the RM_Size is greater than 64 (happens only
-- when strange values are specified by the user,
-- then Esize is simply a copy of RM_Size, it will
-- be further refined later on)
elsif S = 64 then
Set_Esize (E, RM_Size (E));
exit;
-- Otherwise double possible size and keep trying
else
S := S * 2;
end if;
end loop;
end;
end if;
-- For non-discrete sclar types, if the RM_Size is not set,
-- then set it now to a copy of the Esize if the Esize is set.
else
if Known_Esize (E) and then Unknown_RM_Size (E) then
Set_RM_Size (E, Esize (E));
end if;
end if;
Set_Prim_Alignment (E);
-- Non-primitive types
else
-- If RM_Size is known, set Esize if not known
if Known_RM_Size (E) and then Unknown_Esize (E) then
-- If the alignment is known, we bump the Esize up to the
-- next alignment boundary if it is not already on one.
if Known_Alignment (E) then
declare
A : constant Uint := Alignment_In_Bits (E);
S : constant SO_Ref := RM_Size (E);
begin
Set_Esize (E, (S * A + A - 1) / A);
end;
end if;
-- If Esize is set, and RM_Size is not, RM_Size is copied from
-- Esize at least for now this seems reasonable, and is in any
-- case needed for compatibility with old versions of gigi.
-- look to be unknown.
elsif Known_Esize (E) and then Unknown_RM_Size (E) then
Set_RM_Size (E, Esize (E));
end if;
-- For array base types, set component size if object size of
-- the component type is known and is a small power of 2 (8,
-- 16, 32, 64), since this is what will always be used.
if Ekind (E) = E_Array_Type
and then Unknown_Component_Size (E)
then
declare
CT : constant Entity_Id := Component_Type (E);
begin
-- For some reasons, access types can cause trouble,
-- So let's just do this for discrete types ???
if Present (CT)
and then Is_Discrete_Type (CT)
and then Known_Static_Esize (CT)
then
declare
S : constant Uint := Esize (CT);
begin
if S = 8 or else
S = 16 or else
S = 32 or else
S = 64
then
Set_Component_Size (E, Esize (CT));
end if;
end;
end if;
end;
end if;
end if;
-- Layout array and record types if front end layout set
if Frontend_Layout_On_Target then
if Is_Array_Type (E) and then not Is_Bit_Packed_Array (E) then
Layout_Array_Type (E);
elsif Is_Record_Type (E) then
Layout_Record_Type (E);
end if;
end if;
end Layout_Type;
---------------------
-- Rewrite_Integer --
---------------------
procedure Rewrite_Integer (N : Node_Id; V : Uint) is
Loc : constant Source_Ptr := Sloc (N);
Typ : constant Entity_Id := Etype (N);
begin
Rewrite (N, Make_Integer_Literal (Loc, Intval => V));
Set_Etype (N, Typ);
end Rewrite_Integer;
-------------------------------
-- Set_And_Check_Static_Size --
-------------------------------
procedure Set_And_Check_Static_Size
(E : Entity_Id;
Esiz : SO_Ref;
RM_Siz : SO_Ref)
is
SC : Node_Id;
procedure Check_Size_Too_Small (Spec : Uint; Min : Uint);
-- Spec is the number of bit specified in the size clause, and
-- Min is the minimum computed size. An error is given that the
-- specified size is too small if Spec < Min, and in this case
-- both Esize and RM_Size are set to unknown in E. The error
-- message is posted on node SC.
procedure Check_Unused_Bits (Spec : Uint; Max : Uint);
-- Spec is the number of bits specified in the size clause, and
-- Max is the maximum computed size. A warning is given about
-- unused bits if Spec > Max. This warning is posted on node SC.
--------------------------
-- Check_Size_Too_Small --
--------------------------
procedure Check_Size_Too_Small (Spec : Uint; Min : Uint) is
begin
if Spec < Min then
Error_Msg_Uint_1 := Min;
Error_Msg_NE
("size for & too small, minimum allowed is ^", SC, E);
Init_Esize (E);
Init_RM_Size (E);
end if;
end Check_Size_Too_Small;
-----------------------
-- Check_Unused_Bits --
-----------------------
procedure Check_Unused_Bits (Spec : Uint; Max : Uint) is
begin
if Spec > Max then
Error_Msg_Uint_1 := Spec - Max;
Error_Msg_NE ("?^ bits of & unused", SC, E);
end if;
end Check_Unused_Bits;
-- Start of processing for Set_And_Check_Static_Size
begin
-- Case where Object_Size (Esize) is already set by a size clause
if Known_Static_Esize (E) then
SC := Size_Clause (E);
if No (SC) then
SC := Get_Attribute_Definition_Clause (E, Attribute_Object_Size);
end if;
-- Perform checks on specified size against computed sizes
if Present (SC) then
Check_Unused_Bits (Esize (E), Esiz);
Check_Size_Too_Small (Esize (E), RM_Siz);
end if;
end if;
-- Case where Value_Size (RM_Size) is set by specific Value_Size
-- clause (we do not need to worry about Value_Size being set by
-- a Size clause, since that will have set Esize as well, and we
-- already took care of that case).
if Known_Static_RM_Size (E) then
SC := Get_Attribute_Definition_Clause (E, Attribute_Value_Size);
-- Perform checks on specified size against computed sizes
if Present (SC) then
Check_Unused_Bits (RM_Size (E), Esiz);
Check_Size_Too_Small (RM_Size (E), RM_Siz);
end if;
end if;
-- Set sizes if unknown
if Unknown_Esize (E) then
Set_Esize (E, Esiz);
end if;
if Unknown_RM_Size (E) then
Set_RM_Size (E, RM_Siz);
end if;
end Set_And_Check_Static_Size;
--------------------------
-- Set_Discrete_RM_Size --
--------------------------
procedure Set_Discrete_RM_Size (Def_Id : Entity_Id) is
FST : constant Entity_Id := First_Subtype (Def_Id);
begin
-- All discrete types except for the base types in standard
-- are constrained, so indicate this by setting Is_Constrained.
Set_Is_Constrained (Def_Id);
-- We set generic types to have an unknown size, since the
-- representation of a generic type is irrelevant, in view
-- of the fact that they have nothing to do with code.
if Is_Generic_Type (Root_Type (FST)) then
Set_RM_Size (Def_Id, Uint_0);
-- If the subtype statically matches the first subtype, then
-- it is required to have exactly the same layout. This is
-- required by aliasing considerations.
elsif Def_Id /= FST and then
Subtypes_Statically_Match (Def_Id, FST)
then
Set_RM_Size (Def_Id, RM_Size (FST));
Set_Size_Info (Def_Id, FST);
-- In all other cases the RM_Size is set to the minimum size.
-- Note that this routine is never called for subtypes for which
-- the RM_Size is set explicitly by an attribute clause.
else
Set_RM_Size (Def_Id, UI_From_Int (Minimum_Size (Def_Id)));
end if;
end Set_Discrete_RM_Size;
------------------------
-- Set_Prim_Alignment --
------------------------
procedure Set_Prim_Alignment (E : Entity_Id) is
begin
-- Do not set alignment for packed array types, unless we are doing
-- front end layout, because otherwise this is always handled in the
-- backend.
if Is_Packed_Array_Type (E) and then not Frontend_Layout_On_Target then
return;
-- If there is an alignment clause, then we respect it
elsif Has_Alignment_Clause (E) then
return;
-- If the size is not set, then don't attempt to set the alignment. This
-- happens in the backend layout case for access to subprogram types.
elsif not Known_Static_Esize (E) then
return;
-- For access types, do not set the alignment if the size is less than
-- the allowed minimum size. This avoids cascaded error messages.
elsif Is_Access_Type (E)
and then Esize (E) < System_Address_Size
then
return;
end if;
-- Here we calculate the alignment as the largest power of two
-- multiple of System.Storage_Unit that does not exceed either
-- the actual size of the type, or the maximum allowed alignment.
declare
S : constant Int :=
UI_To_Int (Esize (E)) / SSU;
A : Nat;
begin
A := 1;
while 2 * A <= Ttypes.Maximum_Alignment
and then 2 * A <= S
loop
A := 2 * A;
end loop;
-- Now we think we should set the alignment to A, but we
-- skip this if an alignment is already set to a value
-- greater than A (happens for derived types).
-- However, if the alignment is known and too small it
-- must be increased, this happens in a case like:
-- type R is new Character;
-- for R'Size use 16;
-- Here the alignment inherited from Character is 1, but
-- it must be increased to 2 to reflect the increased size.
if Unknown_Alignment (E) or else Alignment (E) < A then
Init_Alignment (E, A);
end if;
end;
end Set_Prim_Alignment;
----------------------
-- SO_Ref_From_Expr --
----------------------
function SO_Ref_From_Expr
(Expr : Node_Id;
Ins_Type : Entity_Id;
Vtype : Entity_Id := Empty)
return Dynamic_SO_Ref
is
Loc : constant Source_Ptr := Sloc (Ins_Type);
K : constant Entity_Id :=
Make_Defining_Identifier (Loc,
Chars => New_Internal_Name ('K'));
Decl : Node_Id;
function Check_Node_V_Ref (N : Node_Id) return Traverse_Result;
-- Function used to check one node for reference to V
function Has_V_Ref is new Traverse_Func (Check_Node_V_Ref);
-- Function used to traverse tree to check for reference to V
----------------------
-- Check_Node_V_Ref --
----------------------
function Check_Node_V_Ref (N : Node_Id) return Traverse_Result is
begin
if Nkind (N) = N_Identifier then
if Chars (N) = Vname then
return Abandon;
else
return Skip;
end if;
else
return OK;
end if;
end Check_Node_V_Ref;
-- Start of processing for SO_Ref_From_Expr
begin
-- Case of expression is an integer literal, in this case we just
-- return the value (which must always be non-negative, since size
-- and offset values can never be negative).
if Nkind (Expr) = N_Integer_Literal then
pragma Assert (Intval (Expr) >= 0);
return Intval (Expr);
end if;
-- Case where there is a reference to V, create function
if Has_V_Ref (Expr) = Abandon then
pragma Assert (Present (Vtype));
Set_Is_Discrim_SO_Function (K);
Decl :=
Make_Subprogram_Body (Loc,
Specification =>
Make_Function_Specification (Loc,
Defining_Unit_Name => K,
Parameter_Specifications => New_List (
Make_Parameter_Specification (Loc,
Defining_Identifier =>
Make_Defining_Identifier (Loc, Chars => Vname),
Parameter_Type =>
New_Occurrence_Of (Vtype, Loc))),
Subtype_Mark =>
New_Occurrence_Of (Standard_Unsigned, Loc)),
Declarations => Empty_List,
Handled_Statement_Sequence =>
Make_Handled_Sequence_Of_Statements (Loc,
Statements => New_List (
Make_Return_Statement (Loc,
Expression => Expr))));
-- No reference to V, create constant
else
Decl :=
Make_Object_Declaration (Loc,
Defining_Identifier => K,
Object_Definition =>
New_Occurrence_Of (Standard_Unsigned, Loc),
Constant_Present => True,
Expression => Expr);
end if;
Append_Freeze_Action (Ins_Type, Decl);
Analyze (Decl);
return Create_Dynamic_SO_Ref (K);
end SO_Ref_From_Expr;
end Layout;
|
ch8/src/userapp.asm | impact-eintr/x86 | 0 | 12605 | <reponame>impact-eintr/x86
SECTION header VSTART=0 ;程序的头部
progran_length:
dd program_end ;程序的总长度
;; 用户程序入口点
code_entry:
dw start ;偏移地址
dd section.code.start ;段地址
;; 段重定位表项个数
realloc_tbl_len dw (segtbl_end-segtbl_begin)/4
;; 段重定位表
segtbl_begin:
code_segment dd section.code.start ;[0x0C]
data_segment dd section.data.start ;[0x10]
stack_segment dd section.stack.start ;[0x14]
segtbl_end:
;; =================================================================
SECTION code ALIGN=16 VSTART=0
start:
;; 初识执行时 DS 和 ES 指向用户程序头部段
mov ax, [stack_segment]
mov ss, ax
mov sp, stack_pointer ;设置初识的栈顶指针
mov ax, [data_segment] ;设置用户程序自己的数据段
mov ds, ax
mov ax, 0xb800
mov es, ax
mov si, message
mov di, 0
next:
mov al, [si]
cmp al, 0
je exit
mov byte [es:di], al
mov byte [es:di], 0x07
inc si
add di, 2
jmp next
exit:
jmp $
;; =================================================================
SECTION data ALIGN=16 VSTART=0
message:
db 'hello world.', 0
;; =================================================================
SECTION stack ALIGN=16 VSTART=0
resb 256
stack_pointer:
;; =================================================================
SECTION trail ALIGN=16
program_end:
|
src/Categories/Category/Instance/StrictCats.agda | bblfish/agda-categories | 5 | 3203 | <reponame>bblfish/agda-categories
{-# OPTIONS --without-K --safe #-}
module Categories.Category.Instance.StrictCats where
-- The (large) 'strict' category of (small) categories.
-- The difference here is that _≈_ is not |NaturalIsomorphism| but |_≈F_|
open import Level
open import Relation.Binary.PropositionalEquality using (refl)
open import Categories.Category using (Category)
open import Categories.Functor using (Functor; id; _∘F_)
open import Categories.Functor.Equivalence
private
variable
o ℓ e : Level
Cats : ∀ o ℓ e → Category (suc (o ⊔ ℓ ⊔ e)) (o ⊔ ℓ ⊔ e) (o ⊔ ℓ ⊔ e)
Cats o ℓ e = record
{ Obj = Category o ℓ e
; _⇒_ = Functor
; _≈_ = _≡F_
; id = id
; _∘_ = _∘F_
; assoc = λ {_ _ _ _ F G H} → ≡F-assoc {F = F} {G} {H}
; sym-assoc = λ {_ _ _ _ F G H} → ≡F-sym-assoc {F = F} {G} {H}
; identityˡ = ≡F-identityˡ
; identityʳ = ≡F-identityʳ
; identity² = ≡F-identity²
; equiv = ≡F-equiv
; ∘-resp-≈ = ∘F-resp-≡F
}
|
mtdb/ec2-tools/1.0/mutants-automation.applescript | hobinyoon/mutants-cassandra-2.2.3 | 0 | 232 | -- 2 machines per experiment
global num_experiments
set num_experiments to 7
-- TODO: create a named window, if not exist. open the named window and work on it.
on open_window_tabs()
tell application "Terminal"
activate
-- Open a new window
-- http://superuser.com/questions/195633/applescript-to-open-a-new-terminal-window-in-current-space
do script "clear"
-- set currentWindow to front window
-- Open new tabs
repeat (num_experiments * 2 - 1) times
tell application "System Events" to tell process "Terminal" to keystroke "t" using command down
end repeat
-- Move to the next (first) tab
tell application "System Events" to key code 124 using {shift down, command down}
end tell
end open_window_tabs
on ssh()
tell application "Terminal"
set currentWindow to front window
-- Without the delay, some connections are not made.
set delay_after_ssh to 0.5
set tab_id to 0
set s_id to 0
repeat until tab_id is (num_experiments * 2)
set tab_id to tab_id + 1
set cmd to "sshs" & s_id
do script (cmd) in tab tab_id of currentWindow
delay delay_after_ssh
set tab_id to tab_id + 1
set cmd to "sshc" & s_id
do script (cmd) in tab tab_id of currentWindow
delay delay_after_ssh
set s_id to s_id + 1
end repeat
end tell
end ssh
on screen()
tell application "Terminal"
set currentWindow to front window
set tab_id to 0
repeat until tab_id is (num_experiments * 2)
set tab_id to tab_id + 1
set cmd to "screen"
do script (cmd) in tab tab_id of currentWindow
set cmd to " "
do script (cmd) in tab tab_id of currentWindow
end repeat
end tell
end screen
-- This can not be scripted inside the server machine, since it doesn't have Mutants source yet.
on install_pkgs_0()
tell application "Terminal"
set currentWindow to front window
set tab_id to 0
repeat until tab_id is (num_experiments * 2)
set tab_id to tab_id + 1
set cmd to "sudo add-apt-repository -y ppa:webupd8team/java"
set cmd to cmd & " && sudo apt-get update"
set cmd to cmd & " && sudo apt-get install oracle-java8-installer git ctags ant htop tree maven gnuplot-nox ntp ioping realpath make gcc cmake g++ libboost-dev libboost-system-dev libboost-timer-dev collectl -y"
set cmd to cmd & " && sudo apt-get autoremove -y vim-tiny"
set cmd to cmd & " && mkdir -p ~/work"
set cmd to cmd & " && cd ~/work"
set cmd to cmd & " && git clone https://github.com/hoytech/vmtouch.git"
set cmd to cmd & " && cd vmtouch"
set cmd to cmd & " && make -j"
set cmd to cmd & " && sudo make install"
set cmd to cmd & " && sudo service ntp stop"
set cmd to cmd & " && sudo ntpdate -bv 0.ubuntu.pool.ntp.org"
set cmd to cmd & " && sudo service ntp start"
set cmd to cmd & " && cd ~/work"
set cmd to cmd & " && git clone <EMAIL>:hobinyoon/linux-home.git"
set cmd to cmd & " && cd linux-home"
set cmd to cmd & " && ./setup-linux.sh"
do script (cmd) in tab tab_id of currentWindow
end repeat
end tell
end install_pkgs_0
on install_pkgs_1()
tell application "Terminal" to activate
set tab_id to 0
repeat until tab_id is (num_experiments * 2)
set tab_id to tab_id + 1
tell application "System Events" to key code 36 -- enter
delay 0.2
tell application "System Events" to key code 123 -- left
tell application "System Events" to key code 36 -- enter
tell application "System Events" to key code 124 using {shift down, command down} -- move to the next tab
delay 0.1
end repeat
end install_pkgs_1
-- Sometimes the previous step takes forever. Need to make sure.
on install_pkgs_2()
tell application "Terminal"
set currentWindow to front window
set tab_id to 0
repeat until tab_id is (num_experiments * 2)
set tab_id to tab_id + 1
set cmd to "yes"
do script (cmd) in tab tab_id of currentWindow
delay 0.1
end repeat
end tell
end install_pkgs_2
on killall_screen()
tell application "Terminal"
set currentWindow to front window
set tab_id to 0
repeat until tab_id is (num_experiments * 2)
set tab_id to tab_id + 1
set cmd to "killall screen"
do script (cmd) in tab tab_id of currentWindow
end repeat
end tell
end killall_screen
on exit_screen()
tell application "Terminal" to activate
set tab_id to 0
repeat until tab_id is num_experiments
set tab_id to tab_id + 1
tell application "System Events" to keystroke "d" using {control down}
tell application "System Events" to keystroke "a" using {control down}
tell application "System Events" to keystroke "X"
tell application "System Events" to keystroke "d" using {control down}
tell application "System Events" to keystroke "a" using {control down}
tell application "System Events" to keystroke "X"
tell application "System Events" to keystroke "d" using {control down}
tell application "System Events" to keystroke "a" using {control down}
tell application "System Events" to keystroke "X"
tell application "System Events" to keystroke "d" using {control down}
tell application "System Events" to keystroke "d" using {control down}
delay 0.1
-- Move to the right
tell application "System Events" to key code 124 using {shift down, command down}
tell application "System Events" to keystroke "d" using {control down}
tell application "System Events" to keystroke "d" using {control down}
delay 0.1
-- Move to the right
tell application "System Events" to key code 124 using {shift down, command down}
end repeat
end exit_screen
on server_screen_split_htop()
tell application "Terminal" to activate
set tab_id to 0
repeat until tab_id is num_experiments
set tab_id to tab_id + 1
tell application "System Events" to keystroke "a" using {control down}
tell application "System Events" to keystroke "S"
tell application "System Events" to keystroke "a" using {control down}
tell application "System Events" to keystroke tab
tell application "System Events" to keystroke "a" using {control down}
tell application "System Events" to keystroke "c"
tell application "System Events" to keystroke "htop"
tell application "System Events" to key code 36
tell application "System Events" to keystroke "a" using {control down}
tell application "System Events" to keystroke "S"
tell application "System Events" to keystroke "a" using {control down}
tell application "System Events" to keystroke tab
tell application "System Events" to keystroke "a" using {control down}
tell application "System Events" to keystroke "c"
tell application "System Events" to keystroke "watch -n 0.5 \"free -mt\""
tell application "System Events" to key code 36
tell application "System Events" to keystroke "a" using {control down}
tell application "System Events" to keystroke "S"
tell application "System Events" to keystroke "a" using {control down}
tell application "System Events" to keystroke tab
tell application "System Events" to keystroke "a" using {control down}
tell application "System Events" to keystroke "c"
tell application "System Events" to keystroke "a" using {control down}
tell application "System Events" to keystroke tab
-- Move 2 to the right, since S and C take turns.
-- 124: right arrow
tell application "System Events" to key code 124 using {shift down, command down}
tell application "System Events" to key code 124 using {shift down, command down}
delay 0.1
end repeat
end server_screen_split_htop
on client_screen_split_htop()
tell application "Terminal" to activate
set tab_id to 0
-- Start from the 2nd tab, which is the first client tab
tell application "System Events" to key code 124 using {shift down, command down}
repeat until tab_id is num_experiments
set tab_id to tab_id + 1
tell application "System Events" to keystroke "a" using {control down}
tell application "System Events" to keystroke "S"
tell application "System Events" to keystroke "a" using {control down}
tell application "System Events" to keystroke tab
tell application "System Events" to keystroke "a" using {control down}
tell application "System Events" to keystroke "c"
tell application "System Events" to keystroke "htop"
tell application "System Events" to key code 36
tell application "System Events" to keystroke "a" using {control down}
tell application "System Events" to keystroke tab
-- Move 2 to the right, since S and C take turns.
-- 124: right arrow
tell application "System Events" to key code 124 using {shift down, command down}
tell application "System Events" to key code 124 using {shift down, command down}
delay 0.1
end repeat
-- Set the current tab to the 1st one
tell application "System Events" to key code 123 using {shift down, command down}
end client_screen_split_htop
-- This can not be scripted, since the mutants source is not there yet.
on build_cass_pressuremem_loadgen()
tell application "Terminal"
set currentWindow to front window
-- Without the delay, some connections are not made.
set delay_after_ssh to 0.2
set tab_id to 0
set s_id to 0
repeat until tab_id is (num_experiments * 2)
set tab_id to tab_id + 1
set cmd to "cd ~/work && (git clone <EMAIL>:hobinyoon/apache-cassandra-2.2.3-src.git || true) && ln -s ~/work/apache-cassandra-2.2.3-src ~/work/cassandra && cd ~/work/cassandra/mtdb/tools/pressure-memory && mkdir -p .build && cd .build && cmake .. && make -j && cdcass && time ant"
do script (cmd) in tab tab_id of currentWindow
delay delay_after_ssh
set tab_id to tab_id + 1
set cmd to "cd ~/work && git clone <EMAIL>:hobinyoon/apache-cassandra-2.2.3-src.git && ln -s ~/work/apache-cassandra-2.2.3-src ~/work/cassandra && cd ~/work/cassandra/mtdb/loadgen && ./loadgen"
do script (cmd) in tab tab_id of currentWindow
delay delay_after_ssh
set s_id to s_id + 1
end repeat
end tell
end build_cass_pressuremem_loadgen
on git_pull()
tell application "Terminal" to activate
set tab_id to 0
repeat until tab_id is (num_experiments * 2)
set tab_id to tab_id + 1
tell application "System Events" to keystroke "c" using {control down}
-- Move to the next tab
tell application "System Events" to key code 124 using {shift down, command down}
delay 0.1
end repeat
tell application "Terminal"
set currentWindow to front window
set tab_id to 0
repeat until tab_id is (num_experiments * 2)
set tab_id to tab_id + 1
set cmd to "cdcass && git pull"
do script (cmd) in tab tab_id of currentWindow
end repeat
end tell
end git_pull
on server_format_ebs_mag_mount_dev_prepare_dirs_cass_data_to_local_ssd_cold_to_ebs_mag()
tell application "Terminal"
set currentWindow to front window
set tab_id to 1
repeat until tab_id > (num_experiments * 2)
set cmd to "~/work/cassandra/mtdb/ec2-tools/server-format-xvdd-mount-ebs-mag-cold-to-ebs-mag.sh"
do script (cmd) in tab tab_id of currentWindow
-- Go to the next server tab
set tab_id to tab_id + 2
end repeat
end tell
end server_format_ebs_mag_mount_dev_prepare_dirs_cass_data_to_local_ssd_cold_to_ebs_mag
on server_mount_local_ssd_cold_to_ebs_ssd()
tell application "Terminal"
set currentWindow to front window
set tab_id to 1
repeat until tab_id > (num_experiments * 2)
set cmd to "~/work/cassandra/mtdb/ec2-tools/server-mount-local-ssd-cold-to-ebs-ssd.sh"
do script (cmd) in tab tab_id of currentWindow
-- Go to the next server tab
set tab_id to tab_id + 2
end repeat
end tell
end server_mount_local_ssd_cold_to_ebs_ssd
on server_format_xvdc_mount_2_local_ssds_cold_to_2nd_local_ssd()
tell application "Terminal"
set currentWindow to front window
set tab_id to 1
repeat until tab_id > (num_experiments * 2)
set cmd to "~/work/cassandra/mtdb/ec2-tools/server-format-xvdc-mount-2-local-ssds-cold-to-2nd-local-ssd.sh"
do script (cmd) in tab tab_id of currentWindow
-- Go to the next server tab
set tab_id to tab_id + 2
end repeat
end tell
end server_format_xvdc_mount_2_local_ssds_cold_to_2nd_local_ssd
on server_edit_cassandra_yaml()
tell application "Terminal"
set currentWindow to front window
set tab_id to 1
repeat until tab_id > (num_experiments * 2)
set cmd to "sed -i -r 's/^ migrate_to_cold_storage:.+/ migrate_to_cold_storage: true/' ~/work/cassandra/conf/cassandra.yaml"
do script (cmd) in tab tab_id of currentWindow
set cmd to "sed -i -r 's/^ tablet_coldness_threshold:.+/ tablet_coldness_threshold: 75/' ~/work/cassandra/conf/cassandra.yaml"
do script (cmd) in tab tab_id of currentWindow
set cmd to "grep migrate_to_cold_storage: ~/work/cassandra/conf/cassandra.yaml"
do script (cmd) in tab tab_id of currentWindow
set cmd to "grep tablet_coldness_threshold: ~/work/cassandra/conf/cassandra.yaml"
do script (cmd) in tab tab_id of currentWindow
-- Go to the next server tab
set tab_id to tab_id + 2
end repeat
end tell
end server_edit_cassandra_yaml
on client_edit_cassandra_yaml()
tell application "Terminal"
set currentWindow to front window
set tab_id to 2
repeat until tab_id > (num_experiments * 2)
set cmd to "sed -i -r 's/^ num_writes_per_simulation_time_mins:.+/ num_writes_per_simulation_time_mins: " & (tab_id * 5000) & "/' ~/work/cassandra/conf/cassandra.yaml"
do script (cmd) in tab tab_id of currentWindow
set cmd to "grep num_writes_per_simulation_time_mins: ~/work/cassandra/conf/cassandra.yaml"
do script (cmd) in tab tab_id of currentWindow
-- Go to the next client tab
set tab_id to tab_id + 2
end repeat
end tell
end client_edit_cassandra_yaml
on save_screen_layout()
tell application "Terminal" to activate
set tab_id to 0
repeat until tab_id is (num_experiments * 2)
set tab_id to tab_id + 1
tell application "System Events" to keystroke "a" using {control down}
tell application "System Events" to keystroke ":layout save default"
tell application "System Events" to key code 36
-- Move to the next tab
tell application "System Events" to key code 124 using {shift down, command down}
delay 0.1
end repeat
end save_screen_layout
-- One-time fix. Won't need again
on mkdir_collectl()
tell application "Terminal"
set currentWindow to front window
set tab_id to 1
repeat until tab_id > (num_experiments * 2)
set cmd to "mkdir ~/work/cassandra/mtdb/logs/collectl"
do script (cmd) in tab tab_id of currentWindow
-- Go to the next server tab
set tab_id to tab_id + 2
end repeat
end tell
end mkdir_collectl
on run_server()
tell application "Terminal"
set currentWindow to front window
set tab_id to 1
repeat until tab_id > (num_experiments * 2)
set cmd to "sudo -- sh -c 'echo 1 > /proc/sys/vm/drop_caches' && cdcass && time ant && rm -rf ~/work/cassandra/data/* && rm -rf /mnt/cold-storage/mtdb-cold/* && (killall mon-num-cass-threads.sh >/dev/null 2>&1 || true) && (~/work/cassandra/mtdb/tools/mon-num-cass-threads.sh &) && (killall collectl >/dev/null 2>&1 || true) && ((collectl -i 1 -sCDN -oTm > ~/work/cassandra/mtdb/logs/collectl/collectl-`date +'%y%m%d-%H%M%S'` 2>/dev/null) &) && bin/cassandra -f | grep --color -E '^|MTDB:'"
do script (cmd) in tab tab_id of currentWindow
-- Give enough delay to make sure the logs have different datetimes.
delay 3
-- Go to the next server tab
set tab_id to tab_id + 2
end repeat
end tell
end run_server
on server_pressure_memory()
tell application "Terminal" to activate
set tab_id to 0
repeat until tab_id is num_experiments
set tab_id to tab_id + 1
tell application "System Events" to keystroke "a" using {control down}
tell application "System Events" to keystroke tab
tell application "System Events" to keystroke "a" using {control down}
tell application "System Events" to keystroke tab
tell application "System Events" to keystroke "a" using {control down}
tell application "System Events" to keystroke tab
-- Kill the foreground process just in case
tell application "System Events" to keystroke "c" using {control down}
-- Move to the next server tab
tell application "System Events" to key code 124 using {shift down, command down}
tell application "System Events" to key code 124 using {shift down, command down}
delay 0.1
end repeat
tell application "Terminal"
set currentWindow to front window
set tab_id to 1
repeat until tab_id > (num_experiments * 2)
set cmd to "cd ~/work/cassandra/mtdb/tools/pressure-memory/.build"
set cmd to cmd & " && (./pressure-memory &)"
set cmd to cmd & " && watchsstables"
do script (cmd) in tab tab_id of currentWindow
-- Go to the next server tab
set tab_id to tab_id + 2
end repeat
end tell
set tab_id to 0
repeat until tab_id is num_experiments
set tab_id to tab_id + 1
tell application "System Events" to keystroke "a" using {control down}
tell application "System Events" to keystroke tab
-- Move to the next server tab
tell application "System Events" to key code 124 using {shift down, command down}
tell application "System Events" to key code 124 using {shift down, command down}
delay 0.1
end repeat
end server_pressure_memory
on client_run_loadgen()
tell application "Terminal"
set currentWindow to front window
set tab_id to 2
repeat until tab_id > (num_experiments * 2)
set cmd to "cd ~/work/cassandra/mtdb/loadgen && ./create-db.sh && ./loadgen"
do script (cmd) in tab tab_id of currentWindow
-- Make sure we get different exp datetime
delay 2
-- Go to the next client tab
set tab_id to tab_id + 2
end repeat
end tell
end client_run_loadgen
on screen_detach()
tell application "Terminal" to activate
set tab_id to 0
repeat until tab_id is (num_experiments * 2)
set tab_id to tab_id + 1
tell application "System Events" to keystroke "a" using {control down}
tell application "System Events" to keystroke "d"
delay 0.1
-- Move to the next tab
tell application "System Events" to key code 124 using {shift down, command down}
end repeat
end screen_detach
on screen_reattach()
tell application "Terminal"
set currentWindow to front window
set tab_id to 1
repeat until tab_id > (num_experiments * 2)
set cmd to "screen -r"
do script (cmd) in tab tab_id of currentWindow
-- Go to the next tab
set tab_id to tab_id + 1
end repeat
end tell
end screen_reattach
on server_get_client_logs_and_process()
tell application "Terminal" to activate
set tab_id to 0
repeat until tab_id is num_experiments
set tab_id to tab_id + 1
tell application "System Events" to keystroke "a" using {control down}
tell application "System Events" to keystroke tab
tell application "System Events" to keystroke "a" using {control down}
tell application "System Events" to keystroke tab
tell application "System Events" to keystroke "a" using {control down}
tell application "System Events" to keystroke tab
tell application "System Events" to keystroke "c" using {control down}
-- Move to the next server tab
tell application "System Events" to key code 124 using {shift down, command down}
tell application "System Events" to key code 124 using {shift down, command down}
delay 0.1
end repeat
tell application "Terminal"
set currentWindow to front window
set tab_id to 1
repeat until tab_id > (num_experiments * 2)
set cmd to "~/work/cassandra/mtdb/ec2-tools/server-get-client-logs-and-process.sh"
do script (cmd) in tab tab_id of currentWindow
-- Go to the next server tab
set tab_id to tab_id + 2
end repeat
end tell
set tab_id to 0
repeat until tab_id is num_experiments
set tab_id to tab_id + 1
tell application "System Events" to keystroke "a" using {control down}
tell application "System Events" to keystroke tab
-- Move to the next server tab
tell application "System Events" to key code 124 using {shift down, command down}
tell application "System Events" to key code 124 using {shift down, command down}
delay 0.1
end repeat
end server_get_client_logs_and_process
-- One-time fix. Won't need again
on server_rename_client_log()
tell application "Terminal" to activate
set tab_id to 0
repeat until tab_id is num_experiments
set tab_id to tab_id + 1
tell application "System Events" to keystroke "a" using {control down}
tell application "System Events" to keystroke tab
tell application "System Events" to keystroke "a" using {control down}
tell application "System Events" to keystroke tab
tell application "System Events" to keystroke "a" using {control down}
tell application "System Events" to keystroke tab
-- Move to the next server tab
tell application "System Events" to key code 124 using {shift down, command down}
tell application "System Events" to key code 124 using {shift down, command down}
delay 0.1
end repeat
tell application "Terminal"
set currentWindow to front window
set tab_id to 1
repeat until tab_id > (num_experiments * 2)
-- I don't like the float division. oh well.
set cmd to "mv ~/work/cassandra/mtdb/logs/loadgen/160302-023811 ~/work/cassandra/mtdb/logs/loadgen/160302-023811-" & ((tab_id - 1) / 2) & " && mv ~/work/cassandra/mtdb/logs/cassandra/160302-023811 ~/work/cassandra/mtdb/logs/cassandra/160302-023811-" & ((tab_id - 1) / 2)
do script (cmd) in tab tab_id of currentWindow
-- Go to the next server tab
set tab_id to tab_id + 2
end repeat
end tell
set tab_id to 0
repeat until tab_id is num_experiments
set tab_id to tab_id + 1
tell application "System Events" to keystroke "a" using {control down}
tell application "System Events" to keystroke tab
-- Move to the next server tab
tell application "System Events" to key code 124 using {shift down, command down}
tell application "System Events" to key code 124 using {shift down, command down}
delay 0.1
end repeat
end server_rename_client_log
-- One-time use.
on server_kill_monitor_processes()
tell application "Terminal"
set currentWindow to front window
set tab_id to 1
repeat until tab_id > (num_experiments * 2)
set cmd to "(killall pressure-memory > /dev/null 2>&1 || true) && (sudo killall collectl > /dev/null 2>&1 || true) && (sudo killall mon-num-cass-threads.sh > /dev/null 2>&1 || true)"
do script (cmd) in tab tab_id of currentWindow
-- Go to the next server tab
set tab_id to tab_id + 2
end repeat
end tell
end server_kill_monitor_processes
on server_switch_data_dir_to_ebs_mag()
tell application "Terminal"
set currentWindow to front window
set tab_id to 1
repeat until tab_id > (num_experiments * 2)
set cmd to "cdcass"
set cmd to cmd & " && \\rm data"
set cmd to cmd & " && ln -s /mnt/ebs-mag/cass-data data"
do script (cmd) in tab tab_id of currentWindow
-- Go to the next server tab
set tab_id to tab_id + 2
end repeat
end tell
end server_switch_data_dir_to_ebs_mag
on server_switch_data_dir_to_local_ssd()
tell application "Terminal"
set currentWindow to front window
set tab_id to 1
repeat until tab_id > (num_experiments * 2)
set cmd to "cdcass"
set cmd to cmd & " && \\rm -rf data"
set cmd to cmd & " && ln -s /mnt/local-ssd/cass-data data"
do script (cmd) in tab tab_id of currentWindow
-- Go to the next server tab
set tab_id to tab_id + 2
end repeat
end tell
end server_switch_data_dir_to_local_ssd
on open_window_tabs_ssh_screen()
my open_window_tabs()
my ssh()
my screen()
end open_window_tabs_ssh_screen
-- One-time use.
on server_ctrl_c()
tell application "Terminal" to activate
set tab_id to 0
repeat until tab_id is num_experiments
set tab_id to tab_id + 1
tell application "System Events" to keystroke "c" using {control down}
-- Move to the next server tab
tell application "System Events" to key code 124 using {shift down, command down}
tell application "System Events" to key code 124 using {shift down, command down}
delay 0.1
end repeat
end server_ctrl_c
-- One-time use.
on ctrl_c()
tell application "Terminal" to activate
set tab_id to 0
repeat until tab_id is (num_experiments * 2)
set tab_id to tab_id + 1
tell application "System Events" to keystroke "c" using {control down}
-- Move to the next server tab
tell application "System Events" to key code 124 using {shift down, command down}
delay 0.1
end repeat
end ctrl_c
on run_all()
my open_window_tabs_ssh_screen()
my install_pkgs_0()
my install_pkgs_1()
my install_pkgs_2()
-- Not a normal process. In case something goes wrong.
-- my exit_screen()
-- Need to logout and login again to make the new .bashrc in effect
-- Hit ^D until all tabs are closed
my open_window_tabs_ssh_screen()
-- These can be grouped
my server_screen_split_htop()
my client_screen_split_htop()
my build_cass_pressuremem_loadgen()
my save_screen_layout()
my screen_detach()
my screen_reattach()
------------------------------------
-- These are VM-specific commands. Consider automating.
-- Run either of these, depending on what dev you have. TODO: let it follow a global configuration file, based on its hostname?
-- my server_format_xvdc_mount_2_local_ssds_cold_to_2nd_local_ssd()
my server_format_ebs_mag_mount_dev_prepare_dirs_cass_data_to_local_ssd_cold_to_ebs_mag()
my server_mount_local_ssd_cold_to_ebs_ssd()
-- Switch data directory to ebs mag
-- my server_switch_data_dir_to_ebs_mag()
-- Only when you want Mutants to migrate tablets
my server_edit_cassandra_yaml()
my client_edit_cassandra_yaml()
-------------------------------------
-- This takes some time to make sure each server has different exp datetime
my run_server()
-- Wait till all servers are ready before pressuring memory
my server_pressure_memory()
-- This takes some time too.
my client_run_loadgen()
-- Detach screen to save network traffic while running experiments
my save_screen_layout()
my screen_detach()
-- May want to check the last tabs to see if the system saturates or cold sstables are created
-- When done, reattach the screen and process the logs
my screen_reattach()
my server_get_client_logs_and_process()
-- Switch data directory to ebs mag
-- my server_switch_data_dir_to_ebs_mag()
end run_all
my save_screen_layout()
my screen_detach()
|
src/Lambda/Virtual-machine.agda | nad/partiality-monad | 2 | 17410 | <filename>src/Lambda/Virtual-machine.agda
------------------------------------------------------------------------
-- Most of a virtual machine
------------------------------------------------------------------------
{-# OPTIONS --sized-types #-}
module Lambda.Virtual-machine where
open import Equality.Propositional
open import Prelude
open import Vec.Function equality-with-J
open import Lambda.Syntax
------------------------------------------------------------------------
-- Instruction set
mutual
-- Instructions.
data Instr (n : ℕ) : Type where
var : (x : Fin n) → Instr n
con : (i : ℕ) → Instr n
clo : (c : Code (suc n)) → Instr n
app : Instr n
ret : Instr n
-- Code.
Code : ℕ → Type
Code n = List (Instr n)
-- Environments and values.
open Closure Code
------------------------------------------------------------------------
-- Stacks and states
-- Stacks.
data StackElement : Type where
val : (v : Value) → StackElement
ret : ∀ {n} (c : Code n) (ρ : Env n) → StackElement
Stack : Type
Stack = List StackElement
-- States.
data State : Type where
⟨_,_,_⟩ : ∀ {n} (c : Code n) (s : Stack) (ρ : Env n) → State
pattern ⟨_∣_,_,_⟩ n c s ρ = ⟨_,_,_⟩ {n} c s ρ
------------------------------------------------------------------------
-- A kind of small-step semantics for the virtual machine
-- The result of running the VM one step.
data Result : Type where
continue : (s : State) → Result
done : (v : Value) → Result
crash : Result
-- A single step of the computation.
step : State → Result
step ⟨ var x ∷ c , s , ρ ⟩ = continue ⟨ c , val (ρ x) ∷ s , ρ ⟩
step ⟨ con i ∷ c , s , ρ ⟩ = continue ⟨ c , val (con i) ∷ s , ρ ⟩
step ⟨ clo c′ ∷ c , s , ρ ⟩ = continue ⟨ c , val (ƛ c′ ρ) ∷ s , ρ ⟩
step ⟨ app ∷ c , val v ∷ val (ƛ c′ ρ′) ∷ s , ρ ⟩ = continue ⟨ c′ , ret c ρ ∷ s , cons v ρ′ ⟩
step ⟨ ret ∷ c , val v ∷ ret c′ ρ′ ∷ s , ρ ⟩ = continue ⟨ c′ , val v ∷ s , ρ′ ⟩
step ⟨ zero ∣ [] , val v ∷ [] , ρ ⟩ = done v
step _ = crash
|
Code/driver/Clock.asm | ZSAIm/ElevatorController-STM8S_ASM | 0 | 160322 | <gh_stars>0
stm8/
#include "STM8S105K4.inc"
segment 'rom'
INTEL
; ---------------------------------
; name : void HSIClockInit() - 16MHZ
; params:
;
; return:
; =================================
; void HSIClockInit()
; {
; ...
; }
; ---------------------------------
.HSIClockInit.w
push cc
push A
HSIClockInit_start:
; => fHSI / 2 = 8Mhz
ld A, CLK_CKDIVR
and A, #11100111B
or A, #00001000B
ld CLK_CKDIVR, A
HSIClockInit_exit:
pop A
pop cc
ret
end
|
Rings/Homomorphisms/Lemmas.agda | Smaug123/agdaproofs | 4 | 13593 | {-# OPTIONS --safe --warning=error --without-K #-}
open import LogicalFormulae
open import Groups.Groups
open import Groups.Homomorphisms.Definition
open import Groups.Definition
open import Numbers.Naturals.Naturals
open import Setoids.Setoids
open import Functions.Definition
open import Sets.EquivalenceRelations
open import Rings.Definition
open import Rings.Homomorphisms.Definition
open import Agda.Primitive using (Level; lzero; lsuc; _⊔_)
module Rings.Homomorphisms.Lemmas {a b : _} {A : Set a} {S : Setoid {a} {b} A} {_+A_ _*A_ : A → A → A} (R : Ring S _+A_ _*A_) where
open import Groups.Homomorphisms.Lemmas2 (Ring.additiveGroup R)
imageRing : {c d : _} {B : Set c} {T : Setoid {c} {d} B} {_+B_ : B → B → B} {_*B_ : B → B → B} → (f : A → B) → SetoidSurjection S T f → ({x y : A} → Setoid._∼_ T (f (x +A y)) ((f x) +B (f y))) → ({x y : A} → Setoid._∼_ T (f (x *A y)) ((f x) *B (f y))) → ({x y m n : B} → Setoid._∼_ T x m → Setoid._∼_ T y n → Setoid._∼_ T (x +B y) (m +B n)) → ({x y m n : B} → Setoid._∼_ T x m → Setoid._∼_ T y n → Setoid._∼_ T (x *B y) (m *B n)) → Ring T _+B_ _*B_
Ring.additiveGroup (imageRing f surj respects+ respects* +wd *wd) = imageGroup f surj respects+ +wd
Ring.*WellDefined (imageRing f surj respects+ respects* +wd *wd) = *wd
Ring.1R (imageRing f surj respects+ respects* +wd *wd) = f (Ring.1R R)
Ring.groupIsAbelian (imageRing {T = T} f record { surjective = surjective ; wellDefined = wellDefined } respects+ respects* +wd *wd) {a} {b} with surjective {a}
... | x , fx=a with surjective {b}
... | y , fy=b = transitive (+wd (symmetric fx=a) (symmetric fy=b)) (transitive (transitive (symmetric respects+) (transitive (wellDefined (Ring.groupIsAbelian R)) respects+)) (+wd fy=b fx=a))
where
open Setoid T
open Equivalence eq
Ring.*Associative (imageRing {T = T} f record { surjective = surjective ; wellDefined = wellDefined } respects+ respects* +wd *wd) {a} {b} {c} with surjective {a}
... | x , fx=a with surjective {b}
... | y , fy=b with surjective {c}
... | z , fz=c = transitive (*wd (symmetric fx=a) (transitive (*wd (symmetric fy=b) (symmetric fz=c)) (symmetric respects*))) (transitive (transitive (symmetric respects*) (transitive (wellDefined (Ring.*Associative R)) respects*)) (*wd (transitive respects* (*wd fx=a fy=b)) fz=c))
where
open Setoid T
open Equivalence eq
Ring.*Commutative (imageRing {T = T} f record { surjective = surjective ; wellDefined = wellDefined } respects+ respects* +wd *wd) {a} {b} with surjective {a}
... | x , fx=a with surjective {b}
... | y , fy=b = transitive (*wd (symmetric fx=a) (symmetric fy=b)) (transitive (transitive (symmetric respects*) (transitive (wellDefined (Ring.*Commutative R)) respects*)) (*wd fy=b fx=a))
where
open Setoid T
open Equivalence eq
Ring.*DistributesOver+ (imageRing {T = T} f record { surjective = surjective ; wellDefined = wellDefined } respects+ respects* +wd *wd) {a} {b} {c} with surjective {a}
... | x , fx=a with surjective {b}
... | y , fy=b with surjective {c}
... | z , fz=c = transitive (*wd (symmetric fx=a) (+wd (symmetric fy=b) (symmetric fz=c))) (transitive (transitive (transitive (*wd reflexive (symmetric respects+)) (symmetric respects*)) (transitive (transitive (wellDefined (Ring.*DistributesOver+ R)) respects+) (+wd respects* respects*))) (+wd (*wd fx=a fy=b) (*wd fx=a fz=c)))
where
open Setoid T
open Equivalence eq
Ring.identIsIdent (imageRing {T = T} f record { wellDefined = wellDefined ; surjective = surjective } respects+ respects* +wd *wd) {b} with surjective {b}
Ring.identIsIdent (imageRing {T = T} f record { wellDefined = wellDefined ; surjective = surjective } respects+ respects* +wd *wd) {b} | a , fa=b = transitive (transitive (*wd reflexive (symmetric fa=b)) (transitive (symmetric respects*) (wellDefined (Ring.identIsIdent R)))) fa=b
where
open Setoid T
open Equivalence eq
homToImageRing : {c d : _} {B : Set c} {T : Setoid {c} {d} B} {_+B_ : B → B → B} {_*B_ : B → B → B} → (f : A → B) → (surj : SetoidSurjection S T f) → (respects+ : {x y : A} → Setoid._∼_ T (f (x +A y)) ((f x) +B (f y))) → (respects* : {x y : A} → Setoid._∼_ T (f (x *A y)) ((f x) *B (f y))) → (+wd : {x y m n : B} → Setoid._∼_ T x m → Setoid._∼_ T y n → Setoid._∼_ T (x +B y) (m +B n)) → (*wd : {x y m n : B} → Setoid._∼_ T x m → Setoid._∼_ T y n → Setoid._∼_ T (x *B y) (m *B n)) → RingHom R (imageRing f surj respects+ respects* +wd *wd) f
RingHom.preserves1 (homToImageRing {T = T} f surj respects+ respects* +wd *wd) = reflexive
where
open Setoid T
open Equivalence eq
RingHom.ringHom (homToImageRing f surj respects+ respects* +wd *wd) = respects*
RingHom.groupHom (homToImageRing f surj respects+ respects* +wd *wd) = homToImageGroup f surj respects+ +wd
|
measurer/gdb-7.9/gdb/testsuite/gdb.ada/optim_drec/foo.adb | armoredsoftware/protocol | 0 | 7241 | -- Copyright 2012-2015 Free Software Foundation, Inc.
--
-- This program is free software; you can redistribute it and/or modify
-- it under the terms of the GNU General Public License as published by
-- the Free Software Foundation; either version 3 of the License, or
-- (at your option) any later version.
--
-- This program is distributed in the hope that it will be useful,
-- but WITHOUT ANY WARRANTY; without even the implied warranty of
-- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-- GNU General Public License for more details.
--
-- You should have received a copy of the GNU General Public License
-- along with this program. If not, see <http://www.gnu.org/licenses/>.
procedure Foo is
type Discriminants_Record (A : Integer; B : Boolean) is record
C : Float;
end record;
-- The following variable is unused on purpose, and might be
-- optimized out by the compiler.
Z : Discriminants_Record := (A => 1, B => False, C => 2.0);
begin
null;
end Foo;
|
src/tree/xpath/XPathLexer.g4 | jabo-lang/antlr4ts | 486 | 732 | <reponame>jabo-lang/antlr4ts
/*
* Copyright 2016 The ANTLR Project. All rights reserved.
* Licensed under the BSD-3-Clause license. See LICENSE file in the project root for license information.
*/
lexer grammar XPathLexer;
tokens { TOKEN_REF, RULE_REF }
/*
path : separator? word (separator word)* EOF ;
separator
: '/' '!'
| '//' '!'
| '/'
| '//'
;
word: TOKEN_REF
| RULE_REF
| STRING
| '*'
;
*/
ANYWHERE : '//' ;
ROOT : '/' ;
WILDCARD : '*' ;
BANG : '!' ;
ID : NameStartChar NameChar*
{
let text = this.text;
if (text.charAt(0) === text.charAt(0).toUpperCase()) {
this.type = XPathLexer.TOKEN_REF;
} else {
this.type = XPathLexer.RULE_REF;
}
}
;
fragment
NameChar : [\p{Ll}\p{Lm}\p{Lo}\p{Lt}\p{Lu}\p{Nl}\p{Pc}\p{Nd}\p{Mc}\p{Mn}\p{Cf}\u0000-\u0008\u000E-\u001B\u007F-\u009F]
;
fragment
NameStartChar
: [\p{Ll}\p{Lm}\p{Lo}\p{Lt}\p{Lu}\p{Nl}]
;
STRING : '\'' .*? '\'' ;
//WS : [ \t\r\n]+ -> skip ;
|
libsrc/_DEVELOPMENT/target/yaz180/device/asci/z180/asm_asci0_flush_Rx_di.asm | Frodevan/z88dk | 640 | 24130 |
SECTION code_driver
SECTION code_driver_character_input
PUBLIC asm_asci0_flush_Rx_di
EXTERN asm_z180_push_di, asm_z180_pop_ei
EXTERN asm_asci0_flush_Rx
asm_asci0_flush_Rx_di:
push af
push hl
call asm_z180_push_di ; di
call asm_asci0_flush_Rx
call asm_z180_pop_ei ; ei
pop hl
pop af
ret
|
tier-1/gmp/source/thin/gmp_c-mpf_ptr.ads | charlie5/cBound | 2 | 11946 | <filename>tier-1/gmp/source/thin/gmp_c-mpf_ptr.ads
-- This file is generated by SWIG. Please do *not* modify by hand.
--
with gmp_c.a_a_mpf_struct;
with Interfaces.C;
package gmp_c.mpf_ptr is
-- Item
--
subtype Item is gmp_c.a_a_mpf_struct.Pointer;
-- Items
--
type Items is
array (Interfaces.C.size_t range <>) of aliased gmp_c.mpf_ptr.Item;
-- Pointer
--
type Pointer is access all gmp_c.mpf_ptr.Item;
-- Pointers
--
type Pointers is
array (Interfaces.C.size_t range <>) of aliased gmp_c.mpf_ptr.Pointer;
-- Pointer_Pointer
--
type Pointer_Pointer is access all gmp_c.mpf_ptr.Pointer;
end gmp_c.mpf_ptr;
|
Working Disassembly/General/Sprites/Tails/Anim - Tails 2P.asm | TeamASM-Blur/Sonic-3-Blue-Balls-Edition | 0 | 97684 | <reponame>TeamASM-Blur/Sonic-3-Blue-Balls-Edition
dc.w byte_15FA2-Ani_Tails2P
dc.w byte_15FA8-Ani_Tails2P
dc.w byte_15FAE-Ani_Tails2P
dc.w byte_15FB3-Ani_Tails2P
dc.w byte_15FB8-Ani_Tails2P
dc.w byte_15FBE-Ani_Tails2P
dc.w byte_15FBE-Ani_Tails2P
dc.w byte_15FBE-Ani_Tails2P
dc.w byte_15FD9-Ani_Tails2P
dc.w byte_15FDC-Ani_Tails2P
dc.w byte_15FBE-Ani_Tails2P
dc.w byte_15FBE-Ani_Tails2P
dc.w byte_15FBE-Ani_Tails2P
dc.w byte_15FE0-Ani_Tails2P
dc.w byte_15FE7-Ani_Tails2P
dc.w byte_15FEA-Ani_Tails2P
dc.w byte_15FED-Ani_Tails2P
dc.w byte_15FF1-Ani_Tails2P
dc.w byte_15FF4-Ani_Tails2P
dc.w byte_15FF7-Ani_Tails2P
dc.w byte_15FFA-Ani_Tails2P
dc.w byte_15FFD-Ani_Tails2P
dc.w byte_16000-Ani_Tails2P
dc.w byte_16003-Ani_Tails2P
dc.w byte_16006-Ani_Tails2P
dc.w byte_16009-Ani_Tails2P
dc.w byte_16009-Ani_Tails2P
dc.w byte_1600C-Ani_Tails2P
dc.w byte_1600F-Ani_Tails2P
dc.w byte_16012-Ani_Tails2P
dc.w byte_16015-Ani_Tails2P
dc.w byte_16018-Ani_Tails2P
dc.w byte_1601E-Ani_Tails2P
byte_15FA2: dc.b $FF, 1, 2, 3, 2, $FF
; ROM:00015F60o
byte_15FA8: dc.b $FF, $D, $E, $FF, $FF, $FF
; ROM:00015F60o
byte_15FAE: dc.b 1, $28, $29, $2A, $FF
; ROM:00015F60o
byte_15FB3: dc.b 1, $28, $29, $2A, $FF
; ROM:00015F60o
byte_15FB8: dc.b $FD, $25, $26, $FF, $FF, $FF
; ROM:00015F60o
byte_15FBE: dc.b 7, $1B, $1B, $1B, $1B, $1B, $1B, $1B, $1B, $1C, $1C, $1C, $1C, $1C, $1C, $1D, $1E, $1D, $1E, $1D
dc.b $1E, $1D, $1E, $1D, $1E, $FE, $10
byte_15FD9: dc.b 5, $2B, $FF
byte_15FDC: dc.b 0, $23, $24, $FF
byte_15FE0: dc.b 5, $22, $22, $22, $22, $FD, 0
byte_15FE7: dc.b 7, $15, $FF
byte_15FEA: dc.b 7, $15, $FF
byte_15FED: dc.b $2F, $15, $FD, 0
byte_15FF1: dc.b 1, $15, $FF
byte_15FF4: dc.b $F, $1F, $FF
byte_15FF7: dc.b $F, $1F, $FF
byte_15FFA: dc.b $13, $15, $FF
byte_15FFD: dc.b $B, $15, $FF
byte_16000: dc.b $20, $20, $FF
byte_16003: dc.b $20, $20, $FF
byte_16006: dc.b $20, $20, $FF
byte_16009: dc.b $40, $21, $FF
byte_1600C: dc.b 9, $21, $FF
byte_1600F: dc.b $77, 0, $FF
byte_16012: dc.b 3, $1B, $FF
byte_16015: dc.b 3, $1B, $FF
byte_16018: dc.b $FF, $D, $E, $FF, $FF, $FF
byte_1601E: dc.b 1, $2C, $2D, $FF
even
|
test/interaction/Issue4307.agda | cruhland/agda | 1,989 | 4996 | <filename>test/interaction/Issue4307.agda
postulate
A : Set
f : {{_ : A}} → A
f = {!!}
|
programs/oeis/143/A143938.asm | karttu/loda | 1 | 19485 | <filename>programs/oeis/143/A143938.asm
; A143938: The Wiener index of a benzenoid consisting of a linear chain of n hexagons.
; 27,109,279,569,1011,1637,2479,3569,4939,6621,8647,11049,13859,17109,20831,25057,29819,35149,41079,47641,54867,62789,71439,80849,91051,102077,113959,126729,140419,155061,170687,187329,205019,223789,243671,264697,286899,310309,334959,360881,388107,416669,446599,477929,510691,544917,580639,617889,656699,697101,739127,782809,828179,875269,924111,974737,1027179,1081469,1137639,1195721,1255747,1317749,1381759,1447809,1515931,1586157,1658519,1733049,1809779,1888741,1969967,2053489,2139339,2227549,2318151,2411177,2506659,2604629,2705119,2808161,2913787,3022029,3132919,3246489,3362771,3481797,3603599,3728209,3855659,3985981,4119207,4255369,4394499,4536629,4681791,4830017,4981339,5135789,5293399,5454201,5618227,5785509,5956079,6129969,6307211,6487837,6671879,6859369,7050339,7244821,7442847,7644449,7849659,8058509,8271031,8487257,8707219,8930949,9158479,9389841,9625067,9864189,10107239,10354249,10605251,10860277,11119359,11382529,11649819,11921261,12196887,12476729,12760819,13049189,13341871,13638897,13940299,14246109,14556359,14871081,15190307,15514069,15842399,16175329,16512891,16855117,17202039,17553689,17910099,18271301,18637327,19008209,19383979,19764669,20150311,20540937,20936579,21337269,21743039,22153921,22569947,22991149,23417559,23849209,24286131,24728357,25175919,25628849,26087179,26550941,27020167,27494889,27975139,28460949,28952351,29449377,29952059,30460429,30974519,31494361,32019987,32551429,33088719,33631889,34180971,34735997,35296999,35864009,36437059,37016181,37601407,38192769,38790299,39394029,40003991,40620217,41242739,41871589,42506799,43148401,43796427,44450909,45111879,45779369,46453411,47134037,47821279,48515169,49215739,49923021,50637047,51357849,52085459,52819909,53561231,54309457,55064619,55826749,56595879,57372041,58155267,58945589,59743039,60547649,61359451,62178477,63004759,63838329,64679219,65527461,66383087,67246129,68116619,68994589,69880071,70773097,71673699,72581909,73497759,74421281,75352507,76291469,77238199,78192729,79155091,80125317,81103439,82089489,83083499,84085501
add $0,2
mul $0,4
bin $0,3
sub $0,2
mov $1,$0
div $1,2
|
oeis/171/A171824.asm | neoneye/loda-programs | 11 | 645 | ; A171824: Triangle T(n,k)= binomial(n + k,n) + binomial(2*n-k,n) read by rows.
; Submitted by <NAME>
; 2,3,3,7,6,7,21,14,14,21,71,40,30,40,71,253,132,77,77,132,253,925,469,238,168,238,469,925,3433,1724,828,450,450,828,1724,3433,12871,6444,3048,1452,990,1452,3048,6444,12871,48621,24320,11495,5225,2717,2717,5225,11495,24320,48621,184757,92389,43824,19734,9009,6006,9009,19734,43824,92389,184757,705433,352728,168038,75946,33189,16744,16744,33189,75946,168038,352728,705433,2704157,1352091,646737,294385,127790,56576,37128,56576,127790,294385,646737,1352091,2704157,10400601,5200314,2496249,1144626
lpb $0
add $1,1
sub $0,$1
lpe
mov $2,$1
mul $2,2
sub $2,$0
bin $2,$1
add $1,$0
bin $1,$0
add $2,$1
mov $0,$2
|
src/main/antlr/M3uLexer.g4 | aerovulpe/m3uparser | 0 | 6949 | <reponame>aerovulpe/m3uparser
lexer grammar M3uLexer;
WS: SPACES+ -> skip;
NEWLINE: NEWLINES -> skip;
FILE_START: '#EXTM3U';
CHANNEL_START: EXTINF;
NUMBER: '-'? DIGIT+;
SAFE_STRING: SAFE_CHAR+;
QUOTED_STRING: QUOTE (SAFE_CHAR | NUMBER | COLON | EQUALS | SPACES | COMMA)+ QUOTE;
COMMA: ',' -> pushMode(CHANNEL_DESC);
COLON: ':';
EQUALS: '=';
mode CHANNEL_DESC;
CHANNEL_DESC_NEWLINE: NEWLINES -> skip;
CHANNEL_DESC_TEXT: CHANNEL_DESC_SAFE_CHAR+;
CHANNEL_DESC_GROUP: '#EXTGRP' -> pushMode(CHANNEL_GROUP);
CHANNEL_DESC_CHANNEL_START: EXTINF -> popMode;
CHANNEL_GROUP_HASH: '#' -> pushMode(COMMENT);
mode CHANNEL_GROUP;
CHANNEL_GROUP_COLON: ':';
CHANNEL_GROUP_TEXT: CHANNEL_GROUP_SAFE_CHAR+;
CHANNEL_GROUP_NEWLINE: NEWLINES -> popMode, skip;
mode COMMENT;
COMMENT_TEXT: COMMENT_SAFE_CHAR+;
COMMENT_NEWLINE: NEWLINES -> popMode, skip;
fragment NEWLINES: ('\r\n' | '\r' | '\n');
fragment EXTINF: '#EXTINF';
fragment QUOTE: '"';
fragment SPACES: [ \t];
fragment DIGIT: [0-9];
fragment SAFE_CHAR: ~[":= \t,\r\n];
fragment CHANNEL_DESC_SAFE_CHAR: ~[#\r\n];
fragment CHANNEL_GROUP_SAFE_CHAR: ~[:\r\n];
fragment COMMENT_SAFE_CHAR: ~[\r\n]; |
libpal/intel_64bit_systemv_nasm/write_es.asm | mars-research/pal | 26 | 22316 | <gh_stars>10-100
bits 64
default rel
section .text
global pal_execute_write_es
pal_execute_write_es :
xor rax, rax
mov es, di
ret
|
scripts/move_deleter.asm | longlostsoul/EvoYellow | 16 | 101381 | <reponame>longlostsoul/EvoYellow
MoveDeleterText1:
db 8 ; asm
ld hl, MoveDeleterGreetingText
call PrintText
jp TextScriptEnd
DeleteMove:
; d = move id
ld b, 0
.searchLoop
ld a, [hli]
cp d
jr z, .foundMoveLoop
inc b
jr .searchLoop
.foundMoveLoop
ld a, b
cp 3
jr z, .zeroLastMove
ld a, [hl]
dec hl
ld [hli], a
push hl
ld de, wPartyMon1PP - wPartyMon1Moves
add hl, de
ld a, [hld]
ld [hl], a ; copy move's PP
pop hl
inc hl
inc b
jr .foundMoveLoop
.zeroLastMove
dec hl
xor a
ld [hl], a
ld de, wPartyMon1PP - wPartyMon1Moves
add hl, de
ld [hl], a ; clear last move's PP
ret
PrepareDeletableMoveList:
; Places a list of the selected pokemon's moves at wDeletableMoves.
; First byte is count, and last byte is $ff.
; Input: party mon index = [wWhichPokemon]
ld a, [wWhichPokemon]
ld hl, wPartyMon1Moves
ld bc, wPartyMon2 - wPartyMon1
call AddNTimes
; hl = pointer to mon's 4 moves
ld b, 0 ; count of moves
ld c, 4 + 1 ; 4 moves
ld de, wEnemyNumHits + 1 ;wDeletableMoves + 1
.loop
dec c
jr z, .done
ld a, [hli]
and a
jr z, .loop
ld [de], a
inc de
inc b
jr .loop
.done
ld a, $ff ; terminate the list
ld [de], a
ld a, b ; store number of moves
ld [wEnemyNumHits],a ;[wDeletableMoves], a
ret
MoveDeleterGreetingText:
TX_FAR _MoveDeleterGreetingText
db "@"
MoveDeleterSaidYesText:
TX_FAR _MoveDeleterSaidYesText
db "@"
MoveDeleterWhichMoveText:
TX_FAR _MoveDeleterWhichMoveText
db "@"
MoveDeleterConfirmText:
TX_FAR _MoveDeleterConfirmText
db "@"
MoveDeleterForgotText:
TX_FAR _MoveDeleterForgotText
db "@"
MoveDeleterByeText:
TX_FAR _MoveDeleterByeText
db "@"
MoveDeleterOneMoveText:
TX_FAR _MoveDeleterOneMoveText
db "@"
|
gcc-gcc-7_3_0-release/gcc/testsuite/gnat.dg/vect6.ads | best08618/asylo | 7 | 2580 | <filename>gcc-gcc-7_3_0-release/gcc/testsuite/gnat.dg/vect6.ads
with Vect6_Pkg;
package Vect6 is
-- Unconstrained array types are vectorizable, possibly with special
-- help for the programmer
type Varray is array (Vect6_Pkg.Index_Type range <>) of Long_Float;
for Varray'Alignment use 16;
function "+" (X : Varray; Y : Long_Float) return Varray;
procedure Add (X : Varray; Y : Long_Float; R : out Varray);
procedure Add (X : not null access Varray; Y : Long_Float; R : not null access Varray);
-- Constrained array types are vectorizable
type Sarray is array (Vect6_Pkg.Index_Type(1) .. Vect6_Pkg.Index_Type(4))
of Long_Float;
for Sarray'Alignment use 16;
function "+" (X : Sarray; Y : Long_Float) return Sarray;
procedure Add (X : Sarray; Y : Long_Float; R : out Sarray);
procedure Add (X : not null access Sarray; Y : Long_Float; R : not null access Sarray);
type Darray1 is array (Vect6_Pkg.Index_Type(1) .. Vect6_Pkg.N) of Long_Float;
for Darray1'Alignment use 16;
function "+" (X : Darray1; Y : Long_Float) return Darray1;
procedure Add (X : Darray1; Y : Long_Float; R : out Darray1);
procedure Add (X : not null access Darray1; Y : Long_Float; R : not null access Darray1);
type Darray2 is array (Vect6_Pkg.K .. Vect6_Pkg.Index_Type(4)) of Long_Float;
for Darray2'Alignment use 16;
function "+" (X : Darray2; Y : Long_Float) return Darray2;
procedure Add (X : Darray2; Y : Long_Float; R : out Darray2);
procedure Add (X : not null access Darray2; Y : Long_Float; R : not null access Darray2);
type Darray3 is array (Vect6_Pkg.K .. Vect6_Pkg.N) of Long_Float;
for Darray3'Alignment use 16;
function "+" (X : Darray3; Y : Long_Float) return Darray3;
procedure Add (X : Darray3; Y : Long_Float; R : out Darray3);
procedure Add (X : not null access Darray3; Y : Long_Float; R : not null access Darray3);
end Vect6;
|
lib/parsers/src/main/antlr4/kuona/maven/dot/parser/MavenDot.g4 | kuona/kuona | 7 | 2865 | grammar MavenDot;
graph:
| DIGRAPH artifact '{' dependency* '}';
artifact: QUOTE
(
groupid=ID SEPARATOR artifactid=ID SEPARATOR packageing=ID SEPARATOR version=ID
| groupid=ID SEPARATOR artifactid=ID SEPARATOR packageing=ID SEPARATOR version=ID SEPARATOR scope=ID
| groupid=ID SEPARATOR artifactid=ID SEPARATOR packageing=ID SEPARATOR unknown=ID SEPARATOR version=ID SEPARATOR scope=ID
) QUOTE ;
dependency: from=artifact ARROW to=artifact SEMI ;
DIGRAPH: 'digraph';
QUOTE : '"';
SEMI: ';' ;
ARROW: '->';
SEPARATOR: ':';
ID : ID_CHAR+ ;
ID_CHAR: [a-zA-Z0-9]
| '.'
| '-'
| '_'
| '/';
WS : [ \t\r\n]+ -> skip ;
|
example_relationships/src/super_sub.adb | cortlandstarrett/mcada | 0 | 12775 | <filename>example_relationships/src/super_sub.adb
-- *************************************************************************************
--
-- The recipient is warned that this code should be handled in accordance
-- with the HM Government Security Classification indicated throughout.
--
-- This code and its contents shall not be used for other than UK Government
-- purposes.
--
-- The copyright in this code is the property of BAE SYSTEMS Electronic Systems Limited.
-- The Code is supplied by BAE SYSTEMS on the express terms that it is to be treated in
-- confidence and that it may not be copied, used or disclosed to others for any
-- purpose except in accordance with DEFCON 91 (Edn 10/92).
--
-- File Name: Super_Sub.adb
-- Version: As detailed by ClearCase
-- Version Date: As detailed by ClearCase
-- Creation Date: 03-11-99
-- Security Classification: Unclassified
-- Project: SRLE (Sting Ray Life Extension)
-- Author: <NAME>
-- Section: Tactical Software/ Software Architecture
-- Division: Underwater Systems Division
-- Description: Generic implementation of Supertype-Subtype relationship
-- Comments:
--
-- MODIFICATION RECORD
-- --------------------
-- NAME DATE ECR No MODIFICATION
--
-- db 22/04/02 SRLE100002907 Procedure initialise removed as surplus to requirements
--
-- db 11/10/02 SRLE100003928 Remove null checks on source navigates and
-- calls to log.
--
-- DNS 20/05/15 CR 10265 For Navigate procedures returning a list,
-- the Return is now an "in" parameter
--
-- **************************************************************************************
with Generic_List;
with Root_Object;
use type Root_Object.Object_Access;
use type Root_Object.Object_List.Node_Access_Type;
with Ada.Tags;
use type Ada.Tags.Tag;
package body Super_Sub is
Super_Side : Ada.Tags.Tag;
---------------------------------------------------------------------
procedure Register_Super_End_Class (Super_Class : in Ada.Tags.Tag) is
begin
Super_Side := Super_Class;
end Register_Super_End_Class;
---------------------------------------------------------------------
Sub_End_Write : Root_Object.Formalised_Relationship_Write_Type;
Sub_End_Read : Root_Object.Formalised_Relationship_Read_Type;
Super_End_Write : Root_Object.Formalised_Relationship_Write_Type;
Super_End_Read : Root_Object.Formalised_Relationship_Read_Type;
-------------------------------------------------------------------
procedure Register_Sub_End_Relationship_Write (To_Write : in Root_Object.Formalised_Relationship_Write_Type) is
begin
Sub_End_Write := To_Write;
end Register_Sub_End_Relationship_Write;
---------------------------------------------------------------------
procedure Register_Sub_End_Relationship_Read (To_Read : in Root_Object.Formalised_Relationship_Read_Type) is
begin
Sub_End_Read := To_Read;
end Register_Sub_End_Relationship_Read;
---------------------------------------------------------------------
procedure Register_Super_End_Relationship_Write (To_Write : in Root_Object.Formalised_Relationship_Write_Type) is
begin
Super_End_Write := To_Write;
end Register_Super_End_Relationship_Write;
---------------------------------------------------------------------
procedure Register_Super_End_Relationship_Read (To_Read : in Root_Object.Formalised_Relationship_Read_Type) is
begin
Super_End_Read := To_Read;
end Register_Super_End_Relationship_Read;
---------------------------------------------------------------------
procedure Link (
A_Instance : in Root_Object.Object_Access;
B_Instance : in Root_Object.Object_Access) is
begin
if A_Instance.all'tag = Super_Side then
--A-Left Link
Sub_End_Write (A_Instance, B_Instance);
Super_End_Write (B_Instance, A_Instance);
elsif B_Instance.all'tag = Super_Side then
--A-Right Link
Super_End_Write (A_Instance, B_Instance);
Sub_End_Write (B_Instance, A_Instance);
end if;
end Link;
---------------------------------------------------------------------
procedure Unlink (
A_Instance : in Root_Object.Object_Access;
B_Instance : in Root_Object.Object_Access) is
begin
if A_Instance.all'tag = Super_Side then
-- A-Left Unlink
Sub_End_Write (A_Instance, null);
Super_End_Write (B_Instance, null);
elsif B_Instance.all'tag = Super_Side then
-- A-Right Unlink
Super_End_Write (A_Instance, null);
Sub_End_Write (B_Instance, null);
end if;
end Unlink;
---------------------------------------------------------------------
procedure Navigate (
From : in Root_Object.Object_Access;
To : out Root_Object.Object_Access) is
begin
if From.all'tag = Super_Side then
-- A-Right Navigate
To := Sub_End_Read (From);
else
--A-Left Navigate
To := Super_End_Read (From);
end if;
end Navigate;
---------------------------------------------------------------------
procedure Navigate (
From : in Root_Object.Object_Access;
Class : in Ada.Tags.Tag;
To : out Root_Object.Object_Access) is
begin
Navigate (
From => From,
To => To);
if To /= null and then To'tag /= Class then
To := null;
end if;
end Navigate;
---------------------------------------------------------------------
procedure Navigate (
From : in Root_Object.Object_List.List_Header_Access_Type;
To : in Root_Object.Object_List.List_Header_Access_Type) is
The_From_Instance : Root_Object.Object_Access;
The_To_Instance : Root_Object.Object_Access;
The_From_Pointer : Root_Object.Object_List.Node_Access_Type;
begin
The_From_Pointer := Root_Object.Object_List.First_Entry_Of (From);
while The_From_Pointer /= null loop
The_From_Instance := The_From_Pointer.Item;
Navigate (
From => The_From_Instance,
To => The_To_Instance);
if The_To_Instance /= null then
Root_Object.Object_List.Insert (
New_Item => The_To_Instance,
On_To => To );
end if;
The_From_Pointer := Root_Object.Object_List.Next_Entry_Of (From);
end loop;
end Navigate;
---------------------------------------------------------------------
procedure Navigate (
From : in Root_Object.Object_List.List_Header_Access_Type;
Class : in Ada.Tags.Tag;
To : in Root_Object.Object_List.List_Header_Access_Type) is
The_From_Instance : Root_Object.Object_Access;
The_To_Instance : Root_Object.Object_Access;
The_From_Pointer : Root_Object.Object_List.Node_Access_Type;
begin
The_From_Pointer := Root_Object.Object_List.First_Entry_Of (From);
while The_From_Pointer /= null loop
The_From_Instance := The_From_Pointer.Item;
Navigate (
From => The_From_Instance,
Class => Class,
To => The_To_Instance);
if The_To_Instance /= null then
Root_Object.Object_List.Insert (
New_Item => The_To_Instance,
On_To => To );
end if;
The_From_Pointer := Root_Object.Object_List.Next_Entry_Of (From);
end loop;
end Navigate;
---------------------------------------------------------------------
end Super_Sub;
|
programs/oeis/271/A271994.asm | neoneye/loda | 22 | 242728 | ; A271994: The chalcogen sequence (a(n) = A018227(n)-2).
; 8,16,34,52,84,116,166,216,288,360,458,556,684,812,974,1136,1336,1536,1778,2020,2308,2596,2934,3272,3664,4056,4506,4956,5468,5980,6558,7136,7784,8432,9154,9876,10676,11476,12358,13240,14208,15176,16234,17292,18444,19596,20846,22096,23448,24800,26258,27716,29284,30852,32534,34216,36016,37816,39738,41660,43708,45756,47934,50112,52424,54736,57186,59636,62228,64820,67558,70296,73184,76072,79114,82156,85356,88556,91918,95280,98808,102336,106034,109732,113604,117476,121526,125576,129808,134040,138458,142876,147484,152092,156894,161696,166696,171696,176898,182100
mov $2,$0
add $0,1
seq $0,3451 ; Number of nonequivalent dissections of an n-gon into 3 polygons by nonintersecting diagonals up to rotation.
mul $0,2
sub $0,2
add $0,$2
div $0,2
add $0,1
mul $0,2
|
test/_file_.asm | bitwiseworks/nasm-os2 | 3 | 247427 | <filename>test/_file_.asm
;Testname=bin; Arguments=-fbin -o_file_.bin; Files=stdout stderr _file_.bin
db __FILE__, `\r\n`
db __FILE__, `\r\n`
dw __LINE__
dw __LINE__
|
test/rv32f_test2.asm | kojad666/Vulcan | 102 | 22203 | <filename>test/rv32f_test2.asm
addi x9, x0, 9
addi x10, x0, 2
fcvt.s.w f1, x9
fcvt.s.w f2, x10
fdiv.s f3, f1, f2
addi x30, x0, 2
loop:
fmul.s f3, f3, f3
addi x30, x30, -1
bne x30, x0, loop
|
Transynther/x86/_processed/NONE/_xt_sm_/i9-9900K_12_0xa0.log_7_753.asm | ljhsiun2/medusa | 9 | 82072 | .global s_prepare_buffers
s_prepare_buffers:
ret
.global s_faulty_load
s_faulty_load:
push %r10
push %r11
push %r14
push %rax
push %rcx
push %rdx
push %rsi
// Store
lea addresses_PSE+0x1cfaf, %rsi
nop
nop
and %r14, %r14
mov $0x5152535455565758, %rax
movq %rax, %xmm2
movups %xmm2, (%rsi)
nop
nop
sub %rax, %rax
// Store
lea addresses_PSE+0x1c65b, %rax
nop
nop
nop
nop
nop
xor $28671, %r11
mov $0x5152535455565758, %rcx
movq %rcx, %xmm6
movups %xmm6, (%rax)
nop
nop
dec %rsi
// Store
lea addresses_RW+0x68ef, %r10
nop
sub $29480, %r14
mov $0x5152535455565758, %rax
movq %rax, %xmm4
vmovaps %ymm4, (%r10)
nop
nop
nop
and $54836, %r14
// Faulty Load
lea addresses_PSE+0x1cfaf, %rdx
nop
nop
nop
cmp %rsi, %rsi
mov (%rdx), %r10w
lea oracles, %rcx
and $0xff, %r10
shlq $12, %r10
mov (%rcx,%r10,1), %r10
pop %rsi
pop %rdx
pop %rcx
pop %rax
pop %r14
pop %r11
pop %r10
ret
/*
<gen_faulty_load>
[REF]
{'src': {'NT': False, 'same': False, 'congruent': 0, 'type': 'addresses_PSE', 'AVXalign': False, 'size': 2}, 'OP': 'LOAD'}
{'OP': 'STOR', 'dst': {'NT': False, 'same': True, 'congruent': 0, 'type': 'addresses_PSE', 'AVXalign': False, 'size': 16}}
{'OP': 'STOR', 'dst': {'NT': False, 'same': False, 'congruent': 2, 'type': 'addresses_PSE', 'AVXalign': False, 'size': 16}}
{'OP': 'STOR', 'dst': {'NT': False, 'same': False, 'congruent': 6, 'type': 'addresses_RW', 'AVXalign': True, 'size': 32}}
[Faulty Load]
{'src': {'NT': False, 'same': True, 'congruent': 0, 'type': 'addresses_PSE', 'AVXalign': False, 'size': 2}, 'OP': 'LOAD'}
<gen_prepare_buffer>
{'58': 7}
58 58 58 58 58 58 58
*/
|
tools-src/gnu/gcc/gcc/ada/prj-tree.ads | enfoTek/tomato.linksys.e2000.nvram-mod | 80 | 24768 | ------------------------------------------------------------------------------
-- --
-- GNAT COMPILER COMPONENTS --
-- --
-- P R J . T R E E --
-- --
-- S p e c --
-- --
-- $Revision$
-- --
-- Copyright (C) 2001 Free Software Foundation, Inc. --
-- --
-- GNAT is free software; you can redistribute it and/or modify it under --
-- terms of the GNU General Public License as published by the Free Soft- --
-- ware Foundation; either version 2, or (at your option) any later ver- --
-- sion. GNAT is distributed in the hope that it will be useful, but WITH- --
-- OUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY --
-- or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License --
-- for more details. You should have received a copy of the GNU General --
-- Public License distributed with GNAT; see file COPYING. If not, write --
-- to the Free Software Foundation, 59 Temple Place - Suite 330, Boston, --
-- MA 02111-1307, USA. --
-- --
-- GNAT was originally developed by the GNAT team at New York University. --
-- Extensive contributions were provided by Ada Core Technologies Inc. --
-- --
------------------------------------------------------------------------------
-- This package defines the structure of the Project File tree.
with GNAT.HTable;
with Prj.Attr; use Prj.Attr;
with Prj.Com; use Prj.Com;
with Types; use Types;
with Table;
package Prj.Tree is
Project_Nodes_Initial : constant := 1_000;
Project_Nodes_Increment : constant := 100;
-- Allocation parameters for initializing and extending number
-- of nodes in table Tree_Private_Part.Project_Nodes
Project_Node_Low_Bound : constant := 0;
Project_Node_High_Bound : constant := 099_999_999;
-- Range of values for project node id's (in practice infinite)
type Project_Node_Id is range
Project_Node_Low_Bound .. Project_Node_High_Bound;
-- The index of table Tree_Private_Part.Project_Nodes
Empty_Node : constant Project_Node_Id := Project_Node_Low_Bound;
-- Designates no node in table Project_Nodes
First_Node_Id : constant Project_Node_Id := Project_Node_Low_Bound;
subtype Variable_Node_Id is Project_Node_Id;
-- Used to designate a node whose expected kind is one of
-- N_Typed_Variable_Declaration, N_Variable_Declaration or
-- N_Variable_Reference.
subtype Package_Declaration_Id is Project_Node_Id;
-- Used to designate a node whose expected kind is N_Proect_Declaration
type Project_Node_Kind is
(N_Project,
N_With_Clause,
N_Project_Declaration,
N_Declarative_Item,
N_Package_Declaration,
N_String_Type_Declaration,
N_Literal_String,
N_Attribute_Declaration,
N_Typed_Variable_Declaration,
N_Variable_Declaration,
N_Expression,
N_Term,
N_Literal_String_List,
N_Variable_Reference,
N_External_Value,
N_Attribute_Reference,
N_Case_Construction,
N_Case_Item);
-- Each node in the tree is of a Project_Node_Kind
-- For the signification of the fields in each node of a
-- Project_Node_Kind, look at package Tree_Private_Part.
procedure Initialize;
-- Initialize the Project File tree: empty the Project_Nodes table
-- and reset the Projects_Htable.
function Default_Project_Node
(Of_Kind : Project_Node_Kind;
And_Expr_Kind : Variable_Kind := Undefined)
return Project_Node_Id;
-- Returns a Project_Node_Record with the specified Kind and
-- Expr_Kind; all the other components have default nil values.
----------------------
-- Access Functions --
----------------------
-- The following query functions are part of the abstract interface
-- of the Project File tree
function Name_Of (Node : Project_Node_Id) return Name_Id;
-- Valid for all non empty nodes. May return No_Name for nodes that have
-- no names.
function Kind_Of (Node : Project_Node_Id) return Project_Node_Kind;
-- Valid for all non empty nodes
function Location_Of (Node : Project_Node_Id) return Source_Ptr;
-- Valid for all non empty nodes
function Directory_Of (Node : Project_Node_Id) return Name_Id;
-- Only valid for N_Project nodes.
function Expression_Kind_Of (Node : Project_Node_Id) return Variable_Kind;
-- Only valid for N_Literal_String, N_Attribute_Declaration,
-- N_Variable_Declaration, N_Typed_Variable_Declaration, N_Expression,
-- N_Term, N_Variable_Reference or N_Attribute_Reference nodes.
function First_Variable_Of
(Node : Project_Node_Id)
return Variable_Node_Id;
-- Only valid for N_Project or N_Package_Declaration nodes
function First_Package_Of
(Node : Project_Node_Id)
return Package_Declaration_Id;
-- Only valid for N_Project nodes
function Package_Id_Of (Node : Project_Node_Id) return Package_Node_Id;
-- Only valid for N_Package_Declaration nodes
function Path_Name_Of (Node : Project_Node_Id) return Name_Id;
-- Only valid for N_Project and N_With_Clause nodes.
function String_Value_Of (Node : Project_Node_Id) return String_Id;
-- Only valid for N_With_Clause or N_Literal_String nodes.
function First_With_Clause_Of
(Node : Project_Node_Id)
return Project_Node_Id;
-- Only valid for N_Project nodes
function Project_Declaration_Of
(Node : Project_Node_Id)
return Project_Node_Id;
-- Only valid for N_Project nodes
function First_String_Type_Of
(Node : Project_Node_Id)
return Project_Node_Id;
-- Only valid for N_Project nodes
function Modified_Project_Path_Of
(Node : Project_Node_Id)
return String_Id;
-- Only valid for N_With_Clause nodes
function Project_Node_Of
(Node : Project_Node_Id)
return Project_Node_Id;
-- Only valid for N_Project nodes
function Next_With_Clause_Of
(Node : Project_Node_Id)
return Project_Node_Id;
-- Only valid for N_With_Clause nodes
function First_Declarative_Item_Of
(Node : Project_Node_Id)
return Project_Node_Id;
-- Only valid for N_With_Clause nodes
function Modified_Project_Of
(Node : Project_Node_Id)
return Project_Node_Id;
-- Only valid for N_With_Clause nodes
function Current_Item_Node
(Node : Project_Node_Id)
return Project_Node_Id;
-- Only valid for N_Declarative_Item nodes
function Next_Declarative_Item
(Node : Project_Node_Id)
return Project_Node_Id;
-- Only valid for N_Declarative_Item node
function Project_Of_Renamed_Package_Of
(Node : Project_Node_Id)
return Project_Node_Id;
-- Only valid for N_Package_Declaration nodes.
-- May return Empty_Node.
function Next_Package_In_Project
(Node : Project_Node_Id)
return Project_Node_Id;
-- Only valid for N_Package_Declaration nodes
function First_Literal_String
(Node : Project_Node_Id)
return Project_Node_Id;
-- Only valid for N_String_Type_Declaration nodes
function Next_String_Type
(Node : Project_Node_Id)
return Project_Node_Id;
-- Only valid for N_String_Type_Declaration nodes
function Next_Literal_String
(Node : Project_Node_Id)
return Project_Node_Id;
-- Only valid for N_Literal_String nodes
function Expression_Of
(Node : Project_Node_Id)
return Project_Node_Id;
-- Only valid for N_Attribute_Declaration, N_Typed_Variable_Declaration
-- or N_Variable_Declaration nodes
function Value_Is_Valid
(For_Typed_Variable : Project_Node_Id;
Value : String_Id)
return Boolean;
-- Only valid for N_Typed_Variable_Declaration. Returns True if Value is
-- in the list of allowed strings for For_Typed_Variable. False otherwise.
function Associative_Array_Index_Of
(Node : Project_Node_Id)
return String_Id;
-- Only valid for N_Attribute_Declaration.
-- Returns No_String for non associative array attributes.
function Next_Variable
(Node : Project_Node_Id)
return Project_Node_Id;
-- Only valid for N_Typed_Variable_Declaration or N_Variable_Declaration
-- nodes.
function First_Term
(Node : Project_Node_Id)
return Project_Node_Id;
-- Only valid for N_Expression nodes
function Next_Expression_In_List
(Node : Project_Node_Id)
return Project_Node_Id;
-- Only valid for N_Expression nodes
function Current_Term
(Node : Project_Node_Id)
return Project_Node_Id;
-- Only valid for N_Term nodes
function Next_Term
(Node : Project_Node_Id)
return Project_Node_Id;
-- Only valid for N_Term nodes
function First_Expression_In_List
(Node : Project_Node_Id)
return Project_Node_Id;
-- Only valid for N_Literal_String_List nodes
function Package_Node_Of
(Node : Project_Node_Id)
return Project_Node_Id;
-- Only valid for N_Variable_Reference or N_Attribute_Reference nodes.
-- May return Empty_Node.
function String_Type_Of
(Node : Project_Node_Id)
return Project_Node_Id;
-- Only valid for N_Variable_Reference or N_Typed_Variable_Declaration
-- nodes.
function External_Reference_Of
(Node : Project_Node_Id)
return Project_Node_Id;
-- Only valid for N_External_Value nodes
function External_Default_Of
(Node : Project_Node_Id)
return Project_Node_Id;
-- Only valid for N_External_Value nodes
function Case_Variable_Reference_Of
(Node : Project_Node_Id)
return Project_Node_Id;
-- Only valid for N_Case_Construction nodes
function First_Case_Item_Of
(Node : Project_Node_Id)
return Project_Node_Id;
-- Only valid for N_Case_Construction nodes
function First_Choice_Of
(Node : Project_Node_Id)
return Project_Node_Id;
-- Return the first choice in a N_Case_Item, or Empty_Node if
-- this is when others.
function Next_Case_Item
(Node : Project_Node_Id)
return Project_Node_Id;
-- Only valid for N_Case_Item nodes
function Case_Insensitive (Node : Project_Node_Id) return Boolean;
-- Only valid for N_Attribute_Declaration nodes
--------------------
-- Set Procedures --
--------------------
-- The following procedures are part of the abstract interface of
-- the Project File tree.
-- Each Set_* procedure is valid only for the same Project_Node_Kind
-- nodes as the corresponding query function above.
procedure Set_Name_Of
(Node : Project_Node_Id;
To : Name_Id);
procedure Set_Kind_Of
(Node : Project_Node_Id;
To : Project_Node_Kind);
procedure Set_Location_Of
(Node : Project_Node_Id;
To : Source_Ptr);
procedure Set_Directory_Of
(Node : Project_Node_Id;
To : Name_Id);
procedure Set_Expression_Kind_Of
(Node : Project_Node_Id;
To : Variable_Kind);
procedure Set_First_Variable_Of
(Node : Project_Node_Id;
To : Variable_Node_Id);
procedure Set_First_Package_Of
(Node : Project_Node_Id;
To : Package_Declaration_Id);
procedure Set_Package_Id_Of
(Node : Project_Node_Id;
To : Package_Node_Id);
procedure Set_Path_Name_Of
(Node : Project_Node_Id;
To : Name_Id);
procedure Set_String_Value_Of
(Node : Project_Node_Id;
To : String_Id);
procedure Set_First_With_Clause_Of
(Node : Project_Node_Id;
To : Project_Node_Id);
procedure Set_Project_Declaration_Of
(Node : Project_Node_Id;
To : Project_Node_Id);
procedure Set_First_String_Type_Of
(Node : Project_Node_Id;
To : Project_Node_Id);
procedure Set_Modified_Project_Path_Of
(Node : Project_Node_Id;
To : String_Id);
procedure Set_Project_Node_Of
(Node : Project_Node_Id;
To : Project_Node_Id);
procedure Set_Next_With_Clause_Of
(Node : Project_Node_Id;
To : Project_Node_Id);
procedure Set_First_Declarative_Item_Of
(Node : Project_Node_Id;
To : Project_Node_Id);
procedure Set_Modified_Project_Of
(Node : Project_Node_Id;
To : Project_Node_Id);
procedure Set_Current_Item_Node
(Node : Project_Node_Id;
To : Project_Node_Id);
procedure Set_Next_Declarative_Item
(Node : Project_Node_Id;
To : Project_Node_Id);
procedure Set_Project_Of_Renamed_Package_Of
(Node : Project_Node_Id;
To : Project_Node_Id);
procedure Set_Next_Package_In_Project
(Node : Project_Node_Id;
To : Project_Node_Id);
procedure Set_First_Literal_String
(Node : Project_Node_Id;
To : Project_Node_Id);
procedure Set_Next_String_Type
(Node : Project_Node_Id;
To : Project_Node_Id);
procedure Set_Next_Literal_String
(Node : Project_Node_Id;
To : Project_Node_Id);
procedure Set_Expression_Of
(Node : Project_Node_Id;
To : Project_Node_Id);
procedure Set_Associative_Array_Index_Of
(Node : Project_Node_Id;
To : String_Id);
procedure Set_Next_Variable
(Node : Project_Node_Id;
To : Project_Node_Id);
procedure Set_First_Term
(Node : Project_Node_Id;
To : Project_Node_Id);
procedure Set_Next_Expression_In_List
(Node : Project_Node_Id;
To : Project_Node_Id);
procedure Set_Current_Term
(Node : Project_Node_Id;
To : Project_Node_Id);
procedure Set_Next_Term
(Node : Project_Node_Id;
To : Project_Node_Id);
procedure Set_First_Expression_In_List
(Node : Project_Node_Id;
To : Project_Node_Id);
procedure Set_Package_Node_Of
(Node : Project_Node_Id;
To : Project_Node_Id);
procedure Set_String_Type_Of
(Node : Project_Node_Id;
To : Project_Node_Id);
procedure Set_External_Reference_Of
(Node : Project_Node_Id;
To : Project_Node_Id);
procedure Set_External_Default_Of
(Node : Project_Node_Id;
To : Project_Node_Id);
procedure Set_Case_Variable_Reference_Of
(Node : Project_Node_Id;
To : Project_Node_Id);
procedure Set_First_Case_Item_Of
(Node : Project_Node_Id;
To : Project_Node_Id);
procedure Set_First_Choice_Of
(Node : Project_Node_Id;
To : Project_Node_Id);
procedure Set_Next_Case_Item
(Node : Project_Node_Id;
To : Project_Node_Id);
procedure Set_Case_Insensitive
(Node : Project_Node_Id;
To : Boolean);
-------------------------------
-- Restricted Access Section --
-------------------------------
package Tree_Private_Part is
-- This is conceptually in the private part.
-- However, for efficiency, some packages are accessing it directly.
type Project_Node_Record is record
Kind : Project_Node_Kind;
Location : Source_Ptr := No_Location;
Directory : Name_Id := No_Name;
-- Only for N_Project
Expr_Kind : Variable_Kind := Undefined;
-- See below for what Project_Node_Kind it is used
Variables : Variable_Node_Id := Empty_Node;
-- First variable in a project or a package
Packages : Package_Declaration_Id := Empty_Node;
-- First package declaration in a project
Pkg_Id : Package_Node_Id := Empty_Package;
-- Only used for N_Package_Declaration
-- The component Pkg_Id is an entry into the table Package_Attributes
-- (in Prj.Attr). It is used to indicate all the attributes of the
-- package with their characteristics.
--
-- The tables Prj.Attr.Attributes and Prj.Attr.Package_Attributes
-- are built once and for all through a call (from Prj.Initialize)
-- to procedure Prj.Attr.Initialize. It is never modified after that.
Name : Name_Id := No_Name;
-- See below for what Project_Node_Kind it is used
Path_Name : Name_Id := No_Name;
-- See below for what Project_Node_Kind it is used
Value : String_Id := No_String;
-- See below for what Project_Node_Kind it is used
Field1 : Project_Node_Id := Empty_Node;
-- See below the meaning for each Project_Node_Kind
Field2 : Project_Node_Id := Empty_Node;
-- See below the meaning for each Project_Node_Kind
Field3 : Project_Node_Id := Empty_Node;
-- See below the meaning for each Project_Node_Kind
Case_Insensitive : Boolean := False;
-- Significant only for N_Attribute_Declaration
-- Indicates, for an associative array attribute, that the
-- index is case insensitive.
end record;
-- type Project_Node_Kind is
-- (N_Project,
-- -- Name: project name
-- -- Path_Name: project path name
-- -- Expr_Kind: Undefined
-- -- Field1: first with clause
-- -- Field2: project declaration
-- -- Field3: first string type
-- -- Value: modified project path name (if any)
-- N_With_Clause,
-- -- Name: imported project name
-- -- Path_Name: imported project path name
-- -- Expr_Kind: Undefined
-- -- Field1: project node
-- -- Field2: next with clause
-- -- Field3: not used
-- -- Value: literal string withed
-- N_Project_Declaration,
-- -- Name: not used
-- -- Path_Name: not used
-- -- Expr_Kind: Undefined
-- -- Field1: first declarative item
-- -- Field2: modified project
-- -- Field3: not used
-- -- Value: not used
-- N_Declarative_Item,
-- -- Name: not used
-- -- Path_Name: not used
-- -- Expr_Kind: Undefined
-- -- Field1: current item node
-- -- Field2: next declarative item
-- -- Field3: not used
-- -- Value: not used
-- N_Package_Declaration,
-- -- Name: package name
-- -- Path_Name: not used
-- -- Expr_Kind: Undefined
-- -- Field1: project of renamed package (if any)
-- -- Field2: first declarative item
-- -- Field3: next package in project
-- -- Value: not used
-- N_String_Type_Declaration,
-- -- Name: type name
-- -- Path_Name: not used
-- -- Expr_Kind: Undefined
-- -- Field1: first literal string
-- -- Field2: next string type
-- -- Field3: not used
-- -- Value: not used
-- N_Literal_String,
-- -- Name: not used
-- -- Path_Name: not used
-- -- Expr_Kind: Single
-- -- Field1: next literal string
-- -- Field2: not used
-- -- Field3: not used
-- -- Value: string value
-- N_Attribute_Declaration,
-- -- Name: attribute name
-- -- Path_Name: not used
-- -- Expr_Kind: attribute kind
-- -- Field1: expression
-- -- Field2: not used
-- -- Field3: not used
-- -- Value: associative array index
-- -- (if an associative array element)
-- N_Typed_Variable_Declaration,
-- -- Name: variable name
-- -- Path_Name: not used
-- -- Expr_Kind: Single
-- -- Field1: expression
-- -- Field2: type of variable (N_String_Type_Declaration)
-- -- Field3: next variable
-- -- Value: not used
-- N_Variable_Declaration,
-- -- Name: variable name
-- -- Path_Name: not used
-- -- Expr_Kind: variable kind
-- -- Field1: expression
-- -- Field2: not used
-- -- Field3 is used for next variable, instead of Field2,
-- -- so that it is the same field for
-- -- N_Variable_Declaration and
-- -- N_Typed_Variable_Declaration
-- -- Field3: next variable
-- -- Value: not used
-- N_Expression,
-- -- Name: not used
-- -- Path_Name: not used
-- -- Expr_Kind: expression kind
-- -- Field1: first term
-- -- Field2: next expression in list
-- -- Field3: not used
-- -- Value: not used
-- N_Term,
-- -- Name: not used
-- -- Path_Name: not used
-- -- Expr_Kind: term kind
-- -- Field1: current term
-- -- Field2: next term in the expression
-- -- Field3: not used
-- -- Value: not used
-- N_Literal_String_List,
-- -- Designates a list of string expressions between brackets
-- -- separated by commas. The string expressions are not necessarily
-- -- literal strings.
-- -- Name: not used
-- -- Path_Name: not used
-- -- Expr_Kind: List
-- -- Field1: first expression
-- -- Field2: not used
-- -- Field3: not used
-- -- Value: not used
-- N_Variable_Reference,
-- -- Name: variable name
-- -- Path_Name: not used
-- -- Expr_Kind: variable kind
-- -- Field1: project (if specified)
-- -- Field2: package (if specified)
-- -- Field3: type of variable (N_String_Type_Declaration), if any
-- -- Value: not used
-- N_External_Value,
-- -- Name: not used
-- -- Path_Name: not used
-- -- Expr_Kind: Single
-- -- Field1: Name of the external reference (literal string)
-- -- Field2: Default (literal string)
-- -- Field3: not used
-- -- Value: not used
-- N_Attribute_Reference,
-- -- Name: attribute name
-- -- Path_Name: not used
-- -- Expr_Kind: attribute kind
-- -- Field1: project
-- -- Field2: package (if attribute of a package)
-- -- Field3: not used
-- -- Value: not used
-- N_Case_Construction,
-- -- Name: not used
-- -- Path_Name: not used
-- -- Expr_Kind: Undefined
-- -- Field1: case variable reference
-- -- Field2: first case item
-- -- Field3: not used
-- -- Value: not used
-- N_Case_Item);
-- -- Name: not used
-- -- Path_Name: not used
-- -- Expr_Kind: not used
-- -- Field1: first choice (literal string), or Empty_Node
-- -- for when others
-- -- Field2: first declarative item
-- -- Field3: next case item
-- -- Value: not used
package Project_Nodes is
new Table.Table (Table_Component_Type => Project_Node_Record,
Table_Index_Type => Project_Node_Id,
Table_Low_Bound => First_Node_Id,
Table_Initial => Project_Nodes_Initial,
Table_Increment => Project_Nodes_Increment,
Table_Name => "Project_Nodes");
-- This table contains the syntactic tree of project data
-- from project files.
type Project_Name_And_Node is record
Name : Name_Id;
-- Name of the project
Node : Project_Node_Id;
-- Node of the project in table Project_Nodes
Modified : Boolean;
-- True when the project is being modified by another project
end record;
No_Project_Name_And_Node : constant Project_Name_And_Node :=
(Name => No_Name, Node => Empty_Node, Modified => True);
package Projects_Htable is new GNAT.HTable.Simple_HTable
(Header_Num => Header_Num,
Element => Project_Name_And_Node,
No_Element => No_Project_Name_And_Node,
Key => Name_Id,
Hash => Hash,
Equal => "=");
-- This hash table contains a mapping of project names to project nodes.
-- Note that this hash table contains only the nodes whose Kind is
-- N_Project. It is used to find the node of a project from its
-- name, and to verify if a project has already been parsed, knowing
-- its name.
end Tree_Private_Part;
end Prj.Tree;
|
programs/oeis/166/A166545.asm | karttu/loda | 1 | 24698 | ; A166545: a(n) = 13*n - a(n-1), (with a(1)=13).
; 13,13,26,26,39,39,52,52,65,65,78,78,91,91,104,104,117,117,130,130,143,143,156,156,169,169,182,182,195,195,208,208,221,221,234,234,247,247,260,260,273,273,286,286,299,299,312,312,325,325,338,338,351,351,364,364,377,377,390,390,403,403,416,416,429,429,442,442,455,455,468,468,481,481,494,494,507,507,520,520,533,533,546,546,559,559,572,572,585,585,598,598,611,611,624,624,637,637,650,650,663,663,676,676,689,689,702,702,715,715,728,728,741,741,754,754,767,767,780,780,793,793,806,806,819,819,832,832,845,845,858,858,871,871,884,884,897,897,910,910,923,923,936,936,949,949,962,962,975,975,988,988,1001,1001,1014,1014,1027,1027,1040,1040,1053,1053,1066,1066,1079,1079,1092,1092,1105,1105,1118,1118,1131,1131,1144,1144,1157,1157,1170,1170,1183,1183,1196,1196,1209,1209,1222,1222,1235,1235,1248,1248,1261,1261,1274,1274,1287,1287,1300,1300,1313,1313,1326,1326,1339,1339,1352,1352,1365,1365,1378,1378,1391,1391,1404,1404,1417,1417,1430,1430,1443,1443,1456,1456,1469,1469,1482,1482,1495,1495,1508,1508,1521,1521,1534,1534,1547,1547,1560,1560,1573,1573,1586,1586,1599,1599,1612,1612,1625,1625
mov $1,$0
div $1,2
mul $1,13
add $1,13
|
orka/src/gl/interface/gl-pixels-extensions.ads | onox/orka | 52 | 26283 | <filename>orka/src/gl/interface/gl-pixels-extensions.ads
-- SPDX-License-Identifier: Apache-2.0
--
-- Copyright (c) 2018 onox <<EMAIL>>
--
-- Licensed under the Apache License, Version 2.0 (the "License");
-- you may not use this file except in compliance with the License.
-- You may obtain a copy of the License at
--
-- http://www.apache.org/licenses/LICENSE-2.0
--
-- Unless required by applicable law or agreed to in writing, software
-- distributed under the License is distributed on an "AS IS" BASIS,
-- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-- See the License for the specific language governing permissions and
-- limitations under the License.
with Ada.Unchecked_Conversion;
package GL.Pixels.Extensions is
pragma Preelaborate;
subtype Floating_Point_Format is Format range Red .. RG;
subtype Integer_Format is Format range RG_Integer .. BGRA_Integer
with Static_Predicate => Integer_Format /= Depth_Stencil;
-----------------------------------------------------------------------------
subtype Non_Packed_Data_Type is Data_Type range Byte .. Half_Float;
subtype Packed_Data_Type is Data_Type
range Unsigned_Byte_3_3_2 .. Float_32_Unsigned_Int_24_8_Rev;
subtype Floating_Point_Data_Type is Data_Type
with Static_Predicate => Floating_Point_Data_Type in
Half_Float | Float | Unsigned_Int_10F_11F_11F_Rev | Unsigned_Int_5_9_9_9_Rev;
-----------------------------------------------------------------------------
type Format_Type is (Float_Or_Normalized_Type, Int_Type, Unsigned_Int_Type, Depth_Type);
function Texture_Format_Type (Format : Pixels.Internal_Format) return Format_Type is
(case Format is
-- Shadow samplers
when Depth_Component16 | Depth_Component24 | Depth_Component32F |
Depth24_Stencil8 | Depth32F_Stencil8 =>
Depth_Type,
-- Floating point or (un)signed normalized fixed-point
when R8 | R8_SNorm | R16 | R16_SNorm | R16F | R32F =>
Float_Or_Normalized_Type,
when RG8 | RG8_SNorm | RG16 | RG16_SNorm | RG16F | RG32F =>
Float_Or_Normalized_Type,
when R3_G3_B2 | RGB4 | RGB5 | RGB8 | RGB8_SNorm | RGB10 | RGB12 |
RGB16 | RGB16_SNorm | RGB16F | RGB32F | R11F_G11F_B10F | RGB9_E5 | SRGB8 =>
Float_Or_Normalized_Type,
when RGBA2 | RGBA4 | RGB5_A1 | RGBA8 | RGBA8_SNorm | RGB10_A2 | RGBA12 |
RGBA16 | RGBA16_SNorm | RGBA16F | RGBA32F | SRGB8_Alpha8 =>
Float_Or_Normalized_Type,
-- Integer samplers
when R8I | R16I | R32I =>
Int_Type,
when RG8I | RG16I | RG32I =>
Int_Type,
when RGB8I | RGB16I | RGB32I =>
Int_Type,
when RGBA8I | RGBA16I | RGBA32I =>
Int_Type,
-- Unsigned integer samplers
when R8UI | R16UI | R32UI =>
Unsigned_Int_Type,
when RG8UI | RG16UI | RG32UI =>
Unsigned_Int_Type,
when RGB8UI | RGB16UI | RGB32UI =>
Unsigned_Int_Type,
when RGBA8UI | RGBA16UI | RGBA32UI | RGB10_A2UI =>
Unsigned_Int_Type,
when others =>
raise Constraint_Error with "Invalid format " & Format'Image & " for sampler");
function Image_Format_Type (Format : Pixels.Internal_Format) return Format_Type is
(case Format is
-- Floating point or (un)signed normalized fixed-point
when R8_SNorm | R16_SNorm | RG8_SNorm | RG16_SNorm | RGBA8_SNorm | RGBA16_SNorm =>
Float_Or_Normalized_Type,
when R8 | R16 | RG8 | RG16 =>
Float_Or_Normalized_Type,
when RGBA8 | RGB10_A2 | RGBA16 =>
Float_Or_Normalized_Type,
when R16F | R32F | R11F_G11F_B10F | RG16F | RG32F | RGBA16F | RGBA32F =>
Float_Or_Normalized_Type,
-- Integer samplers
when R8I | R16I | R32I =>
Int_Type,
when RG8I | RG16I | RG32I =>
Int_Type,
when RGBA8I | RGBA16I | RGBA32I =>
Int_Type,
-- Unsigned integer samplers
when R8UI | R16UI | R32UI =>
Unsigned_Int_Type,
when RG8UI | RG16UI | RG32UI =>
Unsigned_Int_Type,
when RGBA8UI | RGBA16UI | RGBA32UI | RGB10_A2UI =>
Unsigned_Int_Type,
when others =>
raise Constraint_Error with "Invalid format " & Format'Image & " for image sampler");
function Texture_Format (Format : Pixels.Internal_Format) return Pixels.Format is
(case Format is
when Depth_Component16 | Depth_Component24 | Depth_Component32F =>
Depth_Component,
when Depth24_Stencil8 | Depth32F_Stencil8 =>
Depth_Stencil,
when Stencil_Index8 =>
Stencil_Index,
when R8 | R8_SNorm | R16 | R16_SNorm | R16F | R32F =>
Red,
when RG8 | RG8_SNorm | RG16 | RG16_SNorm | RG16F | RG32F =>
RG,
when R3_G3_B2 | RGB4 | RGB5 | RGB8 | RGB8_SNorm | RGB10 | RGB12 |
RGB16 | RGB16_SNorm | RGB16F | RGB32F | R11F_G11F_B10F | RGB9_E5 | SRGB8 =>
RGB,
when RGBA2 | RGBA4 | RGB5_A1 | RGBA8 | RGBA8_SNorm | RGB10_A2 | RGBA12 |
RGBA16 | RGBA16_SNorm | RGBA16F | RGBA32F | SRGB8_Alpha8 =>
RGBA,
when R8I | R8UI | R16I | R16UI | R32I | R32UI =>
Red_Integer,
when RG8I | RG8UI | RG16I | RG16UI | RG32I | RG32UI =>
RG_Integer,
when RGB8I | RGB8UI | RGB16I | RGB16UI | RGB32I | RGB32UI =>
RGB_Integer,
when RGBA8I | RGBA8UI | RGBA16I | RGBA16UI | RGBA32I | RGBA32UI | RGB10_A2UI =>
RGBA_Integer);
function Texture_Data_Type (Format : Pixels.Internal_Format) return Pixels.Data_Type is
(case Format is
when Depth_Component16 =>
Unsigned_Short,
when Depth_Component24 =>
Unsigned_Int,
when Depth24_Stencil8 =>
Unsigned_Int_24_8,
when Depth32F_Stencil8 =>
Float_32_Unsigned_Int_24_8_Rev,
when Depth_Component32F =>
Float,
when Stencil_Index8 =>
Unsigned_Byte,
-- Educated guesses, might be wrong
-- Based on Table 8.13 of the OpenGL specification
when R3_G3_B2 =>
Unsigned_Byte_2_3_3_Rev,
when RGB5_A1 =>
Unsigned_Short_1_5_5_5_Rev,
when RGB9_E5 =>
Unsigned_Int_5_9_9_9_Rev,
when R11F_G11F_B10F =>
Unsigned_Int_10F_11F_11F_Rev,
when RGB10_A2UI | RGB10_A2 =>
Unsigned_Int_2_10_10_10_Rev,
when R8I | RG8I | RGB8I | RGBA8I | R8_SNorm | RG8_SNorm | RGB8_SNorm | RGBA8_SNorm =>
Byte,
when R8UI | RG8UI | RGB8UI | RGBA8UI | R8 | RG8 | RGB8 | SRGB8 | RGBA8 | SRGB8_Alpha8 =>
Unsigned_Byte,
when R16I | RG16I | RGB16I | RGBA16I |
R16_SNorm | RG16_SNorm | RGB16_SNorm | RGBA16_SNorm =>
Short,
when R16UI | RG16UI | RGB16UI | RGBA16UI | R16 | RG16 | RGB16 | RGBA16 =>
Unsigned_Short,
when R32I | RG32I | RGB32I | RGBA32I =>
Int,
when R32UI | RG32UI | RGB32UI | RGBA32UI =>
Unsigned_Int,
when R32F | RG32F | RGB32F | RGBA32F =>
Float,
when R16F | RG16F | RGB16F | RGBA16F =>
Half_Float,
-- Based on Table 8.8 and 8.27 of the OpenGL specification
when RGB4 | RGB5 | RGB10 | RGB12 | RGBA2 | RGBA4 | RGBA12 =>
raise Constraint_Error);
-----------------------------------------------------------------------------
function Compatible
(Format : Pixels.Format;
Data_Type : Pixels.Data_Type) return Boolean
is (not (Format in Integer_Format and Data_Type in Floating_Point_Data_Type));
-- Floating point types are incompatible with integer formats according
-- to Table 8.2 of the OpenGL specification
function Components (Format : Pixels.Format) return Component_Count is
(case Format is
when Red | Green | Blue | Red_Integer | Green_Integer | Blue_Integer => 1,
when RG | RG_Integer => 2,
when RGB | BGR | RGB_Integer | BGR_Integer => 3,
when RGBA | BGRA | RGBA_Integer | BGRA_Integer => 4,
when others => raise Constraint_Error with "Unexpected format " & Format'Image);
function Bytes (Data_Type : Non_Packed_Data_Type) return Byte_Count is
(case Data_Type is
when Byte | Unsigned_Byte => 1,
when Short | Unsigned_Short | Half_Float => 2,
when Int | Unsigned_Int | Float => 4);
function Packed_Bytes (Data_Type : Packed_Data_Type) return Byte_Count is
(case Data_Type is
-- Unsigned_Byte formats (Table 8.6)
when Unsigned_Byte_3_3_2 => 1,
when Unsigned_Byte_2_3_3_Rev => 1,
-- Unsigned_Short formats (Table 8.7)
when Unsigned_Short_5_6_5 => 2,
when Unsigned_Short_5_6_5_Rev => 2,
when Unsigned_Short_4_4_4_4 => 2,
when Unsigned_Short_4_4_4_4_Rev => 2,
when Unsigned_Short_5_5_5_1 => 2,
when Unsigned_Short_1_5_5_5_Rev => 2,
-- Unsigned_Int formats (Table 8.8)
when Unsigned_Int_8_8_8_8 => 4,
when Unsigned_Int_8_8_8_8_Rev => 4,
when Unsigned_Int_10_10_10_2 => 4,
when Unsigned_Int_2_10_10_10_Rev => 4,
when Unsigned_Int_24_8 => 4,
when Unsigned_Int_10F_11F_11F_Rev => 4,
when Unsigned_Int_5_9_9_9_Rev => 4,
-- Float_Unsigned_Int formats (Table 8.9)
when Float_32_Unsigned_Int_24_8_Rev => raise Constraint_Error);
function Byte_Alignment (Value : Alignment) return Byte_Count;
-----------------------------------------------------------------------------
subtype Compressed_Byte_Count is Types.Int range 8 .. 16
with Static_Predicate => Compressed_Byte_Count in 8 | 16;
function Block_Bytes (Format : Pixels.Compressed_Format) return Compressed_Byte_Count is
(case Format is
-- RGTC
when Compressed_Red_RGTC1 => 8,
when Compressed_Signed_Red_RGTC1 => 8,
when Compressed_RG_RGTC2 => 16,
when Compressed_Signed_RG_RGTC2 => 16,
-- BPTC
when Compressed_RGBA_BPTC_Unorm => 16,
when Compressed_SRGB_Alpha_BPTC_UNorm => 16,
when Compressed_RGB_BPTC_Signed_Float => 16,
when Compressed_RGB_BPTC_Unsigned_Float => 16,
-- EAC / ETC
when Compressed_R11_EAC => 8,
when Compressed_Signed_R11_EAC => 8,
when Compressed_RG11_EAC => 16,
when Compressed_Signed_RG11_EAC => 16,
when Compressed_RGB8_ETC2 => 8,
when Compressed_SRGB8_ETC2 => 8,
when Compressed_RGB8_Punchthrough_Alpha1_ETC2 => 8,
when Compressed_SRGB8_Punchthrough_Alpha1_ETC2 => 8,
when Compressed_RGBA8_ETC2_EAC => 16,
when Compressed_SRGB8_Alpha8_ETC2_EAC => 16,
-- ASTC
when Compressed_RGBA_ASTC_4x4_KHR => 16,
when Compressed_RGBA_ASTC_5x4_KHR => 16,
when Compressed_RGBA_ASTC_5x5_KHR => 16,
when Compressed_RGBA_ASTC_6x5_KHR => 16,
when Compressed_RGBA_ASTC_6x6_KHR => 16,
when Compressed_RGBA_ASTC_8x5_KHR => 16,
when Compressed_RGBA_ASTC_8x6_KHR => 16,
when Compressed_RGBA_ASTC_8x8_KHR => 16,
when Compressed_RGBA_ASTC_10x5_KHR => 16,
when Compressed_RGBA_ASTC_10x6_KHR => 16,
when Compressed_RGBA_ASTC_10x8_KHR => 16,
when Compressed_RGBA_ASTC_10x10_KHR => 16,
when Compressed_RGBA_ASTC_12x10_KHR => 16,
when Compressed_RGBA_ASTC_12x12_KHR => 16,
when Compressed_SRGB8_ALPHA8_ASTC_4x4_KHR => 16,
when Compressed_SRGB8_ALPHA8_ASTC_5x4_KHR => 16,
when Compressed_SRGB8_ALPHA8_ASTC_5x5_KHR => 16,
when Compressed_SRGB8_ALPHA8_ASTC_6x5_KHR => 16,
when Compressed_SRGB8_ALPHA8_ASTC_6x6_KHR => 16,
when Compressed_SRGB8_ALPHA8_ASTC_8x5_KHR => 16,
when Compressed_SRGB8_ALPHA8_ASTC_8x6_KHR => 16,
when Compressed_SRGB8_ALPHA8_ASTC_8x8_KHR => 16,
when Compressed_SRGB8_ALPHA8_ASTC_10x5_KHR => 16,
when Compressed_SRGB8_ALPHA8_ASTC_10x6_KHR => 16,
when Compressed_SRGB8_ALPHA8_ASTC_10x8_KHR => 16,
when Compressed_SRGB8_ALPHA8_ASTC_10x10_KHR => 16,
when Compressed_SRGB8_ALPHA8_ASTC_12x10_KHR => 16,
when Compressed_SRGB8_ALPHA8_ASTC_12x12_KHR => 16);
-----------------------------------------------------------------------------
function Depth_Stencil_Format (Format : Internal_Format) return Boolean is
(Format in Depth24_Stencil8 | Depth32F_Stencil8);
function Depth_Format (Format : Internal_Format) return Boolean is
(Format in Depth_Component16 | Depth_Component24 | Depth_Component32F);
function Stencil_Format (Format : Internal_Format) return Boolean is
(Format in Stencil_Index8);
private
function Convert is new Ada.Unchecked_Conversion
(Source => Alignment, Target => Types.Int);
function Byte_Alignment (Value : Alignment) return Byte_Count is
(Convert (Value));
end GL.Pixels.Extensions;
|
programs/oeis/135/A135387.asm | jmorken/loda | 1 | 242072 | ; A135387: Triangle read by rows, with (2, 1, 0, 0, 0,...) in every column.
; 2,1,2,0,1,2,0,0,1,2,0,0,0,1,2,0,0,0,0,1,2,0,0,0,0,0,1,2,0,0,0,0,0,0,1,2,0,0,0,0,0,0,0,1,2
add $0,2
lpb $0
trn $0,$1
sub $0,1
add $1,1
lpe
add $0,1
mov $1,$0
|
multimedia/mythtv-core.25/files/Myth_Frontend_Logging.applescript | telotortium/macports-ports | 0 | 3761 | <filename>multimedia/mythtv-core.25/files/Myth_Frontend_Logging.applescript
(* Applescript to select verbosity level of Myth Frontend
For use with MacPorts install of Myth
Author: <NAME>, ctreleaven at cogeco.ca
Myth Version: 0.25.2
Modified: 2012MAug10 - script path in compiled app
*)
set MFEscriptPath to "@APPLICATIONS_DIR@/MythTV/Myth_Frontend.app/Contents/Resources/Scripts/main.scpt"
set MFEscript to load script MFEscriptPath
--display dialog (MFEverboseLevel of MFEscript)
set verbose_list to {"none", "all", "most", "audio", "channel", "database", "decode", "file", "frame", "general", "gpuvideo", "gui", "libav", "network", "osd", "playback", "process", "schedule", "system", "timestamp", "upnp", "vbi"}
set level_list to {"emerg", "alert", "crit", "err", "warning", "notice", "info", "debug"}
--special: all, most
set verbose_selected to choose from list verbose_list with title "Verbose setting" with prompt "Choose one or more areas for focused logging. General is the default" default items "general" with multiple selections allowed
if (count of verbose_selected) > 1 then
if verbose_selected contains "all" then
set verbose_selected to {"all"}
else if verbose_selected contains "most" then
set verbose_selected to {"most"}
end if
end if
if verbose_selected is not false then
set (MFEverboseLevel of MFEscript) to verbose_selected
store script MFEscript in POSIX file MFEscriptPath with replacing
end if
set level_selected to choose from list level_list with title "Logging depth" with prompt "choose how extensively to log. Info is the Myth default; I find warning adequate." default items "warning" without multiple selections allowed
if level_selected is not false then
set (MFElogLevel of MFEscript) to level_selected
store script MFEscript in POSIX file MFEscriptPath with replacing
end if
set theParams to "--verbose " & joinlist(verbose_selected, ",") & " --loglevel " & level_selected
display dialog ("From now on, Myth_Fontend will start the frontend using: " & theParams)
-- -- -- -- -- -- -- --
-- Handlers
to joinlist(aList, delimiter)
set retVal to ""
set prevDelimiter to AppleScript's text item delimiters
set AppleScript's text item delimiters to delimiter
set retVal to aList as string
set AppleScript's text item delimiters to prevDelimiter
return retVal
end joinlist
(*
Log levels
"emerg", "alert", "crit", "err", "warning", "notice", "info", "debug"
defaults to info
Full list of verbose options
{"none", "all", "most", "audio", "channel", "chanscan", "commflag", "database", "decode", "dsmcc", "dvbcam", "eit", "file", "frame", "general", "gpu", "gpuaudio", "gpuvideo", "gui", "idle", "jobqueue", "libav", "media", "mheg", "network", "osd", "playback", "process", "record", "refcount", "rplxqueue", "schedule", "siparser", "socket", "system", "timestamp", "upnp", "vbi", "xmltv"}
*)
|
test/fail/NonDependentConstructorType.agda | asr/agda-kanso | 1 | 12209 | <reponame>asr/agda-kanso
-- 2010-10-01 Issue 342
module NonDependentConstructorType where
data Wrap : Set1 where
wrap : Set -> Wrap
bla : Set
bla = wrap
-- 2010-10-01 error is printed as (_ : Set) -> Wrap !=< Set
-- error should be printed as Set -> Wrap !=< Set |
archie/noise.asm | bushy555/ZX-Spectrum-1-Bit-Routines | 59 | 245900 | <gh_stars>10-100
; The format is 0
; High value is 224
; Low value is 15
db $07,$01,$04,$03,$01,$0D,$03,$01,$07,$01,$05,$03,$09,$0E,$05,$04
db $06,$02,$06,$06,$09,$13,$04,$07,$02,$02,$03,$03,$0D,$01,$04,$08
db $0D,$02,$03,$01,$07,$02,$05,$04,$02,$05,$11,$09,$04,$02,$08,$03
db $01,$06,$02,$01,$04,$06,$06,$04,$03,$01,$08,$01,$07,$03,$04,$02
db $04,$04,$04,$05,$05,$03,$0D,$03,$0B,$02,$03,$02,$03,$03,$07,$04
db $02,$03,$0A,$04,$04,$01,$03,$0A,$02,$09,$02,$03,$02,$0A,$0F,$07
db $04,$0E,$01,$09,$0A,$08,$05,$01,$01,$04,$09,$05,$02,$08,$04,$03
db $01,$01,$02,$02,$07,$09,$0F,$02,$0B,$03,$04,$06,$01,$06,$01,$03
db $01,$03,$04,$01,$06,$07,$03,$05,$03,$03,$02,$01,$04,$05,$05,$02
db $05,$0B,$02,$01,$0B,$01,$01,$12,$07,$01,$04,$0A,$02,$1B,$01,$02
db $01,$04,$03,$05,$03,$01,$02,$01,$04,$06,$02,$06,$01,$04,$05,$04
db $03,$01,$09,$02,$01,$03,$10,$01,$01,$04,$04,$02,$13,$04,$01,$04
db $0A,$01,$03,$01,$02,$08,$03,$01,$01,$01,$02,$05,$01,$01,$01,$01
db $03,$09,$03,$03,$07,$05,$01,$04,$03,$0D,$01,$06,$0F,$03,$03,$07
db $04,$06,$14,$02,$02,$05,$06,$03,$04,$0D,$04,$04,$02,$01,$05,$02
db $02,$09,$02,$05,$0E,$06,$12,$01,$13,$02,$07,$01,$02,$05,$0A,$01
db $0A,$03,$01,$03,$02,$02,$04,$03,$0B,$04,$09,$01,$01,$01,$01,$03
db $06,$04,$03,$01,$0F,$03,$04,$10,$07,$07,$03,$02,$02,$09,$0B,$06
db $08,$01,$0B,$02,$03,$05,$05,$08,$04,$02,$03,$02,$05,$09,$08,$02
db $07,$03,$02,$07,$11,$03,$09,$04,$08,$02,$06,$04,$01,$05,$08,$06
db $01,$03,$0A,$01,$02,$05,$04,$04,$02,$03,$07,$02,$0F,$02,$04,$04
db $05,$01,$03,$02,$0E,$01,$04,$07,$02,$03,$04,$03,$02,$01,$0D,$01
db $03,$02,$06,$03,$01,$04,$03,$07,$02,$06,$01,$03,$01,$01,$01,$01
db $04,$02,$04,$06,$02,$01,$03,$02,$0A,$03,$07,$02,$02,$01,$04,$0A
db $02,$03,$01,$06,$0F,$04,$02,$08,$02,$03,$09,$0A,$0A,$04,$04,$0F
db $02,$01,$03,$02,$04,$0A,$10,$03,$08,$08,$0B,$01,$02,$07,$0B,$02
db $05,$05,$03,$02,$04,$06,$03,$03,$08,$0A,$01,$20,$0D,$05,$02,$07
db $17,$02,$13,$0F,$02,$04,$04,$0A,$06,$05,$01,$04,$01,$01,$06,$09
db $11,$12,$0E,$02,$07,$03,$05,$07,$07,$03,$05,$04,$03,$03,$05,$04
db $01,$04,$05,$01,$05,$01,$02,$03,$02,$09,$05,$08,$02,$04,$03,$01
db $01,$04,$02,$01,$02,$04,$04,$03,$02,$0E,$08,$01,$02,$01,$02,$01
db $06,$01,$04,$01,$01,$03,$07,$0A,$02,$01,$01,$03,$04,$01,$09,$07
db $02,$0D,$02,$06,$02,$04,$0A,$02,$01,$08,$08,$01,$03,$08,$07,$03
db $03,$03,$02,$03,$0A,$04,$1E,$02,$09,$02,$04,$04,$0C,$06,$01,$02
db $03,$01,$02,$01,$0A,$06,$04,$09,$10,$01,$07,$02,$03,$04,$02,$02
db $02,$05,$03,$03,$01,$03,$04,$01,$1A,$02,$05,$04,$01,$01,$0A,$01
db $05,$05,$07,$01,$09,$04,$05,$02,$0A,$02,$04,$01,$03,$02,$01,$04
db $05,$01,$01,$03,$05,$07,$04,$01,$04,$09,$02,$02,$03,$01,$04,$03
db $12,$04,$09,$02,$02,$04,$03,$03,$02,$08,$04,$02,$04,$0A,$03,$01
db $07,$05,$04,$02,$07,$01,$03,$04,$08,$04,$08,$04,$01,$09,$07,$05
db $12,$05,$04,$01,$02,$03,$0C,$03,$05,$02,$02,$01,$03,$03,$0E,$06
db $06,$09,$0C,$08,$04,$09,$01,$02,$02,$07,$09,$03,$03,$02,$04,$02
db $01,$03,$01,$01,$02,$04,$0D,$01,$01,$04,$01,$03,$04,$07,$06,$03
db $03,$02,$03,$01,$0F,$01,$03,$03,$03,$05,$02,$06,$06,$04,$02,$0B
db $04,$02,$01,$05,$03,$02,$03,$04,$01,$04,$04,$01,$14,$04,$15,$01
db $02,$04,$05,$05,$04,$05,$02,$05,$02,$03,$02,$02,$03,$01,$02,$04
db $02,$01,$0A,$01,$07,$01,$08,$04,$14,$01,$04,$05,$03,$03,$02,$05
db $04,$01,$01,$0B,$03,$04,$07,$04,$03,$06,$02,$07,$04,$04,$02,$03
db $09,$01,$06,$01,$01,$02,$03,$0D,$06,$03,$02,$01,$0B,$06,$07,$01
db $01,$02,$07,$01,$05,$05,$04,$03,$04,$03,$09,$01,$0D,$02,$02,$01
db $01,$03,$01,$02,$04,$01,$0A,$01,$07,$03,$01,$02,$02,$01,$01,$13
db $04,$05,$02,$01,$01,$02,$04,$01,$04,$05,$05,$02,$09,$03,$0D,$01
db $03,$0A,$02,$03,$01,$09,$02,$01,$02,$01,$01,$05,$07,$07,$07,$06
db $02,$03,$01,$03,$08,$03,$09,$05,$02,$02,$04,$03,$01,$02,$04,$01
db $10,$02,$04,$05,$02,$01,$11,$04,$02,$03,$02,$01,$02,$04,$07,$03
db $03,$04,$01,$02,$02,$03,$05,$06,$03,$08,$06,$01,$01,$01,$09,$05
db $05,$02,$02,$05,$06,$02,$02,$02,$08,$01,$04,$02,$02,$09,$02,$05
db $0B,$03,$08,$06,$02,$01,$0C,$07,$01,$01,$0E,$06,$01,$08,$08,$01
db $04,$04,$01,$07,$15,$01,$07,$01,$06,$02,$04,$03,$03,$08,$01,$07
db $03,$04,$04,$05,$01,$09,$03,$01,$02,$02,$07,$02,$08,$07,$01,$03
db $02,$01,$08,$01,$03,$0E,$06,$01,$09,$0B,$09,$05,$05,$03,$08,$03
db $01,$01,$07,$04,$04,$01,$08,$01,$03,$01,$06,$04,$09,$04,$02,$01
db $09,$05,$06,$07,$03,$03,$13,$01,$04,$01,$0A,$0B,$06,$02,$01,$0A
db $04,$06,$13,$01,$03,$01,$03,$02,$08,$05,$01,$15,$06,$01,$02,$02
db $04,$0A,$03,$02,$0B,$07,$03,$02,$0B,$03,$01,$03,$0D,$03,$01,$0C
db $01,$05,$02,$04,$01,$04,$0B,$01,$04,$05,$05,$04,$02,$02,$0A,$04
db $08,$04,$0A,$07,$03,$02,$02,$06,$02,$08,$03,$02,$0B,$06,$0A,$05
db $01,$01,$0D,$0E,$02,$01,$08,$06,$08,$02,$01,$02,$03,$01,$05,$05
db $0A,$02,$01,$04,$01,$02,$02,$01,$03,$01,$01,$03,$03,$02,$01,$02
db $07,$02,$01,$02,$01,$02,$02,$01,$02,$03,$08,$01,$02,$03,$05,$01
db $07,$05,$08,$02,$02,$01,$15,$01,$04,$02,$0B,$14,$0A,$01,$09,$04
db $0D,$02,$06,$04,$01,$01,$01,$03,$06,$01,$04,$06,$0A,$05,$01,$03
db $05,$02,$09,$01,$08,$04,$04,$08,$09,$02,$05,$03,$0F,$03,$01,$02
db $01,$09,$03,$11,$03,$02,$02,$04,$03,$06,$03,$07,$0E,$04,$07,$04
db $01,$0E,$03,$01,$05,$0B,$02,$04,$04,$01,$0B,$04,$04,$0F,$01,$01
db $04,$01,$0C,$02,$03,$01,$03,$03,$0C,$06,$09,$01,$05,$03,$03,$03
db $04,$03,$01,$06,$0D,$05,$0B,$06,$01,$01,$08,$01,$0A,$06,$03,$02
db $08,$03,$06,$07,$11,$06,$03,$06,$03,$06,$05,$06,$0A,$08,$02,$07
db $01,$01,$06,$04,$01,$06,$04,$0B,$10,$04,$04,$01,$01,$06,$08,$06
db $07,$02,$02,$08,$03,$05,$06,$07,$03,$01,$01,$04,$07,$06,$02,$02
db $02,$02,$01,$04,$04,$06,$04,$0B,$03,$01,$04,$01,$05,$02,$02,$05
db $02,$12,$01,$03,$02,$06,$10,$03,$15,$01,$16,$03,$02,$06,$01,$01
db $02,$01,$02,$03,$01,$01,$09,$01,$05,$11,$08,$02,$02,$02,$05,$01
db $03,$01,$03,$06,$01,$02,$08,$01,$04,$01,$01,$06,$09,$02,$06,$03
db $03,$07,$13,$02,$02,$01,$0F,$01,$03,$01,$01,$01,$07,$03,$01,$01
db $14,$0C,$02,$03,$01,$03,$01,$03,$05,$01,$06,$02,$08,$04,$06,$0C
db $01,$04,$03,$04,$08,$04,$02,$04,$01,$09,$07,$02,$0A,$05,$04,$02
db $01,$03,$05,$05,$22,$01,$07,$01,$07,$04,$03,$02,$04,$01,$02,$0C
db $03,$04,$03,$06,$09,$02,$08,$07,$01,$01,$07,$02,$01,$02,$0B,$02
db $05,$02,$04,$03,$06,$01,$07,$01,$0C,$05,$07,$05,$07,$08,$0B,$04
db $03,$03,$05,$01,$08,$03,$01,$01,$04,$11,$07,$02,$01,$05,$02,$0A
db $07,$08,$09,$02,$04,$10,$07,$02,$05,$01,$12,$0A,$04,$02,$04,$02
db $06,$01,$02,$04,$01,$05,$01,$06,$02,$02,$04,$02,$01,$02,$0F,$04
db $02,$01,$09,$06,$01,$01,$10,$03,$08,$01,$01,$02,$02,$03,$02,$06
db $03,$03,$05,$0B,$05,$05,$01,$08,$06,$01,$01,$12,$07,$02,$04,$05
db $03,$01,$01,$01,$01,$01,$05,$05,$03,$04,$03,$0F,$03,$02,$01,$01
db $07,$02,$03,$01,$0D,$01,$02,$03,$02,$03,$05,$01,$03,$05,$01,$01
db $06,$01,$04,$02,$01,$03,$08,$05,$0D,$05,$04,$01,$05,$02,$02,$05
db $0E,$02,$0B,$0B,$02,$01,$14,$02,$0C,$02,$02,$02,$04,$05,$06,$01
db $12,$07,$02,$06,$05,$01,$0B,$04,$02,$06,$05,$07,$12,$02,$03,$05
db $19,$0B,$04,$04,$05,$09,$03,$06,$05,$01,$05,$05,$1C,$05,$17,$01
db $04,$02,$07,$03,$03,$03,$05,$01,$0D,$04,$02,$0F,$03,$04,$01,$11
db $03,$01,$04,$02,$08,$07,$08,$05,$08,$02,$01,$09,$04,$05,$0B,$05
db $01,$05,$08,$04,$02,$02,$04,$0F,$02,$02,$08,$0D,$01,$04,$03,$01
db $09,$01,$05,$02,$05,$02,$0B,$01,$08,$01,$0D,$03,$07,$04,$05,$0D
db $04,$03,$05,$02,$02,$04,$05,$04,$01,$06,$02,$0A,$01,$02,$01,$02
db $01,$0F,$0B,$01,$0A,$04,$14,$02,$0C,$02,$01,$02,$02,$03,$01,$01
db $04,$04,$01,$03,$02,$10,$01,$05,$06,$06,$02,$07,$01,$03,$02,$0B
db $01,$03,$03,$06,$03,$06,$07,$06,$04,$09,$01,$01,$0A,$01,$0A,$01
db $04,$02,$05,$01,$03,$01,$03,$04,$04,$02,$0C,$01,$09,$03,$01,$07
db $01,$02,$09,$03,$09,$09,$0E,$02,$02,$01,$0D,$04,$16,$02,$03,$02
db $01,$02,$13,$02,$06,$06,$02,$01,$01,$01,$18,$0F,$08,$04,$0A,$08
db $04,$02,$03,$01,$02,$01,$07,$06,$01,$03,$01,$01,$09,$01,$06,$01
db $01,$05,$01,$02,$01,$02,$01,$05,$06,$01,$03,$03,$03,$03,$05,$02
db $06,$04,$02,$02,$01,$01,$02,$06,$05,$05,$02,$0B,$01,$02,$04,$02
db $01,$04,$0C,$02,$08,$03,$04,$04,$05,$01,$0A,$08,$01,$02,$06,$01
db $02,$03,$01,$02,$08,$01,$07,$12,$07,$07,$07,$01,$04,$02,$05,$06
db $07,$01,$0B,$07,$05,$02,$08,$08,$05,$01,$02,$05,$09,$07,$0F,$01
db $0E,$04,$03,$06,$01,$04,$13,$01,$02,$03,$07,$05,$06,$06,$05,$0A
db $01,$01,$02,$03,$04,$0B,$03,$03,$01,$05,$04,$01,$04,$03,$08,$07
db $01,$03,$02,$03,$0E,$03,$02,$03,$0A,$01,$08,$01,$01,$02,$06,$01
db $11,$06,$01,$02,$0E,$09,$01,$03,$02,$01,$06,$03,$01,$09,$07,$01
db $05,$01,$08,$01,$01,$01,$03,$02,$01,$06,$01,$06,$08,$06,$05,$02
db $01,$02,$04,$02,$08,$01,$03,$03,$0D,$03,$02,$08,$01,$05,$01,$03
db $05,$01,$05,$06,$02,$01,$03,$06,$06,$04,$02,$01,$01,$06,$09,$0B
db $06,$02,$05,$06,$05,$0A,$01,$04,$06,$01,$01,$05,$04,$05,$0C,$0B
db $03,$06,$05,$01,$07,$01,$04,$08,$08,$04,$0F,$01,$08,$02,$08,$10
db $0B,$04,$02,$02,$04,$0E,$02,$02,$01,$01,$0E,$05,$02,$04,$07,$05
db $09,$01,$07,$01,$0A,$03,$01,$07,$03,$01,$0D,$06,$0D,$04,$03,$07
db $0A,$02,$01,$01,$03,$05,$01,$05,$07,$07,$01,$02,$03,$08,$07,$04
db $07,$06,$01,$04,$04,$03,$06,$01,$05,$01,$05,$07,$05,$01,$03,$04
db $05,$09,$15,$07,$04,$01,$0A,$02,$08,$02,$02,$01,$04,$05,$03,$04
db $0A,$01,$01,$02,$01,$05,$03,$04,$02,$02,$02,$02,$02,$01,$09,$01
db $05,$01,$04,$0E,$08,$06,$09,$02,$07,$04,$0C,$04,$06,$03,$07,$08
db $11,$01,$01,$04,$01,$07,$01,$02,$0A,$08,$02,$06,$03,$06,$09,$01
db $01,$07,$0A,$0F,$01,$04,$06,$03,$04,$01,$0D,$02,$02,$07,$01,$02
db $05,$02,$0C,$01,$05,$06,$01,$02,$07,$03,$07,$02,$01,$02,$0C,$02
db $02,$09,$05,$03,$04,$01,$07,$0E,$0C,$02,$06,$0D,$03,$05,$01,$04
db $05,$07,$01,$0B,$01,$02,$03,$04,$01,$05,$04,$07,$0B,$01,$02,$01
db $02,$05,$02,$03,$08,$0B,$08,$0E,$04,$02,$05,$08,$03,$01,$01,$04
db $02,$0E,$03,$03,$0D,$01,$05,$04,$02,$04,$02,$02,$01,$05,$06,$01
db $06,$02,$04,$01,$08,$05,$0F,$03,$10,$04,$01,$04,$0F,$03,$08,$01
db $0E,$0C,$0A,$0A,$08,$04,$0B,$01,$02,$05,$01,$09,$08,$02,$06,$01
db $0C,$02,$05,$04,$02,$02,$02,$01,$02,$08,$03,$0A,$01,$02,$02,$03
db $0B,$05,$01,$01,$01,$01,$01,$02,$01,$08,$05,$03,$03,$13,$08,$01
db $08,$04,$05,$05,$08,$08,$02,$03,$01,$0C,$0B,$06,$06,$03,$03,$02
db $08,$01,$02,$10,$06,$02,$03,$03,$05,$06,$03,$02,$02,$06,$0C,$06
db $0B,$01,$01,$05,$01,$02,$07,$06,$07,$12,$08,$03,$10,$04,$02,$01
db $0E,$08,$02,$03,$01,$02,$0E,$01,$03,$03,$02,$0C,$03,$04,$03,$03
db $03,$05,$04,$19,$0C,$01,$05,$04,$07,$02,$0E,$02,$03,$02,$02,$01
db $01,$01,$02,$01,$05,$06,$01,$02,$08,$06,$04,$06,$10,$01,$01,$04
db $03,$01,$09,$06,$02,$05,$02,$08,$03,$03,$03,$01,$02,$05,$0B,$02
db $04,$02,$01,$04,$03,$01,$07,$03,$03,$07,$05,$01,$06,$01,$01,$06
db $02,$01,$06,$04,$06,$08,$03,$05,$08,$03,$08,$01,$05,$01,$02,$03
db $01,$23,$01,$01,$01,$04,$06,$01,$15,$02,$02,$03,$01,$02,$01,$07
db $06,$02,$05,$03,$02,$04,$02,$02,$03,$01,$02,$01,$01,$07,$03,$03
db $04,$0C,$01,$0F,$01,$0B,$05,$14,$03,$02,$01,$01,$05,$01,$01,$05
db $14,$01,$0B,$01,$05,$03,$02,$06,$05,$02,$02,$01,$01,$09,$01,$04
db $04,$02,$07,$03,$02,$05,$06,$03,$07,$01,$01,$05,$01,$02,$02,$03
db $02,$05,$01,$05,$03,$03,$03,$0A,$04,$07,$09,$03,$05,$01,$07,$02
db $04,$06,$02,$04,$06,$01,$05,$02,$07,$05,$03,$0A,$14,$06,$09,$02
db $07,$04,$03,$04,$02,$08,$07,$01,$04,$02,$05,$03,$02,$01,$01,$06
db $01,$04,$02,$01,$02,$01,$04,$01,$02,$07,$07,$01,$07,$1A,$0D,$09
db $08,$06,$01,$02,$04,$01,$08,$01,$02,$07,$0B,$04,$0D,$01,$13,$04
db $02,$02,$07,$02,$04,$09,$05,$01,$07,$01,$02,$03,$03,$04,$06,$04
db $0A,$02,$06,$01,$02,$01,$07,$08,$0A,$05,$01,$09,$04,$02,$02,$02
db $05,$03,$09,$01,$04,$01,$02,$03,$06,$01,$06,$02,$02,$02,$08,$05
db $02,$06,$03,$02,$02,$0A,$03,$03,$01,$09,$06,$0A,$03,$05,$01,$01
db $02,$02,$01,$04,$01,$03,$15,$04,$0A,$02,$07,$07,$06,$06,$02,$01
db $01,$01,$02,$01,$03,$02,$05,$03,$18,$03,$06,$01,$05,$04,$05,$04
db $04,$02,$0A,$01,$02,$03,$0E,$06,$07,$01,$04,$01,$06,$01,$13,$09
db $02,$03,$07,$04,$03,$02,$01,$10,$0D,$09,$03,$05,$08,$03,$03,$04
db $0B,$06,$0B,$04,$07,$08,$02,$06,$02,$12,$02,$02,$01,$01,$01,$08
db $09,$06,$01,$01,$04,$02,$04,$08,$01,$01,$05,$03,$01,$02,$01,$08
db $07,$05,$01,$02,$01,$03,$09,$03,$01,$04,$03,$09,$0F,$01,$09,$07
db $12,$03,$03,$01,$01,$09,$05,$12,$02,$01,$0C,$02,$01,$06,$03,$05
db $08,$02,$09,$05,$01,$04,$08,$05,$0A,$02,$03,$03,$02,$02,$03,$04
db $05,$05,$01,$02,$03,$01,$06,$03,$03,$01,$02,$07,$05,$01,$01,$03
db $01,$03,$02,$09,$01,$0A,$03,$04,$0A,$02,$09,$02,$04,$01,$02,$01
db $06,$05,$02,$04,$04,$05,$01,$09,$04,$06,$05,$04,$01,$02,$07,$01
db $03,$02,$10,$01,$03,$03,$01,$02,$03,$01,$03,$04,$0C,$0C,$02,$06
db $04,$05,$01,$07,$03,$01,$02,$05,$05,$0B,$03,$03,$03,$01,$01,$07
db $03,$02,$02,$08,$09,$04,$01,$02,$06,$01,$03,$01,$01,$03,$07,$03
db $0B,$02,$02,$01,$02,$08,$01,$02,$09,$01,$02,$03,$06,$01,$03,$03
db $02,$05,$02,$08,$0A,$05,$0A,$09,$0E,$01,$03,$07,$04,$08,$04,$06
db $10,$01,$01,$06,$02,$08,$06,$03,$01,$02,$01,$02,$03,$01,$03,$09
db $0E,$03,$02,$01,$02,$06,$01,$02,$04,$02,$07,$01,$0B,$06,$03,$07
db $01,$01,$04,$09,$08,$01,$01,$02,$01,$03,$05,$01,$01,$05,$02,$02
db $04,$08,$04,$07,$07,$06,$04,$02,$05,$01,$05,$03,$01,$01,$03,$05
db $10,$01,$03,$04,$02,$02,$04,$06,$04,$02,$01,$01,$07,$07,$01,$02
db $05,$04,$09,$0C,$0A,$01,$04,$02,$05,$06,$06,$05,$04,$05,$01,$01
db $01,$06,$03,$01,$08,$02,$06,$01,$04,$01,$04,$04,$0E,$07,$08,$06
db $02,$02,$03,$01,$03,$05,$08,$03,$06,$02,$01,$02,$0C,$04,$01,$01
db $01,$01,$07,$05,$01,$02,$03,$04,$01,$02,$02,$06,$02,$02,$02,$01
db $0E,$06,$0C,$09,$01,$01,$02,$05,$05,$02,$06,$01,$0B,$02,$07,$08
db $06,$06,$0B,$01,$03,$02,$01,$0A,$06,$0E,$07,$01,$0C,$09,$07,$09
db $07,$03,$0A,$05,$07,$08,$01,$0C,$02,$09,$0B,$0D,$03,$02,$02,$04
db $03,$01,$03,$01,$01,$06,$03,$03,$18,$02,$03,$05,$06,$04,$04,$04
db $03,$01,$03,$0D,$04,$06,$01,$06,$02,$04,$08,$01,$04,$04,$01,$06
db $06,$02,$04,$01,$01,$02,$02,$01,$01,$0F,$05,$0A,$03,$08,$01,$06
db $01,$02,$01,$01,$01,$06,$01,$01,$04,$02,$02,$02,$01,$0A,$03,$01
db $06,$05,$02,$01,$03,$01,$09,$07,$01,$02,$06,$01,$02,$01,$03,$08
db $03,$0A,$01,$03,$02,$02,$01,$07,$02,$01,$01,$05,$03,$01,$02,$04
db $01,$08,$04,$02,$05,$02,$02,$01,$07,$01,$02,$03,$0B,$07,$05,$03
db $0E,$05,$03,$05,$02,$05,$01,$01,$02,$04,$06,$01,$06,$03,$03,$03
db $04,$01,$02,$01,$06,$04,$14,$0F,$14,$05,$04,$05,$06,$01,$01,$04
db $01,$03,$03,$02,$01,$0C,$02,$01,$08,$02,$03,$04,$07,$01,$04,$01
db $04,$08,$02,$02,$07,$04,$01,$02,$01,$09,$0A,$04,$04,$01,$03,$01
db $04,$04,$09,$01,$01,$03,$08,$02,$03,$07,$01,$04,$03,$03,$06,$08
db $12,$0
|
resources/assets/js/Parser/Bison/BisonLexer.g4 | kanungo2000/grammar_review_tool | 6 | 5252 | lexer grammar BisonLexer;
WS: Ws+ -> channel(HIDDEN);
BLOCK_COMMENT: BlockComment -> channel(HIDDEN);
LINE_COMMENT: LineComment -> channel(HIDDEN);
PIPE: Pipe;
SEMICOLON: Semicolon;
DIRECTIVE: Percent Id;
ID: Id -> pushMode(AFTER_ID);
INT: Int|HexInt;
CHAR: SQuoteString;
STRING: DQuoteString;
PROLOGUE_START: OpenPrologue -> pushMode(PROLOGUE);
PERCENT_PERCENT: '%%' {
if (this.percentPercentCount === undefined) {
this.percentPercentCount = 0;
}
if (++this.percentPercentCount == 2) {
this.pushMode(BisonLexer.EPILOGUE);
}
};
BRACED_CODE_START: '{' -> pushMode(BRACED_CODE);
PREDICATE_START: OpenPredicate -> pushMode(PREDICATE);
TAG_START: ('<'|'<') -> pushMode(TAG);
REF: LBracket Id RBracket;
ERROR_CHARACTER: .;
mode AFTER_ID;
AFTER_ID_WS: Ws+ -> channel(HIDDEN);
AFTER_ID_BLOCK_COMMENT: BlockComment -> channel(HIDDEN);
AFTER_ID_LINE_COMMENT: LineComment -> channel(HIDDEN);
AFTER_ID_OPEN_BRACKET: LBracket Id RBracket;
AFTER_ID_COLON: Colon;
// This is implementation of missing "less" command.
// See https://github.com/antlr/antlr4/issues/212#issuecomment-269515905.
AFTER_ID_ANY: ~[/:[] {
this._input.seek(this._tokenStartCharIndex);
this._type = antlr4.Lexer.MORE;
} -> popMode;
mode PROLOGUE;
PROLOGUE_OPEN: OpenPrologue -> type(PROLOGUE_CONTENT), pushMode(PROLOGUE);
PROLOGUE_SQUOTED_STRING: SQuoteString -> type(PROLOGUE_CONTENT);
PROLOGUE_DQUOTED_STRING: DQuoteString -> type(PROLOGUE_CONTENT);
PROLOGUE_SLASH: '/' . -> type(PROLOGUE_CONTENT);
PROLOGUE_BLOCK_COMMENT: BlockComment -> type(PROLOGUE_CONTENT);
PROLOGUE_LINE_COMMENT: LineComment -> type(PROLOGUE_CONTENT);
PROLOGUE_PERCENT: Percent -> type(PROLOGUE_CONTENT);
PROLOGUE_CLOSE: ClosePrologue {
this.popMode();
if (this._modeStack.length) {
this.type = BisonLexer.PROLOGUE_CONTENT;
}
};
PROLOGUE_CONTENT: ~['"{}/%]+;
mode EPILOGUE;
EPILOGUE_CONTENT: .+;
mode BRACED_CODE;
BRACED_CODE_OPEN: LBrace -> type(BRACED_CODE_CONTENT), pushMode(BRACED_CODE);
BRACED_CODE_SQUOTED_STRING: SQuoteString -> type(BRACED_CODE_CONTENT);
BRACED_CODE_DQUOTED_STRING: DQuoteString -> type(BRACED_CODE_CONTENT);
BRACED_CODE_SLASH: '/' . -> type(BRACED_CODE_CONTENT);
BRACED_CODE_BLOCK_COMMENT: BlockComment -> type(BRACED_CODE_CONTENT);
BRACED_CODE_LINE_COMMENT: LineComment -> type(BRACED_CODE_CONTENT);
BRACED_CODE_CLOSE: RBrace {
this.popMode();
if (this._modeStack.length) {
this.type = BisonLexer.BRACED_CODE_CONTENT;
}
};
BRACED_CODE_CONTENT: ~['"{}/]+;
mode PREDICATE;
PREDICATE_OPEN: OpenPredicate -> type(PREDICATE_CONTENT), pushMode(PREDICATE);
PREDICATE_SQUOTED_STRING: SQuoteString -> type(PREDICATE_CONTENT);
PREDICATE_DQUOTED_STRING: DQuoteString -> type(PREDICATE_CONTENT);
PREDICATE_SLASH: '/' . -> type(PREDICATE_CONTENT);
PREDICATE_BLOCK_COMMENT: BlockComment -> type(PREDICATE_CONTENT);
PREDICATE_LINE_COMMENT: LineComment -> type(PREDICATE_CONTENT);
PREDICATE_QUESTION: '?' -> type(PREDICATE_CONTENT);
PREDICATE_PERCENT: Percent -> type(PREDICATE_CONTENT);
PREDICATE_CLOSE: ClosePredicate {
this.popMode();
if (this._modeStack.length) {
this.type = BisonLexer.PREDICATE_CONTENT;
}
};
PREDICATE_CONTENT: ~['"{}/%?]+;
mode TAG;
TAG_OPEN: ('<'|'<') -> type(TAG_CONTENT), pushMode(TAG);
TAG_CLOSE: ('>'|'>') {
this.popMode();
if (this._modeStack.length) {
this.type = BisonLexer.TAG_CONTENT;
}
};
TAG_APOSTROPH: '&' -> type(TAG_CONTENT);
TAG_CONTENT: ~[<>&]+;
fragment Digit: [0-9];
fragment Int: Digit+;
fragment HexInt: [0][xX][0-9abcdefABCDEF]+;
fragment Upper: [A-Z];
fragment Lower: [a-z];
fragment Alpha: Upper|Lower|'_';
fragment Letter: Alpha|'.';
fragment LBrace: '{';
fragment RBrace: '}';
fragment LBracket: '[';
fragment RBracket: ']';
fragment DSlash: '//';
fragment Pipe: '|';
fragment Semicolon: ';';
fragment Ws: Hws|Vws;
fragment Hws: [ \t];
fragment Vws: [\r\n\f\u000B]; // \u000B is \v
fragment BlockComment: '/*' .*? '*/';
fragment LineComment: DSlash ~[\r\n]*;
fragment SQuote: '\'';
fragment SQuoteString: SQuote ('\\\\'|'\\\''|~['\r\n])* SQuote;
fragment DQuote: '"';
fragment DQuoteString: DQuote ('\\\\'|'\\"'|~["\r\n])* DQuote;
fragment OpenPredicate: '%?' Ws* '{';
fragment ClosePredicate: '}';
fragment OpenPrologue: '%{';
fragment ClosePrologue: '%}';
fragment Colon: ':';
fragment Id: Letter (Letter|[-0-9])*;
fragment Percent: '%';
|
src/prototyping/term/tests/Pruning.agda | larrytheliquid/agda | 0 | 9673 | module Pruning where
le2 : {B : Set} -> (A : Set) -> A -> (C : Set) -> C -> (A -> C -> B) -> B
le2 _ x _ y f = f x y
test : le2 Set _ (Set -> Set) _ (\ H -> (\M -> (z : Set) -> H == M z))
test z = refl
{-
let : {B : Set} -> (A : Set) -> A -> (A -> B) -> B
let A x f = f x
test : let Set _ (\ H -> let (Set -> Set) _ (\ M -> (z : Set) -> H == M z))
test z = refl
-}
|
oeis/005/A005586.asm | neoneye/loda-programs | 11 | 20721 | <reponame>neoneye/loda-programs<gh_stars>10-100
; A005586: a(n) = n(n+4)(n+5)/6.
; 0,5,14,28,48,75,110,154,208,273,350,440,544,663,798,950,1120,1309,1518,1748,2000,2275,2574,2898,3248,3625,4030,4464,4928,5423,5950,6510,7104,7733,8398,9100,9840,10619,11438,12298,13200,14145,15134,16168,17248,18375,19550,20774,22048,23373,24750,26180,27664,29203,30798,32450,34160,35929,37758,39648,41600,43615,45694,47838,50048,52325,54670,57084,59568,62123,64750,67450,70224,73073,75998,79000,82080,85239,88478,91798,95200,98685,102254,105908,109648,113475,117390,121394,125488,129673,133950
add $0,4
mov $1,$0
bin $0,3
sub $0,$1
|
test/Succeed/Imports/A.agda | cruhland/agda | 1,989 | 16929 | <reponame>cruhland/agda
module Imports.A where
postulate A : Set
|
src/main/antlr4/fr/insee/vtl/Vtl.g4 | FranckCo/VTL-Service | 0 | 50 | <reponame>FranckCo/VTL-Service
grammar Vtl;
import VtlTokens;
start: (statement? (ML_COMMENT)* (SL_COMMENT)* EOL)* statement? EOF
| ML_COMMENT
| SL_COMMENT
;
/* Assignment */
statement: ((varID ASSIGN)? expr) | persistentAssignment;
persistentAssignment
:
varID PUT_SYMBOL expr
;
/* Conditional */
optionalExpr
: expr | OPTIONAL
;
expr:
exprAtom ('[' (datasetClause|(expr ASSIGN expr)) ']')*(MEMBERSHIP componentID)?
|('+'|'-'|NOT) expr
|expr ('*'|'/') expr
|expr ('+'|'-') expr
|expr ('>'|'<'|'<='|'>='|'='|'<>') expr
|expr (IN|NOT_IN)(lists|IDENTIFIER)
|expr EXISTS_IN expr ALL?
|EXISTS_IN '(' expr ',' expr (',' retainType)? ')'
|expr ('='|'<>') expr
|expr AND expr
|expr (OR|XOR) expr
|IF expr THEN expr ELSE expr
|exprComplex
|exprAtom
|expr CONCAT expr
|constant
|IDENTIFIER
;
exprComplex:
validationExpr #exprValidationExpr
|defExpr #definitionExpressions
|aggrInvocation #standaloneAggregateFunction
|aggrInvocationCompExpr #componentExpressionwithAggrClause
|anFunctionClause #standaloneAnalyticFunction
|aggrFunction #simpleaggregateFunctions
|timeExpr #timeexpressions
|setExpr #setExpressions
|callFunction #callFunctionExpression
|joinExpr #joinExpression
;
timeExpr
:timeSeriesExpr
|periodExpr (opComp=('>'|'<'|'<='|'>='|'='|'<>') expr)?
|timeShiftExpr
|timeAggExpr
|CURRENT_DATE
;
/* Rulesets Definition */
defHierarchical
:
defineHierarchicalRuleset rulesetID '(' hierRuleSignature ')' IS ruleClauseHierarchical endHierarchicalRuleset
;
ruleClauseHierarchical
:
ruleItemHierarchical (';' ruleItemHierarchical)*
;
ruleItemHierarchical
:
(IDENTIFIER ':')? codeItemRelation (erCode)? (erLevel)?
;
hierRuleSignature
:
(VALUE_DOMAIN|VARIABLE) valueDomainSignature? RULE IDENTIFIER
;
valueDomainSignature
:
CONDITION IDENTIFIER (AS IDENTIFIER)? (',' IDENTIFIER (AS IDENTIFIER)?)*
;
codeItemRelation
:
( WHEN expr THEN )? codeItemRef codeItemRelationClause (codeItemRelationClause)*
;
codeItemRelationClause
:
(opAdd=('+'|'-'))? IDENTIFIER ('[' expr ']')?
;
codeItemRef
:
IDENTIFIER (opComp=('='|'>'|'<'|'>='|'<='))?
;
defDatapoint
:
defineDatapointRuleset rulesetID '(' rulesetSignature ')' IS ruleClauseDatapoint endDatapointRuleset
;
ruleClauseDatapoint
:
ruleItemDatapoint (';' ruleItemDatapoint)*
;
ruleItemDatapoint
:
(IDENTIFIER ':')? ( WHEN expr THEN )? expr (erCode)? (erLevel)?
;
rulesetSignature
:
(VALUE_DOMAIN|VARIABLE) varSignature (',' varSignature)*
;
varSignature
:
varID (AS IDENTIFIER)?
;
/* Artefacts Definition */
defExpr
:
defOperator
|defDatapoint
|defHierarchical
;
defOperator
:
DEFINE OPERATOR operatorID '(' (parameterItem (',' parameterItem)*)? ')' (RETURNS dataType)? IS expr END OPERATOR
;
parameterItem
:
varID dataType (DEFAULT constant)?
;
callFunction
:
operatorID '(' ((constant|'_') (',' (constant|'_'))*)? ')'
;
/* Functions */
exprAtom
:
ROUND '(' expr (',' optionalExpr)? ')' # roundAtom
| CEIL '(' expr ')' # ceilAtom
| FLOOR '(' expr ')' # floorAtom
| ABS '(' expr ')' # minAtom
| EXP '(' expr ')' # expAtom
| LN '(' expr ')' # lnAtom
| LOG '(' expr ',' expr ')' # logAtom
| TRUNC '(' expr (',' optionalExpr)? ')' # lnAtom
| POWER '(' expr ',' expr ')' # powerAtom
| SQRT '(' expr ')' # sqrtAtom
| LEN '(' expr ')' # lenAtom
| BETWEEN '(' expr ',' expr ',' expr ')' # betweenAtom
| TRIM '(' expr ')' # trimAtom
| LTRIM '(' expr ')' # ltrimAtom
| RTRIM '(' expr ')' # rtrimAtom
| UCASE '(' expr ')' # ucaseAtom
| LCASE '(' expr ')' # lcaseAtom
| SUBSTR '(' expr (',' optionalExpr)? (',' optionalExpr)? ')' # substrAtom
| INSTR '(' expr ',' expr ( ',' optionalExpr)? (',' optionalExpr)? ')' # instrAtom
| REPLACE '(' expr ',' expr ( ',' optionalExpr)? ')' # replaceAtom
| CHARSET_MATCH '(' expr ',' expr ')' # charsetMatchAtom
| ISNULL '(' expr ')' # isNullAtom
| NVL '(' expr ',' expr ')' # nvlAtom
| MOD '(' expr ',' expr ')' # modAtom
| ref # refAtom
| evalExpr # evalExprAtom
| castExpr # castExprAtom
| hierarchyExpr # hierarchyExprAtom
| FLOW_TO_STOCK '(' expr ')' # flowToStockAtom
| STOCK_TO_FLOW '(' expr ')' # stockToFlowAtom
| validationDatapoint #validateDPruleset
| validationHierarchical #validateHRruleset
| validationExpr #validationSimple
;
/* Parentheses */
ref: '(' expr ')' # parenthesisExprRef
| varID # varIdRef
| constant # constantRef
;
/* identifier list*/
identifierList
:
'[' IDENTIFIER (',' IDENTIFIER)* ']'
;
lists
:
'{' constant (',' constant)* '}'
;
/* eval */
evalExpr
:
EVAL '(' routineName '(' (componentID|constant)? (',' (componentID|constant))* ')' (LANGUAGE STRING_CONSTANT)? (RETURNS outputParameterType)? ')'
;
/* cast */
castExpr
:
CAST '(' expr ',' (basicScalarType|valueDomainName) (',' STRING_CONSTANT)? ')'
;
/* Time operators */
periodExpr
:
PERIOD_INDICATOR '(' expr? ')'
;
/* timeshift */
timeShiftExpr
:
TIMESHIFT '(' expr ',' INTEGER_CONSTANT ')'
;
/* fill time series */
timeSeriesExpr
:
FILL_TIME_SERIES '(' expr (',' (SINGLE|ALL))? ')'
;
/* time period agg */
timeAggExpr
:
TIME_AGG '(' STRING_CONSTANT (',' (STRING_CONSTANT|'_'))? (',' (expr|'_'))? (',' (FIRST|LAST))? ')'
;
/* check */
validationExpr
: CHECK '(' expr (erCode)? (erLevel)? (IMBALANCE expr)? (INVALID|ALL)? ')'
;
validationDatapoint
:
CHECK_DATAPOINT '(' expr ',' IDENTIFIER (COMPONENTS componentID (',' componentID)*)? (INVALID|ALL_MEASURES|ALL)? ')'
;
validationHierarchical
:
CHECK_HIERARCHY '(' expr',' IDENTIFIER (CONDITION componentID (',' componentID)*)? (RULE IDENTIFIER)? (NON_NULL|NON_ZERO|PARTIAL_NULL|PARTIAL_ZERO|ALWAYS_NULL|ALWAYS_ZERO)? (DATASET|DATASET_PRIORITY)? (INVALID|ALL|ALL_MEASURES)? ')'
;
erCode
:
ERRORCODE constant
;
erLevel
:
ERRORLEVEL constant
;
/* hierarchy */
hierarchyExpr
:
HIERARCHY '(' expr ',' IDENTIFIER (CONDITION componentID (',' componentID)*)? (RULE IDENTIFIER)? ((NON_NULL|NON_ZERO|PARTIAL_NULL|PARTIAL_ZERO|ALWAYS_NULL|ALWAYS_ZERO)|'_')? ((RULE|DATASET|RULE_PRIORITY)|'_')? ((COMPUTED|ALL)|'_')? ')'
;
/* Clauses. */
datasetClause
:
RENAME renameClause
| aggrClause
| filterClause
| calcClause
| keepClause
| dropClause
| pivotExpr
| unpivotExpr
| subspaceExpr
;
anFunctionClause
:
(aggrFunctionName|anFunction)? '(' expr? (',' expr)* OVER '(' (partitionByClause)? (orderByClause)? (windowingClause)? ')' ')'
;
partitionByClause
:
PARTITION BY IDENTIFIER (',' IDENTIFIER)*
;
orderByClause
:
ORDER BY componentID (ASC|DESC)? (',' componentID (ASC|DESC)?)*
;
windowingClause
:
((DATA POINTS)|RANGE) BETWEEN limitClauseItem AND limitClauseItem
;
limitClauseItem
:
(INTEGER_CONSTANT PRECEDING)
| (INTEGER_CONSTANT FOLLOWING)
| (CURRENT DATA POINT)
| (UNBOUNDED PRECEDING)
| (UNBOUNDED FOLLOWING)
;
/* Join Expressions*/
joinExpr
:
joinKeyword '(' joinClause (joinBody)? ')'
;
joinClause
:
expr (AS IDENTIFIER)? (',' expr (AS IDENTIFIER)?)* (USING componentID (',' componentID)*)?
;
joinBody
:
joinFilterClause? (joinCalcClause|joinApplyClause|joinAggClause)? (joinKeepClause|joinDropClause)? joinRenameClause?
;
joinCalcClause
:
componentRole? joinCalcClauseItem (',' joinCalcClauseItem)*
;
joinCalcClauseItem
:
CALC (componentRole)? joinCalcExpr (',' (componentRole)? joinCalcExpr)*
;
joinCalcExpr
:
componentID ':=' expr
;
joinAggClause
:
componentRole? AGGREGATE joinAggClauseItem (',' joinAggClauseItem)* groupingClause? havingClause?
;
joinAggClauseItem
:
(componentRole)? joinAggExpr (',' joinAggExpr)*
;
joinAggExpr
:
componentID ':=' aggrFunction
;
joinKeepClause
:
KEEP keepClauseItem (',' keepClauseItem)*
;
joinDropClause
:
DROP dropClauseItem (',' dropClauseItem)*
;
joinFilterClause
:
FILTER expr|rulesetID
;
joinRenameClause
:
RENAME (componentID MEMBERSHIP)? varID TO (componentID MEMBERSHIP)? varID (',' (componentID MEMBERSHIP)? varID TO (componentID MEMBERSHIP)? varID)*?
;
joinApplyClause
:
APPLY expr
;
/* Analytic Functions
anFunction
:
FIRST_VALUE '(' expr ')'
| LAG '(' expr ',' INTEGER_CONSTANT ',' INTEGER_CONSTANT ')'
| LAST_VALUE '(' expr ')'
| RANK '(' expr ')'
| RATIO_TO_REPORT '(' expr ')'
|LEAD '(' expr ')'
; */
anFunction
:
FIRST_VALUE
| LAG
| LAST_VALUE
| RANK
| RATIO_TO_REPORT
|LEAD
;
aggregateClause
:
aggrFunctionClause (',' aggrFunctionClause)*
;
aggrFunctionClause
:
(componentRole)? componentID ':=' aggrFunction
;
getFiltersClause
:
getFilterClause (',' getFilterClause)*
;
getFilterClause
:
(FILTER? expr)
;
aggrClause
:
AGGREGATE aggregateClause groupingClause? havingClause?
;
filterClause
:
FILTER expr
;
renameClause
:
varID TO varID (',' varID TO varID)*
;
aggrFunction
:
SUM '(' expr ')'
| AVG '(' expr ')'
| COUNT '(' expr? ')'
| MEDIAN '(' expr ')'
| MIN '(' expr ')'
| MAX '(' expr ')'
| RANK '(' expr ')'
| STDDEV_POP '(' expr ')'
| STDDEV_SAMP '(' expr ')'
| VAR_POP '(' expr ')'
| VAR_SAMP '(' expr ')'
;
calcClause
:
CALC calcClauseItem (',' calcClauseItem)*
;
calcClauseItem
:
(componentRole)? componentID ':=' calcExpr
;
calcExpr
:
aggrFunction '(' expr ')'
| expr
;
dropClause
:
DROP dropClauseItem (',' dropClauseItem)*
;
dropClauseItem
:
componentID
| (datasetID MEMBERSHIP componentID)
;
keepClause
:
KEEP keepClauseItem (',' keepClauseItem)*
;
keepClauseItem
:
componentID
| (datasetID MEMBERSHIP componentID)
;
/* pivot/unpivot/subspace expressions */
unpivotExpr
:
UNPIVOT varID ',' varID
;
pivotExpr
:
PIVOT varID ',' varID
;
subspaceExpr
: SUBSPACE varID '=' constant (',' varID '=' constant)*
;
inBetweenClause
:
IN (setExpr|IDENTIFIER)
| NOT_IN (setExpr|IDENTIFIER)
;
/* Set expressions */
setExpr
:
UNION '(' expr (',' expr)* ')'
| SYMDIFF '(' expr ',' expr ')'
| SETDIFF '(' expr ',' expr ')'
| INTERSECT '(' expr (',' expr)* ')'
;
/* subscript expression*/
subscriptExpr
:
persistentDatasetID '[' componentID '=' constant ( ',' componentID '=' constant)? ']'
;
/*Aggregation operators invocation*/
aggrInvocation
:
aggrFunctionName '(' IDENTIFIER (MEMBERSHIP componentID)? (',' IDENTIFIER(MEMBERSHIP componentID)?)* (groupingClause)? (havingClause)? ')'
;
aggrInvocationCompExpr
:
aggrFunctionName '(' IDENTIFIER (MEMBERSHIP componentID)? (',' IDENTIFIER(MEMBERSHIP componentID)?)* ')' (groupingClause)? (havingClause)?
;
aggrFunctionName
:
SUM
| AVG
| COUNT
| MEDIAN
| MIN
| MAX
| STDDEV_POP
| STDDEV_SAMP
| VAR_POP
| VAR_SAMP
;
groupingClause
:
groupKeyword ((IDENTIFIER (',' IDENTIFIER)*)|(expr))
;
havingClause
:
HAVING '('? aggrFunction? expr ')'?
;
/* aggregate sequences */
returnAll
:
RETURN ALL DATA POINTS
;
/* Role name*/
componentRole
:
MEASURE
|COMPONENT
|DIMENSION
|ATTRIBUTE
|viralAttribute
;
viralAttribute
:
VIRAL ATTRIBUTE
;
/* Arithmetic */
logBase
:
expr
;
exponent
:
INTEGER_CONSTANT|FLOAT_CONSTANT
;
/* Variable, identifiers, constants */
persistentDatasetID
:
STRING_CONSTANT
;
datasetID
:
IDENTIFIER
;
rulesetID
:
IDENTIFIER
;
varID
:
IDENTIFIER
;
componentID
:
IDENTIFIER
;
operatorID
:
IDENTIFIER
;
routineName
:
IDENTIFIER
;
joinKeyword
:
INNER_JOIN
|LEFT_JOIN
|FULL_JOIN
|CROSS_JOIN
;
groupKeyword
:
(GROUP BY)
|(GROUP EXCEPT)
|(GROUP ALL)
;
constant
:
INTEGER_CONSTANT
| FLOAT_CONSTANT
| BOOLEAN_CONSTANT
| STRING_CONSTANT
| NULL_CONSTANT
;
componentType2
:
STRING
| INTEGER
| FLOAT
| BOOLEAN
| DATE
;
scalarType
:
(basicScalarType|valueDomainName|setName)scalarTypeConstraint?((NOT)? NULL_CONSTANT)?
;
basicScalarType
:
STRING
| INTEGER
| NUMBER
| BOOLEAN
| DATE
| TIME_PERIOD
| DURATION
| SCALAR
| TIME
;
valueDomainName
:
IDENTIFIER
;
setName
:
IDENTIFIER
;
scalarTypeConstraint
:
('[' expr ']')
|('{' constant (',' constant)* '}')
;
dataType
:
scalarType
|componentType
|datasetType
|scalarSetType
|operatorType
|rulesetType
;
componentType
:
componentRole ('<' scalarType '>')?
;
datasetType
:
DATASET ('{'compConstraint (',' compConstraint)* '}' )?
;
compConstraint
:
componentType (componentID|multModifier)
;
multModifier
:
'_' ('+'|'*')?
;
rulesetType
:
RULESET
|dpRuleset
|hrRuleset
;
dpRuleset
:
DATAPOINT
|(DATAPOINT_ON_VD '{' prodValueDomains '}')
|(DATAPOINT_ON_VAR '{' prodVariables '}')
;
hrRuleset
:
HIERARCHICAL
|(HIERARCHICAL_ON_VD ('{' IDENTIFIER ('('prodValueDomains')')? '}')? )
|(HIERARCHICAL_ON_VAR ('{' varID ('('prodVariables')')? '}')? )
;
prodValueDomains
:
IDENTIFIER ('*' IDENTIFIER)*
;
prodVariables
:
varID ('*' varID)*
;
operatorType
:
inputParameterType ('*' inputParameterType)* '->' outputParameterType
;
inputParameterType
:
scalarType
|datasetType
|componentType
;
outputParameterType
:
scalarType
|datasetType
|scalarSetType
|rulesetType
|componentType
;
scalarSetType
:
SET ('<' scalarType '>')?
;
retainType
:
BOOLEAN_CONSTANT
| ALL
;
defineDatapointRuleset
:
DEFINE DATAPOINT RULESET
;
defineHierarchicalRuleset
:
DEFINE HIERARCHICAL RULESET
;
endDatapointRuleset
:
END DATAPOINT RULESET
;
endHierarchicalRuleset
:
END HIERARCHICAL RULESET
;
defineDataStructure
:
DEFINE DATA STRUCTURE
;
|
src/implementation/cl-queueing.adb | flyx/OpenCLAda | 8 | 7084 | --------------------------------------------------------------------------------
-- Copyright (c) 2013, <NAME> <<EMAIL>>
--
-- Permission to use, copy, modify, and/or distribute this software for any
-- purpose with or without fee is hereby granted, provided that the above
-- copyright notice and this permission notice appear in all copies.
--
-- THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
-- WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
-- MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
-- ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
-- WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
-- ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
-- OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
--------------------------------------------------------------------------------
with CL.API;
with CL.Enumerations;
package body CL.Queueing is
function Execute_Kernel (Target_Queue : Command_Queues.Queue'Class;
Kernel : Kernels.Kernel'Class;
Dimension : Kernel_Dimension;
Global_Work_Size : access constant Size_List;
Local_Work_Size : access constant Size_List;
Wait_For : access Events.Event_List)
return Events.Event is
Local_Work_Size_Ptr : access constant Size;
Ret_Event : aliased System.Address;
Error : Enumerations.Error_Code;
begin
if Global_Work_Size = null or else
Global_Work_Size.all'First /= 1 or else
Global_Work_Size.all'Last /= Integer (Dimension) then
raise Invalid_Global_Work_Size;
end if;
if Local_Work_Size /= null then
if Local_Work_Size.all'First /= 1 or
Local_Work_Size.all'Last /= Integer (Dimension) then
raise Invalid_Local_Work_Size;
end if;
Local_Work_Size_Ptr := Local_Work_Size.all (Local_Work_Size.all'First)'Access;
else
Local_Work_Size_Ptr := null;
end if;
if Wait_For /= null and then Wait_For.all'Length > 0 then
declare
Raw_List : Address_List := Raw_Event_List (Wait_For.all);
begin
Error := API.Enqueue_NDRange_Kernel
(CL_Object (Target_Queue).Location,
CL_Object (Kernel).Location,
Dimension, null,
Global_Work_Size.all (1)'Access,
Local_Work_Size_Ptr,
Raw_List'Length,
Raw_List (1)'Unchecked_Access,
Ret_Event'Unchecked_Access);
end;
else
Error := API.Enqueue_NDRange_Kernel
(CL_Object (Target_Queue).Location,
CL_Object (Kernel).Location,
Dimension, null,
Global_Work_Size.all (1)'Access,
Local_Work_Size_Ptr,
0,
null,
Ret_Event'Unchecked_Access);
end if;
Helpers.Error_Handler (Error);
return Events.Event'(Ada.Finalization.Controlled with
Location => Ret_Event);
end Execute_Kernel;
function Execute_Task (Target_Queue : Command_Queues.Queue'Class;
Kernel : Kernels.Kernel'Class;
Wait_For : access Events.Event_List)
return Events.Event is
Error : Enumerations.Error_Code;
Ret_Event : aliased System.Address;
begin
if Wait_For /= null and then Wait_For.all'Length > 0 then
declare
Raw_List : Address_List := Raw_Event_List (Wait_For.all);
begin
Error := API.Enqueue_Task (CL_Object (Target_Queue).Location,
CL_Object (Kernel).Location,
Raw_List'Length,
Raw_List (1)'Unchecked_Access,
Ret_Event'Unchecked_Access);
end;
else
Error := API.Enqueue_Task (CL_Object (Target_Queue).Location,
CL_Object (Kernel).Location,
0, null,
Ret_Event'Unchecked_Access);
end if;
Helpers.Error_Handler (Error);
return Events.Event'(Ada.Finalization.Controlled with
Location => Ret_Event);
end Execute_Task;
function Marker (Target_Queue : Command_Queues.Queue'Class)
return Events.Event is
Ret_Event : aliased System.Address;
Error : Enumerations.Error_Code;
begin
Error := API.Enqueue_Marker (CL_Object (Target_Queue).Location,
Ret_Event'Unchecked_Access);
Helpers.Error_Handler (Error);
return Events.Event'(Ada.Finalization.Controlled with
Location => Ret_Event);
end Marker;
procedure Wait_For_Events (Target_Queue : Command_Queues.Queue'Class;
Event_List : Events.Event_List) is
Raw_List : Address_List := Raw_Event_List (Event_List);
Error : Enumerations.Error_Code;
begin
Error := API.Enqueue_Wait_For_Events (CL_Object (Target_Queue).Location,
Raw_List'Length,
Raw_List (1)'Unchecked_Access);
Helpers.Error_Handler (Error);
end Wait_For_Events;
procedure Barrier (Target_Queue : Command_Queues.Queue'Class) is
Error : Enumerations.Error_Code;
begin
Error := API.Enqueue_Barrier (CL_Object (Target_Queue).Location);
Helpers.Error_Handler (Error);
end Barrier;
end CL.Queueing;
|
test/pmullq.asm | killvxk/AssemblyLine | 147 | 82299 | <reponame>killvxk/AssemblyLine
SECTION .text
GLOBAL test
test:
pmullq xmm0, xmm0
pmullq xmm0, xmm1
pmullq xmm0, xmm2
pmullq xmm0, xmm3
pmullq xmm0, xmm4
pmullq xmm0, xmm5
pmullq xmm0, xmm6
pmullq xmm0, xmm7
pmullq xmm0, xmm8
pmullq xmm0, xmm9
pmullq xmm0, xmm10
pmullq xmm0, xmm11
pmullq xmm0, xmm12
pmullq xmm0, xmm13
pmullq xmm0, xmm14
pmullq xmm0, xmm15
pmullq xmm1, xmm0
pmullq xmm1, xmm1
pmullq xmm1, xmm2
pmullq xmm1, xmm3
pmullq xmm1, xmm4
pmullq xmm1, xmm5
pmullq xmm1, xmm6
pmullq xmm1, xmm7
pmullq xmm1, xmm8
pmullq xmm1, xmm9
pmullq xmm1, xmm10
pmullq xmm1, xmm11
pmullq xmm1, xmm12
pmullq xmm1, xmm13
pmullq xmm1, xmm14
pmullq xmm1, xmm15
pmullq xmm2, xmm0
pmullq xmm2, xmm1
pmullq xmm2, xmm2
pmullq xmm2, xmm3
pmullq xmm2, xmm4
pmullq xmm2, xmm5
pmullq xmm2, xmm6
pmullq xmm2, xmm7
pmullq xmm2, xmm8
pmullq xmm2, xmm9
pmullq xmm2, xmm10
pmullq xmm2, xmm11
pmullq xmm2, xmm12
pmullq xmm2, xmm13
pmullq xmm2, xmm14
pmullq xmm2, xmm15
pmullq xmm3, xmm0
pmullq xmm3, xmm1
pmullq xmm3, xmm2
pmullq xmm3, xmm3
pmullq xmm3, xmm4
pmullq xmm3, xmm5
pmullq xmm3, xmm6
pmullq xmm3, xmm7
pmullq xmm3, xmm8
pmullq xmm3, xmm9
pmullq xmm3, xmm10
pmullq xmm3, xmm11
pmullq xmm3, xmm12
pmullq xmm3, xmm13
pmullq xmm3, xmm14
pmullq xmm3, xmm15
pmullq xmm4, xmm0
pmullq xmm4, xmm1
pmullq xmm4, xmm2
pmullq xmm4, xmm3
pmullq xmm4, xmm4
pmullq xmm4, xmm5
pmullq xmm4, xmm6
pmullq xmm4, xmm7
pmullq xmm4, xmm8
pmullq xmm4, xmm9
pmullq xmm4, xmm10
pmullq xmm4, xmm11
pmullq xmm4, xmm12
pmullq xmm4, xmm13
pmullq xmm4, xmm14
pmullq xmm4, xmm15
pmullq xmm5, xmm0
pmullq xmm5, xmm1
pmullq xmm5, xmm2
pmullq xmm5, xmm3
pmullq xmm5, xmm4
pmullq xmm5, xmm5
pmullq xmm5, xmm6
pmullq xmm5, xmm7
pmullq xmm5, xmm8
pmullq xmm5, xmm9
pmullq xmm5, xmm10
pmullq xmm5, xmm11
pmullq xmm5, xmm12
pmullq xmm5, xmm13
pmullq xmm5, xmm14
pmullq xmm5, xmm15
pmullq xmm6, xmm0
pmullq xmm6, xmm1
pmullq xmm6, xmm2
pmullq xmm6, xmm3
pmullq xmm6, xmm4
pmullq xmm6, xmm5
pmullq xmm6, xmm6
pmullq xmm6, xmm7
pmullq xmm6, xmm8
pmullq xmm6, xmm9
pmullq xmm6, xmm10
pmullq xmm6, xmm11
pmullq xmm6, xmm12
pmullq xmm6, xmm13
pmullq xmm6, xmm14
pmullq xmm6, xmm15
pmullq xmm7, xmm0
pmullq xmm7, xmm1
pmullq xmm7, xmm2
pmullq xmm7, xmm3
pmullq xmm7, xmm4
pmullq xmm7, xmm5
pmullq xmm7, xmm6
pmullq xmm7, xmm7
pmullq xmm7, xmm8
pmullq xmm7, xmm9
pmullq xmm7, xmm10
pmullq xmm7, xmm11
pmullq xmm7, xmm12
pmullq xmm7, xmm13
pmullq xmm7, xmm14
pmullq xmm7, xmm15
pmullq xmm8, xmm0
pmullq xmm8, xmm1
pmullq xmm8, xmm2
pmullq xmm8, xmm3
pmullq xmm8, xmm4
pmullq xmm8, xmm5
pmullq xmm8, xmm6
pmullq xmm8, xmm7
pmullq xmm8, xmm8
pmullq xmm8, xmm9
pmullq xmm8, xmm10
pmullq xmm8, xmm11
pmullq xmm8, xmm12
pmullq xmm8, xmm13
pmullq xmm8, xmm14
pmullq xmm8, xmm15
pmullq xmm9, xmm0
pmullq xmm9, xmm1
pmullq xmm9, xmm2
pmullq xmm9, xmm3
pmullq xmm9, xmm4
pmullq xmm9, xmm5
pmullq xmm9, xmm6
pmullq xmm9, xmm7
pmullq xmm9, xmm8
pmullq xmm9, xmm9
pmullq xmm9, xmm10
pmullq xmm9, xmm11
pmullq xmm9, xmm12
pmullq xmm9, xmm13
pmullq xmm9, xmm14
pmullq xmm9, xmm15
pmullq xmm10, xmm0
pmullq xmm10, xmm1
pmullq xmm10, xmm2
pmullq xmm10, xmm3
pmullq xmm10, xmm4
pmullq xmm10, xmm5
pmullq xmm10, xmm6
pmullq xmm10, xmm7
pmullq xmm10, xmm8
pmullq xmm10, xmm9
pmullq xmm10, xmm10
pmullq xmm10, xmm11
pmullq xmm10, xmm12
pmullq xmm10, xmm13
pmullq xmm10, xmm14
pmullq xmm10, xmm15
pmullq xmm11, xmm0
pmullq xmm11, xmm1
pmullq xmm11, xmm2
pmullq xmm11, xmm3
pmullq xmm11, xmm4
pmullq xmm11, xmm5
pmullq xmm11, xmm6
pmullq xmm11, xmm7
pmullq xmm11, xmm8
pmullq xmm11, xmm9
pmullq xmm11, xmm10
pmullq xmm11, xmm11
pmullq xmm11, xmm12
pmullq xmm11, xmm13
pmullq xmm11, xmm14
pmullq xmm11, xmm15
pmullq xmm12, xmm0
pmullq xmm12, xmm1
pmullq xmm12, xmm2
pmullq xmm12, xmm3
pmullq xmm12, xmm4
pmullq xmm12, xmm5
pmullq xmm12, xmm6
pmullq xmm12, xmm7
pmullq xmm12, xmm8
pmullq xmm12, xmm9
pmullq xmm12, xmm10
pmullq xmm12, xmm11
pmullq xmm12, xmm12
pmullq xmm12, xmm13
pmullq xmm12, xmm14
pmullq xmm12, xmm15
pmullq xmm13, xmm0
pmullq xmm13, xmm1
pmullq xmm13, xmm2
pmullq xmm13, xmm3
pmullq xmm13, xmm4
pmullq xmm13, xmm5
pmullq xmm13, xmm6
pmullq xmm13, xmm7
pmullq xmm13, xmm8
pmullq xmm13, xmm9
pmullq xmm13, xmm10
pmullq xmm13, xmm11
pmullq xmm13, xmm12
pmullq xmm13, xmm13
pmullq xmm13, xmm14
pmullq xmm13, xmm15
pmullq xmm14, xmm0
pmullq xmm14, xmm1
pmullq xmm14, xmm2
pmullq xmm14, xmm3
pmullq xmm14, xmm4
pmullq xmm14, xmm5
pmullq xmm14, xmm6
pmullq xmm14, xmm7
pmullq xmm14, xmm8
pmullq xmm14, xmm9
pmullq xmm14, xmm10
pmullq xmm14, xmm11
pmullq xmm14, xmm12
pmullq xmm14, xmm13
pmullq xmm14, xmm14
pmullq xmm14, xmm15
pmullq xmm0, xmm0
pmullq xmm0, xmm1
pmullq xmm0, xmm2
pmullq xmm0, xmm3
pmullq xmm0, xmm4
pmullq xmm0, xmm5
pmullq xmm0, xmm6
pmullq xmm0, xmm7
pmullq xmm0, xmm8
pmullq xmm0, xmm9
pmullq xmm0, xmm10
pmullq xmm0, xmm11
pmullq xmm0, xmm12
pmullq xmm0, xmm13
pmullq xmm0, xmm14
pmullq xmm0, xmm15 |
lib/m5_crt0.asm | dex4er/deb-z88dk | 1 | 26602 | <filename>lib/m5_crt0.asm
; CRT0 for the SORD M5
;
; <NAME>. 2000
;
; If an error occurs eg break we just drop back to BASIC
;
; $Id: m5_crt0.asm,v 1.6 2007/06/27 20:49:27 dom Exp $
;
MODULE m5_crt0
;
; Initially include the zcc_opt.def file to find out lots of lovely
; information about what we should do..
;
INCLUDE "zcc_opt.def"
; No matter what set up we have, main is always, always external to
; this file
XREF _main
;
; Some variables which are needed for both app and basic startup
;
XDEF cleanup
XDEF l_dcal
; Integer rnd seed
XDEF _std_seed
; vprintf is internal to this file so we only ever include one of the set
; of routines
XDEF _vfprintf
;Exit variables
XDEF exitsp
XDEF exitcount
XDEF heaplast ;Near malloc heap variables
XDEF heapblocks
;For stdin, stdout, stder
XDEF __sgoioblk
; Graphics stuff
XDEF base_graphics
XDEF coords
; Now, getting to the real stuff now!
org $7400
.start
ld hl,0
add hl,sp
ld (start1+1),hl
ld hl,-64
add hl,sp
ld sp,hl
ld (exitsp),sp
exx
push hl
IF !DEFINED_nostreams
IF DEFINED_ANSIstdio
; Set up the std* stuff so we can be called again
ld hl,__sgoioblk+2
ld (hl),19 ;stdin
ld hl,__sgoioblk+6
ld (hl),21 ;stdout
ld hl,__sgoioblk+10
ld (hl),21 ;stderr
ENDIF
ENDIF
call _main
.cleanup
;
; Deallocate memory which has been allocated here!
;
push hl
IF !DEFINED_nostreams
IF DEFINED_ANSIstdio
LIB closeall
call closeall
ENDIF
ENDIF
pop bc
exx
pop hl
exx
.start1
ld sp,0
ret
.l_dcal
jp (hl)
; Now, define some values for stdin, stdout, stderr
.__sgoioblk
IF DEFINED_ANSIstdio
INCLUDE "#stdio_fp.asm"
ELSE
defw -11,-12,-10
ENDIF
; Now, which of the vfprintf routines do we need?
._vfprintf
IF DEFINED_floatstdio
LIB vfprintf_fp
jp vfprintf_fp
ELSE
IF DEFINED_complexstdio
LIB vfprintf_comp
jp vfprintf_comp
ELSE
IF DEFINED_ministdio
LIB vfprintf_mini
jp vfprintf_mini
ENDIF
ENDIF
ENDIF
;Seed for integer rand() routines
._std_seed defw 0
;Atexit routine
.exitsp
defw 0
.exitcount
defb 0
; Heap stuff
.heaplast defw 0
.heapblocks defw 0
; mem stuff
.base_graphics
defw 0
.coords defw 0
defm "Small C+ SORD M5"
defb 0
;All the float stuff is kept in a different file...for ease of altering!
;It will eventually be integrated into the library
;
;Here we have a minor (minor!) problem, we've no idea if we need the
;float package if this is separated from main (we had this problem before
;but it wasn't critical..so, now we will have to read in a file from
;the directory (this will be produced by zcc) which tells us if we need
;the floatpackage, and if so what it is..kludgey, but it might just work!
;
;Brainwave time! The zcc_opt file could actually be written by the
;compiler as it goes through the modules, appending as necessary - this
;way we only include the package if we *really* need it!
IF NEED_floatpack
INCLUDE "#float.asm"
;seed for random number generator - not used yet..
.fp_seed defb $80,$80,0,0,0,0
;Floating point registers...
.extra defs 6
.fa defs 6
.fasign defb 0
ENDIF
|
kernel/usb/hub.asm | ssebs/xos | 15 | 14753 | <filename>kernel/usb/hub.asm
;; xOS32
;; Copyright (C) 2016-2017 by <NAME>.
use32
; USB Hub-Specific Stuff
USB_HUB_CLASS = 0x09
USB_HUB_DESCRIPTOR = 0x29
; USB Hub Feature Selectors
USB_HUB_FEATURE_PORT_ENABLE = 1
USB_HUB_FEATURE_PORT_RESET = 4
USB_HUB_FEATURE_PORT_POWER = 8
USB_HUB_FEATURE_LOCAL_POWER = 0
; USB Hub Port Status
USB_HUB_PORT_CONNECT = 0x0001
USB_HUB_PORT_ENABLED = 0x0002
USB_HUB_PORT_RESET = 0x0010
; usb_hub_init:
; Initializes a non-root USB hub
; In\ EAX = Controller number
; In\ BL = Hub address
; Out\ Nothing
usb_hub_init:
mov [.controller], eax
mov [.address], bl
mov esi, .msg
call kprint
mov eax, [.controller]
call int_to_string
call kprint
mov esi, .msg2
call kprint
movzx eax, [.address]
call int_to_string
call kprint
mov esi, newline
call kprint
; request the hub descriptor
mov edi, usb_hub_descriptor
mov ecx, 7
mov al, 0
rep stosb
mov [usb_setup_packet.request_type], 0xA0
mov [usb_setup_packet.request], USB_GET_DESCRIPTOR
mov [usb_setup_packet.value], USB_HUB_DESCRIPTOR shl 8
mov [usb_setup_packet.index], 0
mov [usb_setup_packet.length], 7
mov eax, [.controller]
mov bl, [.address]
mov bh, 0 ; USB hubs can only have one endpoint
mov esi, usb_setup_packet
mov edi, usb_hub_descriptor
mov ecx, 7 or 0x80000000 ; request 7 bytes only
call usb_setup
; check for errors...
cmp eax, 0
jne .error
cmp [usb_hub_descriptor.type], USB_HUB_DESCRIPTOR
jne .error
mov al, [usb_hub_descriptor.ports] ; downstream port count
mov [.ports], al
; enable local power for the hub
mov [usb_setup_packet.request_type], 0x20
mov [usb_setup_packet.request], USB_SET_FEATURE
mov [usb_setup_packet.value], USB_HUB_FEATURE_LOCAL_POWER
mov [usb_setup_packet.index], 0
mov [usb_setup_packet.length], 0
mov eax, [.controller]
mov bl, [.address]
mov bh, 0
mov esi, usb_setup_packet
mov edi, 0
mov ecx, 0
call usb_setup
cmp eax, 0
jne .error
; reset all downstream ports on the hub
mov [.current_port], 1 ; one-based and not zero!
.ports_loop:
mov al, [.current_port]
cmp al, [.ports]
jg .done
; reset the port
mov [usb_setup_packet.request_type], 0x23
mov [usb_setup_packet.request], USB_SET_FEATURE
mov [usb_setup_packet.value], USB_HUB_FEATURE_PORT_RESET
movzx ax, [.current_port]
mov [usb_setup_packet.index], ax
mov [usb_setup_packet.length], 0
mov eax, [.controller]
mov bl, [.address]
mov bh, 0
mov esi, usb_setup_packet
mov edi, 0
mov ecx, 0
call usb_setup
cmp eax, 0
jne .error
.wait_reset:
; poll the port, wait for the reset to complete
mov [.port_status], 0
mov [usb_setup_packet.request_type], 0xA3
mov [usb_setup_packet.request], USB_GET_STATUS
mov [usb_setup_packet.value], 0
movzx ax, [.current_port]
mov [usb_setup_packet.index], ax
mov [usb_setup_packet.length], 2
mov eax, [.controller]
mov bl, [.address]
mov bh, 0
mov esi, usb_setup_packet
mov edi, .port_status
mov ecx, 2 or 0x80000000 ; device to host
call usb_setup
cmp eax, 0
jne .error
test [.port_status], USB_HUB_PORT_RESET
jnz .wait_reset
; if the port has a device attached, ensure it is enabled
mov [.port_status], 0
mov [usb_setup_packet.request_type], 0xA3
mov [usb_setup_packet.request], USB_GET_STATUS
mov [usb_setup_packet.value], 0
movzx ax, [.current_port]
mov [usb_setup_packet.index], ax
mov [usb_setup_packet.length], 2
mov eax, [.controller]
mov bl, [.address]
mov bh, 0
mov esi, usb_setup_packet
mov edi, .port_status
mov ecx, 2 or 0x80000000
call usb_setup
cmp eax, 0
jne .error
; connected?
test [.port_status], USB_HUB_PORT_CONNECT
jz .next_port
; yes -- enabled?
test [.port_status], USB_HUB_PORT_ENABLED
jz .error
.next_port:
inc [.current_port]
jmp .ports_loop
.done:
ret
.error:
mov esi, .error_msg
call kprint
ret
align 4
.controller dd 0
.ports db 0
.current_port db 0
.address db 0
align 2
.port_status dw 0
.msg db "usb-hub: initialize USB hub on controller ",0
.msg2 db ", address ",0
.error_msg db "usb-hub: failed to initialize USB hub.",10,0
; Hub Descriptor..
align 4
usb_hub_descriptor:
.length db 0
.type db 0
.ports db 0
.characteristics dw 0
.power_good_time db 0
.max_current db 0
|
test/Succeed/Issue778b.agda | redfish64/autonomic-agda | 0 | 16862 | <filename>test/Succeed/Issue778b.agda
-- {-# OPTIONS -v tc.term.exlam:100 -v extendedlambda:100 -v int2abs.reifyterm:100 -v tc.with:100 -v tc.mod.apply:100 #-}
module Issue778b (Param : Set) where
open import Issue778M Param
data D : (Nat → Nat) → Set where
d : D pred → D pred
-- Ulf, 2013-11-11: With the fix to issue 59 that inlines with functions,
-- this no longer termination checks. The problem is having a termination
-- path going through a with-expression (the variable x in this case).
{-# TERMINATING #-}
test : (f : Nat → Nat) → D f → Nat
test .pred (d x) = bla
where bla : Nat
bla with (d x) -- Andreas, 2014-11-06 "with x" has been outlawed.
... | (d (d y)) = test pred y
|
ada/src/sarge.adb | irieger/Sarge | 0 | 1863 | -- sarge.adb - Implementation file for the Sarge command line argument parser project.
-- Revision 0
-- Features:
-- -
-- Notes:
-- -
-- 2019/04/10, <NAME>
with Ada.Command_Line;
with Ada.Text_IO;
use Ada.Text_IO;
package body Sarge is
--- SET ARGUMENT ---
procedure setArgument(arg_short: in Unbounded_String; arg_long: in Unbounded_String; desc: in Unbounded_String; hasVal: in boolean) is
arg: aliased Argument := (arg_short => arg_short, arg_long => arg_long, description => desc, hasValue => hasVal, value => +"", parsed => False);
aa: Argument_Access;
begin
args.append(arg);
-- Set up links.
if length(arg_short) > 0 then
aa := args.Last_Element'Access;
argNames.include(arg_short, aa);
end if;
if length(arg_long) > 0 then
argNames.include(arg_long, arg'Access);
end if;
end setArgument;
--- SET DESCRIPTION ---
procedure setDescription(desc: in Unbounded_String) is
begin
description := desc;
end setDescription;
--- SET USAGE ---
procedure setUsage(usage: in Unbounded_String) is
begin
usageStr := usage;
end setUsage;
--- PARSE ARGUMENTS ---
function parseArguments return boolean is
flag_it: argNames_map.Cursor;
expectValue: boolean := False;
begin
--
execName := Ada.Command_Line.command_name;
for arg in 1..Ada.Command_Line.argument_count loop
-- Each flag will start with a '-' character. Multiple flags can be joined together in
-- the same string if they're the short form flag type (one character per flag).
if expectValue = True then
-- Copy value.
argNames(flag_it).value := arg;
expectValue := False;
elsif arg(arg'First) = '-' then
-- Parse flag.
-- First check for the long form.
if arg(arg'First + 1) = '-' then
-- Long form of the flag.
if not argNames.contains(arg(arg'First + 2..arg'Last)) then
-- Flag wasn't found. Abort.
put_line("Long flag " & arg'Image & " wasn't found");
return False;
end if;
-- Mark as found.
flag_it := argNames.find(arg);
argNames_map.Element(flag_it).parsed := True;
flagCounter := flagCounter + 1;
if argNames_map.Element(flag_it).hasValue = True then
expectValue := True;
end if;
else
-- Parse short form flag. Parse all of them sequentially. Only the last one
-- is allowed to have an additional value following it.
for i in arg'range loop
flag_it := argNames.find(arg(arg'First + (1 + i)..arg'First + (2 + i)));
if flag_it = argNames_map.No_Element then
-- Flag wasn't found. Abort.
put_line("Short flag " & arg(arg'First + (1 + i)..arg'First + (2 + i)) &
" wasn't found.");
return False;
end if;
-- Mark as found.
argNames_map.Element(flag_it).parsed := True;
flagCounter := flagCounter + 1;
if argNames_map.Element(flag_it).hasValue = True then
if i /= (arg'Length - 1) then
-- Flag isn't at end, thus cannot have value.
put_line("Flag " & arg(arg'First + (1 + i)..arg'First + (2 + i))
& " needs to be followed by a value string.");
return False;
else
expectValue := True;
end if;
end if;
end loop;
end if;
else
put_line("Expected flag, not value.");
return False;
end if;
end loop;
parsed := True;
return True;
end parseArguments;
--- GET FLAG ---
function getFlag(arg_flag: in Unbounded_String; arg_value: out Unbounded_String) return boolean is
flag_it: argNames_map.Cursor;
begin
if parsed /= True then
return False;
end if;
flag_it := argNames.find(arg_flag);
if flag_it = No_Elements then
return False;
elsif Element(flag_it).parsed /= True then
return False;
end if;
if Element(flag_it).hasValue = True then
arg_value := Element(flag_it).value;
end if;
return True;
end getFlag;
--- EXISTS ---
function exists(arg_flag: in Unbounded_String) return boolean is
flag_it: argNames_map.Cursor;
begin
if parsed /= True then
return False;
end if;
flag_it := argNames.find(arg_flag);
if flag_it = No_Elements then
return False;
elsif Element(flag_it).parsed /= True then
return False;
end if;
return True;
end exists;
--- PRINT HELP ---
procedure printHelp is
begin
put_line;
put_line(description);
put_line("Usage:");
put_line(usageStr);
put_line;
put_line("Options:");
-- Print out the options.
for opt in args.Iterate loop
put_line("-" & opt.arg_short & " --" & opt.arg_long & " " & opt.description);
end loop;
end printHelp;
--- FLAG COUNT ---
function flagCount return integer is
begin
return flagCount;
end flagCount;
--- EXECUTABLE NAME ---
function executableName return Unbounded_String is
begin
return execName;
end executableName;
end Sarge;
|
oeis/010/A010551.asm | neoneye/loda-programs | 11 | 104764 | <filename>oeis/010/A010551.asm
; A010551: Multiply successively by 1,1,2,2,3,3,4,4,..., n >= 1, a(0) = 1.
; Submitted by <NAME>
; 1,1,1,2,4,12,36,144,576,2880,14400,86400,518400,3628800,25401600,203212800,1625702400,14631321600,131681894400,1316818944000,13168189440000,144850083840000,1593350922240000,19120211066880000,229442532802560000,2982752926433280000,38775788043632640000,542861032610856960000,7600054456551997440000,114000816848279961600000,1710012252724199424000000,27360196043587190784000000,437763136697395052544000000,7441973323855715893248000000,126513546505547170185216000000,2277243837099849063333888000000
mov $3,1
lpb $0
mov $2,$0
sub $0,1
add $2,1
div $2,2
mul $3,$2
lpe
mov $0,$3
|
programs/oeis/052/A052984.asm | jmorken/loda | 1 | 16667 | ; A052984: a(n) = 5*a(n-1) - 2*a(n-2) for n>1, with a(0) = 1, a(1) = 3.
; 1,3,13,59,269,1227,5597,25531,116461,531243,2423293,11053979,50423309,230008587,1049196317,4785964411,21831429421,99585218283,454263232573,2072145726299,9452202166349,43116719379147,196679192563037,897162524056891,4092454235158381
mov $1,1
lpb $0
sub $0,1
add $2,$1
mul $2,2
add $1,$2
lpe
|
awa/plugins/awa-workspaces/src/awa-workspaces-modules.ads | fuzzysloth/ada-awa | 81 | 6423 | -----------------------------------------------------------------------
-- awa-workspaces-module -- Module workspaces
-- Copyright (C) 2011, 2012, 2017 <NAME>
-- Written by <NAME> (<EMAIL>)
--
-- Licensed under the Apache License, Version 2.0 (the "License");
-- you may not use this file except in compliance with the License.
-- You may obtain a copy of the License at
--
-- http://www.apache.org/licenses/LICENSE-2.0
--
-- Unless required by applicable law or agreed to in writing, software
-- distributed under the License is distributed on an "AS IS" BASIS,
-- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-- See the License for the specific language governing permissions and
-- limitations under the License.
-----------------------------------------------------------------------
with ADO.Objects;
with ADO.Sessions;
with Security.Permissions;
with ASF.Applications;
with AWA.Modules;
with AWA.Services.Contexts;
with AWA.Workspaces.Models;
with AWA.Users.Services;
with AWA.Users.Models;
with AWA.Permissions.Services;
with AWA.Events;
private with Ada.Strings.Unbounded;
-- == Events ==
-- The *workspaces* module provides several events that are posted when some action are performed.
--
-- === invite-user ===
-- This event is posted when an invitation is created for a user. The event can be used to
-- send the associated invitation email to the invitee. The event contains the following
-- attributes:
--
-- key
-- email
-- name
-- message
-- inviter
--
-- === accept-invitation ===
-- This event is posted when an invitation is accepted by a user.
package AWA.Workspaces.Modules is
subtype Permission_Index_Array is Security.Permissions.Permission_Index_Array;
Not_Found : exception;
-- The name under which the module is registered.
NAME : constant String := "workspaces";
-- The configuration parameter that defines the list of permissions to grant
-- to a user when his workspace is created.
PARAM_PERMISSIONS_LIST : constant String := "permissions_list";
-- A boolean configuration parameter that indicates that new users can create
-- a workspace. When a user is created, the 'workspace-create' permission is
-- added so that they can create the workspace.
PARAM_ALLOW_WORKSPACE_CREATE : constant String := "allow_workspace_create";
-- Permission to create a workspace.
package ACL_Create_Workspace is new Security.Permissions.Definition ("workspace-create");
package ACL_Invite_User is new Security.Permissions.Definition ("workspace-invite-user");
package ACL_Delete_User is new Security.Permissions.Definition ("workspace-delete-user");
package Invite_User_Event is new AWA.Events.Definition (Name => "invite-user");
package Accept_Invitation_Event is new AWA.Events.Definition (Name => "accept-invitation");
-- ------------------------------
-- Module workspaces
-- ------------------------------
type Workspace_Module is new AWA.Modules.Module and AWA.Users.Services.Listener with private;
type Workspace_Module_Access is access all Workspace_Module'Class;
-- Initialize the workspaces module.
overriding
procedure Initialize (Plugin : in out Workspace_Module;
App : in AWA.Modules.Application_Access;
Props : in ASF.Applications.Config);
-- Configures the module after its initialization and after having read its XML configuration.
overriding
procedure Configure (Plugin : in out Workspace_Module;
Props : in ASF.Applications.Config);
-- Get the list of permissions for the workspace owner.
function Get_Owner_Permissions (Manager : in Workspace_Module) return Permission_Index_Array;
-- Get the workspace module.
function Get_Workspace_Module return Workspace_Module_Access;
-- Get the current workspace associated with the current user.
-- If the user has not workspace, create one.
procedure Get_Workspace (Session : in out ADO.Sessions.Master_Session;
Context : in AWA.Services.Contexts.Service_Context_Access;
Workspace : out AWA.Workspaces.Models.Workspace_Ref);
-- Create a workspace for the user.
procedure Create_Workspace (Module : in Workspace_Module;
Workspace : out AWA.Workspaces.Models.Workspace_Ref);
-- Load the invitation from the access key and verify that the key is still valid.
procedure Load_Invitation (Module : in Workspace_Module;
Key : in String;
Invitation : in out AWA.Workspaces.Models.Invitation_Ref'Class;
Inviter : in out AWA.Users.Models.User_Ref);
-- Accept the invitation identified by the access key.
procedure Accept_Invitation (Module : in Workspace_Module;
Key : in String);
-- Send the invitation to the user.
procedure Send_Invitation (Module : in Workspace_Module;
Invitation : in out AWA.Workspaces.Models.Invitation_Ref'Class);
-- Delete the member from the workspace. Remove the invitation if there is one.
procedure Delete_Member (Module : in Workspace_Module;
Member_Id : in ADO.Identifier);
-- Add a list of permissions for all the users of the workspace that have the appropriate
-- role. Workspace members will be able to access the given database entity for the
-- specified list of permissions.
procedure Add_Permission (Session : in out ADO.Sessions.Master_Session;
User : in ADO.Identifier;
Entity : in ADO.Objects.Object_Ref'Class;
Workspace : in ADO.Identifier;
List : in Security.Permissions.Permission_Index_Array);
-- The `On_Create` procedure is called by `Notify_Create` to notify the creation of the user.
overriding
procedure On_Create (Module : in Workspace_Module;
User : in AWA.Users.Models.User_Ref'Class);
-- The `On_Update` procedure is called by `Notify_Update` to notify the update of the user.
overriding
procedure On_Update (Module : in Workspace_Module;
User : in AWA.Users.Models.User_Ref'Class) is null;
-- The `On_Delete` procedure is called by `Notify_Delete` to notify the deletion of the user.
overriding
procedure On_Delete (Module : in Workspace_Module;
User : in AWA.Users.Models.User_Ref'Class) is null;
private
type Workspace_Module is new AWA.Modules.Module and AWA.Users.Services.Listener with record
User_Manager : AWA.Users.Services.User_Service_Access;
-- The permission manager.
Perm_Manager : AWA.Permissions.Services.Permission_Manager_Access;
-- The list of permissions to grant to a user who creates the workspace.
Owner_Permissions : Ada.Strings.Unbounded.Unbounded_String;
-- When set, allow new users to create a workspace.
Allow_WS_Create : Boolean := False;
end record;
end AWA.Workspaces.Modules;
|
Transynther/x86/_processed/NONE/_zr_/i7-8650U_0xd2.log_10265_758.asm | ljhsiun2/medusa | 9 | 246682 | <reponame>ljhsiun2/medusa
.global s_prepare_buffers
s_prepare_buffers:
push %r10
push %r11
push %r13
push %r15
push %r9
push %rax
push %rbp
push %rcx
push %rdi
push %rsi
lea addresses_WT_ht+0x1b62a, %rbp
nop
nop
nop
nop
and %r15, %r15
and $0xffffffffffffffc0, %rbp
vmovntdqa (%rbp), %ymm4
vextracti128 $0, %ymm4, %xmm4
vpextrq $1, %xmm4, %r9
nop
nop
nop
nop
nop
add $43646, %r10
lea addresses_WC_ht+0x7e5a, %r13
nop
xor $9304, %rbp
movb (%r13), %r11b
nop
nop
nop
nop
nop
inc %rbp
lea addresses_WC_ht+0x1de2a, %r15
add %rax, %rax
movl $0x61626364, (%r15)
nop
nop
nop
nop
cmp %r10, %r10
lea addresses_UC_ht+0x1da08, %rsi
lea addresses_UC_ht+0x11c5a, %rdi
nop
cmp %r9, %r9
mov $16, %rcx
rep movsq
sub %r10, %r10
lea addresses_D_ht+0x176ee, %r10
nop
nop
and $7544, %rax
mov (%r10), %r11
xor $55150, %rsi
lea addresses_WC_ht+0xdd8a, %rbp
nop
nop
cmp %r9, %r9
vmovups (%rbp), %ymm7
vextracti128 $0, %ymm7, %xmm7
vpextrq $0, %xmm7, %r13
nop
inc %r10
lea addresses_UC_ht+0x1d0aa, %r9
nop
xor $31229, %r10
mov (%r9), %r13d
nop
nop
add %r15, %r15
lea addresses_WT_ht+0x1905a, %r9
nop
nop
nop
nop
nop
and %rdi, %rdi
movb $0x61, (%r9)
nop
nop
nop
nop
nop
add %rdi, %rdi
lea addresses_WT_ht+0x6c2a, %rsi
lea addresses_D_ht+0x466, %rdi
nop
nop
nop
xor $34251, %r11
mov $120, %rcx
rep movsl
nop
nop
nop
xor $17374, %r11
lea addresses_WC_ht+0x19612, %r15
dec %r9
movl $0x61626364, (%r15)
nop
nop
nop
nop
sub %r13, %r13
pop %rsi
pop %rdi
pop %rcx
pop %rbp
pop %rax
pop %r9
pop %r15
pop %r13
pop %r11
pop %r10
ret
.global s_faulty_load
s_faulty_load:
push %r10
push %r11
push %r13
push %r15
push %rax
push %rdi
push %rsi
// Store
lea addresses_WT+0x1c552, %r15
nop
nop
dec %rdi
mov $0x5152535455565758, %rsi
movq %rsi, %xmm4
vmovups %ymm4, (%r15)
nop
nop
nop
nop
nop
sub $38468, %rdi
// Faulty Load
lea addresses_A+0x1e62a, %rax
nop
nop
nop
nop
nop
and $12994, %r11
mov (%rax), %rdi
lea oracles, %r13
and $0xff, %rdi
shlq $12, %rdi
mov (%r13,%rdi,1), %rdi
pop %rsi
pop %rdi
pop %rax
pop %r15
pop %r13
pop %r11
pop %r10
ret
/*
<gen_faulty_load>
[REF]
{'OP': 'LOAD', 'src': {'type': 'addresses_A', 'size': 1, 'AVXalign': False, 'NT': False, 'congruent': 0, 'same': False}}
{'OP': 'STOR', 'dst': {'type': 'addresses_WT', 'size': 32, 'AVXalign': False, 'NT': False, 'congruent': 3, 'same': False}}
[Faulty Load]
{'OP': 'LOAD', 'src': {'type': 'addresses_A', 'size': 8, 'AVXalign': False, 'NT': False, 'congruent': 0, 'same': True}}
<gen_prepare_buffer>
{'OP': 'LOAD', 'src': {'type': 'addresses_WT_ht', 'size': 32, 'AVXalign': False, 'NT': True, 'congruent': 11, 'same': False}}
{'OP': 'LOAD', 'src': {'type': 'addresses_WC_ht', 'size': 1, 'AVXalign': False, 'NT': False, 'congruent': 3, 'same': False}}
{'OP': 'STOR', 'dst': {'type': 'addresses_WC_ht', 'size': 4, 'AVXalign': True, 'NT': False, 'congruent': 11, 'same': False}}
{'OP': 'REPM', 'src': {'type': 'addresses_UC_ht', 'congruent': 1, 'same': False}, 'dst': {'type': 'addresses_UC_ht', 'congruent': 4, 'same': False}}
{'OP': 'LOAD', 'src': {'type': 'addresses_D_ht', 'size': 8, 'AVXalign': False, 'NT': False, 'congruent': 1, 'same': False}}
{'OP': 'LOAD', 'src': {'type': 'addresses_WC_ht', 'size': 32, 'AVXalign': False, 'NT': False, 'congruent': 5, 'same': False}}
{'OP': 'LOAD', 'src': {'type': 'addresses_UC_ht', 'size': 4, 'AVXalign': False, 'NT': False, 'congruent': 7, 'same': False}}
{'OP': 'STOR', 'dst': {'type': 'addresses_WT_ht', 'size': 1, 'AVXalign': False, 'NT': False, 'congruent': 0, 'same': False}}
{'OP': 'REPM', 'src': {'type': 'addresses_WT_ht', 'congruent': 9, 'same': False}, 'dst': {'type': 'addresses_D_ht', 'congruent': 2, 'same': False}}
{'OP': 'STOR', 'dst': {'type': 'addresses_WC_ht', 'size': 4, 'AVXalign': False, 'NT': False, 'congruent': 3, 'same': False}}
{'00': 10265}
00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
*/
|
P6/data_P6_2/MDTest44.asm | alxzzhou/BUAA_CO_2020 | 1 | 14799 | <filename>P6/data_P6_2/MDTest44.asm
ori $ra,$ra,0xf
divu $5,$ra
sb $0,9($0)
sb $6,9($0)
addu $2,$2,$3
mthi $6
ori $1,$4,51630
lb $4,7($0)
divu $5,$ra
lb $0,1($0)
mflo $4
sb $4,0($0)
sll $4,$1,27
lui $2,1225
mflo $4
divu $3,$ra
srav $4,$4,$2
multu $4,$4
mtlo $2
sll $4,$1,10
mflo $4
ori $4,$1,50283
ori $1,$2,45477
sb $4,12($0)
divu $4,$ra
mtlo $6
sb $5,6($0)
mflo $2
mflo $1
mthi $5
mflo $4
mflo $3
lui $6,23584
ori $3,$2,50857
srav $5,$4,$5
addu $4,$4,$2
lui $1,48787
mthi $2
div $6,$ra
mfhi $3
addu $5,$6,$6
mflo $5
lui $5,53827
div $4,$ra
srav $5,$4,$4
mthi $4
addu $5,$5,$5
mult $1,$2
divu $1,$ra
mfhi $1
ori $5,$4,16400
lui $0,9220
multu $1,$2
mthi $6
divu $2,$ra
sll $1,$2,23
lui $5,26376
addiu $2,$2,-2360
mflo $5
lui $4,20152
mult $2,$2
ori $4,$0,27313
mthi $6
mthi $5
mult $5,$1
addiu $6,$1,7842
srav $3,$2,$3
mult $4,$4
srav $1,$5,$5
mthi $2
addu $0,$0,$4
sb $1,9($0)
mult $1,$5
addu $1,$5,$2
multu $4,$6
mult $1,$0
lb $0,2($0)
srav $4,$4,$4
lui $6,43612
lb $1,16($0)
sb $4,12($0)
addu $4,$4,$4
multu $1,$2
mult $3,$4
mtlo $4
mtlo $4
srav $4,$4,$0
sll $4,$4,29
addiu $1,$5,-11530
addu $5,$1,$4
mult $1,$1
ori $4,$4,407
mflo $5
addiu $1,$4,-7958
div $4,$ra
mfhi $4
addiu $3,$4,-30259
mflo $0
mthi $5
addu $0,$6,$0
addu $4,$5,$5
addiu $2,$2,-11783
sll $5,$5,11
mult $5,$5
mfhi $5
sll $4,$1,2
div $1,$ra
mtlo $1
divu $0,$ra
addu $6,$4,$2
mfhi $6
sll $0,$5,12
div $0,$ra
mflo $0
mfhi $0
mflo $4
lui $4,4249
srav $1,$2,$5
mult $2,$2
mflo $6
div $4,$ra
ori $2,$2,2843
mflo $3
mfhi $1
multu $6,$2
ori $2,$2,21417
srav $4,$2,$3
addiu $0,$2,12389
srav $4,$4,$2
divu $1,$ra
ori $2,$4,14770
ori $2,$5,34224
mult $4,$4
mflo $5
divu $1,$ra
mflo $6
mfhi $5
mult $3,$0
sll $3,$3,26
lui $3,30575
sll $3,$5,12
sb $2,12($0)
mfhi $4
div $4,$ra
addiu $2,$2,-3952
ori $3,$6,32182
mthi $4
mfhi $4
mthi $0
addu $6,$1,$3
srav $2,$2,$2
sb $2,1($0)
mtlo $4
sll $4,$1,11
div $5,$ra
mult $3,$0
srav $2,$5,$2
mtlo $4
div $4,$ra
divu $4,$ra
mult $0,$4
mthi $5
addu $6,$1,$3
mtlo $2
addiu $4,$4,-26305
mtlo $4
addiu $3,$4,17025
sll $2,$2,17
sb $1,9($0)
sll $2,$6,0
div $3,$ra
mtlo $4
mult $5,$5
ori $3,$4,6538
mflo $4
multu $4,$5
srav $2,$1,$2
multu $4,$5
addiu $6,$6,-9601
sb $4,1($0)
ori $5,$0,16893
div $0,$ra
addu $4,$4,$5
sll $1,$3,15
mult $2,$2
multu $6,$2
addiu $4,$5,28074
div $5,$ra
div $4,$ra
sb $4,5($0)
divu $0,$ra
mflo $6
srav $1,$2,$0
divu $0,$ra
ori $1,$5,41297
mult $4,$4
mfhi $5
mflo $2
srav $2,$2,$2
mfhi $5
sll $5,$4,25
div $3,$ra
divu $1,$ra
srav $0,$0,$4
mthi $5
div $5,$ra
divu $4,$ra
div $5,$ra
addu $4,$3,$3
divu $4,$ra
mfhi $5
ori $4,$0,54758
addu $5,$1,$2
mthi $4
lb $1,9($0)
sb $4,7($0)
lb $3,14($0)
div $1,$ra
multu $5,$4
mfhi $5
lb $2,1($0)
divu $2,$ra
addiu $5,$6,20589
multu $0,$0
mthi $0
mfhi $3
mtlo $3
lb $4,14($0)
multu $5,$1
mflo $6
lui $4,2017
lui $4,26533
sb $4,15($0)
addiu $3,$0,-20289
mthi $6
div $1,$ra
div $4,$ra
mfhi $0
mtlo $3
addiu $1,$2,25965
divu $5,$ra
sb $4,12($0)
mtlo $6
ori $2,$2,46993
multu $2,$2
mtlo $5
lui $4,10518
lb $1,13($0)
multu $2,$2
multu $6,$2
addiu $4,$4,-2857
sb $5,4($0)
mthi $1
lb $4,8($0)
divu $1,$ra
addiu $0,$3,10527
mthi $2
srav $0,$2,$3
mtlo $0
addu $4,$4,$5
div $4,$ra
ori $1,$5,16096
sb $5,8($0)
lb $4,3($0)
div $1,$ra
mflo $1
div $1,$ra
div $4,$ra
mult $0,$5
mthi $5
addiu $5,$4,10253
lui $2,33762
mult $4,$4
addiu $4,$4,23465
mflo $1
mflo $4
mfhi $5
addu $4,$2,$6
ori $6,$1,58889
sll $1,$1,7
mult $1,$1
multu $4,$0
sll $1,$5,11
addu $4,$2,$4
mtlo $0
multu $2,$2
lui $1,43416
lb $6,1($0)
sll $5,$1,12
lui $3,44416
mtlo $4
ori $4,$2,50519
addiu $4,$0,-3001
srav $5,$5,$5
srav $5,$2,$1
mult $6,$4
ori $0,$0,62717
mfhi $4
mult $4,$4
divu $1,$ra
sll $5,$5,9
mtlo $6
mthi $1
mflo $5
addu $2,$4,$2
lui $6,18666
sll $1,$4,11
srav $0,$5,$5
mthi $5
mthi $4
lb $5,4($0)
ori $0,$0,65380
mult $5,$1
lui $1,6471
lui $6,33890
ori $4,$2,45530
lui $4,22062
lui $4,37281
lui $5,38402
ori $0,$3,3502
sb $6,9($0)
divu $1,$ra
addiu $6,$4,4512
srav $1,$3,$3
multu $4,$1
div $3,$ra
mtlo $1
addu $3,$0,$3
lui $4,38273
sll $6,$6,11
mult $4,$4
mthi $3
mtlo $3
mthi $0
sll $4,$4,22
mtlo $5
mult $0,$2
addiu $4,$5,32347
ori $1,$4,52747
multu $5,$5
divu $3,$ra
div $5,$ra
addu $5,$5,$2
mult $6,$1
div $0,$ra
mflo $3
divu $6,$ra
lb $1,16($0)
div $0,$ra
sll $4,$2,20
mtlo $2
mflo $4
mthi $6
div $4,$ra
lb $5,6($0)
addu $5,$4,$4
lb $5,13($0)
ori $4,$4,1122
addu $5,$6,$6
mflo $0
mult $0,$1
div $1,$ra
div $3,$ra
mfhi $5
multu $4,$2
mflo $1
sb $4,13($0)
sll $5,$6,28
addu $5,$5,$5
addu $1,$1,$1
divu $4,$ra
sb $3,5($0)
srav $4,$4,$3
lui $3,10025
mflo $1
addiu $6,$6,20376
lb $0,1($0)
ori $6,$4,61306
mtlo $4
sb $4,15($0)
srav $4,$4,$3
mult $0,$0
mtlo $0
ori $4,$4,53413
div $5,$ra
lui $5,35341
mflo $0
multu $4,$4
addu $1,$1,$1
mtlo $3
lui $6,6443
sll $0,$3,3
mfhi $1
mult $4,$5
mfhi $4
mfhi $0
ori $1,$4,9924
mflo $4
sll $3,$0,23
mflo $1
mfhi $0
srav $5,$4,$0
mflo $1
multu $5,$5
srav $3,$3,$3
ori $0,$4,49090
div $4,$ra
addiu $0,$2,17959
sb $1,5($0)
srav $2,$5,$2
mtlo $4
mflo $4
addu $4,$4,$5
div $4,$ra
srav $5,$3,$3
mtlo $2
lb $6,4($0)
lui $1,19542
mtlo $5
lui $2,45532
mflo $1
mfhi $4
addu $5,$2,$2
sll $4,$2,31
div $1,$ra
mfhi $1
addu $1,$2,$3
mthi $6
divu $5,$ra
srav $4,$6,$4
div $0,$ra
mult $0,$1
srav $5,$4,$2
divu $5,$ra
multu $4,$6
mfhi $3
sb $1,12($0)
mtlo $0
srav $2,$1,$2
addiu $5,$0,-14322
mtlo $1
divu $1,$ra
lui $4,29247
multu $1,$5
lb $4,16($0)
mthi $4
mult $4,$2
addiu $6,$6,-9278
mult $5,$5
mfhi $4
ori $6,$4,28705
mthi $1
addiu $1,$1,5913
mthi $3
sll $0,$5,0
mflo $1
divu $4,$ra
mthi $4
sb $5,16($0)
mflo $1
lui $1,32460
srav $4,$4,$4
lui $1,45931
divu $5,$ra
sll $4,$4,31
multu $1,$2
mfhi $4
div $0,$ra
sll $4,$4,6
srav $4,$5,$4
lb $6,12($0)
mthi $5
lb $5,10($0)
lb $2,14($0)
sb $0,4($0)
div $4,$ra
mfhi $5
mtlo $4
sb $4,8($0)
mthi $5
lui $4,33130
sb $4,7($0)
mult $0,$2
mflo $6
multu $1,$1
lui $4,61243
addu $1,$1,$4
mtlo $1
lui $4,31821
lb $4,14($0)
sb $4,1($0)
sll $6,$4,16
addiu $5,$1,10647
lb $1,16($0)
multu $4,$6
addiu $1,$6,-484
addiu $5,$5,-11145
addiu $2,$2,268
multu $4,$5
mfhi $4
multu $2,$2
addu $4,$2,$2
mthi $5
mult $4,$2
sb $6,11($0)
mtlo $4
addiu $5,$2,14582
divu $4,$ra
mfhi $6
sb $2,4($0)
ori $5,$2,49203
divu $1,$ra
lui $4,15928
div $1,$ra
sll $5,$5,11
addiu $4,$2,21196
lb $1,16($0)
mult $4,$1
addu $1,$5,$2
sll $1,$1,17
mflo $2
sb $4,6($0)
lb $2,15($0)
addiu $5,$4,32304
sb $2,5($0)
mfhi $4
addiu $6,$2,24507
sll $5,$1,4
mtlo $1
ori $4,$5,52203
lb $3,2($0)
addu $4,$2,$2
ori $5,$2,31460
srav $5,$5,$5
sll $5,$5,17
mtlo $6
lb $2,16($0)
divu $6,$ra
sll $2,$2,9
lui $4,24782
sll $5,$1,6
mflo $3
mflo $5
ori $4,$1,31752
mflo $0
ori $4,$4,26369
multu $0,$3
ori $4,$4,52805
addu $4,$0,$2
addiu $4,$4,25517
divu $1,$ra
srav $6,$6,$6
multu $1,$4
ori $1,$2,59740
mflo $1
addiu $5,$0,-28011
addu $4,$0,$2
ori $4,$4,62195
lui $6,12081
mult $6,$6
mult $1,$1
divu $5,$ra
addiu $4,$0,-27380
addu $1,$0,$4
multu $5,$5
addu $5,$6,$0
div $3,$ra
addiu $1,$2,10677
ori $4,$4,28342
mthi $4
sll $5,$0,4
mthi $4
lui $4,40812
lb $0,5($0)
mflo $0
sll $6,$2,14
lui $4,60800
lb $6,15($0)
addiu $4,$4,-19863
addu $1,$1,$5
mfhi $5
addiu $4,$5,10826
sb $0,15($0)
lb $4,10($0)
lb $0,5($0)
srav $1,$3,$3
lui $1,57693
sll $3,$3,17
ori $4,$4,25749
addiu $1,$3,14403
mfhi $2
lui $3,45375
div $0,$ra
mflo $4
mflo $1
mfhi $0
mtlo $4
addiu $5,$4,-23707
addu $4,$3,$3
addiu $4,$4,32414
mthi $5
srav $4,$4,$2
lui $4,11024
mflo $4
multu $6,$1
sll $1,$1,10
srav $3,$2,$3
lui $5,57656
mthi $6
divu $0,$ra
lb $0,12($0)
mfhi $5
addiu $4,$1,3168
addu $2,$2,$3
multu $1,$1
ori $1,$1,6313
mflo $3
div $4,$ra
ori $1,$4,43337
sll $0,$0,5
sll $6,$6,25
mfhi $1
addu $4,$4,$4
sll $2,$1,14
lui $6,40697
mflo $4
sll $1,$2,3
div $2,$ra
div $1,$ra
sll $1,$5,0
ori $5,$5,21185
addu $4,$6,$4
multu $5,$5
sb $0,8($0)
mfhi $1
mflo $2
ori $4,$5,9178
mtlo $3
multu $4,$4
srav $5,$1,$3
srav $4,$6,$2
mflo $6
ori $6,$2,56462
mthi $2
mthi $1
srav $5,$4,$5
mult $5,$1
lui $5,55234
divu $4,$ra
srav $3,$3,$3
mflo $1
sb $5,12($0)
addiu $5,$0,7102
lui $2,27247
sll $4,$2,2
mtlo $1
multu $1,$1
div $2,$ra
mult $3,$1
lb $1,3($0)
lui $1,43793
mfhi $1
mthi $1
div $5,$ra
lb $4,10($0)
sb $1,10($0)
addiu $1,$1,-7197
sb $2,2($0)
mflo $1
mflo $0
mfhi $5
div $6,$ra
mult $0,$5
mthi $3
srav $3,$5,$3
mflo $4
mult $1,$1
mtlo $4
multu $4,$1
sll $4,$0,17
mtlo $4
addu $0,$1,$2
lui $1,22123
divu $0,$ra
lui $4,33674
srav $2,$4,$2
mtlo $1
mfhi $4
sll $4,$4,15
divu $5,$ra
addu $0,$0,$2
mtlo $1
mflo $1
ori $3,$3,22258
srav $4,$3,$3
mtlo $1
mflo $1
div $3,$ra
mult $0,$3
lui $4,19382
addiu $1,$4,17590
mthi $4
div $5,$ra
lui $5,18492
multu $6,$5
mult $6,$4
div $4,$ra
addiu $6,$4,10448
lui $0,506
sb $4,15($0)
lb $1,16($0)
lb $1,12($0)
mult $4,$1
mult $4,$3
divu $4,$ra
mthi $1
mfhi $5
srav $0,$2,$5
mult $4,$4
sll $5,$5,3
ori $5,$5,11535
addiu $5,$2,1547
sll $5,$5,23
sll $0,$5,16
srav $5,$5,$4
addu $2,$2,$4
mflo $1
ori $1,$5,56091
mfhi $5
mult $2,$2
sll $4,$4,12
sb $4,8($0)
mthi $1
mflo $5
divu $5,$ra
lui $4,38927
lui $3,36700
mflo $3
divu $1,$ra
mtlo $2
div $5,$ra
mthi $6
mfhi $4
srav $5,$0,$0
lui $1,16418
mflo $2
mult $2,$2
divu $1,$ra
mflo $4
div $4,$ra
mflo $1
lb $4,7($0)
divu $5,$ra
divu $4,$ra
addiu $4,$2,19305
sll $4,$4,14
ori $1,$1,42971
mfhi $0
mfhi $1
srav $0,$0,$5
srav $4,$5,$3
addu $2,$2,$2
divu $3,$ra
divu $4,$ra
multu $3,$0
sll $1,$4,1
addu $1,$2,$1
srav $6,$6,$2
sb $2,11($0)
ori $6,$3,28358
sb $0,0($0)
srav $3,$1,$3
mfhi $4
ori $4,$4,19788
addu $5,$2,$5
ori $5,$2,38485
mflo $6
sb $1,9($0)
divu $0,$ra
div $3,$ra
lb $4,7($0)
div $3,$ra
sll $5,$5,28
mult $5,$1
ori $6,$5,2355
multu $4,$4
divu $4,$ra
div $5,$ra
mtlo $5
multu $1,$6
div $6,$ra
lui $5,42101
ori $2,$1,12877
sll $5,$4,25
srav $1,$1,$2
addu $4,$2,$2
addiu $5,$2,30795
ori $5,$1,23995
lb $0,10($0)
mult $0,$0
lui $3,45497
addiu $5,$5,22162
addiu $1,$4,-10948
mflo $1
addiu $4,$2,14929
multu $0,$0
ori $2,$2,65406
sll $6,$6,26
div $1,$ra
mult $2,$2
divu $4,$ra
divu $3,$ra
ori $6,$2,7488
mthi $4
addu $6,$5,$5
sb $4,13($0)
lui $3,21449
sll $6,$6,9
lb $3,0($0)
mfhi $4
lb $5,7($0)
addiu $1,$5,-998
lui $3,53820
divu $4,$ra
mfhi $6
addiu $5,$2,-28871
addu $3,$1,$3
addiu $4,$2,-6954
ori $4,$4,38806
lb $5,13($0)
lb $4,2($0)
sb $2,12($0)
sll $3,$3,29
lui $2,4171
mult $4,$4
ori $5,$2,60049
mult $6,$6
mfhi $4
srav $0,$5,$3
addiu $6,$1,30615
ori $6,$2,60949
ori $4,$6,5477
div $5,$ra
mflo $5
mfhi $5
lb $6,13($0)
mfhi $1
mult $6,$3
mflo $4
mfhi $4
mflo $5
lb $4,1($0)
mthi $1
mult $6,$4
sll $1,$4,17
addiu $2,$4,3087
ori $4,$3,60341
mflo $2
addu $4,$6,$4
sll $5,$1,16
mult $5,$5
div $1,$ra
ori $5,$4,60842
mflo $5
addu $5,$5,$4
srav $0,$0,$2
addu $6,$4,$3
div $5,$ra
sll $5,$1,6
srav $0,$4,$3
lui $0,4526
div $4,$ra
mflo $2
mthi $5
lb $6,2($0)
addu $4,$4,$2
srav $6,$2,$5
multu $6,$2
mult $4,$4
lb $5,7($0)
srav $4,$6,$1
mult $5,$5
addiu $3,$4,26185
addiu $2,$2,7854
lb $4,7($0)
mult $5,$5
multu $1,$0
mflo $5
addiu $4,$2,-232
|
programs/oeis/008/A008530.asm | karttu/loda | 1 | 102980 | ; A008530: Coordination sequence for 4-dimensional primitive di-isohexagonal orthogonal lattice.
; 1,12,60,180,408,780,1332,2100,3120,4428,6060,8052,10440,13260,16548,20340,24672,29580,35100,41268,48120,55692,64020,73140,83088,93900,105612,118260,131880,146508,162180,178932,196800,215820,236028,257460,280152,304140,329460,356148,384240,413772,444780,477300,511368,547020,584292,623220,663840,706188,750300,796212,843960,893580,945108,998580,1054032,1111500,1171020,1232628,1296360,1362252,1430340,1500660,1573248,1648140,1725372,1804980,1887000,1971468,2058420,2147892,2239920,2334540,2431788,2531700,2634312,2739660,2847780,2958708,3072480,3189132,3308700,3431220,3556728,3685260,3816852,3951540,4089360,4230348,4374540,4521972,4672680,4826700,4984068,5144820,5308992,5476620,5647740,5822388,6000600,6182412,6367860,6556980,6749808,6946380,7146732,7350900,7558920,7770828,7986660,8206452,8430240,8658060,8889948,9125940,9366072,9610380,9858900,10111668,10368720,10630092,10895820,11165940,11440488,11719500,12003012,12291060,12583680,12880908,13182780,13489332,13800600,14116620,14437428,14763060,15093552,15428940,15769260,16114548,16464840,16820172,17180580,17546100,17916768,18292620,18673692,19060020,19451640,19848588,20250900,20658612,21071760,21490380,21914508,22344180,22779432,23220300,23666820,24119028,24576960,25040652,25510140,25985460,26466648,26953740,27446772,27945780,28450800,28961868,29479020,30002292,30531720,31067340,31609188,32157300,32711712,33272460,33839580,34413108,34993080,35579532,36172500,36772020,37378128,37990860,38610252,39236340,39869160,40508748,41155140,41808372,42468480,43135500,43809468,44490420,45178392,45873420,46575540,47284788,48001200,48724812,49455660,50193780,50939208,51691980,52452132,53219700,53994720,54777228,55567260,56364852,57170040,57982860,58803348,59631540,60467472,61311180,62162700,63022068,63889320,64764492,65647620,66538740,67437888,68345100,69260412,70183860,71115480,72055308,73003380,73959732,74924400,75897420,76878828,77868660,78866952,79873740,80889060,81912948,82945440,83986572,85036380,86094900,87162168,88238220,89323092,90416820,91519440,92630988
pow $1,$0
mov $2,$0
mul $2,6
add $1,$2
mov $3,$0
mul $3,$0
mul $3,$0
mov $2,$3
mul $2,6
add $1,$2
|
api/api016.asm | yosswi414/HariboteOS_USB | 0 | 8721 | <filename>api/api016.asm
[BITS 32]
GLOBAL api_alloctimer
[SECTION .text]
api_alloctimer: ; int api_alloctimer();
MOV EDX, 16
INT 0x40
RET
|
ls.asm | marioherrera19/sistema-operativo | 0 | 18983 |
_ls: file format elf32-i386
Disassembly of section .text:
00000000 <fmtname>:
#include "user.h"
#include "fs.h"
char*
fmtname(char *path)
{
0: 55 push %ebp
1: 89 e5 mov %esp,%ebp
3: 53 push %ebx
4: 83 ec 24 sub $0x24,%esp
static char buf[DIRSIZ+1];
char *p;
// Find first character after last slash.
for(p=path+strlen(path); p >= path && *p != '/'; p--)
7: 8b 45 08 mov 0x8(%ebp),%eax
a: 89 04 24 mov %eax,(%esp)
d: e8 dc 03 00 00 call 3ee <strlen>
12: 03 45 08 add 0x8(%ebp),%eax
15: 89 45 f4 mov %eax,-0xc(%ebp)
18: eb 04 jmp 1e <fmtname+0x1e>
1a: 83 6d f4 01 subl $0x1,-0xc(%ebp)
1e: 8b 45 f4 mov -0xc(%ebp),%eax
21: 3b 45 08 cmp 0x8(%ebp),%eax
24: 72 0a jb 30 <fmtname+0x30>
26: 8b 45 f4 mov -0xc(%ebp),%eax
29: 0f b6 00 movzbl (%eax),%eax
2c: 3c 2f cmp $0x2f,%al
2e: 75 ea jne 1a <fmtname+0x1a>
;
p++;
30: 83 45 f4 01 addl $0x1,-0xc(%ebp)
// Return blank-padded name.
if(strlen(p) >= DIRSIZ)
34: 8b 45 f4 mov -0xc(%ebp),%eax
37: 89 04 24 mov %eax,(%esp)
3a: e8 af 03 00 00 call 3ee <strlen>
3f: 83 f8 0d cmp $0xd,%eax
42: 76 05 jbe 49 <fmtname+0x49>
return p;
44: 8b 45 f4 mov -0xc(%ebp),%eax
47: eb 5f jmp a8 <fmtname+0xa8>
memmove(buf, p, strlen(p));
49: 8b 45 f4 mov -0xc(%ebp),%eax
4c: 89 04 24 mov %eax,(%esp)
4f: e8 9a 03 00 00 call 3ee <strlen>
54: 89 44 24 08 mov %eax,0x8(%esp)
58: 8b 45 f4 mov -0xc(%ebp),%eax
5b: 89 44 24 04 mov %eax,0x4(%esp)
5f: c7 04 24 f8 0d 00 00 movl $0xdf8,(%esp)
66: e8 07 05 00 00 call 572 <memmove>
memset(buf+strlen(p), ' ', DIRSIZ-strlen(p));
6b: 8b 45 f4 mov -0xc(%ebp),%eax
6e: 89 04 24 mov %eax,(%esp)
71: e8 78 03 00 00 call 3ee <strlen>
76: ba 0e 00 00 00 mov $0xe,%edx
7b: 89 d3 mov %edx,%ebx
7d: 29 c3 sub %eax,%ebx
7f: 8b 45 f4 mov -0xc(%ebp),%eax
82: 89 04 24 mov %eax,(%esp)
85: e8 64 03 00 00 call 3ee <strlen>
8a: 05 f8 0d 00 00 add $0xdf8,%eax
8f: 89 5c 24 08 mov %ebx,0x8(%esp)
93: c7 44 24 04 20 00 00 movl $0x20,0x4(%esp)
9a: 00
9b: 89 04 24 mov %eax,(%esp)
9e: e8 70 03 00 00 call 413 <memset>
return buf;
a3: b8 f8 0d 00 00 mov $0xdf8,%eax
}
a8: 83 c4 24 add $0x24,%esp
ab: 5b pop %ebx
ac: 5d pop %ebp
ad: c3 ret
000000ae <ls>:
void
ls(char *path)
{
ae: 55 push %ebp
af: 89 e5 mov %esp,%ebp
b1: 57 push %edi
b2: 56 push %esi
b3: 53 push %ebx
b4: 81 ec 5c 02 00 00 sub $0x25c,%esp
char buf[512], *p;
int fd;
struct dirent de;
struct stat st;
if((fd = open(path, 0)) < 0){
ba: c7 44 24 04 00 00 00 movl $0x0,0x4(%esp)
c1: 00
c2: 8b 45 08 mov 0x8(%ebp),%eax
c5: 89 04 24 mov %eax,(%esp)
c8: e8 2b 05 00 00 call 5f8 <open>
cd: 89 45 e4 mov %eax,-0x1c(%ebp)
d0: 83 7d e4 00 cmpl $0x0,-0x1c(%ebp)
d4: 79 20 jns f6 <ls+0x48>
printf(2, "ls: cannot open %s\n", path);
d6: 8b 45 08 mov 0x8(%ebp),%eax
d9: 89 44 24 08 mov %eax,0x8(%esp)
dd: c7 44 24 04 03 0b 00 movl $0xb03,0x4(%esp)
e4: 00
e5: c7 04 24 02 00 00 00 movl $0x2,(%esp)
ec: e8 4e 06 00 00 call 73f <printf>
return;
f1: e9 01 02 00 00 jmp 2f7 <ls+0x249>
}
if(fstat(fd, &st) < 0){
f6: 8d 85 bc fd ff ff lea -0x244(%ebp),%eax
fc: 89 44 24 04 mov %eax,0x4(%esp)
100: 8b 45 e4 mov -0x1c(%ebp),%eax
103: 89 04 24 mov %eax,(%esp)
106: e8 05 05 00 00 call 610 <fstat>
10b: 85 c0 test %eax,%eax
10d: 79 2b jns 13a <ls+0x8c>
printf(2, "ls: cannot stat %s\n", path);
10f: 8b 45 08 mov 0x8(%ebp),%eax
112: 89 44 24 08 mov %eax,0x8(%esp)
116: c7 44 24 04 17 0b 00 movl $0xb17,0x4(%esp)
11d: 00
11e: c7 04 24 02 00 00 00 movl $0x2,(%esp)
125: e8 15 06 00 00 call 73f <printf>
close(fd);
12a: 8b 45 e4 mov -0x1c(%ebp),%eax
12d: 89 04 24 mov %eax,(%esp)
130: e8 ab 04 00 00 call 5e0 <close>
return;
135: e9 bd 01 00 00 jmp 2f7 <ls+0x249>
}
switch(st.type){
13a: 0f b7 85 bc fd ff ff movzwl -0x244(%ebp),%eax
141: 98 cwtl
142: 83 f8 01 cmp $0x1,%eax
145: 74 53 je 19a <ls+0xec>
147: 83 f8 02 cmp $0x2,%eax
14a: 0f 85 9c 01 00 00 jne 2ec <ls+0x23e>
case T_FILE:
printf(1, "%s %d %d %d\n", fmtname(path), st.type, st.ino, st.size);
150: 8b bd cc fd ff ff mov -0x234(%ebp),%edi
156: 8b b5 c4 fd ff ff mov -0x23c(%ebp),%esi
15c: 0f b7 85 bc fd ff ff movzwl -0x244(%ebp),%eax
163: 0f bf d8 movswl %ax,%ebx
166: 8b 45 08 mov 0x8(%ebp),%eax
169: 89 04 24 mov %eax,(%esp)
16c: e8 8f fe ff ff call 0 <fmtname>
171: 89 7c 24 14 mov %edi,0x14(%esp)
175: 89 74 24 10 mov %esi,0x10(%esp)
179: 89 5c 24 0c mov %ebx,0xc(%esp)
17d: 89 44 24 08 mov %eax,0x8(%esp)
181: c7 44 24 04 2b 0b 00 movl $0xb2b,0x4(%esp)
188: 00
189: c7 04 24 01 00 00 00 movl $0x1,(%esp)
190: e8 aa 05 00 00 call 73f <printf>
break;
195: e9 52 01 00 00 jmp 2ec <ls+0x23e>
case T_DIR:
if(strlen(path) + 1 + DIRSIZ + 1 > sizeof buf){
19a: 8b 45 08 mov 0x8(%ebp),%eax
19d: 89 04 24 mov %eax,(%esp)
1a0: e8 49 02 00 00 call 3ee <strlen>
1a5: 83 c0 10 add $0x10,%eax
1a8: 3d 00 02 00 00 cmp $0x200,%eax
1ad: 76 19 jbe 1c8 <ls+0x11a>
printf(1, "ls: path too long\n");
1af: c7 44 24 04 38 0b 00 movl $0xb38,0x4(%esp)
1b6: 00
1b7: c7 04 24 01 00 00 00 movl $0x1,(%esp)
1be: e8 7c 05 00 00 call 73f <printf>
break;
1c3: e9 24 01 00 00 jmp 2ec <ls+0x23e>
}
strcpy(buf, path);
1c8: 8b 45 08 mov 0x8(%ebp),%eax
1cb: 89 44 24 04 mov %eax,0x4(%esp)
1cf: 8d 85 e0 fd ff ff lea -0x220(%ebp),%eax
1d5: 89 04 24 mov %eax,(%esp)
1d8: e8 9c 01 00 00 call 379 <strcpy>
p = buf+strlen(buf);
1dd: 8d 85 e0 fd ff ff lea -0x220(%ebp),%eax
1e3: 89 04 24 mov %eax,(%esp)
1e6: e8 03 02 00 00 call 3ee <strlen>
1eb: 8d 95 e0 fd ff ff lea -0x220(%ebp),%edx
1f1: 01 d0 add %edx,%eax
1f3: 89 45 e0 mov %eax,-0x20(%ebp)
*p++ = '/';
1f6: 8b 45 e0 mov -0x20(%ebp),%eax
1f9: c6 00 2f movb $0x2f,(%eax)
1fc: 83 45 e0 01 addl $0x1,-0x20(%ebp)
while(read(fd, &de, sizeof(de)) == sizeof(de)){
200: e9 c0 00 00 00 jmp 2c5 <ls+0x217>
if(de.inum == 0)
205: 0f b7 85 d0 fd ff ff movzwl -0x230(%ebp),%eax
20c: 66 85 c0 test %ax,%ax
20f: 0f 84 af 00 00 00 je 2c4 <ls+0x216>
continue;
memmove(p, de.name, DIRSIZ);
215: c7 44 24 08 0e 00 00 movl $0xe,0x8(%esp)
21c: 00
21d: 8d 85 d0 fd ff ff lea -0x230(%ebp),%eax
223: 83 c0 02 add $0x2,%eax
226: 89 44 24 04 mov %eax,0x4(%esp)
22a: 8b 45 e0 mov -0x20(%ebp),%eax
22d: 89 04 24 mov %eax,(%esp)
230: e8 3d 03 00 00 call 572 <memmove>
p[DIRSIZ] = 0;
235: 8b 45 e0 mov -0x20(%ebp),%eax
238: 83 c0 0e add $0xe,%eax
23b: c6 00 00 movb $0x0,(%eax)
if(stat(buf, &st) < 0){
23e: 8d 85 bc fd ff ff lea -0x244(%ebp),%eax
244: 89 44 24 04 mov %eax,0x4(%esp)
248: 8d 85 e0 fd ff ff lea -0x220(%ebp),%eax
24e: 89 04 24 mov %eax,(%esp)
251: e8 83 02 00 00 call 4d9 <stat>
256: 85 c0 test %eax,%eax
258: 79 20 jns 27a <ls+0x1cc>
printf(1, "ls: cannot stat %s\n", buf);
25a: 8d 85 e0 fd ff ff lea -0x220(%ebp),%eax
260: 89 44 24 08 mov %eax,0x8(%esp)
264: c7 44 24 04 17 0b 00 movl $0xb17,0x4(%esp)
26b: 00
26c: c7 04 24 01 00 00 00 movl $0x1,(%esp)
273: e8 c7 04 00 00 call 73f <printf>
continue;
278: eb 4b jmp 2c5 <ls+0x217>
}
printf(1, "%s %d %d %d\n", fmtname(buf), st.type, st.ino, st.size);
27a: 8b bd cc fd ff ff mov -0x234(%ebp),%edi
280: 8b b5 c4 fd ff ff mov -0x23c(%ebp),%esi
286: 0f b7 85 bc fd ff ff movzwl -0x244(%ebp),%eax
28d: 0f bf d8 movswl %ax,%ebx
290: 8d 85 e0 fd ff ff lea -0x220(%ebp),%eax
296: 89 04 24 mov %eax,(%esp)
299: e8 62 fd ff ff call 0 <fmtname>
29e: 89 7c 24 14 mov %edi,0x14(%esp)
2a2: 89 74 24 10 mov %esi,0x10(%esp)
2a6: 89 5c 24 0c mov %ebx,0xc(%esp)
2aa: 89 44 24 08 mov %eax,0x8(%esp)
2ae: c7 44 24 04 2b 0b 00 movl $0xb2b,0x4(%esp)
2b5: 00
2b6: c7 04 24 01 00 00 00 movl $0x1,(%esp)
2bd: e8 7d 04 00 00 call 73f <printf>
2c2: eb 01 jmp 2c5 <ls+0x217>
strcpy(buf, path);
p = buf+strlen(buf);
*p++ = '/';
while(read(fd, &de, sizeof(de)) == sizeof(de)){
if(de.inum == 0)
continue;
2c4: 90 nop
break;
}
strcpy(buf, path);
p = buf+strlen(buf);
*p++ = '/';
while(read(fd, &de, sizeof(de)) == sizeof(de)){
2c5: c7 44 24 08 10 00 00 movl $0x10,0x8(%esp)
2cc: 00
2cd: 8d 85 d0 fd ff ff lea -0x230(%ebp),%eax
2d3: 89 44 24 04 mov %eax,0x4(%esp)
2d7: 8b 45 e4 mov -0x1c(%ebp),%eax
2da: 89 04 24 mov %eax,(%esp)
2dd: e8 ee 02 00 00 call 5d0 <read>
2e2: 83 f8 10 cmp $0x10,%eax
2e5: 0f 84 1a ff ff ff je 205 <ls+0x157>
printf(1, "ls: cannot stat %s\n", buf);
continue;
}
printf(1, "%s %d %d %d\n", fmtname(buf), st.type, st.ino, st.size);
}
break;
2eb: 90 nop
}
close(fd);
2ec: 8b 45 e4 mov -0x1c(%ebp),%eax
2ef: 89 04 24 mov %eax,(%esp)
2f2: e8 e9 02 00 00 call 5e0 <close>
}
2f7: 81 c4 5c 02 00 00 add $0x25c,%esp
2fd: 5b pop %ebx
2fe: 5e pop %esi
2ff: 5f pop %edi
300: 5d pop %ebp
301: c3 ret
00000302 <main>:
int
main(int argc, char *argv[])
{
302: 55 push %ebp
303: 89 e5 mov %esp,%ebp
305: 83 e4 f0 and $0xfffffff0,%esp
308: 83 ec 20 sub $0x20,%esp
int i;
if(argc < 2){
30b: 83 7d 08 01 cmpl $0x1,0x8(%ebp)
30f: 7f 11 jg 322 <main+0x20>
ls(".");
311: c7 04 24 4b 0b 00 00 movl $0xb4b,(%esp)
318: e8 91 fd ff ff call ae <ls>
exit();
31d: e8 96 02 00 00 call 5b8 <exit>
}
for(i=1; i<argc; i++)
322: c7 44 24 1c 01 00 00 movl $0x1,0x1c(%esp)
329: 00
32a: eb 19 jmp 345 <main+0x43>
ls(argv[i]);
32c: 8b 44 24 1c mov 0x1c(%esp),%eax
330: c1 e0 02 shl $0x2,%eax
333: 03 45 0c add 0xc(%ebp),%eax
336: 8b 00 mov (%eax),%eax
338: 89 04 24 mov %eax,(%esp)
33b: e8 6e fd ff ff call ae <ls>
if(argc < 2){
ls(".");
exit();
}
for(i=1; i<argc; i++)
340: 83 44 24 1c 01 addl $0x1,0x1c(%esp)
345: 8b 44 24 1c mov 0x1c(%esp),%eax
349: 3b 45 08 cmp 0x8(%ebp),%eax
34c: 7c de jl 32c <main+0x2a>
ls(argv[i]);
exit();
34e: e8 65 02 00 00 call 5b8 <exit>
353: 90 nop
00000354 <stosb>:
"cc");
}
static inline void
stosb(void *addr, int data, int cnt)
{
354: 55 push %ebp
355: 89 e5 mov %esp,%ebp
357: 57 push %edi
358: 53 push %ebx
asm volatile("cld; rep stosb" :
359: 8b 4d 08 mov 0x8(%ebp),%ecx
35c: 8b 55 10 mov 0x10(%ebp),%edx
35f: 8b 45 0c mov 0xc(%ebp),%eax
362: 89 cb mov %ecx,%ebx
364: 89 df mov %ebx,%edi
366: 89 d1 mov %edx,%ecx
368: fc cld
369: f3 aa rep stos %al,%es:(%edi)
36b: 89 ca mov %ecx,%edx
36d: 89 fb mov %edi,%ebx
36f: 89 5d 08 mov %ebx,0x8(%ebp)
372: 89 55 10 mov %edx,0x10(%ebp)
"=D" (addr), "=c" (cnt) :
"0" (addr), "1" (cnt), "a" (data) :
"memory", "cc");
}
375: 5b pop %ebx
376: 5f pop %edi
377: 5d pop %ebp
378: c3 ret
00000379 <strcpy>:
#include "user.h"
#include "x86.h"
char*
strcpy(char *s, char *t)
{
379: 55 push %ebp
37a: 89 e5 mov %esp,%ebp
37c: 83 ec 10 sub $0x10,%esp
char *os;
os = s;
37f: 8b 45 08 mov 0x8(%ebp),%eax
382: 89 45 fc mov %eax,-0x4(%ebp)
while((*s++ = *t++) != 0)
385: 90 nop
386: 8b 45 0c mov 0xc(%ebp),%eax
389: 0f b6 10 movzbl (%eax),%edx
38c: 8b 45 08 mov 0x8(%ebp),%eax
38f: 88 10 mov %dl,(%eax)
391: 8b 45 08 mov 0x8(%ebp),%eax
394: 0f b6 00 movzbl (%eax),%eax
397: 84 c0 test %al,%al
399: 0f 95 c0 setne %al
39c: 83 45 08 01 addl $0x1,0x8(%ebp)
3a0: 83 45 0c 01 addl $0x1,0xc(%ebp)
3a4: 84 c0 test %al,%al
3a6: 75 de jne 386 <strcpy+0xd>
;
return os;
3a8: 8b 45 fc mov -0x4(%ebp),%eax
}
3ab: c9 leave
3ac: c3 ret
000003ad <strcmp>:
int
strcmp(const char *p, const char *q)
{
3ad: 55 push %ebp
3ae: 89 e5 mov %esp,%ebp
while(*p && *p == *q)
3b0: eb 08 jmp 3ba <strcmp+0xd>
p++, q++;
3b2: 83 45 08 01 addl $0x1,0x8(%ebp)
3b6: 83 45 0c 01 addl $0x1,0xc(%ebp)
}
int
strcmp(const char *p, const char *q)
{
while(*p && *p == *q)
3ba: 8b 45 08 mov 0x8(%ebp),%eax
3bd: 0f b6 00 movzbl (%eax),%eax
3c0: 84 c0 test %al,%al
3c2: 74 10 je 3d4 <strcmp+0x27>
3c4: 8b 45 08 mov 0x8(%ebp),%eax
3c7: 0f b6 10 movzbl (%eax),%edx
3ca: 8b 45 0c mov 0xc(%ebp),%eax
3cd: 0f b6 00 movzbl (%eax),%eax
3d0: 38 c2 cmp %al,%dl
3d2: 74 de je 3b2 <strcmp+0x5>
p++, q++;
return (uchar)*p - (uchar)*q;
3d4: 8b 45 08 mov 0x8(%ebp),%eax
3d7: 0f b6 00 movzbl (%eax),%eax
3da: 0f b6 d0 movzbl %al,%edx
3dd: 8b 45 0c mov 0xc(%ebp),%eax
3e0: 0f b6 00 movzbl (%eax),%eax
3e3: 0f b6 c0 movzbl %al,%eax
3e6: 89 d1 mov %edx,%ecx
3e8: 29 c1 sub %eax,%ecx
3ea: 89 c8 mov %ecx,%eax
}
3ec: 5d pop %ebp
3ed: c3 ret
000003ee <strlen>:
uint
strlen(char *s)
{
3ee: 55 push %ebp
3ef: 89 e5 mov %esp,%ebp
3f1: 83 ec 10 sub $0x10,%esp
int n;
for(n = 0; s[n]; n++)
3f4: c7 45 fc 00 00 00 00 movl $0x0,-0x4(%ebp)
3fb: eb 04 jmp 401 <strlen+0x13>
3fd: 83 45 fc 01 addl $0x1,-0x4(%ebp)
401: 8b 45 fc mov -0x4(%ebp),%eax
404: 03 45 08 add 0x8(%ebp),%eax
407: 0f b6 00 movzbl (%eax),%eax
40a: 84 c0 test %al,%al
40c: 75 ef jne 3fd <strlen+0xf>
;
return n;
40e: 8b 45 fc mov -0x4(%ebp),%eax
}
411: c9 leave
412: c3 ret
00000413 <memset>:
void*
memset(void *dst, int c, uint n)
{
413: 55 push %ebp
414: 89 e5 mov %esp,%ebp
416: 83 ec 0c sub $0xc,%esp
stosb(dst, c, n);
419: 8b 45 10 mov 0x10(%ebp),%eax
41c: 89 44 24 08 mov %eax,0x8(%esp)
420: 8b 45 0c mov 0xc(%ebp),%eax
423: 89 44 24 04 mov %eax,0x4(%esp)
427: 8b 45 08 mov 0x8(%ebp),%eax
42a: 89 04 24 mov %eax,(%esp)
42d: e8 22 ff ff ff call 354 <stosb>
return dst;
432: 8b 45 08 mov 0x8(%ebp),%eax
}
435: c9 leave
436: c3 ret
00000437 <strchr>:
char*
strchr(const char *s, char c)
{
437: 55 push %ebp
438: 89 e5 mov %esp,%ebp
43a: 83 ec 04 sub $0x4,%esp
43d: 8b 45 0c mov 0xc(%ebp),%eax
440: 88 45 fc mov %al,-0x4(%ebp)
for(; *s; s++)
443: eb 14 jmp 459 <strchr+0x22>
if(*s == c)
445: 8b 45 08 mov 0x8(%ebp),%eax
448: 0f b6 00 movzbl (%eax),%eax
44b: 3a 45 fc cmp -0x4(%ebp),%al
44e: 75 05 jne 455 <strchr+0x1e>
return (char*)s;
450: 8b 45 08 mov 0x8(%ebp),%eax
453: eb 13 jmp 468 <strchr+0x31>
}
char*
strchr(const char *s, char c)
{
for(; *s; s++)
455: 83 45 08 01 addl $0x1,0x8(%ebp)
459: 8b 45 08 mov 0x8(%ebp),%eax
45c: 0f b6 00 movzbl (%eax),%eax
45f: 84 c0 test %al,%al
461: 75 e2 jne 445 <strchr+0xe>
if(*s == c)
return (char*)s;
return 0;
463: b8 00 00 00 00 mov $0x0,%eax
}
468: c9 leave
469: c3 ret
0000046a <gets>:
char*
gets(char *buf, int max)
{
46a: 55 push %ebp
46b: 89 e5 mov %esp,%ebp
46d: 83 ec 28 sub $0x28,%esp
int i, cc;
char c;
for(i=0; i+1 < max; ){
470: c7 45 f4 00 00 00 00 movl $0x0,-0xc(%ebp)
477: eb 44 jmp 4bd <gets+0x53>
cc = read(0, &c, 1);
479: c7 44 24 08 01 00 00 movl $0x1,0x8(%esp)
480: 00
481: 8d 45 ef lea -0x11(%ebp),%eax
484: 89 44 24 04 mov %eax,0x4(%esp)
488: c7 04 24 00 00 00 00 movl $0x0,(%esp)
48f: e8 3c 01 00 00 call 5d0 <read>
494: 89 45 f0 mov %eax,-0x10(%ebp)
if(cc < 1)
497: 83 7d f0 00 cmpl $0x0,-0x10(%ebp)
49b: 7e 2d jle 4ca <gets+0x60>
break;
buf[i++] = c;
49d: 8b 45 f4 mov -0xc(%ebp),%eax
4a0: 03 45 08 add 0x8(%ebp),%eax
4a3: 0f b6 55 ef movzbl -0x11(%ebp),%edx
4a7: 88 10 mov %dl,(%eax)
4a9: 83 45 f4 01 addl $0x1,-0xc(%ebp)
if(c == '\n' || c == '\r')
4ad: 0f b6 45 ef movzbl -0x11(%ebp),%eax
4b1: 3c 0a cmp $0xa,%al
4b3: 74 16 je 4cb <gets+0x61>
4b5: 0f b6 45 ef movzbl -0x11(%ebp),%eax
4b9: 3c 0d cmp $0xd,%al
4bb: 74 0e je 4cb <gets+0x61>
gets(char *buf, int max)
{
int i, cc;
char c;
for(i=0; i+1 < max; ){
4bd: 8b 45 f4 mov -0xc(%ebp),%eax
4c0: 83 c0 01 add $0x1,%eax
4c3: 3b 45 0c cmp 0xc(%ebp),%eax
4c6: 7c b1 jl 479 <gets+0xf>
4c8: eb 01 jmp 4cb <gets+0x61>
cc = read(0, &c, 1);
if(cc < 1)
break;
4ca: 90 nop
buf[i++] = c;
if(c == '\n' || c == '\r')
break;
}
buf[i] = '\0';
4cb: 8b 45 f4 mov -0xc(%ebp),%eax
4ce: 03 45 08 add 0x8(%ebp),%eax
4d1: c6 00 00 movb $0x0,(%eax)
return buf;
4d4: 8b 45 08 mov 0x8(%ebp),%eax
}
4d7: c9 leave
4d8: c3 ret
000004d9 <stat>:
int
stat(char *n, struct stat *st)
{
4d9: 55 push %ebp
4da: 89 e5 mov %esp,%ebp
4dc: 83 ec 28 sub $0x28,%esp
int fd;
int r;
fd = open(n, O_RDONLY);
4df: c7 44 24 04 00 00 00 movl $0x0,0x4(%esp)
4e6: 00
4e7: 8b 45 08 mov 0x8(%ebp),%eax
4ea: 89 04 24 mov %eax,(%esp)
4ed: e8 06 01 00 00 call 5f8 <open>
4f2: 89 45 f4 mov %eax,-0xc(%ebp)
if(fd < 0)
4f5: 83 7d f4 00 cmpl $0x0,-0xc(%ebp)
4f9: 79 07 jns 502 <stat+0x29>
return -1;
4fb: b8 ff ff ff ff mov $0xffffffff,%eax
500: eb 23 jmp 525 <stat+0x4c>
r = fstat(fd, st);
502: 8b 45 0c mov 0xc(%ebp),%eax
505: 89 44 24 04 mov %eax,0x4(%esp)
509: 8b 45 f4 mov -0xc(%ebp),%eax
50c: 89 04 24 mov %eax,(%esp)
50f: e8 fc 00 00 00 call 610 <fstat>
514: 89 45 f0 mov %eax,-0x10(%ebp)
close(fd);
517: 8b 45 f4 mov -0xc(%ebp),%eax
51a: 89 04 24 mov %eax,(%esp)
51d: e8 be 00 00 00 call 5e0 <close>
return r;
522: 8b 45 f0 mov -0x10(%ebp),%eax
}
525: c9 leave
526: c3 ret
00000527 <atoi>:
int
atoi(const char *s)
{
527: 55 push %ebp
528: 89 e5 mov %esp,%ebp
52a: 83 ec 10 sub $0x10,%esp
int n;
n = 0;
52d: c7 45 fc 00 00 00 00 movl $0x0,-0x4(%ebp)
while('0' <= *s && *s <= '9')
534: eb 23 jmp 559 <atoi+0x32>
n = n*10 + *s++ - '0';
536: 8b 55 fc mov -0x4(%ebp),%edx
539: 89 d0 mov %edx,%eax
53b: c1 e0 02 shl $0x2,%eax
53e: 01 d0 add %edx,%eax
540: 01 c0 add %eax,%eax
542: 89 c2 mov %eax,%edx
544: 8b 45 08 mov 0x8(%ebp),%eax
547: 0f b6 00 movzbl (%eax),%eax
54a: 0f be c0 movsbl %al,%eax
54d: 01 d0 add %edx,%eax
54f: 83 e8 30 sub $0x30,%eax
552: 89 45 fc mov %eax,-0x4(%ebp)
555: 83 45 08 01 addl $0x1,0x8(%ebp)
atoi(const char *s)
{
int n;
n = 0;
while('0' <= *s && *s <= '9')
559: 8b 45 08 mov 0x8(%ebp),%eax
55c: 0f b6 00 movzbl (%eax),%eax
55f: 3c 2f cmp $0x2f,%al
561: 7e 0a jle 56d <atoi+0x46>
563: 8b 45 08 mov 0x8(%ebp),%eax
566: 0f b6 00 movzbl (%eax),%eax
569: 3c 39 cmp $0x39,%al
56b: 7e c9 jle 536 <atoi+0xf>
n = n*10 + *s++ - '0';
return n;
56d: 8b 45 fc mov -0x4(%ebp),%eax
}
570: c9 leave
571: c3 ret
00000572 <memmove>:
void*
memmove(void *vdst, void *vsrc, int n)
{
572: 55 push %ebp
573: 89 e5 mov %esp,%ebp
575: 83 ec 10 sub $0x10,%esp
char *dst, *src;
dst = vdst;
578: 8b 45 08 mov 0x8(%ebp),%eax
57b: 89 45 fc mov %eax,-0x4(%ebp)
src = vsrc;
57e: 8b 45 0c mov 0xc(%ebp),%eax
581: 89 45 f8 mov %eax,-0x8(%ebp)
while(n-- > 0)
584: eb 13 jmp 599 <memmove+0x27>
*dst++ = *src++;
586: 8b 45 f8 mov -0x8(%ebp),%eax
589: 0f b6 10 movzbl (%eax),%edx
58c: 8b 45 fc mov -0x4(%ebp),%eax
58f: 88 10 mov %dl,(%eax)
591: 83 45 fc 01 addl $0x1,-0x4(%ebp)
595: 83 45 f8 01 addl $0x1,-0x8(%ebp)
{
char *dst, *src;
dst = vdst;
src = vsrc;
while(n-- > 0)
599: 83 7d 10 00 cmpl $0x0,0x10(%ebp)
59d: 0f 9f c0 setg %al
5a0: 83 6d 10 01 subl $0x1,0x10(%ebp)
5a4: 84 c0 test %al,%al
5a6: 75 de jne 586 <memmove+0x14>
*dst++ = *src++;
return vdst;
5a8: 8b 45 08 mov 0x8(%ebp),%eax
}
5ab: c9 leave
5ac: c3 ret
5ad: 90 nop
5ae: 90 nop
5af: 90 nop
000005b0 <fork>:
name: \
movl $SYS_ ## name, %eax; \
int $T_SYSCALL; \
ret
SYSCALL(fork)
5b0: b8 01 00 00 00 mov $0x1,%eax
5b5: cd 40 int $0x40
5b7: c3 ret
000005b8 <exit>:
SYSCALL(exit)
5b8: b8 02 00 00 00 mov $0x2,%eax
5bd: cd 40 int $0x40
5bf: c3 ret
000005c0 <wait>:
SYSCALL(wait)
5c0: b8 03 00 00 00 mov $0x3,%eax
5c5: cd 40 int $0x40
5c7: c3 ret
000005c8 <pipe>:
SYSCALL(pipe)
5c8: b8 04 00 00 00 mov $0x4,%eax
5cd: cd 40 int $0x40
5cf: c3 ret
000005d0 <read>:
SYSCALL(read)
5d0: b8 05 00 00 00 mov $0x5,%eax
5d5: cd 40 int $0x40
5d7: c3 ret
000005d8 <write>:
SYSCALL(write)
5d8: b8 12 00 00 00 mov $0x12,%eax
5dd: cd 40 int $0x40
5df: c3 ret
000005e0 <close>:
SYSCALL(close)
5e0: b8 17 00 00 00 mov $0x17,%eax
5e5: cd 40 int $0x40
5e7: c3 ret
000005e8 <kill>:
SYSCALL(kill)
5e8: b8 06 00 00 00 mov $0x6,%eax
5ed: cd 40 int $0x40
5ef: c3 ret
000005f0 <exec>:
SYSCALL(exec)
5f0: b8 07 00 00 00 mov $0x7,%eax
5f5: cd 40 int $0x40
5f7: c3 ret
000005f8 <open>:
SYSCALL(open)
5f8: b8 11 00 00 00 mov $0x11,%eax
5fd: cd 40 int $0x40
5ff: c3 ret
00000600 <mknod>:
SYSCALL(mknod)
600: b8 13 00 00 00 mov $0x13,%eax
605: cd 40 int $0x40
607: c3 ret
00000608 <unlink>:
SYSCALL(unlink)
608: b8 14 00 00 00 mov $0x14,%eax
60d: cd 40 int $0x40
60f: c3 ret
00000610 <fstat>:
SYSCALL(fstat)
610: b8 08 00 00 00 mov $0x8,%eax
615: cd 40 int $0x40
617: c3 ret
00000618 <link>:
SYSCALL(link)
618: b8 15 00 00 00 mov $0x15,%eax
61d: cd 40 int $0x40
61f: c3 ret
00000620 <mkdir>:
SYSCALL(mkdir)
620: b8 16 00 00 00 mov $0x16,%eax
625: cd 40 int $0x40
627: c3 ret
00000628 <chdir>:
SYSCALL(chdir)
628: b8 09 00 00 00 mov $0x9,%eax
62d: cd 40 int $0x40
62f: c3 ret
00000630 <dup>:
SYSCALL(dup)
630: b8 0a 00 00 00 mov $0xa,%eax
635: cd 40 int $0x40
637: c3 ret
00000638 <getpid>:
SYSCALL(getpid)
638: b8 0b 00 00 00 mov $0xb,%eax
63d: cd 40 int $0x40
63f: c3 ret
00000640 <sbrk>:
SYSCALL(sbrk)
640: b8 0c 00 00 00 mov $0xc,%eax
645: cd 40 int $0x40
647: c3 ret
00000648 <sleep>:
SYSCALL(sleep)
648: b8 0d 00 00 00 mov $0xd,%eax
64d: cd 40 int $0x40
64f: c3 ret
00000650 <uptime>:
SYSCALL(uptime)
650: b8 0e 00 00 00 mov $0xe,%eax
655: cd 40 int $0x40
657: c3 ret
00000658 <procstat>:
# Modificado declaramos una nueva llamada al sistema
SYSCALL(procstat)
658: b8 0f 00 00 00 mov $0xf,%eax
65d: cd 40 int $0x40
65f: c3 ret
00000660 <set_priority>:
# Modificado declaramos una nueva llamada al sistema
SYSCALL(set_priority)
660: b8 10 00 00 00 mov $0x10,%eax
665: cd 40 int $0x40
667: c3 ret
00000668 <putc>:
#include "stat.h"
#include "user.h"
static void
putc(int fd, char c)
{
668: 55 push %ebp
669: 89 e5 mov %esp,%ebp
66b: 83 ec 28 sub $0x28,%esp
66e: 8b 45 0c mov 0xc(%ebp),%eax
671: 88 45 f4 mov %al,-0xc(%ebp)
write(fd, &c, 1);
674: c7 44 24 08 01 00 00 movl $0x1,0x8(%esp)
67b: 00
67c: 8d 45 f4 lea -0xc(%ebp),%eax
67f: 89 44 24 04 mov %eax,0x4(%esp)
683: 8b 45 08 mov 0x8(%ebp),%eax
686: 89 04 24 mov %eax,(%esp)
689: e8 4a ff ff ff call 5d8 <write>
}
68e: c9 leave
68f: c3 ret
00000690 <printint>:
static void
printint(int fd, int xx, int base, int sgn)
{
690: 55 push %ebp
691: 89 e5 mov %esp,%ebp
693: 83 ec 48 sub $0x48,%esp
static char digits[] = "0123456789ABCDEF";
char buf[16];
int i, neg;
uint x;
neg = 0;
696: c7 45 f0 00 00 00 00 movl $0x0,-0x10(%ebp)
if(sgn && xx < 0){
69d: 83 7d 14 00 cmpl $0x0,0x14(%ebp)
6a1: 74 17 je 6ba <printint+0x2a>
6a3: 83 7d 0c 00 cmpl $0x0,0xc(%ebp)
6a7: 79 11 jns 6ba <printint+0x2a>
neg = 1;
6a9: c7 45 f0 01 00 00 00 movl $0x1,-0x10(%ebp)
x = -xx;
6b0: 8b 45 0c mov 0xc(%ebp),%eax
6b3: f7 d8 neg %eax
6b5: 89 45 ec mov %eax,-0x14(%ebp)
6b8: eb 06 jmp 6c0 <printint+0x30>
} else {
x = xx;
6ba: 8b 45 0c mov 0xc(%ebp),%eax
6bd: 89 45 ec mov %eax,-0x14(%ebp)
}
i = 0;
6c0: c7 45 f4 00 00 00 00 movl $0x0,-0xc(%ebp)
do{
buf[i++] = digits[x % base];
6c7: 8b 4d 10 mov 0x10(%ebp),%ecx
6ca: 8b 45 ec mov -0x14(%ebp),%eax
6cd: ba 00 00 00 00 mov $0x0,%edx
6d2: f7 f1 div %ecx
6d4: 89 d0 mov %edx,%eax
6d6: 0f b6 90 e4 0d 00 00 movzbl 0xde4(%eax),%edx
6dd: 8d 45 dc lea -0x24(%ebp),%eax
6e0: 03 45 f4 add -0xc(%ebp),%eax
6e3: 88 10 mov %dl,(%eax)
6e5: 83 45 f4 01 addl $0x1,-0xc(%ebp)
}while((x /= base) != 0);
6e9: 8b 55 10 mov 0x10(%ebp),%edx
6ec: 89 55 d4 mov %edx,-0x2c(%ebp)
6ef: 8b 45 ec mov -0x14(%ebp),%eax
6f2: ba 00 00 00 00 mov $0x0,%edx
6f7: f7 75 d4 divl -0x2c(%ebp)
6fa: 89 45 ec mov %eax,-0x14(%ebp)
6fd: 83 7d ec 00 cmpl $0x0,-0x14(%ebp)
701: 75 c4 jne 6c7 <printint+0x37>
if(neg)
703: 83 7d f0 00 cmpl $0x0,-0x10(%ebp)
707: 74 2a je 733 <printint+0xa3>
buf[i++] = '-';
709: 8d 45 dc lea -0x24(%ebp),%eax
70c: 03 45 f4 add -0xc(%ebp),%eax
70f: c6 00 2d movb $0x2d,(%eax)
712: 83 45 f4 01 addl $0x1,-0xc(%ebp)
while(--i >= 0)
716: eb 1b jmp 733 <printint+0xa3>
putc(fd, buf[i]);
718: 8d 45 dc lea -0x24(%ebp),%eax
71b: 03 45 f4 add -0xc(%ebp),%eax
71e: 0f b6 00 movzbl (%eax),%eax
721: 0f be c0 movsbl %al,%eax
724: 89 44 24 04 mov %eax,0x4(%esp)
728: 8b 45 08 mov 0x8(%ebp),%eax
72b: 89 04 24 mov %eax,(%esp)
72e: e8 35 ff ff ff call 668 <putc>
buf[i++] = digits[x % base];
}while((x /= base) != 0);
if(neg)
buf[i++] = '-';
while(--i >= 0)
733: 83 6d f4 01 subl $0x1,-0xc(%ebp)
737: 83 7d f4 00 cmpl $0x0,-0xc(%ebp)
73b: 79 db jns 718 <printint+0x88>
putc(fd, buf[i]);
}
73d: c9 leave
73e: c3 ret
0000073f <printf>:
// Print to the given fd. Only understands %d, %x, %p, %s.
void
printf(int fd, char *fmt, ...)
{
73f: 55 push %ebp
740: 89 e5 mov %esp,%ebp
742: 83 ec 38 sub $0x38,%esp
char *s;
int c, i, state;
uint *ap;
state = 0;
745: c7 45 ec 00 00 00 00 movl $0x0,-0x14(%ebp)
ap = (uint*)(void*)&fmt + 1;
74c: 8d 45 0c lea 0xc(%ebp),%eax
74f: 83 c0 04 add $0x4,%eax
752: 89 45 e8 mov %eax,-0x18(%ebp)
for(i = 0; fmt[i]; i++){
755: c7 45 f0 00 00 00 00 movl $0x0,-0x10(%ebp)
75c: e9 7d 01 00 00 jmp 8de <printf+0x19f>
c = fmt[i] & 0xff;
761: 8b 55 0c mov 0xc(%ebp),%edx
764: 8b 45 f0 mov -0x10(%ebp),%eax
767: 01 d0 add %edx,%eax
769: 0f b6 00 movzbl (%eax),%eax
76c: 0f be c0 movsbl %al,%eax
76f: 25 ff 00 00 00 and $0xff,%eax
774: 89 45 e4 mov %eax,-0x1c(%ebp)
if(state == 0){
777: 83 7d ec 00 cmpl $0x0,-0x14(%ebp)
77b: 75 2c jne 7a9 <printf+0x6a>
if(c == '%'){
77d: 83 7d e4 25 cmpl $0x25,-0x1c(%ebp)
781: 75 0c jne 78f <printf+0x50>
state = '%';
783: c7 45 ec 25 00 00 00 movl $0x25,-0x14(%ebp)
78a: e9 4b 01 00 00 jmp 8da <printf+0x19b>
} else {
putc(fd, c);
78f: 8b 45 e4 mov -0x1c(%ebp),%eax
792: 0f be c0 movsbl %al,%eax
795: 89 44 24 04 mov %eax,0x4(%esp)
799: 8b 45 08 mov 0x8(%ebp),%eax
79c: 89 04 24 mov %eax,(%esp)
79f: e8 c4 fe ff ff call 668 <putc>
7a4: e9 31 01 00 00 jmp 8da <printf+0x19b>
}
} else if(state == '%'){
7a9: 83 7d ec 25 cmpl $0x25,-0x14(%ebp)
7ad: 0f 85 27 01 00 00 jne 8da <printf+0x19b>
if(c == 'd'){
7b3: 83 7d e4 64 cmpl $0x64,-0x1c(%ebp)
7b7: 75 2d jne 7e6 <printf+0xa7>
printint(fd, *ap, 10, 1);
7b9: 8b 45 e8 mov -0x18(%ebp),%eax
7bc: 8b 00 mov (%eax),%eax
7be: c7 44 24 0c 01 00 00 movl $0x1,0xc(%esp)
7c5: 00
7c6: c7 44 24 08 0a 00 00 movl $0xa,0x8(%esp)
7cd: 00
7ce: 89 44 24 04 mov %eax,0x4(%esp)
7d2: 8b 45 08 mov 0x8(%ebp),%eax
7d5: 89 04 24 mov %eax,(%esp)
7d8: e8 b3 fe ff ff call 690 <printint>
ap++;
7dd: 83 45 e8 04 addl $0x4,-0x18(%ebp)
7e1: e9 ed 00 00 00 jmp 8d3 <printf+0x194>
} else if(c == 'x' || c == 'p'){
7e6: 83 7d e4 78 cmpl $0x78,-0x1c(%ebp)
7ea: 74 06 je 7f2 <printf+0xb3>
7ec: 83 7d e4 70 cmpl $0x70,-0x1c(%ebp)
7f0: 75 2d jne 81f <printf+0xe0>
printint(fd, *ap, 16, 0);
7f2: 8b 45 e8 mov -0x18(%ebp),%eax
7f5: 8b 00 mov (%eax),%eax
7f7: c7 44 24 0c 00 00 00 movl $0x0,0xc(%esp)
7fe: 00
7ff: c7 44 24 08 10 00 00 movl $0x10,0x8(%esp)
806: 00
807: 89 44 24 04 mov %eax,0x4(%esp)
80b: 8b 45 08 mov 0x8(%ebp),%eax
80e: 89 04 24 mov %eax,(%esp)
811: e8 7a fe ff ff call 690 <printint>
ap++;
816: 83 45 e8 04 addl $0x4,-0x18(%ebp)
81a: e9 b4 00 00 00 jmp 8d3 <printf+0x194>
} else if(c == 's'){
81f: 83 7d e4 73 cmpl $0x73,-0x1c(%ebp)
823: 75 46 jne 86b <printf+0x12c>
s = (char*)*ap;
825: 8b 45 e8 mov -0x18(%ebp),%eax
828: 8b 00 mov (%eax),%eax
82a: 89 45 f4 mov %eax,-0xc(%ebp)
ap++;
82d: 83 45 e8 04 addl $0x4,-0x18(%ebp)
if(s == 0)
831: 83 7d f4 00 cmpl $0x0,-0xc(%ebp)
835: 75 27 jne 85e <printf+0x11f>
s = "(null)";
837: c7 45 f4 4d 0b 00 00 movl $0xb4d,-0xc(%ebp)
while(*s != 0){
83e: eb 1e jmp 85e <printf+0x11f>
putc(fd, *s);
840: 8b 45 f4 mov -0xc(%ebp),%eax
843: 0f b6 00 movzbl (%eax),%eax
846: 0f be c0 movsbl %al,%eax
849: 89 44 24 04 mov %eax,0x4(%esp)
84d: 8b 45 08 mov 0x8(%ebp),%eax
850: 89 04 24 mov %eax,(%esp)
853: e8 10 fe ff ff call 668 <putc>
s++;
858: 83 45 f4 01 addl $0x1,-0xc(%ebp)
85c: eb 01 jmp 85f <printf+0x120>
} else if(c == 's'){
s = (char*)*ap;
ap++;
if(s == 0)
s = "(null)";
while(*s != 0){
85e: 90 nop
85f: 8b 45 f4 mov -0xc(%ebp),%eax
862: 0f b6 00 movzbl (%eax),%eax
865: 84 c0 test %al,%al
867: 75 d7 jne 840 <printf+0x101>
869: eb 68 jmp 8d3 <printf+0x194>
putc(fd, *s);
s++;
}
} else if(c == 'c'){
86b: 83 7d e4 63 cmpl $0x63,-0x1c(%ebp)
86f: 75 1d jne 88e <printf+0x14f>
putc(fd, *ap);
871: 8b 45 e8 mov -0x18(%ebp),%eax
874: 8b 00 mov (%eax),%eax
876: 0f be c0 movsbl %al,%eax
879: 89 44 24 04 mov %eax,0x4(%esp)
87d: 8b 45 08 mov 0x8(%ebp),%eax
880: 89 04 24 mov %eax,(%esp)
883: e8 e0 fd ff ff call 668 <putc>
ap++;
888: 83 45 e8 04 addl $0x4,-0x18(%ebp)
88c: eb 45 jmp 8d3 <printf+0x194>
} else if(c == '%'){
88e: 83 7d e4 25 cmpl $0x25,-0x1c(%ebp)
892: 75 17 jne 8ab <printf+0x16c>
putc(fd, c);
894: 8b 45 e4 mov -0x1c(%ebp),%eax
897: 0f be c0 movsbl %al,%eax
89a: 89 44 24 04 mov %eax,0x4(%esp)
89e: 8b 45 08 mov 0x8(%ebp),%eax
8a1: 89 04 24 mov %eax,(%esp)
8a4: e8 bf fd ff ff call 668 <putc>
8a9: eb 28 jmp 8d3 <printf+0x194>
} else {
// Unknown % sequence. Print it to draw attention.
putc(fd, '%');
8ab: c7 44 24 04 25 00 00 movl $0x25,0x4(%esp)
8b2: 00
8b3: 8b 45 08 mov 0x8(%ebp),%eax
8b6: 89 04 24 mov %eax,(%esp)
8b9: e8 aa fd ff ff call 668 <putc>
putc(fd, c);
8be: 8b 45 e4 mov -0x1c(%ebp),%eax
8c1: 0f be c0 movsbl %al,%eax
8c4: 89 44 24 04 mov %eax,0x4(%esp)
8c8: 8b 45 08 mov 0x8(%ebp),%eax
8cb: 89 04 24 mov %eax,(%esp)
8ce: e8 95 fd ff ff call 668 <putc>
}
state = 0;
8d3: c7 45 ec 00 00 00 00 movl $0x0,-0x14(%ebp)
int c, i, state;
uint *ap;
state = 0;
ap = (uint*)(void*)&fmt + 1;
for(i = 0; fmt[i]; i++){
8da: 83 45 f0 01 addl $0x1,-0x10(%ebp)
8de: 8b 55 0c mov 0xc(%ebp),%edx
8e1: 8b 45 f0 mov -0x10(%ebp),%eax
8e4: 01 d0 add %edx,%eax
8e6: 0f b6 00 movzbl (%eax),%eax
8e9: 84 c0 test %al,%al
8eb: 0f 85 70 fe ff ff jne 761 <printf+0x22>
putc(fd, c);
}
state = 0;
}
}
}
8f1: c9 leave
8f2: c3 ret
8f3: 90 nop
000008f4 <free>:
static Header base;
static Header *freep;
void
free(void *ap)
{
8f4: 55 push %ebp
8f5: 89 e5 mov %esp,%ebp
8f7: 83 ec 10 sub $0x10,%esp
Header *bp, *p;
bp = (Header*)ap - 1;
8fa: 8b 45 08 mov 0x8(%ebp),%eax
8fd: 83 e8 08 sub $0x8,%eax
900: 89 45 f8 mov %eax,-0x8(%ebp)
for(p = freep; !(bp > p && bp < p->s.ptr); p = p->s.ptr)
903: a1 10 0e 00 00 mov 0xe10,%eax
908: 89 45 fc mov %eax,-0x4(%ebp)
90b: eb 24 jmp 931 <free+0x3d>
if(p >= p->s.ptr && (bp > p || bp < p->s.ptr))
90d: 8b 45 fc mov -0x4(%ebp),%eax
910: 8b 00 mov (%eax),%eax
912: 3b 45 fc cmp -0x4(%ebp),%eax
915: 77 12 ja 929 <free+0x35>
917: 8b 45 f8 mov -0x8(%ebp),%eax
91a: 3b 45 fc cmp -0x4(%ebp),%eax
91d: 77 24 ja 943 <free+0x4f>
91f: 8b 45 fc mov -0x4(%ebp),%eax
922: 8b 00 mov (%eax),%eax
924: 3b 45 f8 cmp -0x8(%ebp),%eax
927: 77 1a ja 943 <free+0x4f>
free(void *ap)
{
Header *bp, *p;
bp = (Header*)ap - 1;
for(p = freep; !(bp > p && bp < p->s.ptr); p = p->s.ptr)
929: 8b 45 fc mov -0x4(%ebp),%eax
92c: 8b 00 mov (%eax),%eax
92e: 89 45 fc mov %eax,-0x4(%ebp)
931: 8b 45 f8 mov -0x8(%ebp),%eax
934: 3b 45 fc cmp -0x4(%ebp),%eax
937: 76 d4 jbe 90d <free+0x19>
939: 8b 45 fc mov -0x4(%ebp),%eax
93c: 8b 00 mov (%eax),%eax
93e: 3b 45 f8 cmp -0x8(%ebp),%eax
941: 76 ca jbe 90d <free+0x19>
if(p >= p->s.ptr && (bp > p || bp < p->s.ptr))
break;
if(bp + bp->s.size == p->s.ptr){
943: 8b 45 f8 mov -0x8(%ebp),%eax
946: 8b 40 04 mov 0x4(%eax),%eax
949: c1 e0 03 shl $0x3,%eax
94c: 89 c2 mov %eax,%edx
94e: 03 55 f8 add -0x8(%ebp),%edx
951: 8b 45 fc mov -0x4(%ebp),%eax
954: 8b 00 mov (%eax),%eax
956: 39 c2 cmp %eax,%edx
958: 75 24 jne 97e <free+0x8a>
bp->s.size += p->s.ptr->s.size;
95a: 8b 45 f8 mov -0x8(%ebp),%eax
95d: 8b 50 04 mov 0x4(%eax),%edx
960: 8b 45 fc mov -0x4(%ebp),%eax
963: 8b 00 mov (%eax),%eax
965: 8b 40 04 mov 0x4(%eax),%eax
968: 01 c2 add %eax,%edx
96a: 8b 45 f8 mov -0x8(%ebp),%eax
96d: 89 50 04 mov %edx,0x4(%eax)
bp->s.ptr = p->s.ptr->s.ptr;
970: 8b 45 fc mov -0x4(%ebp),%eax
973: 8b 00 mov (%eax),%eax
975: 8b 10 mov (%eax),%edx
977: 8b 45 f8 mov -0x8(%ebp),%eax
97a: 89 10 mov %edx,(%eax)
97c: eb 0a jmp 988 <free+0x94>
} else
bp->s.ptr = p->s.ptr;
97e: 8b 45 fc mov -0x4(%ebp),%eax
981: 8b 10 mov (%eax),%edx
983: 8b 45 f8 mov -0x8(%ebp),%eax
986: 89 10 mov %edx,(%eax)
if(p + p->s.size == bp){
988: 8b 45 fc mov -0x4(%ebp),%eax
98b: 8b 40 04 mov 0x4(%eax),%eax
98e: c1 e0 03 shl $0x3,%eax
991: 03 45 fc add -0x4(%ebp),%eax
994: 3b 45 f8 cmp -0x8(%ebp),%eax
997: 75 20 jne 9b9 <free+0xc5>
p->s.size += bp->s.size;
999: 8b 45 fc mov -0x4(%ebp),%eax
99c: 8b 50 04 mov 0x4(%eax),%edx
99f: 8b 45 f8 mov -0x8(%ebp),%eax
9a2: 8b 40 04 mov 0x4(%eax),%eax
9a5: 01 c2 add %eax,%edx
9a7: 8b 45 fc mov -0x4(%ebp),%eax
9aa: 89 50 04 mov %edx,0x4(%eax)
p->s.ptr = bp->s.ptr;
9ad: 8b 45 f8 mov -0x8(%ebp),%eax
9b0: 8b 10 mov (%eax),%edx
9b2: 8b 45 fc mov -0x4(%ebp),%eax
9b5: 89 10 mov %edx,(%eax)
9b7: eb 08 jmp 9c1 <free+0xcd>
} else
p->s.ptr = bp;
9b9: 8b 45 fc mov -0x4(%ebp),%eax
9bc: 8b 55 f8 mov -0x8(%ebp),%edx
9bf: 89 10 mov %edx,(%eax)
freep = p;
9c1: 8b 45 fc mov -0x4(%ebp),%eax
9c4: a3 10 0e 00 00 mov %eax,0xe10
}
9c9: c9 leave
9ca: c3 ret
000009cb <morecore>:
static Header*
morecore(uint nu)
{
9cb: 55 push %ebp
9cc: 89 e5 mov %esp,%ebp
9ce: 83 ec 28 sub $0x28,%esp
char *p;
Header *hp;
if(nu < 4096)
9d1: 81 7d 08 ff 0f 00 00 cmpl $0xfff,0x8(%ebp)
9d8: 77 07 ja 9e1 <morecore+0x16>
nu = 4096;
9da: c7 45 08 00 10 00 00 movl $0x1000,0x8(%ebp)
p = sbrk(nu * sizeof(Header));
9e1: 8b 45 08 mov 0x8(%ebp),%eax
9e4: c1 e0 03 shl $0x3,%eax
9e7: 89 04 24 mov %eax,(%esp)
9ea: e8 51 fc ff ff call 640 <sbrk>
9ef: 89 45 f4 mov %eax,-0xc(%ebp)
if(p == (char*)-1)
9f2: 83 7d f4 ff cmpl $0xffffffff,-0xc(%ebp)
9f6: 75 07 jne 9ff <morecore+0x34>
return 0;
9f8: b8 00 00 00 00 mov $0x0,%eax
9fd: eb 22 jmp a21 <morecore+0x56>
hp = (Header*)p;
9ff: 8b 45 f4 mov -0xc(%ebp),%eax
a02: 89 45 f0 mov %eax,-0x10(%ebp)
hp->s.size = nu;
a05: 8b 45 f0 mov -0x10(%ebp),%eax
a08: 8b 55 08 mov 0x8(%ebp),%edx
a0b: 89 50 04 mov %edx,0x4(%eax)
free((void*)(hp + 1));
a0e: 8b 45 f0 mov -0x10(%ebp),%eax
a11: 83 c0 08 add $0x8,%eax
a14: 89 04 24 mov %eax,(%esp)
a17: e8 d8 fe ff ff call 8f4 <free>
return freep;
a1c: a1 10 0e 00 00 mov 0xe10,%eax
}
a21: c9 leave
a22: c3 ret
00000a23 <malloc>:
void*
malloc(uint nbytes)
{
a23: 55 push %ebp
a24: 89 e5 mov %esp,%ebp
a26: 83 ec 28 sub $0x28,%esp
Header *p, *prevp;
uint nunits;
nunits = (nbytes + sizeof(Header) - 1)/sizeof(Header) + 1;
a29: 8b 45 08 mov 0x8(%ebp),%eax
a2c: 83 c0 07 add $0x7,%eax
a2f: c1 e8 03 shr $0x3,%eax
a32: 83 c0 01 add $0x1,%eax
a35: 89 45 ec mov %eax,-0x14(%ebp)
if((prevp = freep) == 0){
a38: a1 10 0e 00 00 mov 0xe10,%eax
a3d: 89 45 f0 mov %eax,-0x10(%ebp)
a40: 83 7d f0 00 cmpl $0x0,-0x10(%ebp)
a44: 75 23 jne a69 <malloc+0x46>
base.s.ptr = freep = prevp = &base;
a46: c7 45 f0 08 0e 00 00 movl $0xe08,-0x10(%ebp)
a4d: 8b 45 f0 mov -0x10(%ebp),%eax
a50: a3 10 0e 00 00 mov %eax,0xe10
a55: a1 10 0e 00 00 mov 0xe10,%eax
a5a: a3 08 0e 00 00 mov %eax,0xe08
base.s.size = 0;
a5f: c7 05 0c 0e 00 00 00 movl $0x0,0xe0c
a66: 00 00 00
}
for(p = prevp->s.ptr; ; prevp = p, p = p->s.ptr){
a69: 8b 45 f0 mov -0x10(%ebp),%eax
a6c: 8b 00 mov (%eax),%eax
a6e: 89 45 f4 mov %eax,-0xc(%ebp)
if(p->s.size >= nunits){
a71: 8b 45 f4 mov -0xc(%ebp),%eax
a74: 8b 40 04 mov 0x4(%eax),%eax
a77: 3b 45 ec cmp -0x14(%ebp),%eax
a7a: 72 4d jb ac9 <malloc+0xa6>
if(p->s.size == nunits)
a7c: 8b 45 f4 mov -0xc(%ebp),%eax
a7f: 8b 40 04 mov 0x4(%eax),%eax
a82: 3b 45 ec cmp -0x14(%ebp),%eax
a85: 75 0c jne a93 <malloc+0x70>
prevp->s.ptr = p->s.ptr;
a87: 8b 45 f4 mov -0xc(%ebp),%eax
a8a: 8b 10 mov (%eax),%edx
a8c: 8b 45 f0 mov -0x10(%ebp),%eax
a8f: 89 10 mov %edx,(%eax)
a91: eb 26 jmp ab9 <malloc+0x96>
else {
p->s.size -= nunits;
a93: 8b 45 f4 mov -0xc(%ebp),%eax
a96: 8b 40 04 mov 0x4(%eax),%eax
a99: 89 c2 mov %eax,%edx
a9b: 2b 55 ec sub -0x14(%ebp),%edx
a9e: 8b 45 f4 mov -0xc(%ebp),%eax
aa1: 89 50 04 mov %edx,0x4(%eax)
p += p->s.size;
aa4: 8b 45 f4 mov -0xc(%ebp),%eax
aa7: 8b 40 04 mov 0x4(%eax),%eax
aaa: c1 e0 03 shl $0x3,%eax
aad: 01 45 f4 add %eax,-0xc(%ebp)
p->s.size = nunits;
ab0: 8b 45 f4 mov -0xc(%ebp),%eax
ab3: 8b 55 ec mov -0x14(%ebp),%edx
ab6: 89 50 04 mov %edx,0x4(%eax)
}
freep = prevp;
ab9: 8b 45 f0 mov -0x10(%ebp),%eax
abc: a3 10 0e 00 00 mov %eax,0xe10
return (void*)(p + 1);
ac1: 8b 45 f4 mov -0xc(%ebp),%eax
ac4: 83 c0 08 add $0x8,%eax
ac7: eb 38 jmp b01 <malloc+0xde>
}
if(p == freep)
ac9: a1 10 0e 00 00 mov 0xe10,%eax
ace: 39 45 f4 cmp %eax,-0xc(%ebp)
ad1: 75 1b jne aee <malloc+0xcb>
if((p = morecore(nunits)) == 0)
ad3: 8b 45 ec mov -0x14(%ebp),%eax
ad6: 89 04 24 mov %eax,(%esp)
ad9: e8 ed fe ff ff call 9cb <morecore>
ade: 89 45 f4 mov %eax,-0xc(%ebp)
ae1: 83 7d f4 00 cmpl $0x0,-0xc(%ebp)
ae5: 75 07 jne aee <malloc+0xcb>
return 0;
ae7: b8 00 00 00 00 mov $0x0,%eax
aec: eb 13 jmp b01 <malloc+0xde>
nunits = (nbytes + sizeof(Header) - 1)/sizeof(Header) + 1;
if((prevp = freep) == 0){
base.s.ptr = freep = prevp = &base;
base.s.size = 0;
}
for(p = prevp->s.ptr; ; prevp = p, p = p->s.ptr){
aee: 8b 45 f4 mov -0xc(%ebp),%eax
af1: 89 45 f0 mov %eax,-0x10(%ebp)
af4: 8b 45 f4 mov -0xc(%ebp),%eax
af7: 8b 00 mov (%eax),%eax
af9: 89 45 f4 mov %eax,-0xc(%ebp)
return (void*)(p + 1);
}
if(p == freep)
if((p = morecore(nunits)) == 0)
return 0;
}
afc: e9 70 ff ff ff jmp a71 <malloc+0x4e>
}
b01: c9 leave
b02: c3 ret
|
src/Compilers/CSharp/Portable/Generated/CSharp.Generated.g4 | solrevdev/roslyn | 0 | 2441 | // <auto-generated />
grammar csharp;
compilation_unit
: extern_alias_directive* using_directive* attribute_list* member_declaration*
;
extern_alias_directive
: 'extern' 'alias' identifier_token ';'
;
using_directive
: 'global'? 'using' ('static' | name_equals)? name ';'
;
name_equals
: identifier_name '='
;
identifier_name
: 'global'
| identifier_token
;
name
: alias_qualified_name
| qualified_name
| simple_name
;
alias_qualified_name
: identifier_name '::' simple_name
;
simple_name
: generic_name
| identifier_name
;
generic_name
: identifier_token type_argument_list
;
type_argument_list
: '<' (type (',' type)*)? '>'
;
qualified_name
: name '.' simple_name
;
attribute_list
: '[' attribute_target_specifier? attribute (',' attribute)* ']'
;
attribute_target_specifier
: syntax_token ':'
;
attribute
: name attribute_argument_list?
;
attribute_argument_list
: '(' (attribute_argument (',' attribute_argument)*)? ')'
;
attribute_argument
: (name_equals? | name_colon?) expression
;
name_colon
: identifier_name ':'
;
member_declaration
: base_field_declaration
| base_method_declaration
| base_property_declaration
| base_type_declaration
| delegate_declaration
| enum_member_declaration
| global_statement
| incomplete_member
| namespace_declaration
;
base_field_declaration
: event_field_declaration
| field_declaration
;
event_field_declaration
: attribute_list* modifier* 'event' variable_declaration ';'
;
modifier
: 'abstract'
| 'async'
| 'const'
| 'extern'
| 'fixed'
| 'internal'
| 'new'
| 'override'
| 'partial'
| 'private'
| 'protected'
| 'public'
| 'readonly'
| 'ref'
| 'sealed'
| 'static'
| 'unsafe'
| 'virtual'
| 'volatile'
;
variable_declaration
: type variable_declarator (',' variable_declarator)*
;
variable_declarator
: identifier_token bracketed_argument_list? equals_value_clause?
;
bracketed_argument_list
: '[' argument (',' argument)* ']'
;
argument
: name_colon? ('ref' | 'out' | 'in')? expression
;
equals_value_clause
: '=' expression
;
field_declaration
: attribute_list* modifier* variable_declaration ';'
;
base_method_declaration
: constructor_declaration
| conversion_operator_declaration
| destructor_declaration
| method_declaration
| operator_declaration
;
constructor_declaration
: attribute_list* modifier* identifier_token parameter_list constructor_initializer? (block | (arrow_expression_clause ';'))
;
parameter_list
: '(' (parameter (',' parameter)*)? ')'
;
parameter
: attribute_list* modifier* type? (identifier_token | '__arglist') equals_value_clause?
;
constructor_initializer
: ':' ('base' | 'this') argument_list
;
argument_list
: '(' (argument (',' argument)*)? ')'
;
block
: attribute_list* '{' statement* '}'
;
arrow_expression_clause
: '=>' expression
;
conversion_operator_declaration
: attribute_list* modifier* ('implicit' | 'explicit') 'operator' type parameter_list (block | (arrow_expression_clause ';'))
;
destructor_declaration
: attribute_list* modifier* '~' identifier_token parameter_list (block | (arrow_expression_clause ';'))
;
method_declaration
: attribute_list* modifier* type explicit_interface_specifier? identifier_token type_parameter_list? parameter_list type_parameter_constraint_clause* (block | (arrow_expression_clause ';'))
;
explicit_interface_specifier
: name '.'
;
type_parameter_list
: '<' type_parameter (',' type_parameter)* '>'
;
type_parameter
: attribute_list* ('in' | 'out')? identifier_token
;
type_parameter_constraint_clause
: 'where' identifier_name ':' type_parameter_constraint (',' type_parameter_constraint)*
;
type_parameter_constraint
: class_or_struct_constraint
| constructor_constraint
| default_constraint
| type_constraint
;
class_or_struct_constraint
: 'class' '?'?
| 'struct' '?'?
;
constructor_constraint
: 'new' '(' ')'
;
default_constraint
: 'default'
;
type_constraint
: type
;
operator_declaration
: attribute_list* modifier* type 'operator' ('+' | '-' | '!' | '~' | '++' | '--' | '*' | '/' | '%' | '<<' | '>>' | '|' | '&' | '^' | '==' | '!=' | '<' | '<=' | '>' | '>=' | 'false' | 'true' | 'is') parameter_list (block | (arrow_expression_clause ';'))
;
base_property_declaration
: event_declaration
| indexer_declaration
| property_declaration
;
event_declaration
: attribute_list* modifier* 'event' type explicit_interface_specifier? identifier_token (accessor_list | ';')
;
accessor_list
: '{' accessor_declaration* '}'
;
accessor_declaration
: attribute_list* modifier* ('get' | 'set' | 'init' | 'add' | 'remove' | identifier_token) (block | (arrow_expression_clause ';'))
;
indexer_declaration
: attribute_list* modifier* type explicit_interface_specifier? 'this' bracketed_parameter_list (accessor_list | (arrow_expression_clause ';'))
;
bracketed_parameter_list
: '[' parameter (',' parameter)* ']'
;
property_declaration
: attribute_list* modifier* type explicit_interface_specifier? identifier_token (accessor_list | ((arrow_expression_clause | equals_value_clause) ';'))
;
base_type_declaration
: enum_declaration
| type_declaration
;
enum_declaration
: attribute_list* modifier* 'enum' identifier_token base_list? '{' (enum_member_declaration (',' enum_member_declaration)* ','?)? '}' ';'?
;
base_list
: ':' base_type (',' base_type)*
;
base_type
: primary_constructor_base_type
| simple_base_type
;
primary_constructor_base_type
: type argument_list
;
simple_base_type
: type
;
enum_member_declaration
: attribute_list* modifier* identifier_token equals_value_clause?
;
type_declaration
: class_declaration
| interface_declaration
| record_declaration
| struct_declaration
;
class_declaration
: attribute_list* modifier* 'class' identifier_token type_parameter_list? base_list? type_parameter_constraint_clause* '{' member_declaration* '}' ';'?
;
interface_declaration
: attribute_list* modifier* 'interface' identifier_token type_parameter_list? base_list? type_parameter_constraint_clause* '{' member_declaration* '}' ';'?
;
record_declaration
: attribute_list* modifier* syntax_token ('class' | 'struct')? identifier_token type_parameter_list? parameter_list? base_list? type_parameter_constraint_clause* '{'? member_declaration* '}'? ';'?
;
struct_declaration
: attribute_list* modifier* 'struct' identifier_token type_parameter_list? base_list? type_parameter_constraint_clause* '{' member_declaration* '}' ';'?
;
delegate_declaration
: attribute_list* modifier* 'delegate' type identifier_token type_parameter_list? parameter_list type_parameter_constraint_clause* ';'
;
global_statement
: attribute_list* modifier* statement
;
incomplete_member
: attribute_list* modifier* type?
;
namespace_declaration
: attribute_list* modifier* 'namespace' name '{' extern_alias_directive* using_directive* member_declaration* '}' ';'?
;
type
: array_type
| function_pointer_type
| name
| nullable_type
| omitted_type_argument
| pointer_type
| predefined_type
| ref_type
| tuple_type
;
array_type
: type array_rank_specifier+
;
array_rank_specifier
: '[' (expression (',' expression)*)? ']'
;
function_pointer_type
: 'delegate' '*' function_pointer_calling_convention? function_pointer_parameter_list
;
function_pointer_calling_convention
: 'managed' function_pointer_unmanaged_calling_convention_list?
| 'unmanaged' function_pointer_unmanaged_calling_convention_list?
;
function_pointer_unmanaged_calling_convention_list
: '[' function_pointer_unmanaged_calling_convention (',' function_pointer_unmanaged_calling_convention)* ']'
;
function_pointer_unmanaged_calling_convention
: identifier_token
;
function_pointer_parameter_list
: '<' function_pointer_parameter (',' function_pointer_parameter)* '>'
;
function_pointer_parameter
: attribute_list* modifier* type
;
nullable_type
: type '?'
;
omitted_type_argument
: /* epsilon */
;
pointer_type
: type '*'
;
predefined_type
: 'bool'
| 'byte'
| 'char'
| 'decimal'
| 'double'
| 'float'
| 'int'
| 'long'
| 'object'
| 'sbyte'
| 'short'
| 'string'
| 'uint'
| 'ulong'
| 'ushort'
| 'void'
;
ref_type
: 'ref' 'readonly'? type
;
tuple_type
: '(' tuple_element (',' tuple_element)+ ')'
;
tuple_element
: type identifier_token?
;
statement
: block
| break_statement
| checked_statement
| common_for_each_statement
| continue_statement
| do_statement
| empty_statement
| expression_statement
| fixed_statement
| for_statement
| goto_statement
| if_statement
| labeled_statement
| local_declaration_statement
| local_function_statement
| lock_statement
| return_statement
| switch_statement
| throw_statement
| try_statement
| unsafe_statement
| using_statement
| while_statement
| yield_statement
;
break_statement
: attribute_list* 'break' ';'
;
checked_statement
: attribute_list* ('checked' | 'unchecked') block
;
common_for_each_statement
: for_each_statement
| for_each_variable_statement
;
for_each_statement
: attribute_list* 'await'? 'foreach' '(' type identifier_token 'in' expression ')' statement
;
for_each_variable_statement
: attribute_list* 'await'? 'foreach' '(' expression 'in' expression ')' statement
;
continue_statement
: attribute_list* 'continue' ';'
;
do_statement
: attribute_list* 'do' statement 'while' '(' expression ')' ';'
;
empty_statement
: attribute_list* ';'
;
expression_statement
: attribute_list* expression ';'
;
fixed_statement
: attribute_list* 'fixed' '(' variable_declaration ')' statement
;
for_statement
: attribute_list* 'for' '(' (variable_declaration? | (expression (',' expression)*)?) ';' expression? ';' (expression (',' expression)*)? ')' statement
;
goto_statement
: attribute_list* 'goto' ('case' | 'default')? expression? ';'
;
if_statement
: attribute_list* 'if' '(' expression ')' statement else_clause?
;
else_clause
: 'else' statement
;
labeled_statement
: attribute_list* identifier_token ':' statement
;
local_declaration_statement
: attribute_list* 'await'? 'using'? modifier* variable_declaration ';'
;
local_function_statement
: attribute_list* modifier* type identifier_token type_parameter_list? parameter_list type_parameter_constraint_clause* (block | (arrow_expression_clause ';'))
;
lock_statement
: attribute_list* 'lock' '(' expression ')' statement
;
return_statement
: attribute_list* 'return' expression? ';'
;
switch_statement
: attribute_list* 'switch' '('? expression ')'? '{' switch_section* '}'
;
switch_section
: switch_label+ statement+
;
switch_label
: case_pattern_switch_label
| case_switch_label
| default_switch_label
;
case_pattern_switch_label
: 'case' pattern when_clause? ':'
;
pattern
: binary_pattern
| constant_pattern
| declaration_pattern
| discard_pattern
| parenthesized_pattern
| recursive_pattern
| relational_pattern
| type_pattern
| unary_pattern
| var_pattern
;
binary_pattern
: pattern ('or' | 'and') pattern
;
constant_pattern
: expression
;
declaration_pattern
: type variable_designation
;
variable_designation
: discard_designation
| parenthesized_variable_designation
| single_variable_designation
;
discard_designation
: '_'
;
parenthesized_variable_designation
: '(' (variable_designation (',' variable_designation)*)? ')'
;
single_variable_designation
: identifier_token
;
discard_pattern
: '_'
;
parenthesized_pattern
: '(' pattern ')'
;
recursive_pattern
: type? positional_pattern_clause? property_pattern_clause? variable_designation?
;
positional_pattern_clause
: '(' (subpattern (',' subpattern)*)? ')'
;
subpattern
: base_expression_colon? pattern
;
base_expression_colon
: expression_colon
| name_colon
;
expression_colon
: expression ':'
;
property_pattern_clause
: '{' (subpattern (',' subpattern)* ','?)? '}'
;
relational_pattern
: '!=' expression
| '<' expression
| '<=' expression
| '==' expression
| '>' expression
| '>=' expression
;
type_pattern
: type
;
unary_pattern
: 'not' pattern
;
var_pattern
: 'var' variable_designation
;
when_clause
: 'when' expression
;
case_switch_label
: 'case' expression ':'
;
default_switch_label
: 'default' ':'
;
throw_statement
: attribute_list* 'throw' expression? ';'
;
try_statement
: attribute_list* 'try' block catch_clause* finally_clause?
;
catch_clause
: 'catch' catch_declaration? catch_filter_clause? block
;
catch_declaration
: '(' type identifier_token? ')'
;
catch_filter_clause
: 'when' '(' expression ')'
;
finally_clause
: 'finally' block
;
unsafe_statement
: attribute_list* 'unsafe' block
;
using_statement
: attribute_list* 'await'? 'using' '(' (variable_declaration | expression) ')' statement
;
while_statement
: attribute_list* 'while' '(' expression ')' statement
;
yield_statement
: attribute_list* 'yield' ('return' | 'break') expression? ';'
;
expression
: anonymous_function_expression
| anonymous_object_creation_expression
| array_creation_expression
| assignment_expression
| await_expression
| base_object_creation_expression
| binary_expression
| cast_expression
| checked_expression
| conditional_access_expression
| conditional_expression
| declaration_expression
| default_expression
| element_access_expression
| element_binding_expression
| implicit_array_creation_expression
| implicit_element_access
| implicit_stack_alloc_array_creation_expression
| initializer_expression
| instance_expression
| interpolated_string_expression
| invocation_expression
| is_pattern_expression
| literal_expression
| make_ref_expression
| member_access_expression
| member_binding_expression
| omitted_array_size_expression
| parenthesized_expression
| postfix_unary_expression
| prefix_unary_expression
| query_expression
| range_expression
| ref_expression
| ref_type_expression
| ref_value_expression
| size_of_expression
| stack_alloc_array_creation_expression
| switch_expression
| throw_expression
| tuple_expression
| type
| type_of_expression
| with_expression
;
anonymous_function_expression
: anonymous_method_expression
| lambda_expression
;
anonymous_method_expression
: modifier* 'delegate' parameter_list? block expression?
;
lambda_expression
: parenthesized_lambda_expression
| simple_lambda_expression
;
parenthesized_lambda_expression
: attribute_list* modifier* parameter_list '=>' (block | expression)
;
simple_lambda_expression
: attribute_list* modifier* parameter '=>' (block | expression)
;
anonymous_object_creation_expression
: 'new' '{' (anonymous_object_member_declarator (',' anonymous_object_member_declarator)* ','?)? '}'
;
anonymous_object_member_declarator
: name_equals? expression
;
array_creation_expression
: 'new' array_type initializer_expression?
;
initializer_expression
: '{' (expression (',' expression)* ','?)? '}'
;
assignment_expression
: expression ('=' | '+=' | '-=' | '*=' | '/=' | '%=' | '&=' | '^=' | '|=' | '<<=' | '>>=' | '??=') expression
;
await_expression
: 'await' expression
;
base_object_creation_expression
: implicit_object_creation_expression
| object_creation_expression
;
implicit_object_creation_expression
: 'new' argument_list initializer_expression?
;
object_creation_expression
: 'new' type argument_list? initializer_expression?
;
binary_expression
: expression ('+' | '-' | '*' | '/' | '%' | '<<' | '>>' | '||' | '&&' | '|' | '&' | '^' | '==' | '!=' | '<' | '<=' | '>' | '>=' | 'is' | 'as' | '??') expression
;
cast_expression
: '(' type ')' expression
;
checked_expression
: 'checked' '(' expression ')'
| 'unchecked' '(' expression ')'
;
conditional_access_expression
: expression '?' expression
;
conditional_expression
: expression '?' expression ':' expression
;
declaration_expression
: type variable_designation
;
default_expression
: 'default' '(' type ')'
;
element_access_expression
: expression bracketed_argument_list
;
element_binding_expression
: bracketed_argument_list
;
implicit_array_creation_expression
: 'new' '[' ','* ']' initializer_expression
;
implicit_element_access
: bracketed_argument_list
;
implicit_stack_alloc_array_creation_expression
: 'stackalloc' '[' ']' initializer_expression
;
instance_expression
: base_expression
| this_expression
;
base_expression
: 'base'
;
this_expression
: 'this'
;
interpolated_string_expression
: '$"' interpolated_string_content* '"'
| '$@"' interpolated_string_content* '"'
;
interpolated_string_content
: interpolated_string_text
| interpolation
;
interpolated_string_text
: interpolated_string_text_token
;
interpolation
: '{' expression interpolation_alignment_clause? interpolation_format_clause? '}'
;
interpolation_alignment_clause
: ',' expression
;
interpolation_format_clause
: ':' interpolated_string_text_token
;
invocation_expression
: expression argument_list
;
is_pattern_expression
: expression 'is' pattern
;
literal_expression
: '__arglist'
| 'default'
| 'false'
| 'null'
| 'true'
| character_literal_token
| numeric_literal_token
| string_literal_token
;
make_ref_expression
: '__makeref' '(' expression ')'
;
member_access_expression
: expression ('.' | '->') simple_name
;
member_binding_expression
: '.' simple_name
;
omitted_array_size_expression
: /* epsilon */
;
parenthesized_expression
: '(' expression ')'
;
postfix_unary_expression
: expression ('++' | '--' | '!')
;
prefix_unary_expression
: '!' expression
| '&' expression
| '*' expression
| '+' expression
| '++' expression
| '-' expression
| '--' expression
| '^' expression
| '~' expression
;
query_expression
: from_clause query_body
;
from_clause
: 'from' type? identifier_token 'in' expression
;
query_body
: query_clause+ select_or_group_clause query_continuation?
;
query_clause
: from_clause
| join_clause
| let_clause
| order_by_clause
| where_clause
;
join_clause
: 'join' type? identifier_token 'in' expression 'on' expression 'equals' expression join_into_clause?
;
join_into_clause
: 'into' identifier_token
;
let_clause
: 'let' identifier_token '=' expression
;
order_by_clause
: 'orderby' ordering (',' ordering)*
;
ordering
: expression ('ascending' | 'descending')?
;
where_clause
: 'where' expression
;
select_or_group_clause
: group_clause
| select_clause
;
group_clause
: 'group' expression 'by' expression
;
select_clause
: 'select' expression
;
query_continuation
: 'into' identifier_token query_body
;
range_expression
: expression? '..' expression?
;
ref_expression
: 'ref' expression
;
ref_type_expression
: '__reftype' '(' expression ')'
;
ref_value_expression
: '__refvalue' '(' expression ',' type ')'
;
size_of_expression
: 'sizeof' '(' type ')'
;
stack_alloc_array_creation_expression
: 'stackalloc' type initializer_expression?
;
switch_expression
: expression 'switch' '{' (switch_expression_arm (',' switch_expression_arm)* ','?)? '}'
;
switch_expression_arm
: pattern when_clause? '=>' expression
;
throw_expression
: 'throw' expression
;
tuple_expression
: '(' argument (',' argument)+ ')'
;
type_of_expression
: 'typeof' '(' type ')'
;
with_expression
: expression 'with' initializer_expression
;
xml_node
: xml_c_data_section
| xml_comment
| xml_element
| xml_empty_element
| xml_processing_instruction
| xml_text
;
xml_c_data_section
: '<![CDATA[' xml_text_literal_token* ']]>'
;
xml_comment
: '<!--' xml_text_literal_token* '-->'
;
xml_element
: xml_element_start_tag xml_node* xml_element_end_tag
;
xml_element_start_tag
: '<' xml_name xml_attribute* '>'
;
xml_name
: xml_prefix? identifier_token
;
xml_prefix
: identifier_token ':'
;
xml_attribute
: xml_cref_attribute
| xml_name_attribute
| xml_text_attribute
;
xml_cref_attribute
: xml_name '=' ('\'' | '"') cref ('\'' | '"')
;
cref
: member_cref
| qualified_cref
| type_cref
;
member_cref
: conversion_operator_member_cref
| indexer_member_cref
| name_member_cref
| operator_member_cref
;
conversion_operator_member_cref
: 'explicit' 'operator' type cref_parameter_list?
| 'implicit' 'operator' type cref_parameter_list?
;
cref_parameter_list
: '(' (cref_parameter (',' cref_parameter)*)? ')'
;
cref_parameter
: 'in'? type
| 'out'? type
| 'ref'? type
;
indexer_member_cref
: 'this' cref_bracketed_parameter_list?
;
cref_bracketed_parameter_list
: '[' cref_parameter (',' cref_parameter)* ']'
;
name_member_cref
: type cref_parameter_list?
;
operator_member_cref
: 'operator' ('+' | '-' | '!' | '~' | '++' | '--' | '*' | '/' | '%' | '<<' | '>>' | '|' | '&' | '^' | '==' | '!=' | '<' | '<=' | '>' | '>=' | 'false' | 'true') cref_parameter_list?
;
qualified_cref
: type '.' member_cref
;
type_cref
: type
;
xml_name_attribute
: xml_name '=' ('\'' | '"') identifier_name ('\'' | '"')
;
xml_text_attribute
: xml_name '=' ('\'' | '"') xml_text_literal_token* ('\'' | '"')
;
xml_element_end_tag
: '</' xml_name '>'
;
xml_empty_element
: '<' xml_name xml_attribute* '/>'
;
xml_processing_instruction
: '<?' xml_name xml_text_literal_token* '?>'
;
xml_text
: xml_text_literal_token*
;
structured_trivia
: directive_trivia
| documentation_comment_trivia
| skipped_tokens_trivia
;
directive_trivia
: bad_directive_trivia
| branching_directive_trivia
| define_directive_trivia
| end_if_directive_trivia
| end_region_directive_trivia
| error_directive_trivia
| line_directive_trivia
| load_directive_trivia
| nullable_directive_trivia
| pragma_checksum_directive_trivia
| pragma_warning_directive_trivia
| reference_directive_trivia
| region_directive_trivia
| shebang_directive_trivia
| undef_directive_trivia
| warning_directive_trivia
;
bad_directive_trivia
: '#' syntax_token
;
branching_directive_trivia
: conditional_directive_trivia
| else_directive_trivia
;
conditional_directive_trivia
: elif_directive_trivia
| if_directive_trivia
;
elif_directive_trivia
: '#' 'elif' expression
;
if_directive_trivia
: '#' 'if' expression
;
else_directive_trivia
: '#' 'else'
;
define_directive_trivia
: '#' 'define' identifier_token
;
end_if_directive_trivia
: '#' 'endif'
;
end_region_directive_trivia
: '#' 'endregion'
;
error_directive_trivia
: '#' 'error'
;
line_directive_trivia
: '#' 'line' (numeric_literal_token | 'default' | 'hidden') string_literal_token?
;
load_directive_trivia
: '#' 'load' string_literal_token
;
nullable_directive_trivia
: '#' 'nullable' ('enable' | 'disable' | 'restore') ('warnings' | 'annotations')?
;
pragma_checksum_directive_trivia
: '#' 'pragma' 'checksum' string_literal_token string_literal_token string_literal_token
;
pragma_warning_directive_trivia
: '#' 'pragma' 'warning' ('disable' | 'restore') (expression (',' expression)*)?
;
reference_directive_trivia
: '#' 'r' string_literal_token
;
region_directive_trivia
: '#' 'region'
;
shebang_directive_trivia
: '#' '!'
;
undef_directive_trivia
: '#' 'undef' identifier_token
;
warning_directive_trivia
: '#' 'warning'
;
documentation_comment_trivia
: xml_node*
;
skipped_tokens_trivia
: syntax_token*
;
base_argument_list
: argument_list
| bracketed_argument_list
;
base_cref_parameter_list
: cref_bracketed_parameter_list
| cref_parameter_list
;
base_parameter_list
: bracketed_parameter_list
| parameter_list
;
base_parameter
: function_pointer_parameter
| parameter
;
character_literal_token
: /* see lexical specification */
;
expression_or_pattern
: expression
| pattern
;
identifier_token
: /* see lexical specification */
;
interpolated_string_text_token
: /* see lexical specification */
;
numeric_literal_token
: /* see lexical specification */
;
string_literal_token
: /* see lexical specification */
;
syntax_token
: /* see lexical specification */
;
xml_text_literal_token
: /* see lexical specification */
;
|
src/title_screen.asm | SlyryD/Beta-Quest | 0 | 101120 |
;patch the "DISK" texture w/ the version number texture
.orga 0x1795000
.incbin("../resources/version_ia8.bin")
;patch the copyright w/ ours
.orga 0x17AE300
.incbin("../resources/copyright_ia8.bin")
;patch the japanese text texture w/ "Beta Quest"
.orga 0x17B3C40
.incbin("../resources/beta_quest_i8.bin")
.headersize(0x801EF910 - 0xE6C0D0) ;move to the title_screen file (ovl_En_Mag) 0x801EF910 is the location that this file gets loaded in RAM right now.
;patch the branch that decides whether or not to draw the japanese text below the main logo. making it always draw. regardless of language selected.
.org 0x801F1B84
nop
;patch the branch to always draw the disk drive texture (our version #)
.org 0x801F1078
beql t6, r0, title_screen_draw_dd
.org 0x801F108C
title_screen_draw_dd:
;move the version # texture to the bottom right
.org 0x801F11F4
addiu a3, a3, 0x60
.org 0x801F1204
addiu t0, t0, 0x72 |
assets/irhydra/code.asm | brycebaril/perf_goto_chicago | 1 | 245386 | --- FUNCTION SOURCE (SetFunctionName) id{0,0} ---
(g,h,i){
if((typeof(h)==='symbol')){
h="["+%SymbolDescription(h)+"]";
}
if((i===(void 0))){
%FunctionSetName(g,h);
}else{
%FunctionSetName(g,i+" "+h);
}
}
--- END ---
--- FUNCTION SOURCE (ToName) id{1,0} ---
(i){
return(typeof(i)==='symbol')?i:ToString(i);
}
--- END ---
--- FUNCTION SOURCE (join) id{2,0} ---
(C){
if((this==null)&&!(%_IsUndetectableObject(this)))throw MakeTypeError(14,"Array.prototype.join");
var o=((%_IsSpecObject(%IS_VAR(this)))?this:$toObject(this));
var v=(o.length>>>0);
return InnerArrayJoin(C,o,v);
}
--- END ---
--- FUNCTION SOURCE (DoRegExpExec) id{3,0} ---
(j,k,l){
var m=%_RegExpExec(j,k,l,e);
if(m!==null)$regexpLastMatchInfoOverride=null;
return m;
}
--- END ---
--- FUNCTION SOURCE (PropertyDescriptor_HasValue) id{4,0} ---
(){
return this.hasValue_;
}
--- END ---
--- FUNCTION SOURCE (posix._makeLong) id{5,0} ---
(path) {
return path;
}
--- END ---
--- FUNCTION SOURCE (PropertyDescriptor_HasGetter) id{6,0} ---
(){
return this.hasGetter_;
}
--- END ---
--- FUNCTION SOURCE (IsAccessorDescriptor) id{7,0} ---
(G){
if((G===(void 0)))return false;
return G.hasGetter()||G.hasSetter();
}
--- END ---
--- FUNCTION SOURCE (IsDataDescriptor) id{8,0} ---
(G){
if((G===(void 0)))return false;
return G.hasValue()||G.hasWritable();
}
--- END ---
--- FUNCTION SOURCE (PropertyDescriptor_HasEnumerable) id{9,0} ---
(){
return this.hasEnumerable_;
}
--- END ---
--- FUNCTION SOURCE (PropertyDescriptor_HasConfigurable) id{10,0} ---
(){
return this.hasConfigurable_;
}
--- END ---
--- FUNCTION SOURCE (PropertyDescriptor_HasSetter) id{11,0} ---
(){
return this.hasSetter_;
}
--- END ---
--- FUNCTION SOURCE (GifReaderLZWOutputIndexStream) id{12,0} ---
(code_stream, p, output, output_length) {
var min_code_size = code_stream[p++];
var clear_code = 1 << min_code_size;
var eoi_code = clear_code + 1;
var next_code = eoi_code + 1;
var cur_code_size = min_code_size + 1; // Number of bits per code.
// NOTE: This shares the same name as the encoder, but has a different
// meaning here. Here this masks each code coming from the code stream.
var code_mask = (1 << cur_code_size) - 1;
var cur_shift = 0;
var cur = 0;
var op = 0; // Output pointer.
var subblock_size = code_stream[p++];
// TODO(deanm): Would using a TypedArray be any faster? At least it would
// solve the fast mode / backing store uncertainty.
// var code_table = Array(4096);
var code_table = new Int32Array(4096); // Can be signed, we only use 20 bits.
var prev_code = null; // Track code-1.
while (true) {
// Read up to two bytes, making sure we always 12-bits for max sized code.
while (cur_shift < 16) {
if (subblock_size === 0) break; // No more data to be read.
cur |= code_stream[p++] << cur_shift;
cur_shift += 8;
if (subblock_size === 1) { // Never let it get to 0 to hold logic above.
subblock_size = code_stream[p++]; // Next subblock.
} else {
--subblock_size;
}
}
// TODO(deanm): We should never really get here, we should have received
// and EOI.
if (cur_shift < cur_code_size)
break;
var code = cur & code_mask;
cur >>= cur_code_size;
cur_shift -= cur_code_size;
// TODO(deanm): Maybe should check that the first code was a clear code,
// at least this is what you're supposed to do. But actually our encoder
// now doesn't emit a clear code first anyway.
if (code === clear_code) {
// We don't actually have to clear the table. This could be a good idea
// for greater error checking, but we don't really do any anyway. We
// will just track it with next_code and overwrite old entries.
next_code = eoi_code + 1;
cur_code_size = min_code_size + 1;
code_mask = (1 << cur_code_size) - 1;
// Don't update prev_code ?
prev_code = null;
continue;
} else if (code === eoi_code) {
break;
}
// We have a similar situation as the decoder, where we want to store
// variable length entries (code table entries), but we want to do in a
// faster manner than an array of arrays. The code below stores sort of a
// linked list within the code table, and then "chases" through it to
// construct the dictionary entries. When a new entry is created, just the
// last byte is stored, and the rest (prefix) of the entry is only
// referenced by its table entry. Then the code chases through the
// prefixes until it reaches a single byte code. We have to chase twice,
// first to compute the length, and then to actually copy the data to the
// output (backwards, since we know the length). The alternative would be
// storing something in an intermediate stack, but that doesn't make any
// more sense. I implemented an approach where it also stored the length
// in the code table, although it's a bit tricky because you run out of
// bits (12 + 12 + 8), but I didn't measure much improvements (the table
// entries are generally not the long). Even when I created benchmarks for
// very long table entries the complexity did not seem worth it.
// The code table stores the prefix entry in 12 bits and then the suffix
// byte in 8 bits, so each entry is 20 bits.
var chase_code = code < next_code ? code : prev_code;
// Chase what we will output, either {CODE} or {CODE-1}.
var chase_length = 0;
var chase = chase_code;
while (chase > clear_code) {
chase = code_table[chase] >> 8;
++chase_length;
}
var k = chase;
var op_end = op + chase_length + (chase_code !== code ? 1 : 0);
if (op_end > output_length) {
console.log("Warning, gif stream longer than expected.");
return;
}
// Already have the first byte from the chase, might as well write it fast.
output[op++] = k;
op += chase_length;
var b = op; // Track pointer, writing backwards.
if (chase_code !== code) // The case of emitting {CODE-1} + k.
output[op++] = k;
chase = chase_code;
while (chase_length--) {
chase = code_table[chase];
output[--b] = chase & 0xff; // Write backwards.
chase >>= 8; // Pull down to the prefix code.
}
if (prev_code !== null && next_code < 4096) {
code_table[next_code++] = prev_code << 8 | k;
// TODO(deanm): Figure out this clearing vs code growth logic better. I
// have an feeling that it should just happen somewhere else, for now it
// is awkward between when we grow past the max and then hit a clear code.
// For now just check if we hit the max 12-bits (then a clear code should
// follow, also of course encoded in 12-bits).
if (next_code >= code_mask+1 && cur_code_size < 12) {
++cur_code_size;
code_mask = code_mask << 1 | 1;
}
}
prev_code = code;
}
if (op !== output_length) {
console.log("Warning, gif stream shorter than expected.");
}
return output;
}
--- END ---
[deoptimizing (DEOPT soft): begin 0x7bbfe0a7e29 <JS Function GifReaderLZWOutputIndexStream (SharedFunctionInfo 0x2ac9639f3819)> (opt #12) @53, FP to SP delta: 512]
;;; deoptimize at 0_5213: Insufficient type feedback for combined type of binary operation
reading input frame GifReaderLZWOutputIndexStream => node=5, args=290, height=20; inputs:
0: 0x7bbfe0a7e29 ; (frame function) 0x7bbfe0a7e29 <JS Function GifReaderLZWOutputIndexStream (SharedFunctionInfo 0x2ac9639f3819)>
1: 0x36cdc0e04131 ; [fp - 288] 0x36cdc0e04131 <undefined>
2: 0x7bbfe006401 ; [fp - 280] 0x7bbfe006401 <an Uint8Array with map 0x3d4eb9d1d389>
3: 91597 ; (int) [fp - 440]
4: 0x7bbfe0bbaf1 ; [fp - 264] 0x7bbfe0bbaf1 <an Uint8Array with map 0x3d4eb9d1d331>
5: 0x57e4000000000 ; [fp - 256] 360000
6: 0x7bbfe0a7cb9 ; [fp - 248] 0x7bbfe0a7cb9 <FixedArray[6]>
7: 0x36cdc0e04131 ; (literal 1) 0x36cdc0e04131 <undefined>
8: 0x36cdc0e04131 ; (literal 1) 0x36cdc0e04131 <undefined>
9: 0x36cdc0e04131 ; (literal 1) 0x36cdc0e04131 <undefined>
10: 0x36cdc0e04131 ; (literal 1) 0x36cdc0e04131 <undefined>
11: 0x36cdc0e04131 ; (literal 1) 0x36cdc0e04131 <undefined>
12: 0x36cdc0e04131 ; (literal 1) 0x36cdc0e04131 <undefined>
13: 0x36cdc0e04131 ; (literal 1) 0x36cdc0e04131 <undefined>
14: 0x36cdc0e04131 ; (literal 1) 0x36cdc0e04131 <undefined>
15: 0x57e4000000000 ; [fp - 408] 360000
16: 0x36cdc0e04131 ; (literal 1) 0x36cdc0e04131 <undefined>
17: 0x36cdc0e04131 ; (literal 1) 0x36cdc0e04131 <undefined>
18: 0x36cdc0e04131 ; (literal 1) 0x36cdc0e04131 <undefined>
19: 0x36cdc0e04131 ; (literal 1) 0x36cdc0e04131 <undefined>
20: 0x36cdc0e04131 ; (literal 1) 0x36cdc0e04131 <undefined>
21: 0x36cdc0e04131 ; (literal 1) 0x36cdc0e04131 <undefined>
22: 0x36cdc0e04131 ; (literal 1) 0x36cdc0e04131 <undefined>
23: 0x36cdc0e04131 ; (literal 1) 0x36cdc0e04131 <undefined>
24: 0x36cdc0e04131 ; (literal 1) 0x36cdc0e04131 <undefined>
25: 0x36cdc0e04131 ; (literal 1) 0x36cdc0e04131 <undefined>
translating frame GifReaderLZWOutputIndexStream => node=290, height=152
0x7ffc654cd668: [top + 216] <- 0x36cdc0e04131 ; 0x36cdc0e04131 <undefined> (input #1)
0x7ffc654cd660: [top + 208] <- 0x7bbfe006401 ; 0x7bbfe006401 <an Uint8Array with map 0x3d4eb9d1d389> (input #2)
0x7ffc654cd658: [top + 200] <- 0x165cd00000000 ; 91597 (input #3)
0x7ffc654cd650: [top + 192] <- 0x7bbfe0bbaf1 ; 0x7bbfe0bbaf1 <an Uint8Array with map 0x3d4eb9d1d331> (input #4)
0x7ffc654cd648: [top + 184] <- 0x57e4000000000 ; 360000 (input #5)
0x7ffc654cd640: [top + 176] <- 0x376e6fee7ace ; caller's pc
0x7ffc654cd638: [top + 168] <- 0x7ffc654cd720 ; caller's fp
0x7ffc654cd630: [top + 160] <- 0x7bbfe0a7cb9 ; context 0x7bbfe0a7cb9 <FixedArray[6]> (input #6)
0x7ffc654cd628: [top + 152] <- 0x7bbfe0a7e29 ; function 0x7bbfe0a7e29 <JS Function GifReaderLZWOutputIndexStream (SharedFunctionInfo 0x2ac9639f3819)> (input #0)
0x7ffc654cd620: [top + 144] <- 0x36cdc0e04131 ; 0x36cdc0e04131 <undefined> (input #7)
0x7ffc654cd618: [top + 136] <- 0x36cdc0e04131 ; 0x36cdc0e04131 <undefined> (input #8)
0x7ffc654cd610: [top + 128] <- 0x36cdc0e04131 ; 0x36cdc0e04131 <undefined> (input #9)
0x7ffc654cd608: [top + 120] <- 0x36cdc0e04131 ; 0x36cdc0e04131 <undefined> (input #10)
0x7ffc654cd600: [top + 112] <- 0x36cdc0e04131 ; 0x36cdc0e04131 <undefined> (input #11)
0x7ffc654cd5f8: [top + 104] <- 0x36cdc0e04131 ; 0x36cdc0e04131 <undefined> (input #12)
0x7ffc654cd5f0: [top + 96] <- 0x36cdc0e04131 ; 0x36cdc0e04131 <undefined> (input #13)
0x7ffc654cd5e8: [top + 88] <- 0x36cdc0e04131 ; 0x36cdc0e04131 <undefined> (input #14)
0x7ffc654cd5e0: [top + 80] <- 0x57e4000000000 ; 360000 (input #15)
0x7ffc654cd5d8: [top + 72] <- 0x36cdc0e04131 ; 0x36cdc0e04131 <undefined> (input #16)
0x7ffc654cd5d0: [top + 64] <- 0x36cdc0e04131 ; 0x36cdc0e04131 <undefined> (input #17)
0x7ffc654cd5c8: [top + 56] <- 0x36cdc0e04131 ; 0x36cdc0e04131 <undefined> (input #18)
0x7ffc654cd5c0: [top + 48] <- 0x36cdc0e04131 ; 0x36cdc0e04131 <undefined> (input #19)
0x7ffc654cd5b8: [top + 40] <- 0x36cdc0e04131 ; 0x36cdc0e04131 <undefined> (input #20)
0x7ffc654cd5b0: [top + 32] <- 0x36cdc0e04131 ; 0x36cdc0e04131 <undefined> (input #21)
0x7ffc654cd5a8: [top + 24] <- 0x36cdc0e04131 ; 0x36cdc0e04131 <undefined> (input #22)
0x7ffc654cd5a0: [top + 16] <- 0x36cdc0e04131 ; 0x36cdc0e04131 <undefined> (input #23)
0x7ffc654cd598: [top + 8] <- 0x36cdc0e04131 ; 0x36cdc0e04131 <undefined> (input #24)
0x7ffc654cd590: [top + 0] <- 0x36cdc0e04131 ; 0x36cdc0e04131 <undefined> (input #25)
[deoptimizing (soft): end 0x7bbfe0a7e29 <JS Function GifReaderLZWOutputIndexStream (SharedFunctionInfo 0x2ac9639f3819)> @53 => node=290, pc=0x376e6fee94b2, state=NO_REGISTERS, alignment=no padding, took 0.072 ms]
--- FUNCTION SOURCE (GifReader.decodeAndBlitFrameRGBA) id{13,0} ---
(frame_num, pixels) {
var frame = this.frameInfo(frame_num);
var num_pixels = frame.width * frame.height;
var index_stream = new Uint8Array(num_pixels); // At most 8-bit indices.
GifReaderLZWOutputIndexStream(
buf, frame.data_offset, index_stream, num_pixels);
var palette_offset = frame.palette_offset;
// NOTE(deanm): It seems to be much faster to compare index to 256 than
// to === null. Not sure why, but CompareStub_EQ_STRICT shows up high in
// the profile, not sure if it's related to using a Uint8Array.
var trans = frame.transparent_index;
if (trans === null) trans = 256;
// We are possibly just blitting to a portion of the entire frame.
// That is a subrect within the framerect, so the additional pixels
// must be skipped over after we finished a scanline.
var framewidth = frame.width;
var framestride = width - framewidth;
var xleft = framewidth; // Number of subrect pixels left in scanline.
// Output indicies of the top left and bottom right corners of the subrect.
var opbeg = ((frame.y * width) + frame.x) * 4;
var opend = ((frame.y + frame.height) * width + frame.x) * 4;
var op = opbeg;
var scanstride = framestride * 4;
// Use scanstride to skip past the rows when interlacing. This is skipping
// 7 rows for the first two passes, then 3 then 1.
if (frame.interlaced === true) {
scanstride += width * 4 * 7; // Pass 1.
}
var interlaceskip = 8; // Tracking the row interval in the current pass.
for (var i = 0, il = index_stream.length; i < il; ++i) {
var index = index_stream[i];
if (xleft === 0) { // Beginning of new scan line
op += scanstride;
xleft = framewidth;
if (op >= opend) { // Catch the wrap to switch passes when interlacing.
scanstride = framestride * 4 + width * 4 * (interlaceskip-1);
// interlaceskip / 2 * 4 is interlaceskip << 1.
op = opbeg + (framewidth + framestride) * (interlaceskip << 1);
interlaceskip >>= 1;
}
}
if (index === trans) {
op += 4;
} else {
var r = buf[palette_offset + index * 3];
var g = buf[palette_offset + index * 3 + 1];
var b = buf[palette_offset + index * 3 + 2];
pixels[op++] = r;
pixels[op++] = g;
pixels[op++] = b;
pixels[op++] = 255;
}
--xleft;
}
}
--- END ---
--- FUNCTION SOURCE (GifReaderLZWOutputIndexStream) id{14,0} ---
(code_stream, p, output, output_length) {
var min_code_size = code_stream[p++];
var clear_code = 1 << min_code_size;
var eoi_code = clear_code + 1;
var next_code = eoi_code + 1;
var cur_code_size = min_code_size + 1; // Number of bits per code.
// NOTE: This shares the same name as the encoder, but has a different
// meaning here. Here this masks each code coming from the code stream.
var code_mask = (1 << cur_code_size) - 1;
var cur_shift = 0;
var cur = 0;
var op = 0; // Output pointer.
var subblock_size = code_stream[p++];
// TODO(deanm): Would using a TypedArray be any faster? At least it would
// solve the fast mode / backing store uncertainty.
// var code_table = Array(4096);
var code_table = new Int32Array(4096); // Can be signed, we only use 20 bits.
var prev_code = null; // Track code-1.
while (true) {
// Read up to two bytes, making sure we always 12-bits for max sized code.
while (cur_shift < 16) {
if (subblock_size === 0) break; // No more data to be read.
cur |= code_stream[p++] << cur_shift;
cur_shift += 8;
if (subblock_size === 1) { // Never let it get to 0 to hold logic above.
subblock_size = code_stream[p++]; // Next subblock.
} else {
--subblock_size;
}
}
// TODO(deanm): We should never really get here, we should have received
// and EOI.
if (cur_shift < cur_code_size)
break;
var code = cur & code_mask;
cur >>= cur_code_size;
cur_shift -= cur_code_size;
// TODO(deanm): Maybe should check that the first code was a clear code,
// at least this is what you're supposed to do. But actually our encoder
// now doesn't emit a clear code first anyway.
if (code === clear_code) {
// We don't actually have to clear the table. This could be a good idea
// for greater error checking, but we don't really do any anyway. We
// will just track it with next_code and overwrite old entries.
next_code = eoi_code + 1;
cur_code_size = min_code_size + 1;
code_mask = (1 << cur_code_size) - 1;
// Don't update prev_code ?
prev_code = null;
continue;
} else if (code === eoi_code) {
break;
}
// We have a similar situation as the decoder, where we want to store
// variable length entries (code table entries), but we want to do in a
// faster manner than an array of arrays. The code below stores sort of a
// linked list within the code table, and then "chases" through it to
// construct the dictionary entries. When a new entry is created, just the
// last byte is stored, and the rest (prefix) of the entry is only
// referenced by its table entry. Then the code chases through the
// prefixes until it reaches a single byte code. We have to chase twice,
// first to compute the length, and then to actually copy the data to the
// output (backwards, since we know the length). The alternative would be
// storing something in an intermediate stack, but that doesn't make any
// more sense. I implemented an approach where it also stored the length
// in the code table, although it's a bit tricky because you run out of
// bits (12 + 12 + 8), but I didn't measure much improvements (the table
// entries are generally not the long). Even when I created benchmarks for
// very long table entries the complexity did not seem worth it.
// The code table stores the prefix entry in 12 bits and then the suffix
// byte in 8 bits, so each entry is 20 bits.
var chase_code = code < next_code ? code : prev_code;
// Chase what we will output, either {CODE} or {CODE-1}.
var chase_length = 0;
var chase = chase_code;
while (chase > clear_code) {
chase = code_table[chase] >> 8;
++chase_length;
}
var k = chase;
var op_end = op + chase_length + (chase_code !== code ? 1 : 0);
if (op_end > output_length) {
console.log("Warning, gif stream longer than expected.");
return;
}
// Already have the first byte from the chase, might as well write it fast.
output[op++] = k;
op += chase_length;
var b = op; // Track pointer, writing backwards.
if (chase_code !== code) // The case of emitting {CODE-1} + k.
output[op++] = k;
chase = chase_code;
while (chase_length--) {
chase = code_table[chase];
output[--b] = chase & 0xff; // Write backwards.
chase >>= 8; // Pull down to the prefix code.
}
if (prev_code !== null && next_code < 4096) {
code_table[next_code++] = prev_code << 8 | k;
// TODO(deanm): Figure out this clearing vs code growth logic better. I
// have an feeling that it should just happen somewhere else, for now it
// is awkward between when we grow past the max and then hit a clear code.
// For now just check if we hit the max 12-bits (then a clear code should
// follow, also of course encoded in 12-bits).
if (next_code >= code_mask+1 && cur_code_size < 12) {
++cur_code_size;
code_mask = code_mask << 1 | 1;
}
}
prev_code = code;
}
if (op !== output_length) {
console.log("Warning, gif stream shorter than expected.");
}
return output;
}
--- END ---
--- FUNCTION SOURCE (ArrayBuffer) id{15,0} ---
(i){
if(%_IsConstructCall()){
var j=$toPositiveInteger(i,125);
%ArrayBufferInitialize(this,j,false);
}else{
throw MakeTypeError(20,"ArrayBuffer");
}
}
--- END ---
--- FUNCTION SOURCE (slice) id{16,0} ---
(start, end) {
const buffer = this.subarray(start, end);
Object.setPrototypeOf(buffer, Buffer.prototype);
return buffer;
}
--- END ---
--- FUNCTION SOURCE () id{17,0} ---
(a, b) {
return (a[0] + a[1] + a[2] + a[3]) - (b[0] + b[1] + b[2] + b[3])
}
--- END ---
--- FUNCTION SOURCE (subarray) id{18,0} ---
(R,S){
if(!(%_ClassOf(this)==='Uint8Array')){
throw MakeTypeError(33,"Uint8Array.subarray",this);
}
var T=(%_IsSmi(%IS_VAR(R))?R:%NumberToInteger($toNumber(R)));
if(!(S===(void 0))){
S=(%_IsSmi(%IS_VAR(S))?S:%NumberToInteger($toNumber(S)));
}
var U=%_TypedArrayGetLength(this);
if(T<0){
T=q(0,U+T);
}else{
T=r(U,T);
}
var V=(S===(void 0))?U:S;
if(V<0){
V=q(0,U+V);
}else{
V=r(V,U);
}
if(V<T){
V=T;
}
var C=V-T;
var W=
%_ArrayBufferViewGetByteOffset(this)+T*1;
return new h(%TypedArrayGetBuffer(this),
W,C);
}
--- END ---
--- FUNCTION SOURCE (Uint8ArrayConstructByArrayBuffer) id{19,0} ---
(v,w,x,y){
if(!(x===(void 0))){
x=
$toPositiveInteger(x,139);
}
if(!(y===(void 0))){
y=$toPositiveInteger(y,139);
}
var z=%_ArrayBufferGetByteLength(w);
var A;
if((x===(void 0))){
A=0;
}else{
A=x;
if(A % 1!==0){
throw MakeRangeError(138,
"start offset","Uint8Array",1);
}
if(A>z){
throw MakeRangeError(140);
}
}
var B;
var C;
if((y===(void 0))){
if(z % 1!==0){
throw MakeRangeError(138,
"byte length","Uint8Array",1);
}
B=z-A;
C=B/1;
}else{
var C=y;
B=C*1;
}
if((A+B>z)
||(C>%_MaxSmi())){
throw MakeRangeError(139);
}
%_TypedArrayInitialize(v,1,w,A,B,true);
}
--- END ---
--- FUNCTION SOURCE (Buffer) id{20,0} ---
(arg) {
// Common case.
if (typeof arg === 'number') {
// If less than zero, or NaN.
if (arg < 0 || arg !== arg)
arg = 0;
return allocate(arg);
}
// Slightly less common case.
if (typeof arg === 'string') {
return fromString(arg, arguments[1]);
}
// Unusual.
return fromObject(arg);
}
--- END ---
--- FUNCTION SOURCE (fromString) id{20,1} ---
(string, encoding) {
if (typeof encoding !== 'string' || encoding === '')
encoding = 'utf8';
var length = byteLength(string, encoding);
if (length >= (Buffer.poolSize >>> 1))
return binding.createFromString(string, encoding);
if (length > (poolSize - poolOffset))
createPool();
var actual = allocPool.write(string, poolOffset, encoding);
var b = allocPool.slice(poolOffset, poolOffset + actual);
poolOffset += actual;
alignPool();
return b;
}
--- END ---
INLINE (fromString) id{20,1} AS 1 AT <0:247>
--- FUNCTION SOURCE (slice) id{20,2} ---
(start, end) {
const buffer = this.subarray(start, end);
Object.setPrototypeOf(buffer, Buffer.prototype);
return buffer;
}
--- END ---
INLINE (slice) id{20,2} AS 2 AT <1:382>
--- FUNCTION SOURCE (alignPool) id{20,3} ---
() {
// Ensure aligned slices
if (poolOffset & 0x7) {
poolOffset |= 0x7;
poolOffset++;
}
}
--- END ---
INLINE (alignPool) id{20,3} AS 3 AT <1:448>
--- FUNCTION SOURCE (QuickSort) id{21,0} ---
(y,m,aF){
var aM=0;
while(true){
if(aF-m<=10){
aE(y,m,aF);
return;
}
if(aF-m>1000){
aM=aJ(y,m,aF);
}else{
aM=m+((aF-m)>>1);
}
var aO=y[m];
var aP=y[aF-1];
var aQ=y[aM];
var aR=%_CallFunction((void 0),aO,aP,aC);
if(aR>0){
var aH=aO;
aO=aP;
aP=aH;
}
var aS=%_CallFunction((void 0),aO,aQ,aC);
if(aS>=0){
var aH=aO;
aO=aQ;
aQ=aP;
aP=aH;
}else{
var aT=%_CallFunction((void 0),aP,aQ,aC);
if(aT>0){
var aH=aP;
aP=aQ;
aQ=aH;
}
}
y[m]=aO;
y[aF-1]=aQ;
var aU=aP;
var aV=m+1;
var aW=aF-1;
y[aM]=y[aV];
y[aV]=aU;
partition:for(var t=aV+1;t<aW;t++){
var aG=y[t];
var aI=%_CallFunction((void 0),aG,aU,aC);
if(aI<0){
y[t]=y[aV];
y[aV]=aG;
aV++;
}else if(aI>0){
do{
aW--;
if(aW==t)break partition;
var aX=y[aW];
aI=%_CallFunction((void 0),aX,aU,aC);
}while(aI>0);
y[t]=y[aW];
y[aW]=aG;
if(aI<0){
aG=y[t];
y[t]=y[aV];
y[aV]=aG;
aV++;
}
}
}
if(aF-aW<aV-m){
aN(y,aW,aF);
aF=aV;
}else{
aN(y,m,aV);
m=aW;
}
}
}
--- END ---
--- FUNCTION SOURCE (alignPool) id{22,0} ---
() {
// Ensure aligned slices
if (poolOffset & 0x7) {
poolOffset |= 0x7;
poolOffset++;
}
}
--- END ---
--- FUNCTION SOURCE (sortPixels) id{23,0} ---
(pixels) {
var split = []
for (var i = 0; i < pixels.length; i += 4) {
split.push(pixels.slice(i, i + 4))
}
var sorted = split.sort(function (a, b) {
return (a[0] + a[1] + a[2] + a[3]) - (b[0] + b[1] + b[2] + b[3])
})
var newbuff = new Buffer(pixels.length)
for (var j = 0; j < sorted.length; j++) {
newbuff[j * 4] = sorted[j][0]
newbuff[j * 4 + 1] = sorted[j][1]
newbuff[j * 4 + 2] = sorted[j][2]
newbuff[j * 4 + 3] = sorted[j][3]
}
return newbuff
}
--- END ---
--- FUNCTION SOURCE (slice) id{23,1} ---
(start, end) {
const buffer = this.subarray(start, end);
Object.setPrototypeOf(buffer, Buffer.prototype);
return buffer;
}
--- END ---
INLINE (slice) id{23,1} AS 1 AT <0:97>
--- FUNCTION SOURCE (Buffer) id{23,2} ---
(arg) {
// Common case.
if (typeof arg === 'number') {
// If less than zero, or NaN.
if (arg < 0 || arg !== arg)
arg = 0;
return allocate(arg);
}
// Slightly less common case.
if (typeof arg === 'string') {
return fromString(arg, arguments[1]);
}
// Unusual.
return fromObject(arg);
}
--- END ---
INLINE (Buffer) id{23,2} AS 2 AT <0:252>
--- FUNCTION SOURCE (fromString) id{23,3} ---
(string, encoding) {
if (typeof encoding !== 'string' || encoding === '')
encoding = 'utf8';
var length = byteLength(string, encoding);
if (length >= (Buffer.poolSize >>> 1))
return binding.createFromString(string, encoding);
if (length > (poolSize - poolOffset))
createPool();
var actual = allocPool.write(string, poolOffset, encoding);
var b = allocPool.slice(poolOffset, poolOffset + actual);
poolOffset += actual;
alignPool();
return b;
}
--- END ---
INLINE (fromString) id{23,3} AS 3 AT <2:247>
--- FUNCTION SOURCE (slice) id{23,4} ---
(start, end) {
const buffer = this.subarray(start, end);
Object.setPrototypeOf(buffer, Buffer.prototype);
return buffer;
}
--- END ---
INLINE (slice) id{23,4} AS 4 AT <3:382>
--- FUNCTION SOURCE (alignPool) id{23,5} ---
() {
// Ensure aligned slices
if (poolOffset & 0x7) {
poolOffset |= 0x7;
poolOffset++;
}
}
--- END ---
INLINE (alignPool) id{23,5} AS 5 AT <3:448>
--- FUNCTION SOURCE (min) id{24,0} ---
(h,i){
var j=%_ArgumentsLength();
if(j==2){
h=((typeof(%IS_VAR(h))==='number')?h:$nonNumberToNumber(h));
i=((typeof(%IS_VAR(i))==='number')?i:$nonNumberToNumber(i));
if(i>h)return h;
if(h>i)return i;
if(h==i){
return(h===0&&%_IsMinusZero(h))?h:i;
}
return $NaN;
}
var k=(1/0);
for(var l=0;l<j;l++){
var m=%_Arguments(l);
m=((typeof(%IS_VAR(m))==='number')?m:$nonNumberToNumber(m));
if((!%_IsSmi(%IS_VAR(m))&&!(m==m))||m<k||(k===0&&m===0&&%_IsMinusZero(m))){
k=m;
}
}
return k;
}
--- END ---
--- FUNCTION SOURCE (ToPositiveInteger) id{25,0} ---
(i,aa){
var M=(%_IsSmi(%IS_VAR(i))?i:%NumberToIntegerMapMinusZero($toNumber(i)));
if(M<0)throw MakeRangeError(aa);
return M;
}
--- END ---
--- FUNCTION SOURCE (medianPixel) id{26,0} ---
(pixels) {
var sorted = sortPixels(pixels)
var mid = (sorted.length / 2) - ((sorted.length / 2) % 4)
return sorted.slice(mid, mid + 4)
}
--- END ---
--- FUNCTION SOURCE (sortPixels) id{26,1} ---
(pixels) {
var split = []
for (var i = 0; i < pixels.length; i += 4) {
split.push(pixels.slice(i, i + 4))
}
var sorted = split.sort(function (a, b) {
return (a[0] + a[1] + a[2] + a[3]) - (b[0] + b[1] + b[2] + b[3])
})
var newbuff = new Buffer(pixels.length)
for (var j = 0; j < sorted.length; j++) {
newbuff[j * 4] = sorted[j][0]
newbuff[j * 4 + 1] = sorted[j][1]
newbuff[j * 4 + 2] = sorted[j][2]
newbuff[j * 4 + 3] = sorted[j][3]
}
return newbuff
}
--- END ---
INLINE (sortPixels) id{26,1} AS 1 AT <0:26>
--- FUNCTION SOURCE (slice) id{26,2} ---
(start, end) {
const buffer = this.subarray(start, end);
Object.setPrototypeOf(buffer, Buffer.prototype);
return buffer;
}
--- END ---
INLINE (slice) id{26,2} AS 2 AT <1:97>
--- FUNCTION SOURCE (Buffer) id{26,3} ---
(arg) {
// Common case.
if (typeof arg === 'number') {
// If less than zero, or NaN.
if (arg < 0 || arg !== arg)
arg = 0;
return allocate(arg);
}
// Slightly less common case.
if (typeof arg === 'string') {
return fromString(arg, arguments[1]);
}
// Unusual.
return fromObject(arg);
}
--- END ---
INLINE (Buffer) id{26,3} AS 3 AT <1:252>
--- FUNCTION SOURCE (fromString) id{26,4} ---
(string, encoding) {
if (typeof encoding !== 'string' || encoding === '')
encoding = 'utf8';
var length = byteLength(string, encoding);
if (length >= (Buffer.poolSize >>> 1))
return binding.createFromString(string, encoding);
if (length > (poolSize - poolOffset))
createPool();
var actual = allocPool.write(string, poolOffset, encoding);
var b = allocPool.slice(poolOffset, poolOffset + actual);
poolOffset += actual;
alignPool();
return b;
}
--- END ---
INLINE (fromString) id{26,4} AS 4 AT <3:247>
--- FUNCTION SOURCE (slice) id{26,5} ---
(start, end) {
const buffer = this.subarray(start, end);
Object.setPrototypeOf(buffer, Buffer.prototype);
return buffer;
}
--- END ---
INLINE (slice) id{26,5} AS 5 AT <4:382>
--- FUNCTION SOURCE (alignPool) id{26,6} ---
() {
// Ensure aligned slices
if (poolOffset & 0x7) {
poolOffset |= 0x7;
poolOffset++;
}
}
--- END ---
INLINE (alignPool) id{26,6} AS 6 AT <4:448>
--- FUNCTION SOURCE (slice) id{26,7} ---
(start, end) {
const buffer = this.subarray(start, end);
Object.setPrototypeOf(buffer, Buffer.prototype);
return buffer;
}
--- END ---
INLINE (slice) id{26,7} AS 7 AT <0:121>
--- FUNCTION SOURCE (sort) id{27,0} ---
(aC){
if((this==null)&&!(%_IsUndetectableObject(this)))throw MakeTypeError(14,"Array.prototype.sort");
var o=$toObject(this);
var v=(o.length>>>0);
return %_CallFunction(o,v,aC,InnerArraySort);
}
--- END ---
--- FUNCTION SOURCE (allocate) id{28,0} ---
(size) {
if (size === 0) {
const ui8 = new Uint8Array(size);
Object.setPrototypeOf(ui8, Buffer.prototype);
return ui8;
}
if (size < (Buffer.poolSize >>> 1)) {
if (size > (poolSize - poolOffset))
createPool();
var b = allocPool.slice(poolOffset, poolOffset + size);
poolOffset += size;
alignPool();
return b;
} else {
// Even though this is checked above, the conditional is a safety net and
// sanity check to prevent any subsequent typed array allocation from not
// being zero filled.
if (size > 0)
flags[kNoZeroFill] = 1;
const ui8 = new Uint8Array(size);
Object.setPrototypeOf(ui8, Buffer.prototype);
return ui8;
}
}
--- END ---
--- FUNCTION SOURCE (createPool) id{28,1} ---
() {
poolSize = Buffer.poolSize;
if (poolSize > 0)
flags[kNoZeroFill] = 1;
allocPool = new Uint8Array(poolSize);
Object.setPrototypeOf(allocPool, Buffer.prototype);
poolOffset = 0;
}
--- END ---
INLINE (createPool) id{28,1} AS 1 AT <0:223>
--- FUNCTION SOURCE (slice) id{28,2} ---
(start, end) {
const buffer = this.subarray(start, end);
Object.setPrototypeOf(buffer, Buffer.prototype);
return buffer;
}
--- END ---
INLINE (slice) id{28,2} AS 2 AT <0:259>
--- FUNCTION SOURCE (alignPool) id{28,3} ---
() {
// Ensure aligned slices
if (poolOffset & 0x7) {
poolOffset |= 0x7;
poolOffset++;
}
}
--- END ---
INLINE (alignPool) id{28,3} AS 3 AT <0:325>
--- FUNCTION SOURCE (Uint8ArrayConstructByLength) id{29,0} ---
(v,y){
var D=(y===(void 0))?
0:$toPositiveInteger(y,139);
if(D>%_MaxSmi()){
throw MakeRangeError(139);
}
var E=D*1;
if(E>%_TypedArrayMaxSizeInHeap()){
var w=new d(E);
%_TypedArrayInitialize(v,1,w,0,E,true);
}else{
%_TypedArrayInitialize(v,1,null,0,E,true);
}
}
--- END ---
--- FUNCTION SOURCE (Uint8Array) id{30,0} ---
(O,P,Q){
if(%_IsConstructCall()){
if((%_ClassOf(O)==='ArrayBuffer')||(%_ClassOf(O)==='SharedArrayBuffer')){
Uint8ArrayConstructByArrayBuffer(this,O,P,Q);
}else if((typeof(O)==='number')||(typeof(O)==='string')||
(typeof(O)==='boolean')||(O===(void 0))){
Uint8ArrayConstructByLength(this,O);
}else{
var J=O[symbolIterator];
if((J===(void 0))||J===$arrayValues){
Uint8ArrayConstructByArrayLike(this,O);
}else{
Uint8ArrayConstructByIterable(this,O,J);
}
}
}else{
throw MakeTypeError(20,"Uint8Array")
}
}
--- END ---
--- FUNCTION SOURCE (setPrototypeOf) id{31,0} ---
(J,am){
if((J==null)&&!(%_IsUndetectableObject(J)))throw MakeTypeError(14,"Object.setPrototypeOf");
if(am!==null&&!(%_IsSpecObject(am))){
throw MakeTypeError(79,am);
}
if((%_IsSpecObject(J))){
%SetPrototype(J,am);
}
return J;
}
--- END ---
--- FUNCTION SOURCE (InnerArraySort) id{32,0} ---
(v,aC){
if(!(%_ClassOf(aC)==='Function')){
aC=function(O,aD){
if(O===aD)return 0;
if(%_IsSmi(O)&&%_IsSmi(aD)){
return %SmiLexicographicCompare(O,aD);
}
O=$toString(O);
aD=$toString(aD);
if(O==aD)return 0;
else return O<aD?-1:1;
};
}
var aE=function InsertionSort(y,m,aF){
for(var t=m+1;t<aF;t++){
var aG=y[t];
for(var am=t-1;am>=m;am--){
var aH=y[am];
var aI=%_CallFunction((void 0),aH,aG,aC);
if(aI>0){
y[am+1]=aH;
}else{
break;
}
}
y[am+1]=aG;
}
};
var aJ=function(y,m,aF){
var aK=[];
var aL=200+((aF-m)&15);
for(var t=m+1,am=0;t<aF-1;t+=aL,am++){
aK[am]=[t,y[t]];
}
%_CallFunction(aK,function(y,z){
return %_CallFunction((void 0),y[1],z[1],aC);
},ArraySort);
var aM=aK[aK.length>>1][0];
return aM;
}
var aN=function QuickSort(y,m,aF){
var aM=0;
while(true){
if(aF-m<=10){
aE(y,m,aF);
return;
}
if(aF-m>1000){
aM=aJ(y,m,aF);
}else{
aM=m+((aF-m)>>1);
}
var aO=y[m];
var aP=y[aF-1];
var aQ=y[aM];
var aR=%_CallFunction((void 0),aO,aP,aC);
if(aR>0){
var aH=aO;
aO=aP;
aP=aH;
}
var aS=%_CallFunction((void 0),aO,aQ,aC);
if(aS>=0){
var aH=aO;
aO=aQ;
aQ=aP;
aP=aH;
}else{
var aT=%_CallFunction((void 0),aP,aQ,aC);
if(aT>0){
var aH=aP;
aP=aQ;
aQ=aH;
}
}
y[m]=aO;
y[aF-1]=aQ;
var aU=aP;
var aV=m+1;
var aW=aF-1;
y[aM]=y[aV];
y[aV]=aU;
partition:for(var t=aV+1;t<aW;t++){
var aG=y[t];
var aI=%_CallFunction((void 0),aG,aU,aC);
if(aI<0){
y[t]=y[aV];
y[aV]=aG;
aV++;
}else if(aI>0){
do{
aW--;
if(aW==t)break partition;
var aX=y[aW];
aI=%_CallFunction((void 0),aX,aU,aC);
}while(aI>0);
y[t]=y[aW];
y[aW]=aG;
if(aI<0){
aG=y[t];
y[t]=y[aV];
y[aV]=aG;
aV++;
}
}
}
if(aF-aW<aV-m){
aN(y,aW,aF);
aF=aV;
}else{
aN(y,m,aV);
m=aW;
}
}
};
var aY=function CopyFromPrototype(aZ,v){
var ba=0;
for(var bb=%_GetPrototype(aZ);bb;bb=%_GetPrototype(bb)){
var p=%GetArrayKeys(bb,v);
if((typeof(p)==='number')){
var bc=p;
for(var t=0;t<bc;t++){
if(!(%_CallFunction(aZ,t,i))&&(%_CallFunction(bb,t,i))){
aZ[t]=bb[t];
if(t>=ba){ba=t+1;}
}
}
}else{
for(var t=0;t<p.length;t++){
var Y=p[t];
if(!(Y===(void 0))&&!(%_CallFunction(aZ,Y,i))
&&(%_CallFunction(bb,Y,i))){
aZ[Y]=bb[Y];
if(Y>=ba){ba=Y+1;}
}
}
}
}
return ba;
};
var bd=function(aZ,m,aF){
for(var bb=%_GetPrototype(aZ);bb;bb=%_GetPrototype(bb)){
var p=%GetArrayKeys(bb,aF);
if((typeof(p)==='number')){
var bc=p;
for(var t=m;t<bc;t++){
if((%_CallFunction(bb,t,i))){
aZ[t]=(void 0);
}
}
}else{
for(var t=0;t<p.length;t++){
var Y=p[t];
if(!(Y===(void 0))&&m<=Y&&
(%_CallFunction(bb,Y,i))){
aZ[Y]=(void 0);
}
}
}
}
};
var be=function SafeRemoveArrayHoles(aZ){
var bf=0;
var bg=v-1;
var bh=0;
while(bf<bg){
while(bf<bg&&
!(aZ[bf]===(void 0))){
bf++;
}
if(!(%_CallFunction(aZ,bf,i))){
bh++;
}
while(bf<bg&&
(aZ[bg]===(void 0))){
if(!(%_CallFunction(aZ,bg,i))){
bh++;
}
bg--;
}
if(bf<bg){
aZ[bf]=aZ[bg];
aZ[bg]=(void 0);
}
}
if(!(aZ[bf]===(void 0)))bf++;
var t;
for(t=bf;t<v-bh;t++){
aZ[t]=(void 0);
}
for(t=v-bh;t<v;t++){
if(t in %_GetPrototype(aZ)){
aZ[t]=(void 0);
}else{
delete aZ[t];
}
}
return bf;
};
if(v<2)return this;
var J=(%_IsArray(this));
var bi;
if(!J){
bi=aY(this,v);
}
var bj=%RemoveArrayHoles(this,v);
if(bj==-1){
bj=be(this);
}
aN(this,0,bj);
if(!J&&(bj+1<bi)){
bd(this,bj,bi);
}
return this;
}
--- END ---
--- FUNCTION SOURCE (avg) id{33,0} ---
(frames, alg) {
// Some images strangely have different pixel counts per frame.
// Pick the largest and go with that I guess?
var len = frames.reduce(function min(p, c) {
var length = c.data.length
if (length <= p) {
return length
}
return p
}, Number.MAX_VALUE)
if (len === 1) {
return frames[0].data
}
var avgFrame = new Buffer(len)
for (var i = 0; i < len; i += 4) {
var pixels = new Buffer(4 * frames.length)
for (var j = 0; j < frames.length; j++) {
frames[j].data.copy(pixels, j * 4, i, i + 4)
//pixels[j*4] = frames[j].data[i]
//pixels[j*4+1] = frames[j].data[i+1]
//pixels[j*4+2] = frames[j].data[i+2]
//pixels[j*4+3] = frames[j].data[i+3]
}
var avgPixel = alg(pixels)
avgPixel.copy(avgFrame, i)
}
return avgFrame
}
--- END ---
--- FUNCTION SOURCE (Buffer) id{33,1} ---
(arg) {
// Common case.
if (typeof arg === 'number') {
// If less than zero, or NaN.
if (arg < 0 || arg !== arg)
arg = 0;
return allocate(arg);
}
// Slightly less common case.
if (typeof arg === 'string') {
return fromString(arg, arguments[1]);
}
// Unusual.
return fromObject(arg);
}
--- END ---
INLINE (Buffer) id{33,1} AS 1 AT <0:360>
--- FUNCTION SOURCE (fromString) id{33,2} ---
(string, encoding) {
if (typeof encoding !== 'string' || encoding === '')
encoding = 'utf8';
var length = byteLength(string, encoding);
if (length >= (Buffer.poolSize >>> 1))
return binding.createFromString(string, encoding);
if (length > (poolSize - poolOffset))
createPool();
var actual = allocPool.write(string, poolOffset, encoding);
var b = allocPool.slice(poolOffset, poolOffset + actual);
poolOffset += actual;
alignPool();
return b;
}
--- END ---
INLINE (fromString) id{33,2} AS 2 AT <1:247>
--- FUNCTION SOURCE (slice) id{33,3} ---
(start, end) {
const buffer = this.subarray(start, end);
Object.setPrototypeOf(buffer, Buffer.prototype);
return buffer;
}
--- END ---
INLINE (slice) id{33,3} AS 3 AT <2:382>
--- FUNCTION SOURCE (alignPool) id{33,4} ---
() {
// Ensure aligned slices
if (poolOffset & 0x7) {
poolOffset |= 0x7;
poolOffset++;
}
}
--- END ---
INLINE (alignPool) id{33,4} AS 4 AT <2:448>
--- FUNCTION SOURCE (Buffer) id{33,5} ---
(arg) {
// Common case.
if (typeof arg === 'number') {
// If less than zero, or NaN.
if (arg < 0 || arg !== arg)
arg = 0;
return allocate(arg);
}
// Slightly less common case.
if (typeof arg === 'string') {
return fromString(arg, arguments[1]);
}
// Unusual.
return fromObject(arg);
}
--- END ---
INLINE (Buffer) id{33,5} AS 5 AT <0:430>
--- FUNCTION SOURCE (fromString) id{33,6} ---
(string, encoding) {
if (typeof encoding !== 'string' || encoding === '')
encoding = 'utf8';
var length = byteLength(string, encoding);
if (length >= (Buffer.poolSize >>> 1))
return binding.createFromString(string, encoding);
if (length > (poolSize - poolOffset))
createPool();
var actual = allocPool.write(string, poolOffset, encoding);
var b = allocPool.slice(poolOffset, poolOffset + actual);
poolOffset += actual;
alignPool();
return b;
}
--- END ---
INLINE (fromString) id{33,6} AS 6 AT <5:247>
--- FUNCTION SOURCE (slice) id{33,7} ---
(start, end) {
const buffer = this.subarray(start, end);
Object.setPrototypeOf(buffer, Buffer.prototype);
return buffer;
}
--- END ---
INLINE (slice) id{33,7} AS 7 AT <6:382>
--- FUNCTION SOURCE (alignPool) id{33,8} ---
() {
// Ensure aligned slices
if (poolOffset & 0x7) {
poolOffset |= 0x7;
poolOffset++;
}
}
--- END ---
INLINE (alignPool) id{33,8} AS 8 AT <6:448>
--- FUNCTION SOURCE (medianPixel) id{33,9} ---
(pixels) {
var sorted = sortPixels(pixels)
var mid = (sorted.length / 2) - ((sorted.length / 2) % 4)
return sorted.slice(mid, mid + 4)
}
--- END ---
INLINE (medianPixel) id{33,9} AS 9 AT <0:754>
--- FUNCTION SOURCE (sortPixels) id{33,10} ---
(pixels) {
var split = []
for (var i = 0; i < pixels.length; i += 4) {
split.push(pixels.slice(i, i + 4))
}
var sorted = split.sort(function (a, b) {
return (a[0] + a[1] + a[2] + a[3]) - (b[0] + b[1] + b[2] + b[3])
})
var newbuff = new Buffer(pixels.length)
for (var j = 0; j < sorted.length; j++) {
newbuff[j * 4] = sorted[j][0]
newbuff[j * 4 + 1] = sorted[j][1]
newbuff[j * 4 + 2] = sorted[j][2]
newbuff[j * 4 + 3] = sorted[j][3]
}
return newbuff
}
--- END ---
INLINE (sortPixels) id{33,10} AS 10 AT <9:26>
--- FUNCTION SOURCE (slice) id{33,11} ---
(start, end) {
const buffer = this.subarray(start, end);
Object.setPrototypeOf(buffer, Buffer.prototype);
return buffer;
}
--- END ---
INLINE (slice) id{33,11} AS 11 AT <10:97>
--- FUNCTION SOURCE (Buffer) id{33,12} ---
(arg) {
// Common case.
if (typeof arg === 'number') {
// If less than zero, or NaN.
if (arg < 0 || arg !== arg)
arg = 0;
return allocate(arg);
}
// Slightly less common case.
if (typeof arg === 'string') {
return fromString(arg, arguments[1]);
}
// Unusual.
return fromObject(arg);
}
--- END ---
INLINE (Buffer) id{33,12} AS 12 AT <10:252>
--- FUNCTION SOURCE (fromString) id{33,13} ---
(string, encoding) {
if (typeof encoding !== 'string' || encoding === '')
encoding = 'utf8';
var length = byteLength(string, encoding);
if (length >= (Buffer.poolSize >>> 1))
return binding.createFromString(string, encoding);
if (length > (poolSize - poolOffset))
createPool();
var actual = allocPool.write(string, poolOffset, encoding);
var b = allocPool.slice(poolOffset, poolOffset + actual);
poolOffset += actual;
alignPool();
return b;
}
--- END ---
INLINE (fromString) id{33,13} AS 13 AT <12:247>
--- FUNCTION SOURCE (slice) id{33,14} ---
(start, end) {
const buffer = this.subarray(start, end);
Object.setPrototypeOf(buffer, Buffer.prototype);
return buffer;
}
--- END ---
INLINE (slice) id{33,14} AS 14 AT <13:382>
--- FUNCTION SOURCE (alignPool) id{33,15} ---
() {
// Ensure aligned slices
if (poolOffset & 0x7) {
poolOffset |= 0x7;
poolOffset++;
}
}
--- END ---
INLINE (alignPool) id{33,15} AS 15 AT <13:448>
[deoptimizing (DEOPT eager): begin 0x100fecf4dc39 <JS Function avg (SharedFunctionInfo 0x2ac96392ee49)> (opt #33) @45, FP to SP delta: 440]
;;; deoptimize at 5_272: out of bounds
reading input frame avg => node=3, args=106, height=7; inputs:
0: 0x100fecf4dc39 ; (frame function) 0x100fecf4dc39 <JS Function avg (SharedFunctionInfo 0x2ac96392ee49)>
1: 0x36cdc0e04131 ; r9 0x36cdc0e04131 <undefined>
2: 0x100fecfa5909 ; r8 0x100fecfa5909 <JS Array[51]>
3: 0x100fecf4dbf1 ; rsi 0x100fecf4dbf1 <JS Function medianPixel (SharedFunctionInfo 0x2ac96392eba9)>
4: 0x100fecf4dac9 ; rcx 0x100fecf4dac9 <FixedArray[26]>
5: 1440000 ; rdx
6: 0x100fecfa58b9 ; rbx 0x100fecfa58b9 <an Uint8Array with map 0x3d4eb9d1d389>
7: 1788 ; rax
8: 0x36cdc0e04131 ; (literal 7) 0x36cdc0e04131 <undefined>
9: 0x36cdc0e04131 ; (literal 7) 0x36cdc0e04131 <undefined>
10: 0x36cdc0e04131 ; (literal 7) 0x36cdc0e04131 <undefined>
translating frame avg => node=106, height=48
0x7ffc654cd5f0: [top + 96] <- 0x36cdc0e04131 ; 0x36cdc0e04131 <undefined> (input #1)
0x7ffc654cd5e8: [top + 88] <- 0x100fecfa5909 ; 0x100fecfa5909 <JS Array[51]> (input #2)
0x7ffc654cd5e0: [top + 80] <- 0x100fecf4dbf1 ; 0x100fecf4dbf1 <JS Function medianPixel (SharedFunctionInfo 0x2ac96392eba9)> (input #3)
0x7ffc654cd5d8: [top + 72] <- 0x376e6fef0f21 ; caller's pc
0x7ffc654cd5d0: [top + 64] <- 0x7ffc654cd610 ; caller's fp
0x7ffc654cd5c8: [top + 56] <- 0x100fecf4dac9 ; context 0x100fecf4dac9 <FixedArray[26]> (input #4)
0x7ffc654cd5c0: [top + 48] <- 0x100fecf4dc39 ; function 0x100fecf4dc39 <JS Function avg (SharedFunctionInfo 0x2ac96392ee49)> (input #0)
0x7ffc654cd5b8: [top + 40] <- 0x15f90000000000 ; 1440000 (input #5)
0x7ffc654cd5b0: [top + 32] <- 0x100fecfa58b9 ; 0x100fecfa58b9 <an Uint8Array with map 0x3d4eb9d1d389> (input #6)
0x7ffc654cd5a8: [top + 24] <- 0x6fc00000000 ; 1788 (input #7)
0x7ffc654cd5a0: [top + 16] <- 0x36cdc0e04131 ; 0x36cdc0e04131 <undefined> (input #8)
0x7ffc654cd598: [top + 8] <- 0x36cdc0e04131 ; 0x36cdc0e04131 <undefined> (input #9)
0x7ffc654cd590: [top + 0] <- 0x36cdc0e04131 ; 0x36cdc0e04131 <undefined> (input #10)
[deoptimizing (eager): end 0x100fecf4dc39 <JS Function avg (SharedFunctionInfo 0x2ac96392ee49)> @45 => node=106, pc=0x376e6fef14e0, state=NO_REGISTERS, alignment=no padding, took 0.052 ms]
--- FUNCTION SOURCE (InsertionSort) id{34,0} ---
(y,m,aF){
for(var t=m+1;t<aF;t++){
var aG=y[t];
for(var am=t-1;am>=m;am--){
var aH=y[am];
var aI=%_CallFunction((void 0),aH,aG,aC);
if(aI>0){
y[am+1]=aH;
}else{
break;
}
}
y[am+1]=aG;
}
}
--- END ---
--- FUNCTION SOURCE (avg) id{35,0} ---
(frames, alg) {
// Some images strangely have different pixel counts per frame.
// Pick the largest and go with that I guess?
var len = frames.reduce(function min(p, c) {
var length = c.data.length
if (length <= p) {
return length
}
return p
}, Number.MAX_VALUE)
if (len === 1) {
return frames[0].data
}
var avgFrame = new Buffer(len)
for (var i = 0; i < len; i += 4) {
var pixels = new Buffer(4 * frames.length)
for (var j = 0; j < frames.length; j++) {
frames[j].data.copy(pixels, j * 4, i, i + 4)
//pixels[j*4] = frames[j].data[i]
//pixels[j*4+1] = frames[j].data[i+1]
//pixels[j*4+2] = frames[j].data[i+2]
//pixels[j*4+3] = frames[j].data[i+3]
}
var avgPixel = alg(pixels)
avgPixel.copy(avgFrame, i)
}
return avgFrame
}
--- END ---
--- FUNCTION SOURCE (Buffer) id{35,1} ---
(arg) {
// Common case.
if (typeof arg === 'number') {
// If less than zero, or NaN.
if (arg < 0 || arg !== arg)
arg = 0;
return allocate(arg);
}
// Slightly less common case.
if (typeof arg === 'string') {
return fromString(arg, arguments[1]);
}
// Unusual.
return fromObject(arg);
}
--- END ---
INLINE (Buffer) id{35,1} AS 1 AT <0:360>
--- FUNCTION SOURCE (fromString) id{35,2} ---
(string, encoding) {
if (typeof encoding !== 'string' || encoding === '')
encoding = 'utf8';
var length = byteLength(string, encoding);
if (length >= (Buffer.poolSize >>> 1))
return binding.createFromString(string, encoding);
if (length > (poolSize - poolOffset))
createPool();
var actual = allocPool.write(string, poolOffset, encoding);
var b = allocPool.slice(poolOffset, poolOffset + actual);
poolOffset += actual;
alignPool();
return b;
}
--- END ---
INLINE (fromString) id{35,2} AS 2 AT <1:247>
--- FUNCTION SOURCE (slice) id{35,3} ---
(start, end) {
const buffer = this.subarray(start, end);
Object.setPrototypeOf(buffer, Buffer.prototype);
return buffer;
}
--- END ---
INLINE (slice) id{35,3} AS 3 AT <2:382>
--- FUNCTION SOURCE (alignPool) id{35,4} ---
() {
// Ensure aligned slices
if (poolOffset & 0x7) {
poolOffset |= 0x7;
poolOffset++;
}
}
--- END ---
INLINE (alignPool) id{35,4} AS 4 AT <2:448>
--- FUNCTION SOURCE (Buffer) id{35,5} ---
(arg) {
// Common case.
if (typeof arg === 'number') {
// If less than zero, or NaN.
if (arg < 0 || arg !== arg)
arg = 0;
return allocate(arg);
}
// Slightly less common case.
if (typeof arg === 'string') {
return fromString(arg, arguments[1]);
}
// Unusual.
return fromObject(arg);
}
--- END ---
INLINE (Buffer) id{35,5} AS 5 AT <0:430>
--- FUNCTION SOURCE (fromString) id{35,6} ---
(string, encoding) {
if (typeof encoding !== 'string' || encoding === '')
encoding = 'utf8';
var length = byteLength(string, encoding);
if (length >= (Buffer.poolSize >>> 1))
return binding.createFromString(string, encoding);
if (length > (poolSize - poolOffset))
createPool();
var actual = allocPool.write(string, poolOffset, encoding);
var b = allocPool.slice(poolOffset, poolOffset + actual);
poolOffset += actual;
alignPool();
return b;
}
--- END ---
INLINE (fromString) id{35,6} AS 6 AT <5:247>
--- FUNCTION SOURCE (slice) id{35,7} ---
(start, end) {
const buffer = this.subarray(start, end);
Object.setPrototypeOf(buffer, Buffer.prototype);
return buffer;
}
--- END ---
INLINE (slice) id{35,7} AS 7 AT <6:382>
--- FUNCTION SOURCE (alignPool) id{35,8} ---
() {
// Ensure aligned slices
if (poolOffset & 0x7) {
poolOffset |= 0x7;
poolOffset++;
}
}
--- END ---
INLINE (alignPool) id{35,8} AS 8 AT <6:448>
--- FUNCTION SOURCE (medianPixel) id{35,9} ---
(pixels) {
var sorted = sortPixels(pixels)
var mid = (sorted.length / 2) - ((sorted.length / 2) % 4)
return sorted.slice(mid, mid + 4)
}
--- END ---
INLINE (medianPixel) id{35,9} AS 9 AT <0:754>
--- FUNCTION SOURCE (sortPixels) id{35,10} ---
(pixels) {
var split = []
for (var i = 0; i < pixels.length; i += 4) {
split.push(pixels.slice(i, i + 4))
}
var sorted = split.sort(function (a, b) {
return (a[0] + a[1] + a[2] + a[3]) - (b[0] + b[1] + b[2] + b[3])
})
var newbuff = new Buffer(pixels.length)
for (var j = 0; j < sorted.length; j++) {
newbuff[j * 4] = sorted[j][0]
newbuff[j * 4 + 1] = sorted[j][1]
newbuff[j * 4 + 2] = sorted[j][2]
newbuff[j * 4 + 3] = sorted[j][3]
}
return newbuff
}
--- END ---
INLINE (sortPixels) id{35,10} AS 10 AT <9:26>
--- FUNCTION SOURCE (slice) id{35,11} ---
(start, end) {
const buffer = this.subarray(start, end);
Object.setPrototypeOf(buffer, Buffer.prototype);
return buffer;
}
--- END ---
INLINE (slice) id{35,11} AS 11 AT <10:97>
--- FUNCTION SOURCE (Buffer) id{35,12} ---
(arg) {
// Common case.
if (typeof arg === 'number') {
// If less than zero, or NaN.
if (arg < 0 || arg !== arg)
arg = 0;
return allocate(arg);
}
// Slightly less common case.
if (typeof arg === 'string') {
return fromString(arg, arguments[1]);
}
// Unusual.
return fromObject(arg);
}
--- END ---
INLINE (Buffer) id{35,12} AS 12 AT <10:252>
--- FUNCTION SOURCE (fromString) id{35,13} ---
(string, encoding) {
if (typeof encoding !== 'string' || encoding === '')
encoding = 'utf8';
var length = byteLength(string, encoding);
if (length >= (Buffer.poolSize >>> 1))
return binding.createFromString(string, encoding);
if (length > (poolSize - poolOffset))
createPool();
var actual = allocPool.write(string, poolOffset, encoding);
var b = allocPool.slice(poolOffset, poolOffset + actual);
poolOffset += actual;
alignPool();
return b;
}
--- END ---
INLINE (fromString) id{35,13} AS 13 AT <12:247>
--- FUNCTION SOURCE (slice) id{35,14} ---
(start, end) {
const buffer = this.subarray(start, end);
Object.setPrototypeOf(buffer, Buffer.prototype);
return buffer;
}
--- END ---
INLINE (slice) id{35,14} AS 14 AT <13:382>
--- FUNCTION SOURCE (alignPool) id{35,15} ---
() {
// Ensure aligned slices
if (poolOffset & 0x7) {
poolOffset |= 0x7;
poolOffset++;
}
}
--- END ---
INLINE (alignPool) id{35,15} AS 15 AT <13:448>
--- FUNCTION SOURCE () id{36,0} ---
(a, b) {
return (a[0] + a[1] + a[2] + a[3]) - (b[0] + b[1] + b[2] + b[3])
}
--- END ---
--- FUNCTION SOURCE (QuickSort) id{37,0} ---
(y,m,aF){
var aM=0;
while(true){
if(aF-m<=10){
aE(y,m,aF);
return;
}
if(aF-m>1000){
aM=aJ(y,m,aF);
}else{
aM=m+((aF-m)>>1);
}
var aO=y[m];
var aP=y[aF-1];
var aQ=y[aM];
var aR=%_CallFunction((void 0),aO,aP,aC);
if(aR>0){
var aH=aO;
aO=aP;
aP=aH;
}
var aS=%_CallFunction((void 0),aO,aQ,aC);
if(aS>=0){
var aH=aO;
aO=aQ;
aQ=aP;
aP=aH;
}else{
var aT=%_CallFunction((void 0),aP,aQ,aC);
if(aT>0){
var aH=aP;
aP=aQ;
aQ=aH;
}
}
y[m]=aO;
y[aF-1]=aQ;
var aU=aP;
var aV=m+1;
var aW=aF-1;
y[aM]=y[aV];
y[aV]=aU;
partition:for(var t=aV+1;t<aW;t++){
var aG=y[t];
var aI=%_CallFunction((void 0),aG,aU,aC);
if(aI<0){
y[t]=y[aV];
y[aV]=aG;
aV++;
}else if(aI>0){
do{
aW--;
if(aW==t)break partition;
var aX=y[aW];
aI=%_CallFunction((void 0),aX,aU,aC);
}while(aI>0);
y[t]=y[aW];
y[aW]=aG;
if(aI<0){
aG=y[t];
y[t]=y[aV];
y[aV]=aG;
aV++;
}
}
}
if(aF-aW<aV-m){
aN(y,aW,aF);
aF=aV;
}else{
aN(y,m,aV);
m=aW;
}
}
}
--- END ---
--- FUNCTION SOURCE (InsertionSort) id{38,0} ---
(y,m,aF){
for(var t=m+1;t<aF;t++){
var aG=y[t];
for(var am=t-1;am>=m;am--){
var aH=y[am];
var aI=%_CallFunction((void 0),aH,aG,aC);
if(aI>0){
y[am+1]=aH;
}else{
break;
}
}
y[am+1]=aG;
}
}
--- END ---
--- FUNCTION SOURCE (ToObject) id{39,0} ---
(i){
if((typeof(i)==='string'))return new e(i);
if((typeof(i)==='number'))return new g(i);
if((typeof(i)==='boolean'))return new d(i);
if((typeof(i)==='symbol'))return %NewSymbolWrapper(i);
if((i==null)&&!(%_IsUndetectableObject(i))){
throw MakeTypeError(113);
}
return i;
}
--- END ---
--- FUNCTION SOURCE (abs) id{40,0} ---
(e){
e=+e;
return(e>0)?e:0-e;
}
--- END ---
--- FUNCTION SOURCE (replaceBackground) id{41,0} ---
(frames, replacer, tolerance) {
tolerance = tolerance != null ? tolerance : 50
// var background = meanFrame(frames)
var background = medianFrame(frames)
for (var i = 0; i < frames.length; i++) {
var dupe = copy(frames[i].data)
replacer(dupe)
var rgba = frames[i].data
for (var j = 0; j < background.length; j += 4) {
var rDiff = Math.abs(rgba[j] - background[j])
var gDiff = Math.abs(rgba[j+1] - background[j+1])
var bDiff = Math.abs(rgba[j+2] - background[j+2])
if (!(rDiff > tolerance || gDiff > tolerance || bDiff > tolerance)) {
//if (rDiff + gDiff + bDiff < tolerance) {
var start = (j > dupe.length) ? 0 : j
rgba[j] = dupe[start + 0]
rgba[j+1] = dupe[start + 1]
rgba[j+2] = dupe[start + 2]
}
}
}
}
--- END ---
--- FUNCTION SOURCE (medianFrame) id{41,1} ---
(frames, alg) {
return avg(frames, medianPixel)
}
--- END ---
INLINE (medianFrame) id{41,1} AS 1 AT <0:140>
--- FUNCTION SOURCE (copy) id{41,2} ---
(rgba) {
var dupe = new Buffer(rgba.length)
rgba.copy(dupe)
return dupe
}
--- END ---
INLINE (copy) id{41,2} AS 2 AT <0:219>
--- FUNCTION SOURCE (Buffer) id{41,3} ---
(arg) {
// Common case.
if (typeof arg === 'number') {
// If less than zero, or NaN.
if (arg < 0 || arg !== arg)
arg = 0;
return allocate(arg);
}
// Slightly less common case.
if (typeof arg === 'string') {
return fromString(arg, arguments[1]);
}
// Unusual.
return fromObject(arg);
}
--- END ---
INLINE (Buffer) id{41,3} AS 3 AT <2:22>
--- FUNCTION SOURCE (fromString) id{41,4} ---
(string, encoding) {
if (typeof encoding !== 'string' || encoding === '')
encoding = 'utf8';
var length = byteLength(string, encoding);
if (length >= (Buffer.poolSize >>> 1))
return binding.createFromString(string, encoding);
if (length > (poolSize - poolOffset))
createPool();
var actual = allocPool.write(string, poolOffset, encoding);
var b = allocPool.slice(poolOffset, poolOffset + actual);
poolOffset += actual;
alignPool();
return b;
}
--- END ---
INLINE (fromString) id{41,4} AS 4 AT <3:247>
--- FUNCTION SOURCE (slice) id{41,5} ---
(start, end) {
const buffer = this.subarray(start, end);
Object.setPrototypeOf(buffer, Buffer.prototype);
return buffer;
}
--- END ---
INLINE (slice) id{41,5} AS 5 AT <4:382>
--- FUNCTION SOURCE (alignPool) id{41,6} ---
() {
// Ensure aligned slices
if (poolOffset & 0x7) {
poolOffset |= 0x7;
poolOffset++;
}
}
--- END ---
INLINE (alignPool) id{41,6} AS 6 AT <4:448>
--- FUNCTION SOURCE (replacer) id{41,7} ---
(frame) {
frame.fill(0)
}
--- END ---
INLINE (replacer) id{41,7} AS 7 AT <0:244>
--- FUNCTION SOURCE (DefineOwnProperty) id{42,0} ---
(J,V,G,Y){
if(%_IsJSProxy(J)){
if((typeof(V)==='symbol'))return false;
var w=FromGenericPropertyDescriptor(G);
return DefineProxyProperty(J,V,w,Y);
}else if((%_IsArray(J))){
return DefineArrayProperty(J,V,G,Y);
}else{
return DefineObjectProperty(J,V,G,Y);
}
}
--- END ---
--- FUNCTION SOURCE (GIFEncoder.removeAlphaChannel) id{43,0} ---
(data) {
var w = this.width;
var h = this.height;
var pixels = new Uint8Array(w * h * 3);
var count = 0;
for (var i = 0; i < h; i++) {
for (var j = 0; j < w; j++) {
var b = (i * w * 4) + j * 4;
pixels[count++] = data[b];
pixels[count++] = data[b+1];
pixels[count++] = data[b+2];
}
}
return pixels;
}
--- END ---
[deoptimizing (DEOPT eager): begin 0x3ed23a86f091 <JS Function abs (SharedFunctionInfo 0x36cdc0e69bd9)> (opt #40) @2, FP to SP delta: 24]
;;; deoptimize at 0_8: lost precision
reading input frame abs => node=2, args=3, height=1; inputs:
0: 0x3ed23a86f091 ; (frame function) 0x3ed23a86f091 <JS Function abs (SharedFunctionInfo 0x36cdc0e69bd9)>
1: 0x3ed23a854651 ; [fp + 24] 0x3ed23a854651 <a MathConstructor with map 0x3d4eb9d0ad49>
2: 0x7bbff3ebea1 ; [fp + 16] 0x7bbff3ebea1 <Number: 0.015625>
3: 0x3ed23a871969 ; [fp - 24] 0x3ed23a871969 <FixedArray[15]>
translating frame abs => node=3, height=0
0x7ffc654cd278: [top + 40] <- 0x3ed23a854651 ; 0x3ed23a854651 <a MathConstructor with map 0x3d4eb9d0ad49> (input #1)
0x7ffc654cd270: [top + 32] <- 0x7bbff3ebea1 ; 0x7bbff3ebea1 <Number: 0.015625> (input #2)
0x7ffc654cd268: [top + 24] <- 0x376e6ff4264e ; caller's pc
0x7ffc654cd260: [top + 16] <- 0x7ffc654cd2e0 ; caller's fp
0x7ffc654cd258: [top + 8] <- 0x3ed23a871969 ; context 0x3ed23a871969 <FixedArray[15]> (input #3)
0x7ffc654cd250: [top + 0] <- 0x3ed23a86f091 ; function 0x3ed23a86f091 <JS Function abs (SharedFunctionInfo 0x36cdc0e69bd9)> (input #0)
[deoptimizing (eager): end 0x3ed23a86f091 <JS Function abs (SharedFunctionInfo 0x36cdc0e69bd9)> @2 => node=3, pc=0x376e6ff0d186, state=NO_REGISTERS, alignment=no padding, took 0.037 ms]
--- FUNCTION SOURCE (abs) id{44,0} ---
(e){
e=+e;
return(e>0)?e:0-e;
}
--- END ---
--- FUNCTION SOURCE (contest) id{45,0} ---
(b, g, r) {
/*
finds closest neuron (min dist) and updates freq
finds best neuron (min dist-bias) and returns position
for frequently chosen neurons, freq[i] is high and bias[i] is negative
bias[i] = gamma * ((1 / netsize) - freq[i])
*/
var bestd = ~(1 << 31);
var bestbiasd = bestd;
var bestpos = -1;
var bestbiaspos = bestpos;
var i, n, dist, biasdist, betafreq;
for (i = 0; i < netsize; i++) {
n = network[i];
dist = Math.abs(n[0] - b) + Math.abs(n[1] - g) + Math.abs(n[2] - r);
if (dist < bestd) {
bestd = dist;
bestpos = i;
}
biasdist = dist - ((bias[i]) >> (intbiasshift - netbiasshift));
if (biasdist < bestbiasd) {
bestbiasd = biasdist;
bestbiaspos = i;
}
betafreq = (freq[i] >> betashift);
freq[i] -= betafreq;
bias[i] += (betafreq << gammashift);
}
freq[bestpos] += beta;
bias[bestpos] -= betagamma;
return bestbiaspos;
}
--- END ---
--- FUNCTION SOURCE (alterneigh) id{46,0} ---
(radius, i, b, g, r) {
var lo = Math.abs(i - radius);
var hi = Math.min(i + radius, netsize);
var j = i + 1;
var k = i - 1;
var m = 1;
var p, a;
while ((j < hi) || (k > lo)) {
a = radpower[m++];
if (j < hi) {
p = network[j++];
p[0] -= (a * (p[0] - b)) / alpharadbias;
p[1] -= (a * (p[1] - g)) / alpharadbias;
p[2] -= (a * (p[2] - r)) / alpharadbias;
}
if (k > lo) {
p = network[k--];
p[0] -= (a * (p[0] - b)) / alpharadbias;
p[1] -= (a * (p[1] - g)) / alpharadbias;
p[2] -= (a * (p[2] - r)) / alpharadbias;
}
}
}
--- END ---
--- FUNCTION SOURCE (altersingle) id{47,0} ---
(alpha, i, b, g, r) {
network[i][0] -= (alpha * (network[i][0] - b)) / initalpha;
network[i][1] -= (alpha * (network[i][1] - g)) / initalpha;
network[i][2] -= (alpha * (network[i][2] - r)) / initalpha;
}
--- END ---
[deoptimizing (DEOPT soft): begin 0x7bbfe01ac69 <JS Function alterneigh (SharedFunctionInfo 0x100fecfd14a1)> (opt #46) @26, FP to SP delta: 64]
;;; deoptimize at 0_473: Insufficient type feedback for keyed load
reading input frame alterneigh => node=6, args=499, height=8; inputs:
0: 0x7bbfe01ac69 ; (frame function) 0x7bbfe01ac69 <JS Function alterneigh (SharedFunctionInfo 0x100fecfd14a1)>
1: 0x36cdc0e04131 ; [fp + 56] 0x36cdc0e04131 <undefined>
2: 0x1300000000 ; [fp + 48] 19
3: 0x4600000000 ; [fp + 40] 70
4: 0xc2000000000 ; r12 3104
5: 0x46000000000 ; [fp + 24] 1120
6: 0x2000000000 ; r14 32
7: 0x7bbfe01aad1 ; [fp - 24] 0x7bbfe01aad1 <FixedArray[18]>
8: 5.100000e+01 ; xmm1 (bool)
9: 8.900000e+01 ; xmm2 (bool)
10: 72 ; rax
11: 69 ; rdx
12: 2 ; (int) [fp - 32]
13: 0x36cdc0e04131 ; (literal 1) 0x36cdc0e04131 <undefined>
14: 223541 ; rbx
translating frame alterneigh => node=499, height=56
0x7ffc654cd308: [top + 128] <- 0x36cdc0e04131 ; 0x36cdc0e04131 <undefined> (input #1)
0x7ffc654cd300: [top + 120] <- 0x1300000000 ; 19 (input #2)
0x7ffc654cd2f8: [top + 112] <- 0x4600000000 ; 70 (input #3)
0x7ffc654cd2f0: [top + 104] <- 0xc2000000000 ; 3104 (input #4)
0x7ffc654cd2e8: [top + 96] <- 0x46000000000 ; 1120 (input #5)
0x7ffc654cd2e0: [top + 88] <- 0x2000000000 ; 32 (input #6)
0x7ffc654cd2d8: [top + 80] <- 0x376e6ff41f51 ; caller's pc
0x7ffc654cd2d0: [top + 72] <- 0x7ffc654cd398 ; caller's fp
0x7ffc654cd2c8: [top + 64] <- 0x7bbfe01aad1 ; context 0x7bbfe01aad1 <FixedArray[18]> (input #7)
0x7ffc654cd2c0: [top + 56] <- 0x7bbfe01ac69 ; function 0x7bbfe01ac69 <JS Function alterneigh (SharedFunctionInfo 0x100fecfd14a1)> (input #0)
0x7ffc654cd2b8: [top + 48] <- 0x3300000000 ; 51 (input #8)
0x7ffc654cd2b0: [top + 40] <- 0x5900000000 ; 89 (input #9)
0x7ffc654cd2a8: [top + 32] <- 0x4800000000 ; 72 (input #10)
0x7ffc654cd2a0: [top + 24] <- 0x4500000000 ; 69 (input #11)
0x7ffc654cd298: [top + 16] <- 0x200000000 ; 2 (input #12)
0x7ffc654cd290: [top + 8] <- 0x36cdc0e04131 ; 0x36cdc0e04131 <undefined> (input #13)
0x7ffc654cd288: [top + 0] <- 0x3693500000000 ; 223541 (input #14)
[deoptimizing (soft): end 0x7bbfe01ac69 <JS Function alterneigh (SharedFunctionInfo 0x100fecfd14a1)> @26 => node=499, pc=0x376e6ff43793, state=NO_REGISTERS, alignment=no padding, took 0.054 ms]
--- FUNCTION SOURCE (alterneigh) id{48,0} ---
(radius, i, b, g, r) {
var lo = Math.abs(i - radius);
var hi = Math.min(i + radius, netsize);
var j = i + 1;
var k = i - 1;
var m = 1;
var p, a;
while ((j < hi) || (k > lo)) {
a = radpower[m++];
if (j < hi) {
p = network[j++];
p[0] -= (a * (p[0] - b)) / alpharadbias;
p[1] -= (a * (p[1] - g)) / alpharadbias;
p[2] -= (a * (p[2] - r)) / alpharadbias;
}
if (k > lo) {
p = network[k--];
p[0] -= (a * (p[0] - b)) / alpharadbias;
p[1] -= (a * (p[1] - g)) / alpharadbias;
p[2] -= (a * (p[2] - r)) / alpharadbias;
}
}
}
--- END ---
--- FUNCTION SOURCE (inxbuild) id{49,0} ---
() {
var i, j, p, q, smallpos, smallval, previouscol = 0, startpos = 0;
for (i = 0; i < netsize; i++) {
p = network[i];
smallpos = i;
smallval = p[1]; // index on g
// find smallest in i..netsize-1
for (j = i + 1; j < netsize; j++) {
q = network[j];
if (q[1] < smallval) { // index on g
smallpos = j;
smallval = q[1]; // index on g
}
}
q = network[smallpos];
// swap p (i) and q (smallpos) entries
if (i != smallpos) {
j = q[0]; q[0] = p[0]; p[0] = j;
j = q[1]; q[1] = p[1]; p[1] = j;
j = q[2]; q[2] = p[2]; p[2] = j;
j = q[3]; q[3] = p[3]; p[3] = j;
}
// smallval entry is now in position i
if (smallval != previouscol) {
netindex[previouscol] = (startpos + i) >> 1;
for (j = previouscol + 1; j < smallval; j++)
netindex[j] = i;
previouscol = smallval;
startpos = i;
}
}
netindex[previouscol] = (startpos + maxnetpos) >> 1;
for (j = previouscol + 1; j < 256; j++)
netindex[j] = maxnetpos; // really 256
}
--- END ---
[deoptimizing (DEOPT soft): begin 0x7bbfe01acf9 <JS Function inxbuild (SharedFunctionInfo 0x100fecfd15f1)> (opt #49) @39, FP to SP delta: 184]
;;; deoptimize at 0_1035: Insufficient type feedback for LHS of binary operation
reading input frame inxbuild => node=1, args=52, height=9; inputs:
0: 0x7bbfe01acf9 ; (frame function) 0x7bbfe01acf9 <JS Function inxbuild (SharedFunctionInfo 0x100fecfd15f1)>
1: 0x36cdc0e04131 ; [fp - 112] 0x36cdc0e04131 <undefined>
2: 0x7bbfe01aad1 ; [fp - 96] 0x7bbfe01aad1 <FixedArray[18]>
3: 0x36cdc0e04131 ; (literal 1) 0x36cdc0e04131 <undefined>
4: 0x36cdc0e04131 ; (literal 1) 0x36cdc0e04131 <undefined>
5: 0x36cdc0e04131 ; (literal 1) 0x36cdc0e04131 <undefined>
6: 0x36cdc0e04131 ; (literal 1) 0x36cdc0e04131 <undefined>
7: 0x36cdc0e04131 ; (literal 1) 0x36cdc0e04131 <undefined>
8: 0x36cdc0e04131 ; (literal 1) 0x36cdc0e04131 <undefined>
9: 0x7bbfe214819 ; rbx 0x7bbfe214819 <Number: 255>
10: 0xff00000000 ; [fp - 104] 255
translating frame inxbuild => node=52, height=64
0x7ffc654cd3a8: [top + 96] <- 0x36cdc0e04131 ; 0x36cdc0e04131 <undefined> (input #1)
0x7ffc654cd3a0: [top + 88] <- 0x376e6ff4046a ; caller's pc
0x7ffc654cd398: [top + 80] <- 0x7ffc654cd3c8 ; caller's fp
0x7ffc654cd390: [top + 72] <- 0x7bbfe01aad1 ; context 0x7bbfe01aad1 <FixedArray[18]> (input #2)
0x7ffc654cd388: [top + 64] <- 0x7bbfe01acf9 ; function 0x7bbfe01acf9 <JS Function inxbuild (SharedFunctionInfo 0x100fecfd15f1)> (input #0)
0x7ffc654cd380: [top + 56] <- 0x36cdc0e04131 ; 0x36cdc0e04131 <undefined> (input #3)
0x7ffc654cd378: [top + 48] <- 0x36cdc0e04131 ; 0x36cdc0e04131 <undefined> (input #4)
0x7ffc654cd370: [top + 40] <- 0x36cdc0e04131 ; 0x36cdc0e04131 <undefined> (input #5)
0x7ffc654cd368: [top + 32] <- 0x36cdc0e04131 ; 0x36cdc0e04131 <undefined> (input #6)
0x7ffc654cd360: [top + 24] <- 0x36cdc0e04131 ; 0x36cdc0e04131 <undefined> (input #7)
0x7ffc654cd358: [top + 16] <- 0x36cdc0e04131 ; 0x36cdc0e04131 <undefined> (input #8)
0x7ffc654cd350: [top + 8] <- 0x7bbfe214819 ; 0x7bbfe214819 <Number: 255> (input #9)
0x7ffc654cd348: [top + 0] <- 0xff00000000 ; 255 (input #10)
[deoptimizing (soft): end 0x7bbfe01acf9 <JS Function inxbuild (SharedFunctionInfo 0x100fecfd15f1)> @39 => node=52, pc=0x376e6ff44e8d, state=NO_REGISTERS, alignment=no padding, took 0.042 ms]
--- FUNCTION SOURCE (inxsearch) id{50,0} ---
(b, g, r) {
var a, p, dist;
var bestd = 1000; // biggest possible dist is 256*3
var best = -1;
var i = netindex[g]; // index on g
var j = i - 1; // start at netindex[g] and work outwards
while ((i < netsize) || (j >= 0)) {
if (i < netsize) {
p = network[i];
dist = p[1] - g; // inx key
if (dist >= bestd) i = netsize; // stop iter
else {
i++;
if (dist < 0) dist = -dist;
a = p[0] - b; if (a < 0) a = -a;
dist += a;
if (dist < bestd) {
a = p[2] - r; if (a < 0) a = -a;
dist += a;
if (dist < bestd) {
bestd = dist;
best = p[3];
}
}
}
}
if (j >= 0) {
p = network[j];
dist = g - p[1]; // inx key - reverse dif
if (dist >= bestd) j = -1; // stop iter
else {
j--;
if (dist < 0) dist = -dist;
a = p[0] - b; if (a < 0) a = -a;
dist += a;
if (dist < bestd) {
a = p[2] - r; if (a < 0) a = -a;
dist += a;
if (dist < bestd) {
bestd = dist;
best = p[3];
}
}
}
}
}
return best;
}
--- END ---
--- FUNCTION SOURCE (GIFEncoder.analyzePixels) id{51,0} ---
() {
var len = this.pixels.length;
var nPix = len / 3;
// TODO: Re-use indexedPixels
this.indexedPixels = new Uint8Array(nPix);
var imgq = new NeuQuant(this.pixels, this.sample);
imgq.buildColormap(); // create reduced palette
this.colorTab = imgq.getColormap();
// map image pixels to new palette
var k = 0;
for (var j = 0; j < nPix; j++) {
var index = imgq.lookupRGB(
this.pixels[k++] & 0xff,
this.pixels[k++] & 0xff,
this.pixels[k++] & 0xff
);
this.usedEntry[index] = true;
this.indexedPixels[j] = index;
}
this.pixels = null;
this.colorDepth = 8;
this.palSize = 7;
// get closest match to transparent color if specified
if (this.transparent !== null) {
this.transIndex = this.findClosest(this.transparent);
}
}
--- END ---
[deoptimizing (DEOPT soft): begin 0x3ed23a8fced1 <JS Function inxsearch (SharedFunctionInfo 0x100fecfd1699)> (opt #50) @27, FP to SP delta: 24]
;;; deoptimize at 0_940: Insufficient type feedback for combined type of binary operation
reading input frame inxsearch => node=4, args=495, height=8; inputs:
0: 0x3ed23a8fced1 ; (frame function) 0x3ed23a8fced1 <JS Function inxsearch (SharedFunctionInfo 0x100fecfd1699)>
1: 0x3ed23a8fcf19 ; [fp + 40] 0x3ed23a8fcf19 <a NeuQuant with map 0x3d4eb9d0eb81>
2: 0x8700000000 ; r9 135
3: 0x6c00000000 ; r8 108
4: 0x00000000 ; r11 0
5: 0x3ed23a8fce31 ; [fp - 24] 0x3ed23a8fce31 <FixedArray[18]>
6: 0x36cdc0e04131 ; (literal 1) 0x36cdc0e04131 <undefined>
7: 0xc518ec195b9 ; rdx 0xc518ec195b9 <a Float64Array with map 0x3d4eb9d157c9>
8: 0.000000e+00 ; xmm7 (bool)
9: 0x7bbff1f1dc1 ; r12 0x7bbff1f1dc1 <Number: 135>
10: 1.080000e+02 ; xmm6 (bool)
11: 74 ; rax
12: 72 ; rbx
translating frame inxsearch => node=495, height=56
0x7ffc654cd390: [top + 112] <- 0x3ed23a8fcf19 ; 0x3ed23a8fcf19 <a NeuQuant with map 0x3d4eb9d0eb81> (input #1)
0x7ffc654cd388: [top + 104] <- 0x8700000000 ; 135 (input #2)
0x7ffc654cd380: [top + 96] <- 0x6c00000000 ; 108 (input #3)
0x7ffc654cd378: [top + 88] <- 0x00000000 ; 0 (input #4)
0x7ffc654cd370: [top + 80] <- 0x376e6ff49dfc ; caller's pc
0x7ffc654cd368: [top + 72] <- 0x7ffc654cd428 ; caller's fp
0x7ffc654cd360: [top + 64] <- 0x3ed23a8fce31 ; context 0x3ed23a8fce31 <FixedArray[18]> (input #5)
0x7ffc654cd358: [top + 56] <- 0x3ed23a8fced1 ; function 0x3ed23a8fced1 <JS Function inxsearch (SharedFunctionInfo 0x100fecfd1699)> (input #0)
0x7ffc654cd350: [top + 48] <- 0x36cdc0e04131 ; 0x36cdc0e04131 <undefined> (input #6)
0x7ffc654cd348: [top + 40] <- 0xc518ec195b9 ; 0xc518ec195b9 <a Float64Array with map 0x3d4eb9d157c9> (input #7)
0x7ffc654cd340: [top + 32] <- 0x00000000 ; 0 (input #8)
0x7ffc654cd338: [top + 24] <- 0x7bbff1f1dc1 ; 0x7bbff1f1dc1 <Number: 135> (input #9)
0x7ffc654cd330: [top + 16] <- 0x6c00000000 ; 108 (input #10)
0x7ffc654cd328: [top + 8] <- 0x4a00000000 ; 74 (input #11)
0x7ffc654cd320: [top + 0] <- 0x4800000000 ; 72 (input #12)
[deoptimizing (soft): end 0x3ed23a8fced1 <JS Function inxsearch (SharedFunctionInfo 0x100fecfd1699)> @27 => node=495, pc=0x376e6ff473e7, state=NO_REGISTERS, alignment=no padding, took 0.089 ms]
[deoptimizing (DEOPT eager): begin 0x2ac96395d689 <JS Function GIFEncoder.analyzePixels (SharedFunctionInfo 0x2ac96394b679)> (opt #51) @31, FP to SP delta: 144]
;;; deoptimize at 0_522: out of bounds
reading input frame GIFEncoder.analyzePixels => node=1, args=226, height=8; inputs:
0: 0x2ac96395d689 ; (frame function) 0x2ac96395d689 <JS Function GIFEncoder.analyzePixels (SharedFunctionInfo 0x2ac96394b679)>
1: 0x3ed23a8fcf31 ; rbx 0x3ed23a8fcf31 <a GIFEncoder with map 0x3d4eb9d3f149>
2: 0x100fecf7fb11 ; [fp - 128] 0x100fecf7fb11 <FixedArray[8]>
3: 0x36cdc0e04131 ; (literal 1) 0x36cdc0e04131 <undefined>
4: 360000 ; (int) [fp - 120]
5: 0x3ed23a8fcf19 ; [fp - 112] 0x3ed23a8fcf19 <a NeuQuant with map 0x3d4eb9d0eb81>
6: 360873 ; (int) [fp - 144]
7: 120290 ; (int) [fp - 104]
8: 0x36cdc0e04131 ; (literal 1) 0x36cdc0e04131 <undefined>
9: 0x7bbff1f22f1 ; rax 0x7bbff1f22f1 <Number: 67>
translating frame GIFEncoder.analyzePixels => node=226, height=56
0x7ffc654cd438: [top + 88] <- 0x3ed23a8fcf31 ; 0x3ed23a8fcf31 <a GIFEncoder with map 0x3d4eb9d3f149> (input #1)
0x7ffc654cd430: [top + 80] <- 0x376e6ff3e4d3 ; caller's pc
0x7ffc654cd428: [top + 72] <- 0x7ffc654cd458 ; caller's fp
0x7ffc654cd420: [top + 64] <- 0x100fecf7fb11 ; context 0x100fecf7fb11 <FixedArray[8]> (input #2)
0x7ffc654cd418: [top + 56] <- 0x2ac96395d689 ; function 0x2ac96395d689 <JS Function GIFEncoder.analyzePixels (SharedFunctionInfo 0x2ac96394b679)> (input #0)
0x7ffc654cd410: [top + 48] <- 0x36cdc0e04131 ; 0x36cdc0e04131 <undefined> (input #3)
0x7ffc654cd408: [top + 40] <- 0x57e4000000000 ; 360000 (input #4)
0x7ffc654cd400: [top + 32] <- 0x3ed23a8fcf19 ; 0x3ed23a8fcf19 <a NeuQuant with map 0x3d4eb9d0eb81> (input #5)
0x7ffc654cd3f8: [top + 24] <- 0x581a900000000 ; 360873 (input #6)
0x7ffc654cd3f0: [top + 16] <- 0x1d5e200000000 ; 120290 (input #7)
0x7ffc654cd3e8: [top + 8] <- 0x36cdc0e04131 ; 0x36cdc0e04131 <undefined> (input #8)
0x7ffc654cd3e0: [top + 0] <- 0x7bbff1f22f1 ; 0x7bbff1f22f1 <Number: 67> (input #9)
[deoptimizing (eager): end 0x2ac96395d689 <JS Function GIFEncoder.analyzePixels (SharedFunctionInfo 0x2ac96394b679)> @31 => node=226, pc=0x376e6ff3fd7f, state=TOS_REG, alignment=no padding, took 0.059 ms]
--- FUNCTION SOURCE (inxsearch) id{52,0} ---
(b, g, r) {
var a, p, dist;
var bestd = 1000; // biggest possible dist is 256*3
var best = -1;
var i = netindex[g]; // index on g
var j = i - 1; // start at netindex[g] and work outwards
while ((i < netsize) || (j >= 0)) {
if (i < netsize) {
p = network[i];
dist = p[1] - g; // inx key
if (dist >= bestd) i = netsize; // stop iter
else {
i++;
if (dist < 0) dist = -dist;
a = p[0] - b; if (a < 0) a = -a;
dist += a;
if (dist < bestd) {
a = p[2] - r; if (a < 0) a = -a;
dist += a;
if (dist < bestd) {
bestd = dist;
best = p[3];
}
}
}
}
if (j >= 0) {
p = network[j];
dist = g - p[1]; // inx key - reverse dif
if (dist >= bestd) j = -1; // stop iter
else {
j--;
if (dist < 0) dist = -dist;
a = p[0] - b; if (a < 0) a = -a;
dist += a;
if (dist < bestd) {
a = p[2] - r; if (a < 0) a = -a;
dist += a;
if (dist < bestd) {
bestd = dist;
best = p[3];
}
}
}
}
}
return best;
}
--- END ---
--- FUNCTION SOURCE (GIFEncoder.analyzePixels) id{53,0} ---
() {
var len = this.pixels.length;
var nPix = len / 3;
// TODO: Re-use indexedPixels
this.indexedPixels = new Uint8Array(nPix);
var imgq = new NeuQuant(this.pixels, this.sample);
imgq.buildColormap(); // create reduced palette
this.colorTab = imgq.getColormap();
// map image pixels to new palette
var k = 0;
for (var j = 0; j < nPix; j++) {
var index = imgq.lookupRGB(
this.pixels[k++] & 0xff,
this.pixels[k++] & 0xff,
this.pixels[k++] & 0xff
);
this.usedEntry[index] = true;
this.indexedPixels[j] = index;
}
this.pixels = null;
this.colorDepth = 8;
this.palSize = 7;
// get closest match to transparent color if specified
if (this.transparent !== null) {
this.transIndex = this.findClosest(this.transparent);
}
}
--- END ---
[deoptimizing (DEOPT soft): begin 0x2ac96395d689 <JS Function GIFEncoder.analyzePixels (SharedFunctionInfo 0x2ac96394b679)> (opt #53) @35, FP to SP delta: 144]
;;; deoptimize at 0_584: Insufficient type feedback for generic named access
reading input frame GIFEncoder.analyzePixels => node=1, args=178, height=7; inputs:
0: 0x2ac96395d689 ; (frame function) 0x2ac96395d689 <JS Function GIFEncoder.analyzePixels (SharedFunctionInfo 0x2ac96394b679)>
1: 0x3ed23a8fcf31 ; rdx 0x3ed23a8fcf31 <a GIFEncoder with map 0x3d4eb9d3f149>
2: 0x100fecf7fb11 ; [fp - 128] 0x100fecf7fb11 <FixedArray[8]>
3: 0x36cdc0e04131 ; (literal 1) 0x36cdc0e04131 <undefined>
4: 0x36cdc0e04131 ; (literal 1) 0x36cdc0e04131 <undefined>
5: 0x36cdc0e04131 ; (literal 1) 0x36cdc0e04131 <undefined>
6: 0x36cdc0e04131 ; (literal 1) 0x36cdc0e04131 <undefined>
7: 0x36cdc0e04131 ; (literal 1) 0x36cdc0e04131 <undefined>
8: 0x36cdc0e04131 ; (literal 1) 0x36cdc0e04131 <undefined>
translating frame GIFEncoder.analyzePixels => node=178, height=48
0x7ffc654cd438: [top + 80] <- 0x3ed23a8fcf31 ; 0x3ed23a8fcf31 <a GIFEncoder with map 0x3d4eb9d3f149> (input #1)
0x7ffc654cd430: [top + 72] <- 0x376e6ff3e4d3 ; caller's pc
0x7ffc654cd428: [top + 64] <- 0x7ffc654cd458 ; caller's fp
0x7ffc654cd420: [top + 56] <- 0x100fecf7fb11 ; context 0x100fecf7fb11 <FixedArray[8]> (input #2)
0x7ffc654cd418: [top + 48] <- 0x2ac96395d689 ; function 0x2ac96395d689 <JS Function GIFEncoder.analyzePixels (SharedFunctionInfo 0x2ac96394b679)> (input #0)
0x7ffc654cd410: [top + 40] <- 0x36cdc0e04131 ; 0x36cdc0e04131 <undefined> (input #3)
0x7ffc654cd408: [top + 32] <- 0x36cdc0e04131 ; 0x36cdc0e04131 <undefined> (input #4)
0x7ffc654cd400: [top + 24] <- 0x36cdc0e04131 ; 0x36cdc0e04131 <undefined> (input #5)
0x7ffc654cd3f8: [top + 16] <- 0x36cdc0e04131 ; 0x36cdc0e04131 <undefined> (input #6)
0x7ffc654cd3f0: [top + 8] <- 0x36cdc0e04131 ; 0x36cdc0e04131 <undefined> (input #7)
0x7ffc654cd3e8: [top + 0] <- 0x36cdc0e04131 ; 0x36cdc0e04131 <undefined> (input #8)
[deoptimizing (soft): end 0x2ac96395d689 <JS Function GIFEncoder.analyzePixels (SharedFunctionInfo 0x2ac96394b679)> @35 => node=178, pc=0x376e6ff3fe8f, state=NO_REGISTERS, alignment=no padding, took 0.055 ms]
[marking dependent code 0x376e6ff4ac41 (opt #53) for deoptimization, reason: prototype-check]
[marking dependent code 0x376e6ff499a1 (opt #51) for deoptimization, reason: prototype-check]
[deoptimize marked code in all contexts]
--- FUNCTION SOURCE (ByteCapacitor.writeByte) id{54,0} ---
(val) {
this.data.push(val);
}
--- END ---
--- FUNCTION SOURCE (nextPixel) id{55,0} ---
() {
if (remaining === 0) return EOF;
--remaining;
var pix = pixels[curPixel++];
return pix & 0xff;
}
--- END ---
--- FUNCTION SOURCE (compress) id{56,0} ---
(init_bits, outs) {
var fcode, c, i, ent, disp, hsize_reg, hshift;
// Set up the globals: g_init_bits - initial number of bits
g_init_bits = init_bits;
// Set up the necessary values
clear_flg = false;
n_bits = g_init_bits;
maxcode = MAXCODE(n_bits);
ClearCode = 1 << (init_bits - 1);
EOFCode = ClearCode + 1;
free_ent = ClearCode + 2;
a_count = 0; // clear packet
ent = nextPixel();
hshift = 0;
for (fcode = HSIZE; fcode < 65536; fcode *= 2) ++hshift;
hshift = 8 - hshift; // set hash code range bound
hsize_reg = HSIZE;
cl_hash(hsize_reg); // clear hash table
output(ClearCode, outs);
outer_loop: while ((c = nextPixel()) != EOF) {
fcode = (c << BITS) + ent;
i = (c << hshift) ^ ent; // xor hashing
if (htab[i] === fcode) {
ent = codetab[i];
continue;
} else if (htab[i] >= 0) { // non-empty slot
disp = hsize_reg - i; // secondary hash (after G. Knott)
if (i === 0) disp = 1;
do {
if ((i -= disp) < 0) i += hsize_reg;
if (htab[i] === fcode) {
ent = codetab[i];
continue outer_loop;
}
} while (htab[i] >= 0);
}
output(ent, outs);
ent = c;
if (free_ent < 1 << BITS) {
codetab[i] = free_ent++; // code -> hashtable
htab[i] = fcode;
} else {
cl_block(outs);
}
}
// Put out the final code.
output(ent, outs);
output(EOFCode, outs);
}
--- END ---
--- FUNCTION SOURCE (MAXCODE) id{56,1} ---
(n_bits) {
return (1 << n_bits) - 1;
}
--- END ---
INLINE (MAXCODE) id{56,1} AS 1 AT <0:264>
--- FUNCTION SOURCE (nextPixel) id{56,2} ---
() {
if (remaining === 0) return EOF;
--remaining;
var pix = pixels[curPixel++];
return pix & 0xff;
}
--- END ---
INLINE (nextPixel) id{56,2} AS 2 AT <0:424>
--- FUNCTION SOURCE (cl_hash) id{56,3} ---
(hsize) {
for (var i = 0; i < hsize; ++i) htab[i] = -1;
}
--- END ---
INLINE (cl_hash) id{56,3} AS 3 AT <0:596>
--- FUNCTION SOURCE (nextPixel) id{56,4} ---
() {
if (remaining === 0) return EOF;
--remaining;
var pix = pixels[curPixel++];
return pix & 0xff;
}
--- END ---
INLINE (nextPixel) id{56,4} AS 4 AT <0:695>
--- FUNCTION SOURCE (char_out) id{57,0} ---
(c, outs) {
accum[a_count++] = c;
if (a_count >= 254) flush_char(outs);
}
--- END ---
[marking dependent code 0x376e6ff515e1 (opt #56) for deoptimization, reason: property-cell-changed]
[deoptimize marked code in all contexts]
[deoptimizer unlinked: compress / 7bbfe1c9b11]
[deoptimizing (DEOPT lazy): begin 0x7bbfe1c9b11 <JS Function compress (SharedFunctionInfo 0xc518ec2e0a1)> (opt #56) @40, FP to SP delta: 168]
reading input frame compress => node=3, args=560, height=8; inputs:
0: 0x7bbfe1c9b11 ; (frame function) 0x7bbfe1c9b11 <JS Function compress (SharedFunctionInfo 0xc518ec2e0a1)>
1: 0x36cdc0e04131 ; [fp - 144] 0x36cdc0e04131 <undefined>
2: 0x36cdc0e04131 ; (literal 4) 0x36cdc0e04131 <undefined>
3: 0x3ed23a8fcf31 ; [fp - 136] 0x3ed23a8fcf31 <a GIFEncoder with map 0x3d4eb9d454f9>
4: 0x7bbfe1c9949 ; [fp - 128] 0x7bbfe1c9949 <FixedArray[28]>
5: 49663 ; (int) [fp - 160]
6: 12 ; (int) [fp - 152]
7: 0x13f00000000 ; [fp - 168] 319
8: 0x36cdc0e04131 ; (literal 4) 0x36cdc0e04131 <undefined>
9: 0x36cdc0e04131 ; (literal 4) 0x36cdc0e04131 <undefined>
10: 0x138b00000000 ; [fp - 120] 5003
11: 4 ; (int) [fp - 112]
translating frame compress => node=560, height=56
0x7ffc654cd3d0: [top + 104] <- 0x36cdc0e04131 ; 0x36cdc0e04131 <undefined> (input #1)
0x7ffc654cd3c8: [top + 96] <- 0x36cdc0e04131 ; 0x36cdc0e04131 <undefined> (input #2)
0x7ffc654cd3c0: [top + 88] <- 0x3ed23a8fcf31 ; 0x3ed23a8fcf31 <a GIFEncoder with map 0x3d4eb9d454f9> (input #3)
0x7ffc654cd3b8: [top + 80] <- 0x376e6ff4e19e ; caller's pc
0x7ffc654cd3b0: [top + 72] <- 0x7ffc654cd3f0 ; caller's fp
0x7ffc654cd3a8: [top + 64] <- 0x7bbfe1c9949 ; context 0x7bbfe1c9949 <FixedArray[28]> (input #4)
0x7ffc654cd3a0: [top + 56] <- 0x7bbfe1c9b11 ; function 0x7bbfe1c9b11 <JS Function compress (SharedFunctionInfo 0xc518ec2e0a1)> (input #0)
0x7ffc654cd398: [top + 48] <- 0xc1ff00000000 ; 49663 (input #5)
0x7ffc654cd390: [top + 40] <- 0xc00000000 ; 12 (input #6)
0x7ffc654cd388: [top + 32] <- 0x13f00000000 ; 319 (input #7)
0x7ffc654cd380: [top + 24] <- 0x36cdc0e04131 ; 0x36cdc0e04131 <undefined> (input #8)
0x7ffc654cd378: [top + 16] <- 0x36cdc0e04131 ; 0x36cdc0e04131 <undefined> (input #9)
0x7ffc654cd370: [top + 8] <- 0x138b00000000 ; 5003 (input #10)
0x7ffc654cd368: [top + 0] <- 0x400000000 ; 4 (input #11)
[deoptimizing (lazy): end 0x7bbfe1c9b11 <JS Function compress (SharedFunctionInfo 0xc518ec2e0a1)> @40 => node=560, pc=0x376e6ff4eb9d, state=NO_REGISTERS, alignment=no padding, took 0.062 ms]
--- FUNCTION SOURCE (compress) id{58,0} ---
(init_bits, outs) {
var fcode, c, i, ent, disp, hsize_reg, hshift;
// Set up the globals: g_init_bits - initial number of bits
g_init_bits = init_bits;
// Set up the necessary values
clear_flg = false;
n_bits = g_init_bits;
maxcode = MAXCODE(n_bits);
ClearCode = 1 << (init_bits - 1);
EOFCode = ClearCode + 1;
free_ent = ClearCode + 2;
a_count = 0; // clear packet
ent = nextPixel();
hshift = 0;
for (fcode = HSIZE; fcode < 65536; fcode *= 2) ++hshift;
hshift = 8 - hshift; // set hash code range bound
hsize_reg = HSIZE;
cl_hash(hsize_reg); // clear hash table
output(ClearCode, outs);
outer_loop: while ((c = nextPixel()) != EOF) {
fcode = (c << BITS) + ent;
i = (c << hshift) ^ ent; // xor hashing
if (htab[i] === fcode) {
ent = codetab[i];
continue;
} else if (htab[i] >= 0) { // non-empty slot
disp = hsize_reg - i; // secondary hash (after G. Knott)
if (i === 0) disp = 1;
do {
if ((i -= disp) < 0) i += hsize_reg;
if (htab[i] === fcode) {
ent = codetab[i];
continue outer_loop;
}
} while (htab[i] >= 0);
}
output(ent, outs);
ent = c;
if (free_ent < 1 << BITS) {
codetab[i] = free_ent++; // code -> hashtable
htab[i] = fcode;
} else {
cl_block(outs);
}
}
// Put out the final code.
output(ent, outs);
output(EOFCode, outs);
}
--- END ---
--- FUNCTION SOURCE (MAXCODE) id{58,1} ---
(n_bits) {
return (1 << n_bits) - 1;
}
--- END ---
INLINE (MAXCODE) id{58,1} AS 1 AT <0:264>
--- FUNCTION SOURCE (nextPixel) id{58,2} ---
() {
if (remaining === 0) return EOF;
--remaining;
var pix = pixels[curPixel++];
return pix & 0xff;
}
--- END ---
INLINE (nextPixel) id{58,2} AS 2 AT <0:424>
--- FUNCTION SOURCE (cl_hash) id{58,3} ---
(hsize) {
for (var i = 0; i < hsize; ++i) htab[i] = -1;
}
--- END ---
INLINE (cl_hash) id{58,3} AS 3 AT <0:596>
--- FUNCTION SOURCE (nextPixel) id{58,4} ---
() {
if (remaining === 0) return EOF;
--remaining;
var pix = pixels[curPixel++];
return pix & 0xff;
}
--- END ---
INLINE (nextPixel) id{58,4} AS 4 AT <0:695>
[deoptimizing (DEOPT soft): begin 0x7bbfe1c9b11 <JS Function compress (SharedFunctionInfo 0xc518ec2e0a1)> (opt #58) @39, FP to SP delta: 168]
;;; deoptimize at 0_1002: Insufficient type feedback for combined type of binary operation
reading input frame compress => node=3, args=419, height=9; inputs:
0: 0x7bbfe1c9b11 ; (frame function) 0x7bbfe1c9b11 <JS Function compress (SharedFunctionInfo 0xc518ec2e0a1)>
1: 0x36cdc0e04131 ; r9 0x36cdc0e04131 <undefined>
2: 0x36cdc0e04131 ; (literal 4) 0x36cdc0e04131 <undefined>
3: 0x3ed23a8fcf31 ; r8 0x3ed23a8fcf31 <a GIFEncoder with map 0x3d4eb9d454f9>
4: 0x7bbfe1c9949 ; rsi 0x7bbfe1c9949 <FixedArray[28]>
5: 258796 ; r12
6: 63 ; r11
7: 284 ; rdi
8: 748 ; rdx
9: 0x36cdc0e04131 ; (literal 4) 0x36cdc0e04131 <undefined>
10: 0x138b00000000 ; rbx 5003
11: 4 ; rax
12: 4719 ; rcx
translating frame compress => node=419, height=64
0x7ffc654cd3d0: [top + 112] <- 0x36cdc0e04131 ; 0x36cdc0e04131 <undefined> (input #1)
0x7ffc654cd3c8: [top + 104] <- 0x36cdc0e04131 ; 0x36cdc0e04131 <undefined> (input #2)
0x7ffc654cd3c0: [top + 96] <- 0x3ed23a8fcf31 ; 0x3ed23a8fcf31 <a GIFEncoder with map 0x3d4eb9d454f9> (input #3)
0x7ffc654cd3b8: [top + 88] <- 0x376e6ff4e19e ; caller's pc
0x7ffc654cd3b0: [top + 80] <- 0x7ffc654cd3f0 ; caller's fp
0x7ffc654cd3a8: [top + 72] <- 0x7bbfe1c9949 ; context 0x7bbfe1c9949 <FixedArray[28]> (input #4)
0x7ffc654cd3a0: [top + 64] <- 0x7bbfe1c9b11 ; function 0x7bbfe1c9b11 <JS Function compress (SharedFunctionInfo 0xc518ec2e0a1)> (input #0)
0x7ffc654cd398: [top + 56] <- 0x3f2ec00000000 ; 258796 (input #5)
0x7ffc654cd390: [top + 48] <- 0x3f00000000 ; 63 (input #6)
0x7ffc654cd388: [top + 40] <- 0x11c00000000 ; 284 (input #7)
0x7ffc654cd380: [top + 32] <- 0x2ec00000000 ; 748 (input #8)
0x7ffc654cd378: [top + 24] <- 0x36cdc0e04131 ; 0x36cdc0e04131 <undefined> (input #9)
0x7ffc654cd370: [top + 16] <- 0x138b00000000 ; 5003 (input #10)
0x7ffc654cd368: [top + 8] <- 0x400000000 ; 4 (input #11)
0x7ffc654cd360: [top + 0] <- 0x126f00000000 ; 4719 (input #12)
[deoptimizing (soft): end 0x7bbfe1c9b11 <JS Function compress (SharedFunctionInfo 0xc518ec2e0a1)> @39 => node=419, pc=0x376e6ff4e954, state=TOS_REG, alignment=no padding, took 0.048 ms]
--- FUNCTION SOURCE (compress) id{59,0} ---
(init_bits, outs) {
var fcode, c, i, ent, disp, hsize_reg, hshift;
// Set up the globals: g_init_bits - initial number of bits
g_init_bits = init_bits;
// Set up the necessary values
clear_flg = false;
n_bits = g_init_bits;
maxcode = MAXCODE(n_bits);
ClearCode = 1 << (init_bits - 1);
EOFCode = ClearCode + 1;
free_ent = ClearCode + 2;
a_count = 0; // clear packet
ent = nextPixel();
hshift = 0;
for (fcode = HSIZE; fcode < 65536; fcode *= 2) ++hshift;
hshift = 8 - hshift; // set hash code range bound
hsize_reg = HSIZE;
cl_hash(hsize_reg); // clear hash table
output(ClearCode, outs);
outer_loop: while ((c = nextPixel()) != EOF) {
fcode = (c << BITS) + ent;
i = (c << hshift) ^ ent; // xor hashing
if (htab[i] === fcode) {
ent = codetab[i];
continue;
} else if (htab[i] >= 0) { // non-empty slot
disp = hsize_reg - i; // secondary hash (after G. Knott)
if (i === 0) disp = 1;
do {
if ((i -= disp) < 0) i += hsize_reg;
if (htab[i] === fcode) {
ent = codetab[i];
continue outer_loop;
}
} while (htab[i] >= 0);
}
output(ent, outs);
ent = c;
if (free_ent < 1 << BITS) {
codetab[i] = free_ent++; // code -> hashtable
htab[i] = fcode;
} else {
cl_block(outs);
}
}
// Put out the final code.
output(ent, outs);
output(EOFCode, outs);
}
--- END ---
--- FUNCTION SOURCE (MAXCODE) id{59,1} ---
(n_bits) {
return (1 << n_bits) - 1;
}
--- END ---
INLINE (MAXCODE) id{59,1} AS 1 AT <0:264>
--- FUNCTION SOURCE (nextPixel) id{59,2} ---
() {
if (remaining === 0) return EOF;
--remaining;
var pix = pixels[curPixel++];
return pix & 0xff;
}
--- END ---
INLINE (nextPixel) id{59,2} AS 2 AT <0:424>
--- FUNCTION SOURCE (cl_hash) id{59,3} ---
(hsize) {
for (var i = 0; i < hsize; ++i) htab[i] = -1;
}
--- END ---
INLINE (cl_hash) id{59,3} AS 3 AT <0:596>
--- FUNCTION SOURCE (nextPixel) id{59,4} ---
() {
if (remaining === 0) return EOF;
--remaining;
var pix = pixels[curPixel++];
return pix & 0xff;
}
--- END ---
INLINE (nextPixel) id{59,4} AS 4 AT <0:695>
--- FUNCTION SOURCE (output) id{60,0} ---
(code, outs) {
cur_accum &= masks[cur_bits];
if (cur_bits > 0) cur_accum |= (code << cur_bits);
else cur_accum = code;
cur_bits += n_bits;
while (cur_bits >= 8) {
char_out((cur_accum & 0xff), outs);
cur_accum >>= 8;
cur_bits -= 8;
}
// If the next entry is going to be too big for the code size,
// then increase it, if possible.
if (free_ent > maxcode || clear_flg) {
if (clear_flg) {
maxcode = MAXCODE(n_bits = g_init_bits);
clear_flg = false;
} else {
++n_bits;
if (n_bits == BITS) maxcode = 1 << BITS;
else maxcode = MAXCODE(n_bits);
}
}
if (code == EOFCode) {
// At EOF, write the rest of the buffer.
while (cur_bits > 0) {
char_out((cur_accum & 0xff), outs);
cur_accum >>= 8;
cur_bits -= 8;
}
flush_char(outs);
}
}
--- END ---
--- FUNCTION SOURCE (char_out) id{60,1} ---
(c, outs) {
accum[a_count++] = c;
if (a_count >= 254) flush_char(outs);
}
--- END ---
INLINE (char_out) id{60,1} AS 1 AT <0:192>
--- FUNCTION SOURCE (flush_char) id{60,2} ---
(outs) {
if (a_count > 0) {
outs.writeByte(a_count);
outs.writeBytes(accum, 0, a_count);
a_count = 0;
}
}
--- END ---
INLINE (flush_char) id{60,2} AS 2 AT <1:62>
--- FUNCTION SOURCE (ByteCapacitor.writeByte) id{60,3} ---
(val) {
this.data.push(val);
}
--- END ---
INLINE (ByteCapacitor.writeByte) id{60,3} AS 3 AT <2:43>
--- FUNCTION SOURCE (ByteCapacitor.writeBytes) id{60,4} ---
(array, offset, length) {
for (var l = length || array.length, i = offset || 0; i < l; i++) {
this.writeByte(array[i]);
}
}
--- END ---
INLINE (ByteCapacitor.writeBytes) id{60,4} AS 4 AT <2:74>
--- FUNCTION SOURCE (ByteCapacitor.writeByte) id{60,5} ---
(val) {
this.data.push(val);
}
--- END ---
INLINE (ByteCapacitor.writeByte) id{60,5} AS 5 AT <4:105>
--- FUNCTION SOURCE (MAXCODE) id{60,6} ---
(n_bits) {
return (1 << n_bits) - 1;
}
--- END ---
INLINE (MAXCODE) id{60,6} AS 6 AT <0:631>
[deoptimizing (DEOPT soft): begin 0x7bbfe1c9c79 <JS Function output (SharedFunctionInfo 0xc518ec2e3e9)> (opt #60) @36, FP to SP delta: 72]
;;; deoptimize at 0_599: Insufficient type feedback for RHS of binary operation
reading input frame output => node=3, args=268, height=1; inputs:
0: 0x7bbfe1c9c79 ; (frame function) 0x7bbfe1c9c79 <JS Function output (SharedFunctionInfo 0xc518ec2e3e9)>
1: 0x36cdc0ec8a59 ; [fp + 32] 0x36cdc0ec8a59 <JS Global Object>
2: 0x64500000000 ; [fp + 24] 1605
3: 0x3ed23a8fcf31 ; r8 0x3ed23a8fcf31 <a GIFEncoder with map 0x3d4eb9d454f9>
4: 0x7bbfe1c9949 ; rax 0x7bbfe1c9949 <FixedArray[28]>
translating frame output => node=268, height=0
0x7ffc654cd2f8: [top + 48] <- 0x36cdc0ec8a59 ; 0x36cdc0ec8a59 <JS Global Object> (input #1)
0x7ffc654cd2f0: [top + 40] <- 0x64500000000 ; 1605 (input #2)
0x7ffc654cd2e8: [top + 32] <- 0x3ed23a8fcf31 ; 0x3ed23a8fcf31 <a GIFEncoder with map 0x3d4eb9d454f9> (input #3)
0x7ffc654cd2e0: [top + 24] <- 0x376e6ff545c4 ; caller's pc
0x7ffc654cd2d8: [top + 16] <- 0x7ffc654cd3b0 ; caller's fp
0x7ffc654cd2d0: [top + 8] <- 0x7bbfe1c9949 ; context 0x7bbfe1c9949 <FixedArray[28]> (input #4)
0x7ffc654cd2c8: [top + 0] <- 0x7bbfe1c9c79 ; function 0x7bbfe1c9c79 <JS Function output (SharedFunctionInfo 0xc518ec2e3e9)> (input #0)
[deoptimizing (soft): end 0x7bbfe1c9c79 <JS Function output (SharedFunctionInfo 0xc518ec2e3e9)> @36 => node=268, pc=0x376e6ff4f8ca, state=NO_REGISTERS, alignment=no padding, took 0.034 ms]
--- FUNCTION SOURCE (output) id{61,0} ---
(code, outs) {
cur_accum &= masks[cur_bits];
if (cur_bits > 0) cur_accum |= (code << cur_bits);
else cur_accum = code;
cur_bits += n_bits;
while (cur_bits >= 8) {
char_out((cur_accum & 0xff), outs);
cur_accum >>= 8;
cur_bits -= 8;
}
// If the next entry is going to be too big for the code size,
// then increase it, if possible.
if (free_ent > maxcode || clear_flg) {
if (clear_flg) {
maxcode = MAXCODE(n_bits = g_init_bits);
clear_flg = false;
} else {
++n_bits;
if (n_bits == BITS) maxcode = 1 << BITS;
else maxcode = MAXCODE(n_bits);
}
}
if (code == EOFCode) {
// At EOF, write the rest of the buffer.
while (cur_bits > 0) {
char_out((cur_accum & 0xff), outs);
cur_accum >>= 8;
cur_bits -= 8;
}
flush_char(outs);
}
}
--- END ---
--- FUNCTION SOURCE (char_out) id{61,1} ---
(c, outs) {
accum[a_count++] = c;
if (a_count >= 254) flush_char(outs);
}
--- END ---
INLINE (char_out) id{61,1} AS 1 AT <0:192>
--- FUNCTION SOURCE (flush_char) id{61,2} ---
(outs) {
if (a_count > 0) {
outs.writeByte(a_count);
outs.writeBytes(accum, 0, a_count);
a_count = 0;
}
}
--- END ---
INLINE (flush_char) id{61,2} AS 2 AT <1:62>
--- FUNCTION SOURCE (ByteCapacitor.writeByte) id{61,3} ---
(val) {
this.data.push(val);
}
--- END ---
INLINE (ByteCapacitor.writeByte) id{61,3} AS 3 AT <2:43>
--- FUNCTION SOURCE (ByteCapacitor.writeBytes) id{61,4} ---
(array, offset, length) {
for (var l = length || array.length, i = offset || 0; i < l; i++) {
this.writeByte(array[i]);
}
}
--- END ---
INLINE (ByteCapacitor.writeBytes) id{61,4} AS 4 AT <2:74>
--- FUNCTION SOURCE (ByteCapacitor.writeByte) id{61,5} ---
(val) {
this.data.push(val);
}
--- END ---
INLINE (ByteCapacitor.writeByte) id{61,5} AS 5 AT <4:105>
--- FUNCTION SOURCE (MAXCODE) id{61,6} ---
(n_bits) {
return (1 << n_bits) - 1;
}
--- END ---
INLINE (MAXCODE) id{61,6} AS 6 AT <0:631>
[deoptimizing (DEOPT soft): begin 0x7bbfe1c9c79 <JS Function output (SharedFunctionInfo 0xc518ec2e3e9)> (opt #61) @40, FP to SP delta: 72]
;;; deoptimize at 0_759: Insufficient type feedback for combined type of binary operation
reading input frame output => node=3, args=329, height=1; inputs:
0: 0x7bbfe1c9c79 ; (frame function) 0x7bbfe1c9c79 <JS Function output (SharedFunctionInfo 0xc518ec2e3e9)>
1: 0x36cdc0e04131 ; [fp + 32] 0x36cdc0e04131 <undefined>
2: 0x10100000000 ; [fp + 24] 257
3: 0x3ed23a8fcf31 ; [fp + 16] 0x3ed23a8fcf31 <a GIFEncoder with map 0x3d4eb9d454f9>
4: 0x7bbfe1c9949 ; rbx 0x7bbfe1c9949 <FixedArray[28]>
translating frame output => node=329, height=0
0x7ffc654cd2f8: [top + 48] <- 0x36cdc0e04131 ; 0x36cdc0e04131 <undefined> (input #1)
0x7ffc654cd2f0: [top + 40] <- 0x10100000000 ; 257 (input #2)
0x7ffc654cd2e8: [top + 32] <- 0x3ed23a8fcf31 ; 0x3ed23a8fcf31 <a GIFEncoder with map 0x3d4eb9d454f9> (input #3)
0x7ffc654cd2e0: [top + 24] <- 0x376e6ff547eb ; caller's pc
0x7ffc654cd2d8: [top + 16] <- 0x7ffc654cd3b0 ; caller's fp
0x7ffc654cd2d0: [top + 8] <- 0x7bbfe1c9949 ; context 0x7bbfe1c9949 <FixedArray[28]> (input #4)
0x7ffc654cd2c8: [top + 0] <- 0x7bbfe1c9c79 ; function 0x7bbfe1c9c79 <JS Function output (SharedFunctionInfo 0xc518ec2e3e9)> (input #0)
[deoptimizing (soft): end 0x7bbfe1c9c79 <JS Function output (SharedFunctionInfo 0xc518ec2e3e9)> @40 => node=329, pc=0x376e6ff4fb90, state=NO_REGISTERS, alignment=no padding, took 0.034 ms]
--- FUNCTION SOURCE (Float64Array) id{62,0} ---
(O,P,Q){
if(%_IsConstructCall()){
if((%_ClassOf(O)==='ArrayBuffer')||(%_ClassOf(O)==='SharedArrayBuffer')){
Float64ArrayConstructByArrayBuffer(this,O,P,Q);
}else if((typeof(O)==='number')||(typeof(O)==='string')||
(typeof(O)==='boolean')||(O===(void 0))){
Float64ArrayConstructByLength(this,O);
}else{
var J=O[symbolIterator];
if((J===(void 0))||J===$arrayValues){
Float64ArrayConstructByArrayLike(this,O);
}else{
Float64ArrayConstructByIterable(this,O,J);
}
}
}else{
throw MakeTypeError(20,"Float64Array")
}
}
--- END ---
--- FUNCTION SOURCE (learn) id{63,0} ---
() {
var i;
var lengthcount = pixels.length;
var alphadec = 30 + ((samplefac - 1) / 3);
var samplepixels = lengthcount / (3 * samplefac);
var delta = ~~(samplepixels / ncycles);
var alpha = initalpha;
var radius = initradius;
var rad = radius >> radiusbiasshift;
if (rad <= 1) rad = 0;
for (i = 0; i < rad; i++)
radpower[i] = alpha * (((rad * rad - i * i) * radbias) / (rad * rad));
var step;
if (lengthcount < minpicturebytes) {
samplefac = 1;
step = 3;
} else if ((lengthcount % prime1) !== 0) {
step = 3 * prime1;
} else if ((lengthcount % prime2) !== 0) {
step = 3 * prime2;
} else if ((lengthcount % prime3) !== 0) {
step = 3 * prime3;
} else {
step = 3 * prime4;
}
var b, g, r, j;
var pix = 0; // current pixel
i = 0;
while (i < samplepixels) {
b = (pixels[pix] & 0xff) << netbiasshift;
g = (pixels[pix + 1] & 0xff) << netbiasshift;
r = (pixels[pix + 2] & 0xff) << netbiasshift;
j = contest(b, g, r);
altersingle(alpha, j, b, g, r);
if (rad !== 0) alterneigh(rad, j, b, g, r); // alter neighbours
pix += step;
if (pix >= lengthcount) pix -= lengthcount;
i++;
if (delta === 0) delta = 1;
if (i % delta === 0) {
alpha -= alpha / alphadec;
radius -= radius / radiusdec;
rad = radius >> radiusbiasshift;
if (rad <= 1) rad = 0;
for (j = 0; j < rad; j++)
radpower[j] = alpha * (((rad * rad - j * j) * radbias) / (rad * rad));
}
}
}
--- END ---
--- FUNCTION SOURCE (inxbuild) id{64,0} ---
() {
var i, j, p, q, smallpos, smallval, previouscol = 0, startpos = 0;
for (i = 0; i < netsize; i++) {
p = network[i];
smallpos = i;
smallval = p[1]; // index on g
// find smallest in i..netsize-1
for (j = i + 1; j < netsize; j++) {
q = network[j];
if (q[1] < smallval) { // index on g
smallpos = j;
smallval = q[1]; // index on g
}
}
q = network[smallpos];
// swap p (i) and q (smallpos) entries
if (i != smallpos) {
j = q[0]; q[0] = p[0]; p[0] = j;
j = q[1]; q[1] = p[1]; p[1] = j;
j = q[2]; q[2] = p[2]; p[2] = j;
j = q[3]; q[3] = p[3]; p[3] = j;
}
// smallval entry is now in position i
if (smallval != previouscol) {
netindex[previouscol] = (startpos + i) >> 1;
for (j = previouscol + 1; j < smallval; j++)
netindex[j] = i;
previouscol = smallval;
startpos = i;
}
}
netindex[previouscol] = (startpos + maxnetpos) >> 1;
for (j = previouscol + 1; j < 256; j++)
netindex[j] = maxnetpos; // really 256
}
--- END ---
--- FUNCTION SOURCE (GIFEncoder.analyzePixels) id{65,0} ---
() {
var len = this.pixels.length;
var nPix = len / 3;
// TODO: Re-use indexedPixels
this.indexedPixels = new Uint8Array(nPix);
var imgq = new NeuQuant(this.pixels, this.sample);
imgq.buildColormap(); // create reduced palette
this.colorTab = imgq.getColormap();
// map image pixels to new palette
var k = 0;
for (var j = 0; j < nPix; j++) {
var index = imgq.lookupRGB(
this.pixels[k++] & 0xff,
this.pixels[k++] & 0xff,
this.pixels[k++] & 0xff
);
this.usedEntry[index] = true;
this.indexedPixels[j] = index;
}
this.pixels = null;
this.colorDepth = 8;
this.palSize = 7;
// get closest match to transparent color if specified
if (this.transparent !== null) {
this.transIndex = this.findClosest(this.transparent);
}
}
--- END ---
--- FUNCTION SOURCE (getColormap) id{65,1} ---
() {
var map = [];
var index = [];
for (var i = 0; i < netsize; i++)
index[network[i][3]] = i;
var k = 0;
for (var l = 0; l < netsize; l++) {
var j = index[l];
map[k++] = (network[j][0]);
map[k++] = (network[j][1]);
map[k++] = (network[j][2]);
}
return map;
}
--- END ---
INLINE (getColormap) id{65,1} AS 1 AT <0:264>
[deoptimizing (DEOPT eager): begin 0x2ac96395d1e1 <JS Function ByteCapacitor.writeByte (SharedFunctionInfo 0x2ac96394aca1)> (opt #54) @3, FP to SP delta: 24]
;;; deoptimize at 0_20: wrong map
reading input frame ByteCapacitor.writeByte => node=2, args=3, height=1; inputs:
0: 0x2ac96395d1e1 ; (frame function) 0x2ac96395d1e1 <JS Function ByteCapacitor.writeByte (SharedFunctionInfo 0x2ac96394aca1)>
1: 0x3ed23a8fcf31 ; rbx 0x3ed23a8fcf31 <a GIFEncoder with map 0x3d4eb9d454f9>
2: 0x2100000000 ; [fp + 16] 33
3: 0x100fecf7fb11 ; [fp - 24] 0x100fecf7fb11 <FixedArray[8]>
translating frame ByteCapacitor.writeByte => node=3, height=0
0x7ffc654cd400: [top + 40] <- 0x3ed23a8fcf31 ; 0x3ed23a8fcf31 <a GIFEncoder with map 0x3d4eb9d454f9> (input #1)
0x7ffc654cd3f8: [top + 32] <- 0x2100000000 ; 33 (input #2)
0x7ffc654cd3f0: [top + 24] <- 0x376e6ff4cf7a ; caller's pc
0x7ffc654cd3e8: [top + 16] <- 0x7ffc654cd430 ; caller's fp
0x7ffc654cd3e0: [top + 8] <- 0x100fecf7fb11 ; context 0x100fecf7fb11 <FixedArray[8]> (input #3)
0x7ffc654cd3d8: [top + 0] <- 0x2ac96395d1e1 ; function 0x2ac96395d1e1 <JS Function ByteCapacitor.writeByte (SharedFunctionInfo 0x2ac96394aca1)> (input #0)
[deoptimizing (eager): end 0x2ac96395d1e1 <JS Function ByteCapacitor.writeByte (SharedFunctionInfo 0x2ac96394aca1)> @3 => node=3, pc=0x376e6ff38cde, state=NO_REGISTERS, alignment=no padding, took 0.043 ms]
--- FUNCTION SOURCE (ByteCapacitor.writeByte) id{66,0} ---
(val) {
this.data.push(val);
}
--- END ---
[deoptimizing (DEOPT eager): begin 0x7bbfe085861 <JS Function compress (SharedFunctionInfo 0xc518ec2e0a1)> (opt #59) @25, FP to SP delta: 176]
;;; deoptimize at 0_695: value mismatch
reading input frame compress => node=3, args=274, height=8; inputs:
0: 0x7bbfe085861 ; (frame function) 0x7bbfe085861 <JS Function compress (SharedFunctionInfo 0xc518ec2e0a1)>
1: 0x36cdc0e04131 ; r9 0x36cdc0e04131 <undefined>
2: 0x36cdc0e04131 ; (literal 4) 0x36cdc0e04131 <undefined>
3: 0x3ed23a8fcf31 ; r8 0x3ed23a8fcf31 <a GIFEncoder with map 0x3d4eb9d454f9>
4: 0x7bbfe085699 ; rsi 0x7bbfe085699 <FixedArray[28]>
5: 0x36cdc0e04131 ; (literal 4) 0x36cdc0e04131 <undefined>
6: 0x36cdc0e04131 ; (literal 4) 0x36cdc0e04131 <undefined>
7: 0x36cdc0e04131 ; (literal 4) 0x36cdc0e04131 <undefined>
8: 329 ; rdx
9: 0x36cdc0e04131 ; (literal 4) 0x36cdc0e04131 <undefined>
10: 5003 ; rbx
11: 4 ; (int) [fp - 120]
translating frame compress => node=274, height=56
0x7ffc654cd3d0: [top + 104] <- 0x36cdc0e04131 ; 0x36cdc0e04131 <undefined> (input #1)
0x7ffc654cd3c8: [top + 96] <- 0x36cdc0e04131 ; 0x36cdc0e04131 <undefined> (input #2)
0x7ffc654cd3c0: [top + 88] <- 0x3ed23a8fcf31 ; 0x3ed23a8fcf31 <a GIFEncoder with map 0x3d4eb9d454f9> (input #3)
0x7ffc654cd3b8: [top + 80] <- 0x376e6ff4e19e ; caller's pc
0x7ffc654cd3b0: [top + 72] <- 0x7ffc654cd3f0 ; caller's fp
0x7ffc654cd3a8: [top + 64] <- 0x7bbfe085699 ; context 0x7bbfe085699 <FixedArray[28]> (input #4)
0x7ffc654cd3a0: [top + 56] <- 0x7bbfe085861 ; function 0x7bbfe085861 <JS Function compress (SharedFunctionInfo 0xc518ec2e0a1)> (input #0)
0x7ffc654cd398: [top + 48] <- 0x36cdc0e04131 ; 0x36cdc0e04131 <undefined> (input #5)
0x7ffc654cd390: [top + 40] <- 0x36cdc0e04131 ; 0x36cdc0e04131 <undefined> (input #6)
0x7ffc654cd388: [top + 32] <- 0x36cdc0e04131 ; 0x36cdc0e04131 <undefined> (input #7)
0x7ffc654cd380: [top + 24] <- 0x14900000000 ; 329 (input #8)
0x7ffc654cd378: [top + 16] <- 0x36cdc0e04131 ; 0x36cdc0e04131 <undefined> (input #9)
0x7ffc654cd370: [top + 8] <- 0x138b00000000 ; 5003 (input #10)
0x7ffc654cd368: [top + 0] <- 0x400000000 ; 4 (input #11)
[deoptimizing (eager): end 0x7bbfe085861 <JS Function compress (SharedFunctionInfo 0xc518ec2e0a1)> @25 => node=274, pc=0x376e6ff4ed15, state=NO_REGISTERS, alignment=no padding, took 0.045 ms]
--- FUNCTION SOURCE (compress) id{67,0} ---
(init_bits, outs) {
var fcode, c, i, ent, disp, hsize_reg, hshift;
// Set up the globals: g_init_bits - initial number of bits
g_init_bits = init_bits;
// Set up the necessary values
clear_flg = false;
n_bits = g_init_bits;
maxcode = MAXCODE(n_bits);
ClearCode = 1 << (init_bits - 1);
EOFCode = ClearCode + 1;
free_ent = ClearCode + 2;
a_count = 0; // clear packet
ent = nextPixel();
hshift = 0;
for (fcode = HSIZE; fcode < 65536; fcode *= 2) ++hshift;
hshift = 8 - hshift; // set hash code range bound
hsize_reg = HSIZE;
cl_hash(hsize_reg); // clear hash table
output(ClearCode, outs);
outer_loop: while ((c = nextPixel()) != EOF) {
fcode = (c << BITS) + ent;
i = (c << hshift) ^ ent; // xor hashing
if (htab[i] === fcode) {
ent = codetab[i];
continue;
} else if (htab[i] >= 0) { // non-empty slot
disp = hsize_reg - i; // secondary hash (after G. Knott)
if (i === 0) disp = 1;
do {
if ((i -= disp) < 0) i += hsize_reg;
if (htab[i] === fcode) {
ent = codetab[i];
continue outer_loop;
}
} while (htab[i] >= 0);
}
output(ent, outs);
ent = c;
if (free_ent < 1 << BITS) {
codetab[i] = free_ent++; // code -> hashtable
htab[i] = fcode;
} else {
cl_block(outs);
}
}
// Put out the final code.
output(ent, outs);
output(EOFCode, outs);
}
--- END ---
--- FUNCTION SOURCE (cl_block) id{67,1} ---
(outs) {
cl_hash(HSIZE);
free_ent = ClearCode + 2;
clear_flg = true;
output(ClearCode, outs);
}
--- END ---
INLINE (cl_block) id{67,1} AS 1 AT <0:1405>
--- FUNCTION SOURCE (cl_hash) id{67,2} ---
(hsize) {
for (var i = 0; i < hsize; ++i) htab[i] = -1;
}
--- END ---
INLINE (cl_hash) id{67,2} AS 2 AT <1:13>
--- FUNCTION SOURCE (ByteCapacitor.writeBytes) id{68,0} ---
(array, offset, length) {
for (var l = length || array.length, i = offset || 0; i < l; i++) {
this.writeByte(array[i]);
}
}
--- END ---
--- FUNCTION SOURCE (ByteCapacitor.writeByte) id{68,1} ---
(val) {
this.data.push(val);
}
--- END ---
INLINE (ByteCapacitor.writeByte) id{68,1} AS 1 AT <0:105>
--- FUNCTION SOURCE (output) id{69,0} ---
(code, outs) {
cur_accum &= masks[cur_bits];
if (cur_bits > 0) cur_accum |= (code << cur_bits);
else cur_accum = code;
cur_bits += n_bits;
while (cur_bits >= 8) {
char_out((cur_accum & 0xff), outs);
cur_accum >>= 8;
cur_bits -= 8;
}
// If the next entry is going to be too big for the code size,
// then increase it, if possible.
if (free_ent > maxcode || clear_flg) {
if (clear_flg) {
maxcode = MAXCODE(n_bits = g_init_bits);
clear_flg = false;
} else {
++n_bits;
if (n_bits == BITS) maxcode = 1 << BITS;
else maxcode = MAXCODE(n_bits);
}
}
if (code == EOFCode) {
// At EOF, write the rest of the buffer.
while (cur_bits > 0) {
char_out((cur_accum & 0xff), outs);
cur_accum >>= 8;
cur_bits -= 8;
}
flush_char(outs);
}
}
--- END ---
--- FUNCTION SOURCE (MAXCODE) id{69,1} ---
(n_bits) {
return (1 << n_bits) - 1;
}
--- END ---
INLINE (MAXCODE) id{69,1} AS 1 AT <0:468>
--- FUNCTION SOURCE (char_out) id{69,2} ---
(c, outs) {
accum[a_count++] = c;
if (a_count >= 254) flush_char(outs);
}
--- END ---
INLINE (char_out) id{69,2} AS 2 AT <0:774>
--- FUNCTION SOURCE (flush_char) id{69,3} ---
(outs) {
if (a_count > 0) {
outs.writeByte(a_count);
outs.writeBytes(accum, 0, a_count);
a_count = 0;
}
}
--- END ---
INLINE (flush_char) id{69,3} AS 3 AT <0:872>
--- FUNCTION SOURCE (ByteCapacitor.writeByte) id{69,4} ---
(val) {
this.data.push(val);
}
--- END ---
INLINE (ByteCapacitor.writeByte) id{69,4} AS 4 AT <3:43>
--- FUNCTION SOURCE (ByteCapacitor.writeBytes) id{69,5} ---
(array, offset, length) {
for (var l = length || array.length, i = offset || 0; i < l; i++) {
this.writeByte(array[i]);
}
}
--- END ---
INLINE (ByteCapacitor.writeBytes) id{69,5} AS 5 AT <3:74>
--- FUNCTION SOURCE (ByteCapacitor.writeByte) id{69,6} ---
(val) {
this.data.push(val);
}
--- END ---
INLINE (ByteCapacitor.writeByte) id{69,6} AS 6 AT <5:105>
[deoptimizing (DEOPT eager): begin 0x7bbfe085861 <JS Function compress (SharedFunctionInfo 0xc518ec2e0a1)> (opt #67) @31, FP to SP delta: 192]
;;; deoptimize at 0_1405: value mismatch
reading input frame compress => node=3, args=586, height=8; inputs:
0: 0x7bbfe085861 ; (frame function) 0x7bbfe085861 <JS Function compress (SharedFunctionInfo 0xc518ec2e0a1)>
1: 0x36cdc0e04131 ; [fp - 152] 0x36cdc0e04131 <undefined>
2: 0x36cdc0e04131 ; (literal 3) 0x36cdc0e04131 <undefined>
3: 0x3ed23a8fcf31 ; [fp - 144] 0x3ed23a8fcf31 <a GIFEncoder with map 0x3d4eb9d454f9>
4: 0x7bbfe085699 ; rax 0x7bbfe085699 <FixedArray[28]>
5: 0x36cdc0e04131 ; (literal 3) 0x36cdc0e04131 <undefined>
6: 0x36cdc0e04131 ; (literal 3) 0x36cdc0e04131 <undefined>
7: 0x36cdc0e04131 ; (literal 3) 0x36cdc0e04131 <undefined>
8: 0x4e00000000 ; [fp - 168] 78
9: 0x36cdc0e04131 ; (literal 3) 0x36cdc0e04131 <undefined>
10: 5003 ; (int) [fp - 128]
11: 4 ; (int) [fp - 120]
translating frame compress => node=586, height=56
0x7ffc654cd3d0: [top + 104] <- 0x36cdc0e04131 ; 0x36cdc0e04131 <undefined> (input #1)
0x7ffc654cd3c8: [top + 96] <- 0x36cdc0e04131 ; 0x36cdc0e04131 <undefined> (input #2)
0x7ffc654cd3c0: [top + 88] <- 0x3ed23a8fcf31 ; 0x3ed23a8fcf31 <a GIFEncoder with map 0x3d4eb9d454f9> (input #3)
0x7ffc654cd3b8: [top + 80] <- 0x376e6ff4e19e ; caller's pc
0x7ffc654cd3b0: [top + 72] <- 0x7ffc654cd3f0 ; caller's fp
0x7ffc654cd3a8: [top + 64] <- 0x7bbfe085699 ; context 0x7bbfe085699 <FixedArray[28]> (input #4)
0x7ffc654cd3a0: [top + 56] <- 0x7bbfe085861 ; function 0x7bbfe085861 <JS Function compress (SharedFunctionInfo 0xc518ec2e0a1)> (input #0)
0x7ffc654cd398: [top + 48] <- 0x36cdc0e04131 ; 0x36cdc0e04131 <undefined> (input #5)
0x7ffc654cd390: [top + 40] <- 0x36cdc0e04131 ; 0x36cdc0e04131 <undefined> (input #6)
0x7ffc654cd388: [top + 32] <- 0x36cdc0e04131 ; 0x36cdc0e04131 <undefined> (input #7)
0x7ffc654cd380: [top + 24] <- 0x4e00000000 ; 78 (input #8)
0x7ffc654cd378: [top + 16] <- 0x36cdc0e04131 ; 0x36cdc0e04131 <undefined> (input #9)
0x7ffc654cd370: [top + 8] <- 0x138b00000000 ; 5003 (input #10)
0x7ffc654cd368: [top + 0] <- 0x400000000 ; 4 (input #11)
[deoptimizing (eager): end 0x7bbfe085861 <JS Function compress (SharedFunctionInfo 0xc518ec2e0a1)> @31 => node=586, pc=0x376e6ff4ecbc, state=NO_REGISTERS, alignment=no padding, took 0.046 ms]
[deoptimizing (DEOPT eager): begin 0x7bbfe0859c9 <JS Function output (SharedFunctionInfo 0xc518ec2e3e9)> (opt #69) @15, FP to SP delta: 96]
;;; deoptimize at 0_468: value mismatch
reading input frame output => node=3, args=237, height=4; inputs:
0: 0x7bbfe0859c9 ; (frame function) 0x7bbfe0859c9 <JS Function output (SharedFunctionInfo 0xc518ec2e3e9)>
1: 0x36cdc0e04131 ; [fp + 32] 0x36cdc0e04131 <undefined>
2: 0x10000000000 ; [fp + 24] 256
3: 0x3ed23a8fcf31 ; [fp + 16] 0x3ed23a8fcf31 <a GIFEncoder with map 0x3d4eb9d454f9>
4: 0x7bbfe085699 ; rbx 0x7bbfe085699 <FixedArray[28]>
5: 0x7bbfe085939 ; rsi 0x7bbfe085939 <JS Function MAXCODE (SharedFunctionInfo 0xc518ec2e299)>
6: 0x36cdc0e04131 ; (literal 6) 0x36cdc0e04131 <undefined>
7: 0x900000000 ; rdi 9
translating frame output => node=237, height=24
0x7ffc654cd320: [top + 72] <- 0x36cdc0e04131 ; 0x36cdc0e04131 <undefined> (input #1)
0x7ffc654cd318: [top + 64] <- 0x10000000000 ; 256 (input #2)
0x7ffc654cd310: [top + 56] <- 0x3ed23a8fcf31 ; 0x3ed23a8fcf31 <a GIFEncoder with map 0x3d4eb9d454f9> (input #3)
0x7ffc654cd308: [top + 48] <- 0x376e6ff57e0d ; caller's pc
0x7ffc654cd300: [top + 40] <- 0x7ffc654cd340 ; caller's fp
0x7ffc654cd2f8: [top + 32] <- 0x7bbfe085699 ; context 0x7bbfe085699 <FixedArray[28]> (input #4)
0x7ffc654cd2f0: [top + 24] <- 0x7bbfe0859c9 ; function 0x7bbfe0859c9 <JS Function output (SharedFunctionInfo 0xc518ec2e3e9)> (input #0)
0x7ffc654cd2e8: [top + 16] <- 0x7bbfe085939 ; 0x7bbfe085939 <JS Function MAXCODE (SharedFunctionInfo 0xc518ec2e299)> (input #5)
0x7ffc654cd2e0: [top + 8] <- 0x36cdc0e04131 ; 0x36cdc0e04131 <undefined> (input #6)
0x7ffc654cd2d8: [top + 0] <- 0x900000000 ; 9 (input #7)
[deoptimizing (eager): end 0x7bbfe0859c9 <JS Function output (SharedFunctionInfo 0xc518ec2e3e9)> @15 => node=237, pc=0x376e6ff4f791, state=TOS_REG, alignment=no padding, took 0.034 ms]
--- FUNCTION SOURCE (compress) id{70,0} ---
(init_bits, outs) {
var fcode, c, i, ent, disp, hsize_reg, hshift;
// Set up the globals: g_init_bits - initial number of bits
g_init_bits = init_bits;
// Set up the necessary values
clear_flg = false;
n_bits = g_init_bits;
maxcode = MAXCODE(n_bits);
ClearCode = 1 << (init_bits - 1);
EOFCode = ClearCode + 1;
free_ent = ClearCode + 2;
a_count = 0; // clear packet
ent = nextPixel();
hshift = 0;
for (fcode = HSIZE; fcode < 65536; fcode *= 2) ++hshift;
hshift = 8 - hshift; // set hash code range bound
hsize_reg = HSIZE;
cl_hash(hsize_reg); // clear hash table
output(ClearCode, outs);
outer_loop: while ((c = nextPixel()) != EOF) {
fcode = (c << BITS) + ent;
i = (c << hshift) ^ ent; // xor hashing
if (htab[i] === fcode) {
ent = codetab[i];
continue;
} else if (htab[i] >= 0) { // non-empty slot
disp = hsize_reg - i; // secondary hash (after G. Knott)
if (i === 0) disp = 1;
do {
if ((i -= disp) < 0) i += hsize_reg;
if (htab[i] === fcode) {
ent = codetab[i];
continue outer_loop;
}
} while (htab[i] >= 0);
}
output(ent, outs);
ent = c;
if (free_ent < 1 << BITS) {
codetab[i] = free_ent++; // code -> hashtable
htab[i] = fcode;
} else {
cl_block(outs);
}
}
// Put out the final code.
output(ent, outs);
output(EOFCode, outs);
}
--- END ---
[deoptimizing (DEOPT eager): begin 0x7bbfe085861 <JS Function compress (SharedFunctionInfo 0xc518ec2e0a1)> (opt #70) @44, FP to SP delta: 184]
;;; deoptimize at 0_1471: value mismatch
reading input frame compress => node=3, args=275, height=8; inputs:
0: 0x7bbfe085861 ; (frame function) 0x7bbfe085861 <JS Function compress (SharedFunctionInfo 0xc518ec2e0a1)>
1: 0x36cdc0e04131 ; [fp - 152] 0x36cdc0e04131 <undefined>
2: 0x36cdc0e04131 ; (literal 1) 0x36cdc0e04131 <undefined>
3: 0x3ed23a8fcf31 ; [fp - 144] 0x3ed23a8fcf31 <a GIFEncoder with map 0x3d4eb9d454f9>
4: 0x7bbfe085699 ; rax 0x7bbfe085699 <FixedArray[28]>
5: 0x36cdc0e04131 ; (literal 1) 0x36cdc0e04131 <undefined>
6: 0x36cdc0e04131 ; (literal 1) 0x36cdc0e04131 <undefined>
7: 0x36cdc0e04131 ; (literal 1) 0x36cdc0e04131 <undefined>
8: 1137 ; rsi
9: 0x36cdc0e04131 ; (literal 1) 0x36cdc0e04131 <undefined>
10: 0x36cdc0e04131 ; (literal 1) 0x36cdc0e04131 <undefined>
11: 0x36cdc0e04131 ; (literal 1) 0x36cdc0e04131 <undefined>
translating frame compress => node=275, height=56
0x7ffc654cd3d0: [top + 104] <- 0x36cdc0e04131 ; 0x36cdc0e04131 <undefined> (input #1)
0x7ffc654cd3c8: [top + 96] <- 0x36cdc0e04131 ; 0x36cdc0e04131 <undefined> (input #2)
0x7ffc654cd3c0: [top + 88] <- 0x3ed23a8fcf31 ; 0x3ed23a8fcf31 <a GIFEncoder with map 0x3d4eb9d454f9> (input #3)
0x7ffc654cd3b8: [top + 80] <- 0x376e6ff4e19e ; caller's pc
0x7ffc654cd3b0: [top + 72] <- 0x7ffc654cd3f0 ; caller's fp
0x7ffc654cd3a8: [top + 64] <- 0x7bbfe085699 ; context 0x7bbfe085699 <FixedArray[28]> (input #4)
0x7ffc654cd3a0: [top + 56] <- 0x7bbfe085861 ; function 0x7bbfe085861 <JS Function compress (SharedFunctionInfo 0xc518ec2e0a1)> (input #0)
0x7ffc654cd398: [top + 48] <- 0x36cdc0e04131 ; 0x36cdc0e04131 <undefined> (input #5)
0x7ffc654cd390: [top + 40] <- 0x36cdc0e04131 ; 0x36cdc0e04131 <undefined> (input #6)
0x7ffc654cd388: [top + 32] <- 0x36cdc0e04131 ; 0x36cdc0e04131 <undefined> (input #7)
0x7ffc654cd380: [top + 24] <- 0x47100000000 ; 1137 (input #8)
0x7ffc654cd378: [top + 16] <- 0x36cdc0e04131 ; 0x36cdc0e04131 <undefined> (input #9)
0x7ffc654cd370: [top + 8] <- 0x36cdc0e04131 ; 0x36cdc0e04131 <undefined> (input #10)
0x7ffc654cd368: [top + 0] <- 0x36cdc0e04131 ; 0x36cdc0e04131 <undefined> (input #11)
[deoptimizing (eager): end 0x7bbfe085861 <JS Function compress (SharedFunctionInfo 0xc518ec2e0a1)> @44 => node=275, pc=0x376e6ff4ed1a, state=NO_REGISTERS, alignment=no padding, took 0.047 ms]
[marking dependent code 0x376e6ff61d21 (opt #65) for deoptimization, reason: prototype-check]
[deoptimize marked code in all contexts]
[deoptimizer unlinked: GIFEncoder.analyzePixels / 2ac96395d689]
[deoptimizing (DEOPT lazy): begin 0x2ac96395d689 <JS Function GIFEncoder.analyzePixels (SharedFunctionInfo 0x2ac96394b679)> (opt #65) @9, FP to SP delta: 152]
reading input frame GIFEncoder.analyzePixels => node=1, args=99, height=8; inputs:
0: 0x2ac96395d689 ; (frame function) 0x2ac96395d689 <JS Function GIFEncoder.analyzePixels (SharedFunctionInfo 0x2ac96394b679)>
1: 0x3ed23a8fcf31 ; [fp + 16] 0x3ed23a8fcf31 <a GIFEncoder with map 0x3d4eb9d454f9>
2: 0x100fecf7fb11 ; [fp - 72] 0x100fecf7fb11 <FixedArray[8]>
3: 0x36cdc0e04131 ; (literal 2) 0x36cdc0e04131 <undefined>
4: 360000 ; (int) [fp - 80]
5: 0x36cdc0e04131 ; (literal 2) 0x36cdc0e04131 <undefined>
6: 0x36cdc0e04131 ; (literal 2) 0x36cdc0e04131 <undefined>
7: 0x36cdc0e04131 ; (literal 2) 0x36cdc0e04131 <undefined>
8: 0x36cdc0e04131 ; (literal 2) 0x36cdc0e04131 <undefined>
9: 0x7bbfe0db2a9 ; rax 0x7bbfe0db2a9 <a NeuQuant with map 0x3d4eb9d404e1>
translating frame GIFEncoder.analyzePixels => node=99, height=56
0x7ffc654cd438: [top + 88] <- 0x3ed23a8fcf31 ; 0x3ed23a8fcf31 <a GIFEncoder with map 0x3d4eb9d454f9> (input #1)
0x7ffc654cd430: [top + 80] <- 0x376e6ff3e4d3 ; caller's pc
0x7ffc654cd428: [top + 72] <- 0x7ffc654cd458 ; caller's fp
0x7ffc654cd420: [top + 64] <- 0x100fecf7fb11 ; context 0x100fecf7fb11 <FixedArray[8]> (input #2)
0x7ffc654cd418: [top + 56] <- 0x2ac96395d689 ; function 0x2ac96395d689 <JS Function GIFEncoder.analyzePixels (SharedFunctionInfo 0x2ac96394b679)> (input #0)
0x7ffc654cd410: [top + 48] <- 0x36cdc0e04131 ; 0x36cdc0e04131 <undefined> (input #3)
0x7ffc654cd408: [top + 40] <- 0x57e4000000000 ; 360000 (input #4)
0x7ffc654cd400: [top + 32] <- 0x36cdc0e04131 ; 0x36cdc0e04131 <undefined> (input #5)
0x7ffc654cd3f8: [top + 24] <- 0x36cdc0e04131 ; 0x36cdc0e04131 <undefined> (input #6)
0x7ffc654cd3f0: [top + 16] <- 0x36cdc0e04131 ; 0x36cdc0e04131 <undefined> (input #7)
0x7ffc654cd3e8: [top + 8] <- 0x36cdc0e04131 ; 0x36cdc0e04131 <undefined> (input #8)
0x7ffc654cd3e0: [top + 0] <- 0x7bbfe0db2a9 ; 0x7bbfe0db2a9 <a NeuQuant with map 0x3d4eb9d404e1> (input #9)
[deoptimizing (lazy): end 0x2ac96395d689 <JS Function GIFEncoder.analyzePixels (SharedFunctionInfo 0x2ac96394b679)> @9 => node=99, pc=0x376e6ff3fab0, state=TOS_REG, alignment=no padding, took 0.043 ms]
--- FUNCTION SOURCE (GIFEncoder.analyzePixels) id{71,0} ---
() {
var len = this.pixels.length;
var nPix = len / 3;
// TODO: Re-use indexedPixels
this.indexedPixels = new Uint8Array(nPix);
var imgq = new NeuQuant(this.pixels, this.sample);
imgq.buildColormap(); // create reduced palette
this.colorTab = imgq.getColormap();
// map image pixels to new palette
var k = 0;
for (var j = 0; j < nPix; j++) {
var index = imgq.lookupRGB(
this.pixels[k++] & 0xff,
this.pixels[k++] & 0xff,
this.pixels[k++] & 0xff
);
this.usedEntry[index] = true;
this.indexedPixels[j] = index;
}
this.pixels = null;
this.colorDepth = 8;
this.palSize = 7;
// get closest match to transparent color if specified
if (this.transparent !== null) {
this.transIndex = this.findClosest(this.transparent);
}
}
--- END ---
--- FUNCTION SOURCE (compress) id{72,0} ---
(init_bits, outs) {
var fcode, c, i, ent, disp, hsize_reg, hshift;
// Set up the globals: g_init_bits - initial number of bits
g_init_bits = init_bits;
// Set up the necessary values
clear_flg = false;
n_bits = g_init_bits;
maxcode = MAXCODE(n_bits);
ClearCode = 1 << (init_bits - 1);
EOFCode = ClearCode + 1;
free_ent = ClearCode + 2;
a_count = 0; // clear packet
ent = nextPixel();
hshift = 0;
for (fcode = HSIZE; fcode < 65536; fcode *= 2) ++hshift;
hshift = 8 - hshift; // set hash code range bound
hsize_reg = HSIZE;
cl_hash(hsize_reg); // clear hash table
output(ClearCode, outs);
outer_loop: while ((c = nextPixel()) != EOF) {
fcode = (c << BITS) + ent;
i = (c << hshift) ^ ent; // xor hashing
if (htab[i] === fcode) {
ent = codetab[i];
continue;
} else if (htab[i] >= 0) { // non-empty slot
disp = hsize_reg - i; // secondary hash (after G. Knott)
if (i === 0) disp = 1;
do {
if ((i -= disp) < 0) i += hsize_reg;
if (htab[i] === fcode) {
ent = codetab[i];
continue outer_loop;
}
} while (htab[i] >= 0);
}
output(ent, outs);
ent = c;
if (free_ent < 1 << BITS) {
codetab[i] = free_ent++; // code -> hashtable
htab[i] = fcode;
} else {
cl_block(outs);
}
}
// Put out the final code.
output(ent, outs);
output(EOFCode, outs);
}
--- END ---
--- FUNCTION SOURCE (output) id{73,0} ---
(code, outs) {
cur_accum &= masks[cur_bits];
if (cur_bits > 0) cur_accum |= (code << cur_bits);
else cur_accum = code;
cur_bits += n_bits;
while (cur_bits >= 8) {
char_out((cur_accum & 0xff), outs);
cur_accum >>= 8;
cur_bits -= 8;
}
// If the next entry is going to be too big for the code size,
// then increase it, if possible.
if (free_ent > maxcode || clear_flg) {
if (clear_flg) {
maxcode = MAXCODE(n_bits = g_init_bits);
clear_flg = false;
} else {
++n_bits;
if (n_bits == BITS) maxcode = 1 << BITS;
else maxcode = MAXCODE(n_bits);
}
}
if (code == EOFCode) {
// At EOF, write the rest of the buffer.
while (cur_bits > 0) {
char_out((cur_accum & 0xff), outs);
cur_accum >>= 8;
cur_bits -= 8;
}
flush_char(outs);
}
}
--- END ---
--- FUNCTION SOURCE (cl_hash) id{74,0} ---
(hsize) {
for (var i = 0; i < hsize; ++i) htab[i] = -1;
}
--- END ---
[marking dependent code 0x376e6ff676a1 (opt #71) for deoptimization, reason: prototype-check]
[deoptimize marked code in all contexts]
[deoptimizer unlinked: GIFEncoder.analyzePixels / 2ac96395d689]
[deoptimizing (DEOPT lazy): begin 0x2ac96395d689 <JS Function GIFEncoder.analyzePixels (SharedFunctionInfo 0x2ac96394b679)> (opt #71) @9, FP to SP delta: 136]
reading input frame GIFEncoder.analyzePixels => node=1, args=99, height=8; inputs:
0: 0x2ac96395d689 ; (frame function) 0x2ac96395d689 <JS Function GIFEncoder.analyzePixels (SharedFunctionInfo 0x2ac96394b679)>
1: 0x3ed23a8fcf31 ; [fp + 16] 0x3ed23a8fcf31 <a GIFEncoder with map 0x3d4eb9d454f9>
2: 0x100fecf7fb11 ; [fp - 72] 0x100fecf7fb11 <FixedArray[8]>
3: 0x36cdc0e04131 ; (literal 1) 0x36cdc0e04131 <undefined>
4: 360000 ; (int) [fp - 80]
5: 0x36cdc0e04131 ; (literal 1) 0x36cdc0e04131 <undefined>
6: 0x36cdc0e04131 ; (literal 1) 0x36cdc0e04131 <undefined>
7: 0x36cdc0e04131 ; (literal 1) 0x36cdc0e04131 <undefined>
8: 0x36cdc0e04131 ; (literal 1) 0x36cdc0e04131 <undefined>
9: 0x7bbff37b521 ; rax 0x7bbff37b521 <a NeuQuant with map 0x3d4eb9d40539>
translating frame GIFEncoder.analyzePixels => node=99, height=56
0x7ffc654cd438: [top + 88] <- 0x3ed23a8fcf31 ; 0x3ed23a8fcf31 <a GIFEncoder with map 0x3d4eb9d454f9> (input #1)
0x7ffc654cd430: [top + 80] <- 0x376e6ff3e4d3 ; caller's pc
0x7ffc654cd428: [top + 72] <- 0x7ffc654cd458 ; caller's fp
0x7ffc654cd420: [top + 64] <- 0x100fecf7fb11 ; context 0x100fecf7fb11 <FixedArray[8]> (input #2)
0x7ffc654cd418: [top + 56] <- 0x2ac96395d689 ; function 0x2ac96395d689 <JS Function GIFEncoder.analyzePixels (SharedFunctionInfo 0x2ac96394b679)> (input #0)
0x7ffc654cd410: [top + 48] <- 0x36cdc0e04131 ; 0x36cdc0e04131 <undefined> (input #3)
0x7ffc654cd408: [top + 40] <- 0x57e4000000000 ; 360000 (input #4)
0x7ffc654cd400: [top + 32] <- 0x36cdc0e04131 ; 0x36cdc0e04131 <undefined> (input #5)
0x7ffc654cd3f8: [top + 24] <- 0x36cdc0e04131 ; 0x36cdc0e04131 <undefined> (input #6)
0x7ffc654cd3f0: [top + 16] <- 0x36cdc0e04131 ; 0x36cdc0e04131 <undefined> (input #7)
0x7ffc654cd3e8: [top + 8] <- 0x36cdc0e04131 ; 0x36cdc0e04131 <undefined> (input #8)
0x7ffc654cd3e0: [top + 0] <- 0x7bbff37b521 ; 0x7bbff37b521 <a NeuQuant with map 0x3d4eb9d40539> (input #9)
[deoptimizing (lazy): end 0x2ac96395d689 <JS Function GIFEncoder.analyzePixels (SharedFunctionInfo 0x2ac96394b679)> @9 => node=99, pc=0x376e6ff3fab0, state=TOS_REG, alignment=no padding, took 0.051 ms]
--- FUNCTION SOURCE (GIFEncoder.analyzePixels) id{75,0} ---
() {
var len = this.pixels.length;
var nPix = len / 3;
// TODO: Re-use indexedPixels
this.indexedPixels = new Uint8Array(nPix);
var imgq = new NeuQuant(this.pixels, this.sample);
imgq.buildColormap(); // create reduced palette
this.colorTab = imgq.getColormap();
// map image pixels to new palette
var k = 0;
for (var j = 0; j < nPix; j++) {
var index = imgq.lookupRGB(
this.pixels[k++] & 0xff,
this.pixels[k++] & 0xff,
this.pixels[k++] & 0xff
);
this.usedEntry[index] = true;
this.indexedPixels[j] = index;
}
this.pixels = null;
this.colorDepth = 8;
this.palSize = 7;
// get closest match to transparent color if specified
if (this.transparent !== null) {
this.transIndex = this.findClosest(this.transparent);
}
}
--- END ---
--- FUNCTION SOURCE (flush_char) id{76,0} ---
(outs) {
if (a_count > 0) {
outs.writeByte(a_count);
outs.writeBytes(accum, 0, a_count);
a_count = 0;
}
}
--- END ---
--- FUNCTION SOURCE (ByteCapacitor.writeByte) id{76,1} ---
(val) {
this.data.push(val);
}
--- END ---
INLINE (ByteCapacitor.writeByte) id{76,1} AS 1 AT <0:43>
--- FUNCTION SOURCE (ByteCapacitor.writeBytes) id{76,2} ---
(array, offset, length) {
for (var l = length || array.length, i = offset || 0; i < l; i++) {
this.writeByte(array[i]);
}
}
--- END ---
INLINE (ByteCapacitor.writeBytes) id{76,2} AS 2 AT <0:74>
--- FUNCTION SOURCE (ByteCapacitor.writeByte) id{76,3} ---
(val) {
this.data.push(val);
}
--- END ---
INLINE (ByteCapacitor.writeByte) id{76,3} AS 3 AT <2:105>
--- FUNCTION SOURCE (Float64ArrayConstructByArrayLike) id{77,0} ---
(v,F){
var y=F.length;
var D=$toPositiveInteger(y,139);
if(D>%_MaxSmi()){
throw MakeRangeError(139);
}
var G=false;
var E=D*8;
if(E<=%_TypedArrayMaxSizeInHeap()){
%_TypedArrayInitialize(v,8,null,0,E,false);
}else{
G=
%TypedArrayInitializeFromArrayLike(v,8,F,D);
}
if(!G){
for(var H=0;H<D;H++){
v[H]=F[H];
}
}
}
--- END ---
--- FUNCTION SOURCE (Int32ArrayConstructByLength) id{78,0} ---
(v,y){
var D=(y===(void 0))?
0:$toPositiveInteger(y,139);
if(D>%_MaxSmi()){
throw MakeRangeError(139);
}
var E=D*4;
if(E>%_TypedArrayMaxSizeInHeap()){
var w=new d(E);
%_TypedArrayInitialize(v,6,w,0,E,true);
}else{
%_TypedArrayInitialize(v,6,null,0,E,true);
}
}
--- END ---
--- FUNCTION SOURCE (debugs.(anonymous function)) id{79,0} ---
() {}
--- END ---
--- FUNCTION SOURCE (GIFEncoder.writeShort) id{80,0} ---
(pValue) {
this.writeByte(pValue & 0xFF);
this.writeByte((pValue >> 8) & 0xFF);
}
--- END ---
--- FUNCTION SOURCE (ByteCapacitor.writeByte) id{80,1} ---
(val) {
this.data.push(val);
}
--- END ---
INLINE (ByteCapacitor.writeByte) id{80,1} AS 1 AT <0:18>
--- FUNCTION SOURCE (ByteCapacitor.writeByte) id{80,2} ---
(val) {
this.data.push(val);
}
--- END ---
INLINE (ByteCapacitor.writeByte) id{80,2} AS 2 AT <0:51>
--- FUNCTION SOURCE (isNull) id{81,0} ---
(arg) {
return arg === null;
}
--- END ---
--- FUNCTION SOURCE (MAXCODE) id{82,0} ---
(n_bits) {
return (1 << n_bits) - 1;
}
--- END ---
|
src/fltk-widgets-valuators-sliders-hor_fill.adb | micahwelf/FLTK-Ada | 1 | 24700 | <gh_stars>1-10
with
Interfaces.C.Strings,
System;
use type
System.Address;
package body FLTK.Widgets.Valuators.Sliders.Hor_Fill is
procedure hor_fill_slider_set_draw_hook
(W, D : in System.Address);
pragma Import (C, hor_fill_slider_set_draw_hook, "hor_fill_slider_set_draw_hook");
pragma Inline (hor_fill_slider_set_draw_hook);
procedure hor_fill_slider_set_handle_hook
(W, H : in System.Address);
pragma Import (C, hor_fill_slider_set_handle_hook, "hor_fill_slider_set_handle_hook");
pragma Inline (hor_fill_slider_set_handle_hook);
function new_fl_hor_fill_slider
(X, Y, W, H : in Interfaces.C.int;
Text : in Interfaces.C.char_array)
return System.Address;
pragma Import (C, new_fl_hor_fill_slider, "new_fl_hor_fill_slider");
pragma Inline (new_fl_hor_fill_slider);
procedure free_fl_hor_fill_slider
(D : in System.Address);
pragma Import (C, free_fl_hor_fill_slider, "free_fl_hor_fill_slider");
pragma Inline (free_fl_hor_fill_slider);
procedure fl_hor_fill_slider_draw
(W : in System.Address);
pragma Import (C, fl_hor_fill_slider_draw, "fl_hor_fill_slider_draw");
pragma Inline (fl_hor_fill_slider_draw);
function fl_hor_fill_slider_handle
(W : in System.Address;
E : in Interfaces.C.int)
return Interfaces.C.int;
pragma Import (C, fl_hor_fill_slider_handle, "fl_hor_fill_slider_handle");
pragma Inline (fl_hor_fill_slider_handle);
procedure Finalize
(This : in out Hor_Fill_Slider) is
begin
if This.Void_Ptr /= System.Null_Address and then
This in Hor_Fill_Slider'Class
then
free_fl_hor_fill_slider (This.Void_Ptr);
This.Void_Ptr := System.Null_Address;
end if;
Finalize (Slider (This));
end Finalize;
package body Forge is
function Create
(X, Y, W, H : in Integer;
Text : in String)
return Hor_Fill_Slider is
begin
return This : Hor_Fill_Slider do
This.Void_Ptr := new_fl_hor_fill_slider
(Interfaces.C.int (X),
Interfaces.C.int (Y),
Interfaces.C.int (W),
Interfaces.C.int (H),
Interfaces.C.To_C (Text));
fl_widget_set_user_data
(This.Void_Ptr,
Widget_Convert.To_Address (This'Unchecked_Access));
hor_fill_slider_set_draw_hook (This.Void_Ptr, Draw_Hook'Address);
hor_fill_slider_set_handle_hook (This.Void_Ptr, Handle_Hook'Address);
end return;
end Create;
end Forge;
procedure Draw
(This : in out Hor_Fill_Slider) is
begin
fl_hor_fill_slider_draw (This.Void_Ptr);
end Draw;
function Handle
(This : in out Hor_Fill_Slider;
Event : in Event_Kind)
return Event_Outcome is
begin
return Event_Outcome'Val
(fl_hor_fill_slider_handle (This.Void_Ptr, Event_Kind'Pos (Event)));
end Handle;
end FLTK.Widgets.Valuators.Sliders.Hor_Fill;
|
Transynther/x86/_processed/NONE/_xt_/i7-7700_9_0x48.log_21829_490.asm | ljhsiun2/medusa | 9 | 21238 | .global s_prepare_buffers
s_prepare_buffers:
push %r11
push %r12
push %r15
push %r9
push %rcx
push %rdi
push %rsi
lea addresses_normal_ht+0x3f88, %rsi
lea addresses_A_ht+0x4a2e, %rdi
nop
add $45227, %r9
mov $88, %rcx
rep movsb
nop
nop
nop
add $57988, %r12
lea addresses_normal_ht+0x1ab9e, %r15
nop
nop
nop
nop
nop
cmp $54425, %rcx
mov $0x6162636465666768, %r9
movq %r9, %xmm1
movups %xmm1, (%r15)
nop
nop
nop
nop
sub %rcx, %rcx
lea addresses_WT_ht+0x7b9e, %r9
clflush (%r9)
nop
nop
xor %r11, %r11
mov $0x6162636465666768, %r12
movq %r12, %xmm6
vmovups %ymm6, (%r9)
add $30262, %rsi
pop %rsi
pop %rdi
pop %rcx
pop %r9
pop %r15
pop %r12
pop %r11
ret
.global s_faulty_load
s_faulty_load:
push %r12
push %r13
push %r15
push %r9
push %rax
push %rdi
push %rdx
// Store
lea addresses_UC+0xe6f6, %r13
nop
nop
inc %r9
movl $0x51525354, (%r13)
nop
nop
nop
and $38395, %rax
// Store
lea addresses_WT+0x19117, %r12
nop
xor $44518, %rdx
mov $0x5152535455565758, %rax
movq %rax, %xmm2
movups %xmm2, (%r12)
nop
nop
xor %rax, %rax
// Store
lea addresses_PSE+0x479e, %r15
nop
nop
xor $26450, %rdx
movb $0x51, (%r15)
nop
nop
dec %r12
// Faulty Load
lea addresses_RW+0x1439e, %r9
nop
xor %rdx, %rdx
mov (%r9), %eax
lea oracles, %r13
and $0xff, %rax
shlq $12, %rax
mov (%r13,%rax,1), %rax
pop %rdx
pop %rdi
pop %rax
pop %r9
pop %r15
pop %r13
pop %r12
ret
/*
<gen_faulty_load>
[REF]
{'OP': 'LOAD', 'src': {'type': 'addresses_RW', 'AVXalign': False, 'congruent': 0, 'size': 32, 'same': True, 'NT': False}}
{'OP': 'STOR', 'dst': {'type': 'addresses_UC', 'AVXalign': False, 'congruent': 0, 'size': 4, 'same': False, 'NT': False}}
{'OP': 'STOR', 'dst': {'type': 'addresses_WT', 'AVXalign': False, 'congruent': 0, 'size': 16, 'same': False, 'NT': False}}
{'OP': 'STOR', 'dst': {'type': 'addresses_PSE', 'AVXalign': False, 'congruent': 8, 'size': 1, 'same': False, 'NT': False}}
[Faulty Load]
{'OP': 'LOAD', 'src': {'type': 'addresses_RW', 'AVXalign': False, 'congruent': 0, 'size': 4, 'same': True, 'NT': False}}
<gen_prepare_buffer>
{'OP': 'REPM', 'src': {'type': 'addresses_normal_ht', 'congruent': 0, 'same': False}, 'dst': {'type': 'addresses_A_ht', 'congruent': 1, 'same': False}}
{'OP': 'STOR', 'dst': {'type': 'addresses_normal_ht', 'AVXalign': False, 'congruent': 10, 'size': 16, 'same': False, 'NT': False}}
{'OP': 'STOR', 'dst': {'type': 'addresses_WT_ht', 'AVXalign': False, 'congruent': 11, 'size': 32, 'same': False, 'NT': False}}
{'32': 21829}
32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32
*/
|
oeis/021/A021738.asm | neoneye/loda-programs | 11 | 10097 | ; A021738: Decimal expansion of 1/734.
; Submitted by Jon Maiga
; 0,0,1,3,6,2,3,9,7,8,2,0,1,6,3,4,8,7,7,3,8,4,1,9,6,1,8,5,2,8,6,1,0,3,5,4,2,2,3,4,3,3,2,4,2,5,0,6,8,1,1,9,8,9,1,0,0,8,1,7,4,3,8,6,9,2,0,9,8,0,9,2,6,4,3,0,5,1,7,7,1,1,1,7,1,6,6,2,1,2,5,3,4,0,5,9,9,4,5
seq $0,199685 ; a(n) = 5*10^n+1.
div $0,367
mod $0,10
|
tools/scitools/conf/understand/ada/ada12/s-stache.ads | brucegua/moocos | 1 | 20681 | ------------------------------------------------------------------------------
-- --
-- GNAT RUN-TIME LIBRARY (GNARL) COMPONENTS --
-- --
-- S Y S T E M . S T A C K _ C H E C K I N G --
-- --
-- S p e c --
-- --
-- Copyright (C) 1999-2009, Free Software Foundation, Inc. --
-- --
-- GNARL is free software; you can redistribute it and/or modify it under --
-- terms of the GNU General Public License as published by the Free Soft- --
-- ware Foundation; either version 3, or (at your option) any later ver- --
-- sion. GNAT is distributed in the hope that it will be useful, but WITH- --
-- OUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY --
-- or FITNESS FOR A PARTICULAR PURPOSE. --
-- --
-- --
-- --
-- --
-- --
-- You should have received a copy of the GNU General Public License and --
-- a copy of the GCC Runtime Library Exception along with this program; --
-- see the files COPYING3 and COPYING.RUNTIME respectively. If not, see --
-- <http://www.gnu.org/licenses/>. --
-- --
-- GNARL was developed by the GNARL team at Florida State University. --
-- Extensive contributions were provided by Ada Core Technologies, Inc. --
-- --
------------------------------------------------------------------------------
-- This package provides a system-independent implementation of stack
-- checking using comparison with stack base and limit.
-- This package defines basic types and objects. Operations related to
-- stack checking can be found in package System.Stack_Checking.Operations.
pragma Compiler_Unit;
with System.Storage_Elements;
package System.Stack_Checking is
pragma Preelaborate;
pragma Elaborate_Body;
-- This unit has a junk null body. The reason is that historically we
-- used to have a real body, and it causes bootstrapping path problems
-- to eliminate it, since the old body may still be present in the
-- compilation environment for a build.
type Stack_Info is record
Limit : System.Address := System.Null_Address;
Base : System.Address := System.Null_Address;
Size : System.Storage_Elements.Storage_Offset := 0;
end record;
-- This record may be part of a larger data structure like the
-- task control block in the tasking case.
-- This specific layout has the advantage of being compatible with the
-- Intel x86 BOUNDS instruction.
type Stack_Access is access all Stack_Info;
-- Unique local storage associated with a specific task. This storage is
-- used for the stack base and limit, and is returned by Checked_Self.
-- Only self may write this information, it may be read by any task.
-- At no time the address range Limit .. Base (or Base .. Limit for
-- upgrowing stack) may contain any address that is part of another stack.
-- The Stack_Access may be part of a larger data structure.
Multi_Processor : constant Boolean := False; -- Not supported yet
private
Null_Stack_Info : aliased Stack_Info :=
(Limit => System.Null_Address,
Base => System.Null_Address,
Size => 0);
-- Use explicit assignment to avoid elaboration code (call to init proc)
Null_Stack : constant Stack_Access := Null_Stack_Info'Access;
-- Stack_Access value that will return a Stack_Base and Stack_Limit
-- that fail any stack check.
end System.Stack_Checking;
|
transformy/tables/gen/0018.asm | mborik/regression | 3 | 14332 | xor a
ld hl, basescradr + #08cc
ld (hl), a
inc h
ld (hl), a
inc h
ld (hl), a
inc h
ld (hl), a
inc h
ld (hl), a
ld hl, basescradr + #0a10
ld (hl), a
inc h
ld (hl), a
inc h
ld (hl), a
ld hl, basescradr + #120b
ld (hl), a
inc h
ld (hl), a
inc h
ld (hl), a
inc h
ld (hl), a
inc h
ld (hl), a
ld (basescradr + #05ef), a
ld (basescradr + #0e31), a
ld (basescradr + #0eac), a
ld (basescradr + #0f31), a
ld (basescradr + #0fac), a
ld (basescradr + #0ff5), a
ld (basescradr + #1015), a
ld (basescradr + #1114), a
ld a, 96
ld (basescradr + #06ef), a
ld a, 112
ld (basescradr + #07ef), a
ld a, 248
ld (basescradr + #080f), a
ld (basescradr + #090f), a
ld (basescradr + #09b3), a
ld (basescradr + #0a30), a
ld (basescradr + #0b30), a
ld (basescradr + #0bd4), a
ld (basescradr + #0f72), a
ld (basescradr + #112d), a
ld (basescradr + #1312), a
ld a, 252
ld (basescradr + #0892), a
ld (basescradr + #0a0f), a
ld (basescradr + #0ab3), a
ld (basescradr + #0c30), a
ld (basescradr + #0cd4), a
ld (basescradr + #0dd4), a
ld (basescradr + #102e), a
ld (basescradr + #170f), a
ld a, 1
ld hl, basescradr + #0b0e
ld (hl), a
inc h
ld (hl), a
inc h
ld (hl), a
ld hl, basescradr + #0dcc
ld (hl), a
inc h
ld (hl), a
inc h
ld (hl), a
ld (basescradr + #0e6d), a
ld a, 254
ld (basescradr + #0992), a
ld (basescradr + #0a92), a
ld (basescradr + #0b0f), a
ld (basescradr + #0bb3), a
ld (basescradr + #0cb3), a
ld (basescradr + #0d30), a
ld (basescradr + #0ed4), a
ld (basescradr + #0ff4), a
ld (basescradr + #1113), a
inc a
ld hl, basescradr + #08f4
ld (hl), a
inc h
ld (hl), a
inc h
ld (hl), a
inc h
ld (hl), a
inc h
ld (hl), a
ld hl, basescradr + #0c0f
ld (hl), a
inc h
ld (hl), a
inc h
ld (hl), a
ld hl, basescradr + #0db3
ld (hl), a
inc h
ld (hl), a
inc h
ld (hl), a
ld d,a
ld e,a
ld (basescradr + #160e), de
ld (basescradr + #170d), de
ld (basescradr + #0871), a
ld (basescradr + #08d3), a
ld (basescradr + #096e), a
ld (basescradr + #0b92), a
ld (basescradr + #0c92), a
ld (basescradr + #0fd4), a
ld (basescradr + #102d), a
ld (basescradr + #1411), a
ld (basescradr + #1510), a
ld a, 128
ld (basescradr + #0851), a
ld (basescradr + #08f5), a
ld (basescradr + #0c93), a
ld (basescradr + #0d10), a
ld (basescradr + #0e10), a
ld (basescradr + #0eb4), a
ld a, 3
ld hl, basescradr + #08ec
ld (hl), a
inc h
ld (hl), a
inc h
ld (hl), a
ld (basescradr + #082e), a
ld (basescradr + #088d), a
ld (basescradr + #098d), a
ld (basescradr + #0e0e), a
ld (basescradr + #0f0e), a
ld a, 192
ld (basescradr + #0951), a
ld (basescradr + #09f5), a
ld (basescradr + #0af5), a
ld (basescradr + #0b72), a
ld (basescradr + #0d93), a
ld (basescradr + #0ef5), a
ld (basescradr + #0f10), a
ld (basescradr + #0fb4), a
ld (basescradr + #1213), a
ld (basescradr + #1511), a
ld a, 224
ld (basescradr + #0830), a
ld (basescradr + #08d4), a
ld (basescradr + #09d4), a
ld (basescradr + #0a51), a
ld (basescradr + #0bf5), a
ld (basescradr + #0c72), a
ld (basescradr + #0e93), a
ld (basescradr + #0f93), a
ld (basescradr + #1014), a
ld a, 7
ld hl, basescradr + #092e
ld (hl), a
inc h
ld (hl), a
inc h
ld (hl), a
ld hl, basescradr + #0b8d
ld (hl), a
inc h
ld (hl), a
inc h
ld (hl), a
ld hl, basescradr + #0bec
ld (hl), a
inc h
ld (hl), a
inc h
ld (hl), a
ld a, 240
ld (basescradr + #08b3), a
ld (basescradr + #0930), a
ld (basescradr + #0ad4), a
ld (basescradr + #0c51), a
ld (basescradr + #0cf5), a
ld (basescradr + #0df5), a
ld (basescradr + #0e72), a
ld (basescradr + #1610), a
ld a, 15
ld hl, basescradr + #0c2e
ld (hl), a
inc h
ld (hl), a
inc h
ld (hl), a
ld (basescradr + #08ad), a
ld (basescradr + #0e8d), a
ld (basescradr + #0eec), a
ld (basescradr + #0f8d), a
ld (basescradr + #0fec), a
ld (basescradr + #100c), a
ld a, 31
ld hl, basescradr + #09ad
ld (hl), a
inc h
ld (hl), a
inc h
ld (hl), a
ld hl, basescradr + #110c
ld (hl), a
inc h
ld (hl), a
inc h
ld (hl), a
ld (basescradr + #084e), a
ld (basescradr + #094e), a
ld (basescradr + #0f2e), a
ld a, 63
ld hl, basescradr + #0cad
ld (hl), a
inc h
ld (hl), a
inc h
ld (hl), a
ld hl, basescradr + #140c
ld (hl), a
inc h
ld (hl), a
inc h
ld (hl), a
inc h
ld (hl), a
ld (basescradr + #0b4e), a
ld (basescradr + #0c4e), a
ld a, 127
ld (basescradr + #08cd), a
ld (basescradr + #09cd), a
ld (basescradr + #0e4e), a
ld (basescradr + #0fad), a
ld (basescradr + #102c), a
ld (basescradr + #112c), a
ret
|
bdshemu_test/basic/test_32_sys01.asm | andreaswimmer/bddisasm | 1 | 178884 | <reponame>andreaswimmer/bddisasm
bits 32
sysenter |
core/lib/groups/Groups.agda | timjb/HoTT-Agda | 0 | 6224 |
{-# OPTIONS --without-K --rewriting #-}
module lib.groups.Groups where
open import lib.groups.CommutingSquare public
open import lib.groups.FreeAbelianGroup public
open import lib.groups.FreeGroup public
open import lib.groups.GroupProduct public
open import lib.groups.Homomorphism public
open import lib.groups.HomotopyGroup public
open import lib.groups.Int public
open import lib.groups.Isomorphism public
open import lib.groups.Lift public
open import lib.groups.LoopSpace public
open import lib.groups.QuotientGroup public
open import lib.groups.PullbackGroup public
open import lib.groups.Subgroup public
open import lib.groups.SubgroupProp public
open import lib.groups.TruncationGroup public
open import lib.groups.Unit public
|
programs/oeis/159/A159075.asm | karttu/loda | 1 | 13768 | <gh_stars>1-10
; A159075: a(1) = -1, otherwise a(n) = 0.
; 0,-1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0
cmp $0,1
sub $1,$0
|
Retired/Assemblearning_Clamp.asm | UlrichBerntien/Codewars-Katas | 0 | 89128 | section .text
global clamp
; uint64_t clamp(uint64_t a, uint64_t lo, uint64_t hi)
; input:
; rdi - value a to clamp
; rsi - lower limit
; rdx - upper limit
; return
; rax - the clamped value
clamp:
mov rax,rdi ; value a could be correct
cmp rax,rsi
cmovb rax,rsi ; change to lo if a is below lo
cmp rax,rdx
cmova rax,rdx ; cahnge to up if a is above hi
ret |
oeis/026/A026387.asm | neoneye/loda-programs | 11 | 166803 | <filename>oeis/026/A026387.asm
; A026387: a(n) = number of integer strings s(0),...,s(n) counted by array T in A026386 that have s(n)=0; also a(n) = T(2n,n).
; Submitted by <NAME>
; 2,8,34,150,678,3116,14494,68032,321590,1528776,7301142,35003238,168359754,812041860,3926147730,19022666310,92338836390,448968093320,2186194166950,10659569748370,52037098259090,254308709196660
mov $1,1
mov $2,1
mov $3,$0
mov $4,2
lpb $3
mul $1,$3
mul $2,3
sub $3,1
cmp $4,2
add $5,$4
div $1,$5
add $2,$1
add $4,2
lpe
mov $0,$2
mul $0,2
|
oeis/074/A074985.asm | neoneye/loda-programs | 11 | 100955 | <reponame>neoneye/loda-programs
; A074985: Squares of semiprimes (A001358).
; Submitted by <NAME>
; 16,36,81,100,196,225,441,484,625,676,1089,1156,1225,1444,1521,2116,2401,2601,3025,3249,3364,3844,4225,4761,5476,5929,6724,7225,7396,7569,8281,8649,8836,9025,11236,12321,13225,13924,14161,14641,14884,15129,16641,17689,17956,19881,20164,20449,21025,21316,24025,24964,25281,25921,27556,28561,31329,31684,33489,34225,34969,37636,40401,40804,41209,42025,42436,43681,45369,45796,46225,47089,47524,47961,48841,51076,55225,56169,61009,62001,64009,64516,67081,68644,70225,71289,75076,77284,82369,83521,84681
seq $0,1358 ; Semiprimes (or biprimes): products of two primes.
pow $0,2
|
programs/oeis/242/A242096.asm | neoneye/loda | 22 | 101567 | ; A242096: a(n) = (n mod 2) * pi( ceiling(n/2)-1 ), where pi is the prime counting function (A000720).
; 0,0,0,0,0,1,0,2,0,2,0,3,0,3,0,4,0,4,0,4,0,4,0,5,0,5,0,6,0,6,0,6,0,6,0,7,0,7,0,8,0,8,0,8,0,8,0,9,0,9,0,9,0,9,0,9,0,9,0,10,0,10,0,11,0,11,0,11,0,11,0,11,0,11,0,12,0,12,0,12,0,12,0,13,0,13,0,14,0,14,0,14,0,14,0,15,0,15,0,15
lpb $0
div $0,2
mov $1,$0
mul $0,2
seq $1,230980 ; Number of primes <= n, starting at n=0.
lpe
mov $0,$1
|
sqlparser/seata-sqlparser-antlr/src/main/java/io/seata/sqlparser/antlr/oracle/antlr/PlSqlParser.g4 | YechenGu/seata | 0 | 4774 | /**
* Oracle(c) PL/SQL 11g Parser
*
* Copyright (c) 2009-2011 <NAME> <<EMAIL>>
* Copyright (c) 2015-2019 <NAME> (KvanTTT, <EMAIL>, Positive Technologies).
* Copyright (c) 2017-2018 <NAME> <<EMAIL>>
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
grammar PlSqlParser;
import PlSqlLexer;
@parser::postinclude {
#include <PlSqlParserBase.h>
}
sql_script
: ((unit_statement | sql_plus_command) SEMICOLON?)* EOF
;
unit_statement
: transaction_control_statements
| alter_cluster
| alter_database
| alter_function
| alter_package
| alter_procedure
| alter_sequence
| alter_session
| alter_trigger
| alter_type
| alter_table
| alter_tablespace
| alter_index
| alter_library
| alter_materialized_view
| alter_materialized_view_log
| alter_user
| alter_view
| analyze
| associate_statistics
| audit_traditional
| unified_auditing
| create_function_body
| create_procedure_body
| create_package
| create_package_body
| create_index
| create_table
| create_tablespace
| create_cluster
| create_context
| create_view //TODO
| create_directory
| create_materialized_view
| create_materialized_view_log
| create_user
| create_sequence
| create_trigger
| create_type
| create_synonym
| drop_function
| drop_package
| drop_procedure
| drop_sequence
| drop_trigger
| drop_type
| data_manipulation_language_statements
| truncate_table
| drop_table
| drop_view
| drop_index
| rename_object
| comment_on_column
| comment_on_table
| anonymous_block
| grant_statement
| procedure_call
;
// DDL -> SQL Statements for Stored PL/SQL Units
// Function DDLs
drop_function
: DROP FUNCTION function_name ';'
;
alter_function
: ALTER FUNCTION function_name COMPILE DEBUG? compiler_parameters_clause* (REUSE SETTINGS)? ';'
;
create_function_body
: CREATE (OR REPLACE)? FUNCTION function_name ('(' parameter (',' parameter)* ')')?
RETURN type_spec (invoker_rights_clause | parallel_enable_clause | result_cache_clause | DETERMINISTIC)*
((PIPELINED? (IS | AS) (DECLARE? seq_of_declare_specs? body | call_spec)) | (PIPELINED | AGGREGATE) USING implementation_type_name) ';'
;
// Creation Function - Specific Clauses
parallel_enable_clause
: PARALLEL_ENABLE partition_by_clause?
;
partition_by_clause
: '(' PARTITION expression BY (ANY | (HASH | RANGE | LIST) paren_column_list) streaming_clause? ')'
;
result_cache_clause
: RESULT_CACHE relies_on_part?
;
relies_on_part
: RELIES_ON '(' tableview_name (',' tableview_name)* ')'
;
streaming_clause
: (ORDER | CLUSTER) expression BY paren_column_list
;
// Package DDLs
drop_package
: DROP PACKAGE BODY? (schema_object_name '.')? package_name ';'
;
alter_package
: ALTER PACKAGE package_name COMPILE DEBUG? (PACKAGE | BODY | SPECIFICATION)? compiler_parameters_clause* (REUSE SETTINGS)? ';'
;
create_package
: CREATE (OR REPLACE)? PACKAGE (schema_object_name '.')? package_name invoker_rights_clause? (IS | AS) package_obj_spec* END package_name? ';'
;
create_package_body
: CREATE (OR REPLACE)? PACKAGE BODY (schema_object_name '.')? package_name (IS | AS) package_obj_body* (BEGIN seq_of_statements)? END package_name? ';'
;
// Create Package Specific Clauses
package_obj_spec
: pragma_declaration
| exception_declaration
| variable_declaration
| subtype_declaration
| cursor_declaration
| type_declaration
| procedure_spec
| function_spec
;
procedure_spec
: PROCEDURE identifier ('(' parameter ( ',' parameter )* ')')? ';'
;
function_spec
: FUNCTION identifier ('(' parameter ( ',' parameter)* ')')?
RETURN type_spec PIPELINED? DETERMINISTIC? (RESULT_CACHE)? ';'
;
package_obj_body
: exception_declaration
| subtype_declaration
| cursor_declaration
| variable_declaration
| type_declaration
| procedure_body
| function_body
| procedure_spec
| function_spec
;
// Procedure DDLs
drop_procedure
: DROP PROCEDURE procedure_name ';'
;
alter_procedure
: ALTER PROCEDURE procedure_name COMPILE DEBUG? compiler_parameters_clause* (REUSE SETTINGS)? ';'
;
function_body
: FUNCTION identifier ('(' parameter (',' parameter)* ')')?
RETURN type_spec (invoker_rights_clause | parallel_enable_clause | result_cache_clause | DETERMINISTIC)*
((PIPELINED? DETERMINISTIC? (IS | AS) (DECLARE? seq_of_declare_specs? body | call_spec)) | (PIPELINED | AGGREGATE) USING implementation_type_name) ';'
;
procedure_body
: PROCEDURE identifier ('(' parameter (',' parameter)* ')')? (IS | AS)
(DECLARE? seq_of_declare_specs? body | call_spec | EXTERNAL) ';'
;
create_procedure_body
: CREATE (OR REPLACE)? PROCEDURE procedure_name ('(' parameter (',' parameter)* ')')?
invoker_rights_clause? (IS | AS)
(DECLARE? seq_of_declare_specs? body | call_spec | EXTERNAL) ';'
;
// Trigger DDLs
drop_trigger
: DROP TRIGGER trigger_name ';'
;
alter_trigger
: ALTER TRIGGER alter_trigger_name=trigger_name
((ENABLE | DISABLE) | RENAME TO rename_trigger_name=trigger_name | COMPILE DEBUG? compiler_parameters_clause* (REUSE SETTINGS)?) ';'
;
create_trigger
: CREATE ( OR REPLACE )? TRIGGER trigger_name
(simple_dml_trigger | compound_dml_trigger | non_dml_trigger)
trigger_follows_clause? (ENABLE | DISABLE)? trigger_when_clause? trigger_body ';'
;
trigger_follows_clause
: FOLLOWS trigger_name (',' trigger_name)*
;
trigger_when_clause
: WHEN '(' condition ')'
;
// Create Trigger Specific Clauses
simple_dml_trigger
: (BEFORE | AFTER | INSTEAD OF) dml_event_clause referencing_clause? for_each_row?
;
for_each_row
: FOR EACH ROW
;
compound_dml_trigger
: FOR dml_event_clause referencing_clause?
;
non_dml_trigger
: (BEFORE | AFTER) non_dml_event (OR non_dml_event)* ON (DATABASE | (schema_name '.')? SCHEMA)
;
trigger_body
: COMPOUND TRIGGER
| CALL identifier
| trigger_block
;
routine_clause
: routine_name function_argument?
;
compound_trigger_block
: COMPOUND TRIGGER seq_of_declare_specs? timing_point_section+ END trigger_name
;
timing_point_section
: bk=BEFORE STATEMENT IS trigger_block BEFORE STATEMENT ';'
| bk=BEFORE EACH ROW IS trigger_block BEFORE EACH ROW ';'
| ak=AFTER STATEMENT IS trigger_block AFTER STATEMENT ';'
| ak=AFTER EACH ROW IS trigger_block AFTER EACH ROW ';'
;
non_dml_event
: ALTER
| ANALYZE
| ASSOCIATE STATISTICS
| AUDIT
| COMMENT
| CREATE
| DISASSOCIATE STATISTICS
| DROP
| GRANT
| NOAUDIT
| RENAME
| REVOKE
| TRUNCATE
| DDL
| STARTUP
| SHUTDOWN
| DB_ROLE_CHANGE
| LOGON
| LOGOFF
| SERVERERROR
| SUSPEND
| DATABASE
| SCHEMA
| FOLLOWS
;
dml_event_clause
: dml_event_element (OR dml_event_element)* ON dml_event_nested_clause? tableview_name
;
dml_event_element
: (DELETE | INSERT | UPDATE) (OF column_list)?
;
dml_event_nested_clause
: NESTED TABLE tableview_name OF
;
referencing_clause
: REFERENCING referencing_element+
;
referencing_element
: (NEW | OLD | PARENT) column_alias
;
// DDLs
drop_type
: DROP TYPE BODY? type_name (FORCE | VALIDATE)? ';'
;
alter_type
: ALTER TYPE type_name
(compile_type_clause
| replace_type_clause
//TODO | {input.LT(2).getText().equalsIgnoreCase("attribute")}? alter_attribute_definition
| alter_method_spec
| alter_collection_clauses
| modifier_clause
| overriding_subprogram_spec
) dependent_handling_clause? ';'
;
// Alter Type Specific Clauses
compile_type_clause
: COMPILE DEBUG? (SPECIFICATION | BODY)? compiler_parameters_clause* (REUSE SETTINGS)?
;
replace_type_clause
: REPLACE invoker_rights_clause? AS OBJECT '(' object_member_spec (',' object_member_spec)* ')'
;
alter_method_spec
: alter_method_element (',' alter_method_element)*
;
alter_method_element
: (ADD | DROP) (map_order_function_spec | subprogram_spec)
;
alter_attribute_definition
: (ADD | MODIFY | DROP) ATTRIBUTE (attribute_definition | '(' attribute_definition (',' attribute_definition)* ')')
;
attribute_definition
: attribute_name type_spec?
;
alter_collection_clauses
: MODIFY (LIMIT expression | ELEMENT TYPE type_spec)
;
dependent_handling_clause
: INVALIDATE
| CASCADE (CONVERT TO SUBSTITUTABLE | NOT? INCLUDING TABLE DATA)? dependent_exceptions_part?
;
dependent_exceptions_part
: FORCE? EXCEPTIONS INTO tableview_name
;
create_type
: CREATE (OR REPLACE)? TYPE (type_definition | type_body) ';'
;
// Create Type Specific Clauses
type_definition
: type_name (OID CHAR_STRING)? FORCE? object_type_def?
;
object_type_def
: invoker_rights_clause? (object_as_part | object_under_part) sqlj_object_type?
('(' object_member_spec (',' object_member_spec)* ')')? modifier_clause*
;
object_as_part
: (IS | AS) (OBJECT | varray_type_def | nested_table_type_def)
;
object_under_part
: UNDER type_spec
;
nested_table_type_def
: TABLE OF type_spec (NOT NULL_)?
;
sqlj_object_type
: EXTERNAL NAME expression LANGUAGE JAVA USING (SQLDATA | CUSTOMDATUM | ORADATA)
;
type_body
: BODY type_name (IS | AS) (type_body_elements)+ END
;
type_body_elements
: map_order_func_declaration
| subprog_decl_in_type
| overriding_subprogram_spec
;
map_order_func_declaration
: (MAP | ORDER) MEMBER func_decl_in_type
;
subprog_decl_in_type
: (MEMBER | STATIC) (proc_decl_in_type | func_decl_in_type | constructor_declaration)
;
proc_decl_in_type
: PROCEDURE procedure_name '(' type_elements_parameter (',' type_elements_parameter)* ')'
(IS | AS) (call_spec | DECLARE? seq_of_declare_specs? body ';')
;
func_decl_in_type
: FUNCTION function_name ('(' type_elements_parameter (',' type_elements_parameter)* ')')?
RETURN type_spec (IS | AS) (call_spec | DECLARE? seq_of_declare_specs? body ';')
;
constructor_declaration
: FINAL? INSTANTIABLE? CONSTRUCTOR FUNCTION type_spec
('(' (SELF IN OUT type_spec ',') type_elements_parameter (',' type_elements_parameter)* ')')?
RETURN SELF AS RESULT (IS | AS) (call_spec | DECLARE? seq_of_declare_specs? body ';')
;
// Common Type Clauses
modifier_clause
: NOT? (INSTANTIABLE | FINAL | OVERRIDING)
;
object_member_spec
: identifier type_spec sqlj_object_type_attr?
| element_spec
;
sqlj_object_type_attr
: EXTERNAL NAME expression
;
element_spec
: modifier_clause? element_spec_options+ (',' pragma_clause)?
;
element_spec_options
: subprogram_spec
| constructor_spec
| map_order_function_spec
;
subprogram_spec
: (MEMBER | STATIC) (type_procedure_spec | type_function_spec)
;
// TODO: should be refactored such as Procedure body and Function body, maybe Type_Function_Body and overriding_function_body
overriding_subprogram_spec
: OVERRIDING MEMBER overriding_function_spec
;
overriding_function_spec
: FUNCTION function_name ('(' type_elements_parameter (',' type_elements_parameter)* ')')?
RETURN (type_spec | SELF AS RESULT)
(PIPELINED? (IS | AS) (DECLARE? seq_of_declare_specs? body))? ';'?
;
type_procedure_spec
: PROCEDURE procedure_name '(' type_elements_parameter (',' type_elements_parameter)* ')' ((IS | AS) call_spec)?
;
type_function_spec
: FUNCTION function_name ('(' type_elements_parameter (',' type_elements_parameter)* ')')?
RETURN (type_spec | SELF AS RESULT) ((IS | AS) call_spec | EXTERNAL VARIABLE? NAME expression)?
;
constructor_spec
: FINAL? INSTANTIABLE? CONSTRUCTOR FUNCTION
type_spec ('(' (SELF IN OUT type_spec ',') type_elements_parameter (',' type_elements_parameter)* ')')?
RETURN SELF AS RESULT ((IS | AS) call_spec)?
;
map_order_function_spec
: (MAP | ORDER) MEMBER type_function_spec
;
pragma_clause
: PRAGMA RESTRICT_REFERENCES '(' pragma_elements (',' pragma_elements)* ')'
;
pragma_elements
: identifier
| DEFAULT
;
type_elements_parameter
: parameter_name type_spec
;
// Sequence DDLs
drop_sequence
: DROP SEQUENCE sequence_name ';'
;
alter_sequence
: ALTER SEQUENCE sequence_name sequence_spec+ ';'
;
alter_session
: ALTER SESSION (
ADVISE ( COMMIT | ROLLBACK | NOTHING )
| CLOSE DATABASE LINK parameter_name
| enable_or_disable COMMIT IN PROCEDURE
| enable_or_disable GUARD
| (enable_or_disable | FORCE) PARALLEL (DML | DDL | QUERY) (PARALLEL (literal | parameter_name))?
| SET alter_session_set_clause
)
;
alter_session_set_clause
: parameter_name '=' parameter_value
;
create_sequence
: CREATE SEQUENCE sequence_name (sequence_start_clause | sequence_spec)* ';'
;
// Common Sequence
sequence_spec
: INCREMENT BY UNSIGNED_INTEGER
| MAXVALUE UNSIGNED_INTEGER
| NOMAXVALUE
| MINVALUE UNSIGNED_INTEGER
| NOMINVALUE
| CYCLE
| NOCYCLE
| CACHE UNSIGNED_INTEGER
| NOCACHE
| ORDER
| NOORDER
;
sequence_start_clause
: START WITH UNSIGNED_INTEGER
;
create_index
: CREATE (UNIQUE | BITMAP)? INDEX index_name
ON (cluster_index_clause | table_index_clause | bitmap_join_index_clause)
UNUSABLE?
';'
;
cluster_index_clause
: CLUSTER cluster_name index_attributes?
;
cluster_name
: (id_expression '.')? id_expression
;
table_index_clause
: tableview_name table_alias? '(' index_expr (ASC | DESC)? (',' index_expr (ASC | DESC)? )* ')'
index_properties?
;
bitmap_join_index_clause
: tableview_name '(' (tableview_name | table_alias)? column_name (ASC | DESC)? (',' (tableview_name | table_alias)? column_name (ASC | DESC)? )* ')'
FROM tableview_name table_alias (',' tableview_name table_alias)*
where_clause local_partitioned_index? index_attributes?
;
index_expr
: column_name
| expression
;
index_properties
: (global_partitioned_index | local_partitioned_index | index_attributes)+
| INDEXTYPE IS (domain_index_clause | xmlindex_clause)
;
domain_index_clause
: indextype local_domain_index_clause? parallel_clause? (PARAMETERS '(' odci_parameters ')' )?
;
local_domain_index_clause
: LOCAL ('(' PARTITION partition_name (PARAMETERS '(' odci_parameters ')' )? (',' PARTITION partition_name (PARAMETERS '(' odci_parameters ')' )? )* ')' )?
;
xmlindex_clause
: (XDB '.')? XMLINDEX local_xmlindex_clause?
parallel_clause? //TODO xmlindex_parameters_clause?
;
local_xmlindex_clause
: LOCAL ('(' PARTITION partition_name (',' PARTITION partition_name //TODO xmlindex_parameters_clause?
)* ')')?
;
global_partitioned_index
: GLOBAL PARTITION BY (RANGE '(' column_name (',' column_name)* ')' '(' index_partitioning_clause ')'
| HASH '(' column_name (',' column_name)* ')'
(individual_hash_partitions
| hash_partitions_by_quantity
)
)
;
index_partitioning_clause
: PARTITION partition_name? VALUES LESS THAN '(' literal (',' literal)* ')'
segment_attributes_clause?
;
local_partitioned_index
: LOCAL (on_range_partitioned_table
| on_list_partitioned_table
| on_hash_partitioned_table
| on_comp_partitioned_table
)?
;
on_range_partitioned_table
: '(' partitioned_table (',' partitioned_table)* ')'
;
on_list_partitioned_table
: '(' partitioned_table (',' partitioned_table)* ')'
;
partitioned_table
: PARTITION partition_name?
(segment_attributes_clause | key_compression)*
UNUSABLE?
;
on_hash_partitioned_table
: STORE IN '(' tablespace (',' tablespace)* ')'
| '(' on_hash_partitioned_clause (',' on_hash_partitioned_clause)* ')'
;
on_hash_partitioned_clause
: PARTITION partition_name? (TABLESPACE tablespace)?
key_compression? UNUSABLE?
;
on_comp_partitioned_table
: (STORE IN '(' tablespace (',' tablespace)* ')' )?
'(' on_comp_partitioned_clause (',' on_comp_partitioned_clause)* ')'
;
on_comp_partitioned_clause
: PARTITION partition_name?
(segment_attributes_clause | key_compression)*
UNUSABLE index_subpartition_clause?
;
index_subpartition_clause
: STORE IN '(' tablespace (',' tablespace)* ')'
| '(' index_subpartition_subclause (',' index_subpartition_subclause)* ')'
;
index_subpartition_subclause
: SUBPARTITION subpartition_name? (TABLESPACE tablespace)?
key_compression? UNUSABLE?
;
odci_parameters
: CHAR_STRING
;
indextype
: (id_expression '.')? id_expression
;
//https://docs.oracle.com/cd/E11882_01/server.112/e41084/statements_1010.htm#SQLRF00805
alter_index
: ALTER INDEX index_name (alter_index_ops_set1 | alter_index_ops_set2) ';'
;
alter_index_ops_set1
: ( deallocate_unused_clause
| allocate_extent_clause
| shrink_clause
| parallel_clause
| physical_attributes_clause
| logging_clause
)+
;
alter_index_ops_set2
: rebuild_clause
| PARAMETERS '(' odci_parameters ')'
| COMPILE
| enable_or_disable
| UNUSABLE
| visible_or_invisible
| RENAME TO new_index_name
| COALESCE
| monitoring_nomonitoring USAGE
| UPDATE BLOCK REFERENCES
| alter_index_partitioning
;
visible_or_invisible
: VISIBLE
| INVISIBLE
;
monitoring_nomonitoring
: MONITORING
| NOMONITORING
;
rebuild_clause
: REBUILD ( PARTITION partition_name
| SUBPARTITION subpartition_name
| REVERSE
| NOREVERSE
)?
( parallel_clause
| TABLESPACE tablespace
| PARAMETERS '(' odci_parameters ')'
//TODO | xmlindex_parameters_clause
| ONLINE
| physical_attributes_clause
| key_compression
| logging_clause
)*
;
alter_index_partitioning
: modify_index_default_attrs
| add_hash_index_partition
| modify_index_partition
| rename_index_partition
| drop_index_partition
| split_index_partition
| coalesce_index_partition
| modify_index_subpartition
;
modify_index_default_attrs
: MODIFY DEFAULT ATTRIBUTES (FOR PARTITION partition_name)?
( physical_attributes_clause
| TABLESPACE (tablespace | DEFAULT)
| logging_clause
)
;
add_hash_index_partition
: ADD PARTITION partition_name? (TABLESPACE tablespace)?
key_compression? parallel_clause?
;
coalesce_index_partition
: COALESCE PARTITION parallel_clause?
;
modify_index_partition
: MODIFY PARTITION partition_name
( modify_index_partitions_ops+
| PARAMETERS '(' odci_parameters ')'
| COALESCE
| UPDATE BLOCK REFERENCES
| UNUSABLE
)
;
modify_index_partitions_ops
: deallocate_unused_clause
| allocate_extent_clause
| physical_attributes_clause
| logging_clause
| key_compression
;
rename_index_partition
: RENAME (PARTITION partition_name | SUBPARTITION subpartition_name)
TO new_partition_name
;
drop_index_partition
: DROP PARTITION partition_name
;
split_index_partition
: SPLIT PARTITION partition_name_old AT '(' literal (',' literal)* ')'
(INTO '(' index_partition_description ',' index_partition_description ')' ) ? parallel_clause?
;
index_partition_description
: PARTITION (partition_name ( (segment_attributes_clause | key_compression)+
| PARAMETERS '(' odci_parameters ')'
)
UNUSABLE?
)?
;
modify_index_subpartition
: MODIFY SUBPARTITION subpartition_name (UNUSABLE
| allocate_extent_clause
| deallocate_unused_clause
)
;
partition_name_old
: partition_name
;
new_partition_name
: partition_name
;
new_index_name
: index_name
;
create_user
: CREATE USER
user_object_name
( identified_by
| identified_other_clause
| user_tablespace_clause
| quota_clause
| profile_clause
| password_expire_clause
| user_lock_clause
| user_editions_clause
| container_clause
)+ ';'
;
// The standard clauses only permit one user per statement.
// The proxy clause allows multiple users for a proxy designation.
alter_user
: ALTER USER
user_object_name
( alter_identified_by
| identified_other_clause
| user_tablespace_clause
| quota_clause
| profile_clause
| user_default_role_clause
| password_expire_clause
| user_lock_clause
| alter_user_editions_clause
| container_clause
| container_data_clause
)+
';'
| user_object_name (',' user_object_name)* proxy_clause ';'
;
alter_identified_by
: identified_by (REPLACE id_expression)?
;
identified_by
: IDENTIFIED BY id_expression
;
identified_other_clause
: IDENTIFIED (EXTERNALLY | GLOBALLY) (AS quoted_string)?
;
user_tablespace_clause
: (DEFAULT | TEMPORARY) TABLESPACE id_expression
;
quota_clause
: QUOTA (size_clause | UNLIMITED) ON id_expression
;
profile_clause
: PROFILE id_expression
;
role_clause
: role_name (',' role_name)*
| ALL (EXCEPT role_name (',' role_name)*)*
;
user_default_role_clause
: DEFAULT ROLE (NONE | role_clause)
;
password_expire_clause
: PASSWORD EXPIRE
;
user_lock_clause
: ACCOUNT (LOCK | UNLOCK)
;
user_editions_clause
: ENABLE EDITIONS
;
alter_user_editions_clause
: user_editions_clause (FOR regular_id (',' regular_id)*)? FORCE?
;
proxy_clause
: REVOKE CONNECT THROUGH (ENTERPRISE USERS | user_object_name)
| GRANT CONNECT THROUGH
( ENTERPRISE USERS
| user_object_name
(WITH (NO ROLES | ROLE role_clause))?
(AUTHENTICATION REQUIRED)?
(AUTHENTICATED USING (PASSWORD | CERTIFICATE | DISTINGUISHED NAME))?
)
;
container_names
: LEFT_PAREN id_expression (',' id_expression)* RIGHT_PAREN
;
set_container_data
: SET CONTAINER_DATA EQUALS_OP (ALL | DEFAULT | container_names)
;
add_rem_container_data
: (ADD | REMOVE) CONTAINER_DATA EQUALS_OP container_names
;
container_data_clause
: set_container_data
| add_rem_container_data (FOR container_tableview_name)?
;
// https://docs.oracle.com/cd/E11882_01/server.112/e41084/statements_4005.htm#SQLRF01105
analyze
: ( ANALYZE (TABLE tableview_name | INDEX index_name) partition_extention_clause?
| ANALYZE CLUSTER cluster_name
)
( validation_clauses
| LIST CHAINED ROWS into_clause1?
| DELETE SYSTEM? STATISTICS
)
';'
;
partition_extention_clause
: PARTITION ( '(' partition_name ')'
| FOR '(' partition_key_value (',' partition_key_value)* ')'
)
| SUBPARTITION ( '(' subpartition_name ')'
| FOR '(' subpartition_key_value (',' subpartition_key_value)* ')'
)
;
validation_clauses
: VALIDATE REF UPDATE (SET DANGLING TO NULL_)?
| VALIDATE STRUCTURE
( CASCADE FAST
| CASCADE online_or_offline? into_clause?
| CASCADE
)?
online_or_offline? into_clause?
;
online_or_offline
: OFFLINE
| ONLINE
;
into_clause1
: INTO tableview_name?
;
//Making assumption on partition ad subpartition key value clauses
partition_key_value
: literal
;
subpartition_key_value
: literal
;
//https://docs.oracle.com/cd/E11882_01/server.112/e41084/statements_4006.htm#SQLRF01106
associate_statistics
: ASSOCIATE STATISTICS
WITH (column_association | function_association)
storage_table_clause?
';'
;
column_association
: COLUMNS tableview_name '.' column_name (',' tableview_name '.' column_name)* using_statistics_type
;
function_association
: ( FUNCTIONS function_name (',' function_name)*
| PACKAGES package_name (',' package_name)*
| TYPES type_name (',' type_name)*
| INDEXES index_name (',' index_name)*
| INDEXTYPES indextype_name (',' indextype_name)*
)
( using_statistics_type
| default_cost_clause (',' default_selectivity_clause)?
| default_selectivity_clause (',' default_cost_clause)?
)
;
indextype_name
: id_expression
;
using_statistics_type
: USING (statistics_type_name | NULL_)
;
statistics_type_name
: regular_id
;
default_cost_clause
: DEFAULT COST '(' cpu_cost ',' io_cost ',' network_cost ')'
;
cpu_cost
: UNSIGNED_INTEGER
;
io_cost
: UNSIGNED_INTEGER
;
network_cost
: UNSIGNED_INTEGER
;
default_selectivity_clause
: DEFAULT SELECTIVITY default_selectivity
;
default_selectivity
: UNSIGNED_INTEGER
;
storage_table_clause
: WITH (SYSTEM | USER) MANAGED STORAGE TABLES
;
// https://docs.oracle.com/database/121/SQLRF/statements_4008.htm#SQLRF56110
unified_auditing
: {isVersion12()}?
AUDIT (POLICY policy_name ((BY | EXCEPT) audit_user (',' audit_user)* )?
(WHENEVER NOT? SUCCESSFUL)?
| CONTEXT NAMESPACE oracle_namespace
ATTRIBUTES attribute_name (',' attribute_name)* (BY audit_user (',' audit_user)*)?
)
';'
;
policy_name
: identifier
;
// https://docs.oracle.com/cd/E11882_01/server.112/e41084/statements_4007.htm#SQLRF01107
// https://docs.oracle.com/database/121/SQLRF/statements_4007.htm#SQLRF01107
audit_traditional
: AUDIT ( audit_operation_clause (auditing_by_clause | IN SESSION CURRENT)?
| audit_schema_object_clause
| NETWORK
| audit_direct_path
)
(BY (SESSION | ACCESS) )? (WHENEVER NOT? SUCCESSFUL)?
audit_container_clause?
';'
;
audit_direct_path
: {isVersion12()}? DIRECT_PATH auditing_by_clause
;
audit_container_clause
: {isVersion12()}? (CONTAINER EQUALS_OP (CURRENT | ALL))
;
audit_operation_clause
: ( (sql_statement_shortcut | ALL STATEMENTS?) (',' (sql_statement_shortcut | ALL STATEMENTS?) )*
| (system_privilege | ALL PRIVILEGES) (',' (system_privilege | ALL PRIVILEGES) )*
)
;
auditing_by_clause
: BY audit_user (',' audit_user)*
;
audit_user
: regular_id
;
audit_schema_object_clause
: ( sql_operation (',' sql_operation)* | ALL) auditing_on_clause
;
sql_operation
: ALTER
| AUDIT
| COMMENT
| DELETE
| EXECUTE
| FLASHBACK
| GRANT
| INDEX
| INSERT
| LOCK
| READ
| RENAME
| SELECT
| UPDATE
;
auditing_on_clause
: ON ( object_name
| DIRECTORY regular_id
| MINING MODEL model_name
| {isVersion12()}? SQL TRANSLATION PROFILE profile_name
| DEFAULT
)
;
model_name
: (id_expression '.')? id_expression
;
object_name
: (id_expression '.')? id_expression
;
profile_name
: (id_expression '.')? id_expression
;
sql_statement_shortcut
: ALTER SYSTEM
| CLUSTER
| CONTEXT
| DATABASE LINK
| DIMENSION
| DIRECTORY
| INDEX
| MATERIALIZED VIEW
| NOT EXISTS
| OUTLINE
| {isVersion12()}? PLUGGABLE DATABASE
| PROCEDURE
| PROFILE
| PUBLIC DATABASE LINK
| PUBLIC SYNONYM
| ROLE
| ROLLBACK SEGMENT
| SEQUENCE
| SESSION
| SYNONYM
| SYSTEM AUDIT
| SYSTEM GRANT
| TABLE
| TABLESPACE
| TRIGGER
| TYPE
| USER
| VIEW
| ALTER SEQUENCE
| ALTER TABLE
| COMMENT TABLE
| DELETE TABLE
| EXECUTE PROCEDURE
| GRANT DIRECTORY
| GRANT PROCEDURE
| GRANT SEQUENCE
| GRANT TABLE
| GRANT TYPE
| INSERT TABLE
| LOCK TABLE
| SELECT SEQUENCE
| SELECT TABLE
| UPDATE TABLE
;
drop_index
: DROP INDEX index_name ';'
;
rename_object
: RENAME object_name TO object_name ';'
;
grant_statement
: GRANT
( ','?
(role_name
| system_privilege
| object_privilege paren_column_list?
)
)+
(ON grant_object_name)?
TO (grantee_name | PUBLIC) (',' (grantee_name | PUBLIC) )*
(WITH (ADMIN | DELEGATE) OPTION)?
(WITH HIERARCHY OPTION)?
(WITH GRANT OPTION)?
container_clause? ';'
;
container_clause
: CONTAINER EQUALS_OP (CURRENT | ALL)
;
create_directory
: CREATE (OR REPLACE)? DIRECTORY directory_name AS directory_path
';'
;
directory_name
: regular_id
;
directory_path
: CHAR_STRING
;
// https://docs.oracle.com/cd/E11882_01/appdev.112/e25519/alter_library.htm#LNPLS99946
// https://docs.oracle.com/database/121/LNPLS/alter_library.htm#LNPLS99946
alter_library
: ALTER LIBRARY library_name
( COMPILE library_debug? compiler_parameters_clause* (REUSE SETTINGS)?
| library_editionable
)
';'
;
library_editionable
: {isVersion12()}? (EDITIONABLE | NONEDITIONABLE)
;
library_debug
: {isVersion12()}? DEBUG
;
compiler_parameters_clause
: parameter_name EQUALS_OP parameter_value
;
parameter_value
: regular_id
;
library_name
: (regular_id '.')? regular_id
;
// https://docs.oracle.com/cd/E11882_01/server.112/e41084/statements_4004.htm#SQLRF01104
// https://docs.oracle.com/database/121/SQLRF/statements_4004.htm#SQLRF01104
alter_view
: ALTER VIEW tableview_name
( ADD out_of_line_constraint
| MODIFY CONSTRAINT constraint_name (RELY | NORELY)
| DROP ( CONSTRAINT constraint_name
| PRIMARY KEY
| UNIQUE '(' column_name (',' column_name)* ')'
)
| COMPILE
| READ (ONLY | WRITE)
| alter_view_editionable?
)
';'
;
alter_view_editionable
: {isVersion12()}? (EDITIONABLE | NONEDITIONABLE)
;
create_view
: CREATE (OR REPLACE)? (OR? FORCE)? EDITIONABLE? EDITIONING? VIEW
tableview_name view_options?
AS select_only_statement subquery_restriction_clause?
;
view_options
: view_alias_constraint
| object_view_clause
// | xmltype_view_clause //TODO
;
view_alias_constraint
: '(' ( ','? (table_alias inline_constraint* | out_of_line_constraint) )+ ')'
;
object_view_clause
: OF type_name
( WITH OBJECT (IDENTIFIER|ID|OID) ( DEFAULT | '(' REGULAR_ID (',' REGULAR_ID)* ')' )
| UNDER tableview_name
)
( '(' ( ','? (out_of_line_constraint | REGULAR_ID inline_constraint ) )+ ')' )*
;
inline_constraint
: (CONSTRAINT constraint_name)?
( NOT? NULL_
| UNIQUE
| PRIMARY KEY
| references_clause
| check_constraint
)
constraint_state?
;
inline_ref_constraint
: SCOPE IS tableview_name
| WITH ROWID
| (CONSTRAINT constraint_name)? references_clause constraint_state?
;
out_of_line_ref_constraint
: SCOPE FOR '(' ref_col_or_attr=regular_id ')' IS tableview_name
| REF '(' ref_col_or_attr=regular_id ')' WITH ROWID
| (CONSTRAINT constraint_name)? FOREIGN KEY '(' ( ','? ref_col_or_attr=regular_id)+ ')' references_clause constraint_state?
;
out_of_line_constraint
: ( (CONSTRAINT constraint_name)?
( UNIQUE '(' column_name (',' column_name)* ')'
| PRIMARY KEY '(' column_name (',' column_name)* ')'
| foreign_key_clause
| CHECK '(' expression ')'
)
)
constraint_state?
;
constraint_state
: ( NOT? DEFERRABLE
| INITIALLY (IMMEDIATE|DEFERRED)
| (RELY|NORELY)
| (ENABLE|DISABLE)
| (VALIDATE|NOVALIDATE)
| using_index_clause
)+
;
alter_tablespace
: ALTER TABLESPACE tablespace
( DEFAULT table_compression? storage_clause?
| MINIMUM EXTENT size_clause
| RESIZE size_clause
| COALESCE
| SHRINK SPACE_KEYWORD (KEEP size_clause)?
| RENAME TO new_tablespace_name
| begin_or_end BACKUP
| datafile_tempfile_clauses
| tablespace_logging_clauses
| tablespace_group_clause
| tablespace_state_clauses
| autoextend_clause
| flashback_mode_clause
| tablespace_retention_clause
)
';'
;
datafile_tempfile_clauses
: ADD (datafile_specification | tempfile_specification)
| DROP (DATAFILE | TEMPFILE) (filename | UNSIGNED_INTEGER) (KEEP size_clause)?
| SHRINK TEMPFILE (filename | UNSIGNED_INTEGER) (KEEP size_clause)?
| RENAME DATAFILE filename (',' filename)* TO filename (',' filename)*
| (DATAFILE | TEMPFILE) (online_or_offline)
;
tablespace_logging_clauses
: logging_clause
| NO? FORCE LOGGING
;
tablespace_group_clause
: TABLESPACE GROUP (tablespace_group_name | CHAR_STRING)
;
tablespace_group_name
: regular_id
;
tablespace_state_clauses
: ONLINE
| OFFLINE (NORMAL | TEMPORARY | IMMEDIATE)?
| READ (ONLY | WRITE)
| PERMANENT
| TEMPORARY
;
flashback_mode_clause
: FLASHBACK (ON | OFF)
;
new_tablespace_name
: tablespace
;
create_tablespace
: CREATE (BIGFILE | SMALLFILE)?
( permanent_tablespace_clause
| temporary_tablespace_clause
| undo_tablespace_clause
)
';'
;
permanent_tablespace_clause
: TABLESPACE id_expression datafile_specification?
( MINIMUM EXTENT size_clause
| BLOCKSIZE size_clause
| logging_clause
| FORCE LOGGING
| (ONLINE | OFFLINE)
| ENCRYPTION tablespace_encryption_spec
| DEFAULT //TODO table_compression? storage_clause?
| extent_management_clause
| segment_management_clause
| flashback_mode_clause
)*
;
tablespace_encryption_spec
: USING encrypt_algorithm=CHAR_STRING
;
logging_clause
: LOGGING
| NOLOGGING
| FILESYSTEM_LIKE_LOGGING
;
extent_management_clause
: EXTENT MANAGEMENT LOCAL
( AUTOALLOCATE
| UNIFORM (SIZE size_clause)?
)?
;
segment_management_clause
: SEGMENT SPACE_KEYWORD MANAGEMENT (AUTO | MANUAL)
;
temporary_tablespace_clause
: TEMPORARY TABLESPACE tablespace_name=id_expression
tempfile_specification?
tablespace_group_clause? extent_management_clause?
;
undo_tablespace_clause
: UNDO TABLESPACE tablespace_name=id_expression
datafile_specification?
extent_management_clause? tablespace_retention_clause?
;
tablespace_retention_clause
: RETENTION (GUARANTEE | NOGUARANTEE)
;
// asm_filename is just a charater string. Would need to parse the string
// to find diskgroup...
datafile_specification
: DATAFILE
(','? datafile_tempfile_spec)
;
tempfile_specification
: TEMPFILE
(','? datafile_tempfile_spec)
;
datafile_tempfile_spec
: (CHAR_STRING)? (SIZE size_clause)? REUSE? autoextend_clause?
;
redo_log_file_spec
: (DATAFILE CHAR_STRING
| '(' ( ','? CHAR_STRING )+ ')'
)?
(SIZE size_clause)?
(BLOCKSIZE size_clause)?
REUSE?
;
autoextend_clause
: AUTOEXTEND (OFF | ON (NEXT size_clause)? maxsize_clause? )
;
maxsize_clause
: MAXSIZE (UNLIMITED | size_clause)
;
build_clause
: BUILD (IMMEDIATE | DEFERRED)
;
parallel_clause
: NOPARALLEL
| PARALLEL parallel_count=UNSIGNED_INTEGER?
;
alter_materialized_view
: ALTER MATERIALIZED VIEW tableview_name
( physical_attributes_clause
| modify_mv_column_clause
| table_compression
| lob_storage_clause (',' lob_storage_clause)*
| modify_lob_storage_clause (',' modify_lob_storage_clause)*
//TODO | alter_table_partitioning
| parallel_clause
| logging_clause
| allocate_extent_clause
| deallocate_unused_clause
| shrink_clause
| (cache_or_nocache)
)?
alter_iot_clauses?
(USING INDEX physical_attributes_clause)?
alter_mv_option1?
( enable_or_disable QUERY REWRITE
| COMPILE
| CONSIDER FRESH
)?
';'
;
alter_mv_option1
: alter_mv_refresh
//TODO | MODIFY scoped_table_ref_constraint
;
alter_mv_refresh
: REFRESH ( FAST
| COMPLETE
| FORCE
| ON (DEMAND | COMMIT)
| START WITH expression
| NEXT expression
| WITH PRIMARY KEY
| USING DEFAULT? MASTER ROLLBACK SEGMENT rollback_segment?
| USING (ENFORCED | TRUSTED) CONSTRAINTS
)+
;
rollback_segment
: regular_id
;
modify_mv_column_clause
: MODIFY '(' column_name (ENCRYPT encryption_spec | DECRYPT)? ')'
;
alter_materialized_view_log
: ALTER MATERIALIZED VIEW LOG FORCE? ON tableview_name
( physical_attributes_clause
| add_mv_log_column_clause
//TODO | alter_table_partitioning
| parallel_clause
| logging_clause
| allocate_extent_clause
| shrink_clause
| move_mv_log_clause
| cache_or_nocache
)?
mv_log_augmentation? mv_log_purge_clause?
';'
;
add_mv_log_column_clause
: ADD '(' column_name ')'
;
move_mv_log_clause
: MOVE segment_attributes_clause parallel_clause?
;
mv_log_augmentation
: ADD ( ( OBJECT ID
| PRIMARY KEY
| ROWID
| SEQUENCE
)
('(' column_name (',' column_name)* ')')?
| '(' column_name (',' column_name)* ')'
)
new_values_clause?
;
// Should bound this to just date/time expr
datetime_expr
: expression
;
// Should bound this to just interval expr
interval_expr
: expression
;
synchronous_or_asynchronous
: SYNCHRONOUS
| ASYNCHRONOUS
;
including_or_excluding
: INCLUDING
| EXCLUDING
;
create_materialized_view_log
: CREATE MATERIALIZED VIEW LOG ON tableview_name
( ( physical_attributes_clause
| TABLESPACE tablespace_name=id_expression
| logging_clause
| (CACHE | NOCACHE)
)+
)?
parallel_clause?
// table_partitioning_clauses TODO
( WITH
( ','?
( OBJECT ID
| PRIMARY KEY
| ROWID
| SEQUENCE
| COMMIT SCN
)
)*
('(' ( ','? regular_id )+ ')' new_values_clause? )?
mv_log_purge_clause?
)*
;
new_values_clause
: (INCLUDING | EXCLUDING ) NEW VALUES
;
mv_log_purge_clause
: PURGE
( IMMEDIATE (SYNCHRONOUS | ASYNCHRONOUS)?
// |START WITH CLAUSES TODO
)
;
create_materialized_view
: CREATE MATERIALIZED VIEW tableview_name
(OF type_name )?
//scoped_table_ref and column alias goes here TODO
( ON PREBUILT TABLE ( (WITH | WITHOUT) REDUCED PRECISION)?
| physical_properties? (CACHE | NOCACHE)? parallel_clause? build_clause?
)
( USING INDEX ( (physical_attributes_clause | TABLESPACE mv_tablespace=id_expression)+ )*
| USING NO INDEX
)?
create_mv_refresh?
(FOR UPDATE)?
( (DISABLE | ENABLE) QUERY REWRITE )?
AS select_only_statement
';'
;
create_mv_refresh
: ( NEVER REFRESH
| REFRESH
( (FAST | COMPLETE | FORCE)
| ON (DEMAND | COMMIT)
| (START WITH | NEXT) //date goes here TODO
| WITH (PRIMARY KEY | ROWID)
| USING
( DEFAULT (MASTER | LOCAL)? ROLLBACK SEGMENT
| (MASTER | LOCAL)? ROLLBACK SEGMENT rb_segment=REGULAR_ID
)
| USING (ENFORCED | TRUSTED) CONSTRAINTS
)+
)
;
create_context
: CREATE (OR REPLACE)? CONTEXT oracle_namespace USING (schema_object_name '.')? package_name
(INITIALIZED (EXTERNALLY | GLOBALLY)
| ACCESSED GLOBALLY
)?
';'
;
oracle_namespace
: id_expression
;
//https://docs.oracle.com/cd/E11882_01/server.112/e41084/statements_5001.htm#SQLRF01201
create_cluster
: CREATE CLUSTER cluster_name '(' column_name datatype SORT? (',' column_name datatype SORT?)* ')'
( physical_attributes_clause
| SIZE size_clause
| TABLESPACE tablespace
| INDEX
| (SINGLE TABLE)? HASHKEYS UNSIGNED_INTEGER (HASH IS expression)?
)*
parallel_clause? (ROWDEPENDENCIES | NOROWDEPENDENCIES)?
(CACHE | NOCACHE)?
';'
;
create_table
: CREATE (GLOBAL TEMPORARY)? TABLE tableview_name
(relational_table | object_table | xmltype_table) (AS select_only_statement)?
';'
;
xmltype_table
: OF XMLTYPE ('(' object_properties ')')?
(XMLTYPE xmltype_storage)? xmlschema_spec? xmltype_virtual_columns?
(ON COMMIT (DELETE | PRESERVE) ROWS)? oid_clause? oid_index_clause?
physical_properties? column_properties? table_partitioning_clauses?
(CACHE | NOCACHE)? (RESULT_CACHE '(' MODE (DEFAULT | FORCE) ')')?
parallel_clause? (ROWDEPENDENCIES | NOROWDEPENDENCIES)?
(enable_disable_clause+)? row_movement_clause?
flashback_archive_clause?
;
xmltype_virtual_columns
: VIRTUAL COLUMNS '(' column_name AS '(' expression ')' (',' column_name AS '(' expression ')')* ')'
;
xmltype_column_properties
: XMLTYPE COLUMN? column_name xmltype_storage? xmlschema_spec?
;
xmltype_storage
: STORE AS (OBJECT RELATIONAL
| (SECUREFILE | BASICFILE)? (CLOB | BINARY XML) (lob_segname ('(' lob_parameters ')')? | '(' lob_parameters ')')?
)
| STORE VARRAYS AS (LOBS | TABLES)
;
xmlschema_spec
: (XMLSCHEMA DELIMITED_ID)? ELEMENT DELIMITED_ID
(allow_or_disallow NONSCHEMA)?
(allow_or_disallow ANYSCHEMA)?
;
object_table
: OF type_name object_table_substitution?
('(' object_properties (',' object_properties)* ')')?
(ON COMMIT (DELETE | PRESERVE) ROWS)? oid_clause? oid_index_clause?
physical_properties? column_properties? table_partitioning_clauses?
(CACHE | NOCACHE)? (RESULT_CACHE '(' MODE (DEFAULT | FORCE) ')')?
parallel_clause? (ROWDEPENDENCIES | NOROWDEPENDENCIES)?
(enable_disable_clause+)? row_movement_clause? flashback_archive_clause?
;
oid_index_clause
: OIDINDEX index_name? '(' (physical_attributes_clause | TABLESPACE tablespace)+ ')'
;
oid_clause
: OBJECT IDENTIFIER IS (SYSTEM GENERATED | PRIMARY KEY)
;
object_properties
: (column_name | attribute_name) (DEFAULT expression)? (inline_constraint (',' inline_constraint)* | inline_ref_constraint)?
| out_of_line_constraint
| out_of_line_ref_constraint
| supplemental_logging_props
;
object_table_substitution
: NOT? SUBSTITUTABLE AT ALL LEVELS
;
relational_table
: ('(' relational_property (',' relational_property)* ')')?
(ON COMMIT (DELETE | PRESERVE) ROWS)?
physical_properties? column_properties? table_partitioning_clauses?
(CACHE | NOCACHE)? (RESULT_CACHE '(' MODE (DEFAULT | FORCE) ')')?
parallel_clause?
(ROWDEPENDENCIES | NOROWDEPENDENCIES)?
(enable_disable_clause+)? row_movement_clause? flashback_archive_clause?
;
relational_property
: (column_definition
| virtual_column_definition
| out_of_line_constraint
| out_of_line_ref_constraint
| supplemental_logging_props
)
;
table_partitioning_clauses
: range_partitions
| list_partitions
| hash_partitions
| composite_range_partitions
| composite_list_partitions
| composite_hash_partitions
| reference_partitioning
| system_partitioning
;
range_partitions
: PARTITION BY RANGE '(' column_name (',' column_name)* ')'
(INTERVAL '(' expression ')' (STORE IN '(' tablespace (',' tablespace)* ')' )? )?
'(' PARTITION partition_name? range_values_clause table_partition_description (',' PARTITION partition_name? range_values_clause table_partition_description)* ')'
;
list_partitions
: PARTITION BY LIST '(' column_name ')'
'(' PARTITION partition_name? list_values_clause table_partition_description (',' PARTITION partition_name? list_values_clause table_partition_description )* ')'
;
hash_partitions
: PARTITION BY HASH '(' column_name (',' column_name)* ')'
(individual_hash_partitions | hash_partitions_by_quantity)
;
individual_hash_partitions
: '(' PARTITION partition_name? partitioning_storage_clause? (',' PARTITION partition_name? partitioning_storage_clause?)* ')'
;
hash_partitions_by_quantity
: PARTITIONS hash_partition_quantity
(STORE IN '(' tablespace (',' tablespace)* ')')?
(table_compression | key_compression)?
(OVERFLOW STORE IN '(' tablespace (',' tablespace)* ')' )?
;
hash_partition_quantity
: UNSIGNED_INTEGER
;
composite_range_partitions
: PARTITION BY RANGE '(' column_name (',' column_name)* ')'
(INTERVAL '(' expression ')' (STORE IN '(' tablespace (',' tablespace)* ')' )? )?
(subpartition_by_range | subpartition_by_list | subpartition_by_hash)
'(' range_partition_desc (',' range_partition_desc)* ')'
;
composite_list_partitions
: PARTITION BY LIST '(' column_name ')'
(subpartition_by_range | subpartition_by_list | subpartition_by_hash)
'(' list_partition_desc (',' list_partition_desc)* ')'
;
composite_hash_partitions
: PARTITION BY HASH '(' (',' column_name)+ ')'
(subpartition_by_range | subpartition_by_list | subpartition_by_hash)
(individual_hash_partitions | hash_partitions_by_quantity)
;
reference_partitioning
: PARTITION BY REFERENCE '(' regular_id ')'
('(' reference_partition_desc (',' reference_partition_desc)* ')')?
;
reference_partition_desc
: PARTITION partition_name? table_partition_description
;
system_partitioning
: PARTITION BY SYSTEM
(PARTITIONS UNSIGNED_INTEGER | reference_partition_desc (',' reference_partition_desc)*)?
;
range_partition_desc
: PARTITION partition_name? range_values_clause table_partition_description
( ( '(' ( range_subpartition_desc (',' range_subpartition_desc)*
| list_subpartition_desc (',' list_subpartition_desc)*
| individual_hash_subparts (',' individual_hash_subparts)*
)
')'
| hash_subparts_by_quantity
)
)?
;
list_partition_desc
: PARTITION partition_name? list_values_clause table_partition_description
( ( '(' ( range_subpartition_desc (',' range_subpartition_desc)*
| list_subpartition_desc (',' list_subpartition_desc)*
| individual_hash_subparts (',' individual_hash_subparts)*
)
')'
| hash_subparts_by_quantity
)
)?
;
subpartition_template
: SUBPARTITION TEMPLATE
( ( '(' ( range_subpartition_desc (',' range_subpartition_desc)*
| list_subpartition_desc (',' list_subpartition_desc)*
| individual_hash_subparts (',' individual_hash_subparts)*
)
')'
| hash_subpartition_quantity
)
)
;
hash_subpartition_quantity
: UNSIGNED_INTEGER
;
subpartition_by_range
: SUBPARTITION BY RANGE '(' column_name (',' column_name)* ')' subpartition_template?
;
subpartition_by_list
: SUBPARTITION BY LIST '(' column_name ')' subpartition_template?
;
subpartition_by_hash
: SUBPARTITION BY HASH '(' column_name (',' column_name)* ')'
(SUBPARTITIONS UNSIGNED_INTEGER (STORE IN '(' tablespace (',' tablespace)* ')' )?
| subpartition_template
)?
;
subpartition_name
: partition_name
;
range_subpartition_desc
: SUBPARTITION subpartition_name? range_values_clause partitioning_storage_clause?
;
list_subpartition_desc
: SUBPARTITION subpartition_name? list_values_clause partitioning_storage_clause?
;
individual_hash_subparts
: SUBPARTITION subpartition_name? partitioning_storage_clause?
;
hash_subparts_by_quantity
: SUBPARTITIONS UNSIGNED_INTEGER (STORE IN '(' tablespace (',' tablespace)* ')' )?
;
range_values_clause
: VALUES LESS THAN '(' literal (',' literal)* ')'
;
list_values_clause
: VALUES '(' (literal (',' literal)* | DEFAULT) ')'
;
table_partition_description
: deferred_segment_creation? segment_attributes_clause?
(table_compression | key_compression)?
(OVERFLOW segment_attributes_clause? )?
(lob_storage_clause | varray_col_properties | nested_table_col_properties)?
;
partitioning_storage_clause
: ( TABLESPACE tablespace
| OVERFLOW (TABLESPACE tablespace)?
| table_compression
| key_compression
| lob_partitioning_storage
| VARRAY varray_item STORE AS (BASICFILE | SECUREFILE)? LOB lob_segname
)+
;
lob_partitioning_storage
: LOB '(' lob_item ')'
STORE AS (BASICFILE | SECUREFILE)?
(lob_segname ('(' TABLESPACE tablespace ')' )?
| '(' TABLESPACE tablespace ')'
)
;
datatype_null_enable
: column_name datatype
SORT? (DEFAULT expression)? (ENCRYPT ( USING CHAR_STRING )? (IDENTIFIED BY REGULAR_ID)? CHAR_STRING? ( NO? SALT )? )?
(NOT NULL_)? (ENABLE | DISABLE)?
;
//Technically, this should only allow 'K' | 'M' | 'G' | 'T' | 'P' | 'E'
// but having issues with examples/numbers01.sql line 11 "sysdate -1m"
size_clause
: UNSIGNED_INTEGER REGULAR_ID?
;
table_compression
: COMPRESS
( BASIC
| FOR ( OLTP
| (QUERY | ARCHIVE) (LOW | HIGH)?
)
)?
| NOCOMPRESS
;
physical_attributes_clause
: (PCTFREE pctfree=UNSIGNED_INTEGER
| PCTUSED pctused=UNSIGNED_INTEGER
| INITRANS inittrans=UNSIGNED_INTEGER
| storage_clause
)+
;
storage_clause
: STORAGE '('
(INITIAL initial_size=size_clause
| NEXT next_size=size_clause
| MINEXTENTS minextents=(UNSIGNED_INTEGER | UNLIMITED)
| MAXEXTENTS minextents=(UNSIGNED_INTEGER | UNLIMITED)
| PCTINCREASE pctincrease=UNSIGNED_INTEGER
| FREELISTS freelists=UNSIGNED_INTEGER
| FREELIST GROUPS freelist_groups=UNSIGNED_INTEGER
| OPTIMAL (size_clause | NULL_ )
| BUFFER_POOL (KEEP | RECYCLE | DEFAULT)
| FLASH_CACHE (KEEP | NONE | DEFAULT)
| ENCRYPT
)+
')'
;
deferred_segment_creation
: SEGMENT CREATION (IMMEDIATE | DEFERRED)
;
segment_attributes_clause
: ( physical_attributes_clause
| TABLESPACE tablespace_name=id_expression
| logging_clause
)+
;
physical_properties
: deferred_segment_creation? segment_attributes_clause table_compression?
;
row_movement_clause
: (ENABLE | DISABLE)? ROW MOVEMENT
;
flashback_archive_clause
: FLASHBACK ARCHIVE flashback_archive=REGULAR_ID
| NO FLASHBACK ARCHIVE
;
log_grp
: UNSIGNED_INTEGER
;
supplemental_table_logging
: ADD SUPPLEMENTAL LOG (supplemental_log_grp_clause | supplemental_id_key_clause)
(',' SUPPLEMENTAL LOG (supplemental_log_grp_clause | supplemental_id_key_clause) )*
| DROP SUPPLEMENTAL LOG (supplemental_id_key_clause | GROUP log_grp)
(',' SUPPLEMENTAL LOG (supplemental_id_key_clause | GROUP log_grp) )*
;
supplemental_log_grp_clause
: GROUP log_grp '(' regular_id (NO LOG)? (',' regular_id (NO LOG)?)* ')' ALWAYS?
;
supplemental_id_key_clause
: DATA '('( ','? ( ALL
| PRIMARY KEY
| UNIQUE
| FOREIGN KEY
)
)+
')'
COLUMNS
;
allocate_extent_clause
: ALLOCATE EXTENT
( '(' ( SIZE size_clause
| DATAFILE datafile=CHAR_STRING
| INSTANCE inst_num=UNSIGNED_INTEGER
)+
')'
)?
;
deallocate_unused_clause
: DEALLOCATE UNUSED (KEEP size_clause)?
;
shrink_clause
: SHRINK SPACE_KEYWORD COMPACT? CASCADE?
;
records_per_block_clause
: (MINIMIZE | NOMINIMIZE)? RECORDS_PER_BLOCK
;
upgrade_table_clause
: UPGRADE (NOT? INCLUDING DATA) column_properties
;
truncate_table
: TRUNCATE TABLE tableview_name PURGE? SEMICOLON
;
drop_table
: DROP TABLE tableview_name PURGE? SEMICOLON
;
drop_view
: DROP VIEW tableview_name (CASCADE CONSTRAINT)? SEMICOLON
;
comment_on_column
: COMMENT ON COLUMN column_name IS quoted_string
;
enable_or_disable
: ENABLE
| DISABLE
;
allow_or_disallow
: ALLOW
| DISALLOW
;
// Synonym DDL Clauses
create_synonym
// Synonym's schema cannot be specified for public synonyms
: CREATE (OR REPLACE)? PUBLIC SYNONYM synonym_name FOR (schema_name PERIOD)? schema_object_name (AT_SIGN link_name)?
| CREATE (OR REPLACE)? SYNONYM (schema_name PERIOD)? synonym_name FOR (schema_name PERIOD)? schema_object_name (AT_SIGN link_name)?
;
comment_on_table
: COMMENT ON TABLE tableview_name IS quoted_string
;
alter_cluster
: ALTER CLUSTER cluster_name
( physical_attributes_clause
| SIZE size_clause
| allocate_extent_clause
| deallocate_unused_clause
| cache_or_nocache
)+
parallel_clause?
';'
;
cache_or_nocache
: CACHE
| NOCACHE
;
database_name
: regular_id
;
alter_database
: ALTER DATABASE database_name?
( startup_clauses
| recovery_clauses
| database_file_clauses
| logfile_clauses
| controlfile_clauses
| standby_database_clauses
| default_settings_clause
| instance_clauses
| security_clause
)
';'
;
startup_clauses
: MOUNT ((STANDBY | CLONE) DATABASE)?
| OPEN (READ WRITE)? resetlogs_or_noresetlogs? upgrade_or_downgrade?
| OPEN READ ONLY
;
resetlogs_or_noresetlogs
: RESETLOGS
| NORESETLOGS
;
upgrade_or_downgrade
: UPGRADE
| DOWNGRADE
;
recovery_clauses
: general_recovery
| managed_standby_recovery
| begin_or_end BACKUP
;
begin_or_end
: BEGIN
| END
;
general_recovery
: RECOVER AUTOMATIC? (FROM CHAR_STRING)?
( (full_database_recovery | partial_database_recovery | LOGFILE CHAR_STRING )?
((TEST | ALLOW UNSIGNED_INTEGER CORRUPTION | parallel_clause)+ )?
| CONTINUE DEFAULT?
| CANCEL
)
;
//Need to come back to
full_database_recovery
: STANDBY? DATABASE
((UNTIL (CANCEL |TIME CHAR_STRING | CHANGE UNSIGNED_INTEGER | CONSISTENT)
| USING BACKUP CONTROLFILE
)+
)?
;
partial_database_recovery
: TABLESPACE tablespace (',' tablespace)*
| DATAFILE CHAR_STRING | filenumber (',' CHAR_STRING | filenumber)*
| partial_database_recovery_10g
;
partial_database_recovery_10g
: {isVersion10()}? STANDBY
( TABLESPACE tablespace (',' tablespace)*
| DATAFILE CHAR_STRING | filenumber (',' CHAR_STRING | filenumber)*
)
UNTIL (CONSISTENT WITH)? CONTROLFILE
;
managed_standby_recovery
: RECOVER (MANAGED STANDBY DATABASE
((USING CURRENT LOGFILE
| DISCONNECT (FROM SESSION)?
| NODELAY
| UNTIL CHANGE UNSIGNED_INTEGER
| UNTIL CONSISTENT
| parallel_clause
)+
| FINISH
| CANCEL
)?
| TO LOGICAL STANDBY (db_name | KEEP IDENTITY)
)
;
db_name
: regular_id
;
database_file_clauses
: RENAME FILE filename (',' filename)* TO filename
| create_datafile_clause
| alter_datafile_clause
| alter_tempfile_clause
;
create_datafile_clause
: CREATE DATAFILE (filename | filenumber) (',' (filename | filenumber) )*
(AS (//TODO (','? file_specification)+ |
NEW) )?
;
alter_datafile_clause
: DATAFILE (filename|filenumber) (',' (filename|filenumber) )*
( ONLINE
| OFFLINE (FOR DROP)?
| RESIZE size_clause
| autoextend_clause
| END BACKUP
)
;
alter_tempfile_clause
: TEMPFILE (filename | filenumber) (',' (filename | filenumber) )*
( RESIZE size_clause
| autoextend_clause
| DROP (INCLUDING DATAFILES)
| ONLINE
| OFFLINE
)
;
logfile_clauses
: (ARCHIVELOG MANUAL? | NOARCHIVELOG)
| NO? FORCE LOGGING
| RENAME FILE filename (',' filename)* TO filename
| CLEAR UNARCHIVED? LOGFILE logfile_descriptor (',' logfile_descriptor)* (UNRECOVERABLE DATAFILE)?
| add_logfile_clauses
| drop_logfile_clauses
| switch_logfile_clause
| supplemental_db_logging
;
add_logfile_clauses
: ADD STANDBY? LOGFILE
(
//TODO (INSTANCE CHAR_STRING | THREAD UNSIGNED_INTEGER)?
(log_file_group redo_log_file_spec)+
| MEMBER filename REUSE? (',' filename REUSE?)* TO logfile_descriptor (',' logfile_descriptor)*
)
;
log_file_group
:(','? (THREAD UNSIGNED_INTEGER)? GROUP UNSIGNED_INTEGER)
;
drop_logfile_clauses
: DROP STANDBY?
LOGFILE (logfile_descriptor (',' logfile_descriptor)*
| MEMBER filename (',' filename)*
)
;
switch_logfile_clause
: SWITCH ALL LOGFILES TO BLOCKSIZE UNSIGNED_INTEGER
;
supplemental_db_logging
: add_or_drop
SUPPLEMENTAL LOG (DATA
| supplemental_id_key_clause
| supplemental_plsql_clause
)
;
add_or_drop
: ADD
| DROP
;
supplemental_plsql_clause
: DATA FOR PROCEDURAL REPLICATION
;
logfile_descriptor
: GROUP UNSIGNED_INTEGER
| '(' filename (',' filename)* ')'
| filename
;
controlfile_clauses
: CREATE (LOGICAL | PHYSICAL)? STANDBY CONTROLFILE AS filename REUSE?
| BACKUP CONTROLFILE TO (filename REUSE? | trace_file_clause)
;
trace_file_clause
: TRACE (AS filename REUSE?)? (RESETLOGS|NORESETLOGS)?
;
standby_database_clauses
: ( activate_standby_db_clause
| maximize_standby_db_clause
| register_logfile_clause
| commit_switchover_clause
| start_standby_clause
| stop_standby_clause
| convert_database_clause
)
parallel_clause?
;
activate_standby_db_clause
: ACTIVATE (PHYSICAL | LOGICAL)? STANDBY DATABASE (FINISH APPLY)?
;
maximize_standby_db_clause
: SET STANDBY DATABASE TO MAXIMIZE (PROTECTION | AVAILABILITY | PERFORMANCE)
;
register_logfile_clause
: REGISTER (OR REPLACE)? (PHYSICAL | LOGICAL) LOGFILE //TODO (','? file_specification)+
//TODO (FOR logminer_session_name)?
;
commit_switchover_clause
: (PREPARE | COMMIT) TO SWITCHOVER
((TO (((PHYSICAL | LOGICAL)? PRIMARY | PHYSICAL? STANDBY)
((WITH | WITHOUT)? SESSION SHUTDOWN (WAIT | NOWAIT) )?
| LOGICAL STANDBY
)
| LOGICAL STANDBY
)
| CANCEL
)?
;
start_standby_clause
: START LOGICAL STANDBY APPLY IMMEDIATE? NODELAY?
( NEW PRIMARY regular_id
| INITIAL scn_value=UNSIGNED_INTEGER?
| SKIP_ FAILED TRANSACTION
| FINISH
)?
;
stop_standby_clause
: (STOP | ABORT) LOGICAL STANDBY APPLY
;
convert_database_clause
: CONVERT TO (PHYSICAL | SNAPSHOT) STANDBY
;
default_settings_clause
: DEFAULT EDITION EQUALS_OP edition_name
| SET DEFAULT (BIGFILE | SMALLFILE) TABLESPACE
| DEFAULT TABLESPACE tablespace
| DEFAULT TEMPORARY TABLESPACE (tablespace | tablespace_group_name)
| RENAME GLOBAL_NAME TO database ('.' domain)+
| ENABLE BLOCK CHANGE TRACKING (USING FILE filename REUSE?)?
| DISABLE BLOCK CHANGE TRACKING
| flashback_mode_clause
| set_time_zone_clause
;
set_time_zone_clause
: SET TIMEZONE EQUALS_OP CHAR_STRING
;
instance_clauses
: enable_or_disable INSTANCE CHAR_STRING
;
security_clause
: GUARD (ALL | STANDBY | NONE)
;
domain
: regular_id
;
database
: regular_id
;
edition_name
: regular_id
;
filenumber
: UNSIGNED_INTEGER
;
filename
: CHAR_STRING
;
alter_table
: ALTER TABLE tableview_name
(
| alter_table_properties
| constraint_clauses
| column_clauses
//TODO | alter_table_partitioning
//TODO | alter_external_table
| move_table_clause
)
((enable_disable_clause | enable_or_disable (TABLE LOCK | ALL TRIGGERS) )+)?
';'
;
alter_table_properties
: alter_table_properties_1
| RENAME TO tableview_name
| shrink_clause
| READ ONLY
| READ WRITE
| REKEY CHAR_STRING
;
alter_table_properties_1
: ( physical_attributes_clause
| logging_clause
| table_compression
| supplemental_table_logging
| allocate_extent_clause
| deallocate_unused_clause
| (CACHE | NOCACHE)
| RESULT_CACHE '(' MODE (DEFAULT | FORCE) ')'
| upgrade_table_clause
| records_per_block_clause
| parallel_clause
| row_movement_clause
| flashback_archive_clause
)+
alter_iot_clauses?
;
alter_iot_clauses
: index_org_table_clause
| alter_overflow_clause
| alter_mapping_table_clause
| COALESCE
;
alter_mapping_table_clause
: MAPPING TABLE (allocate_extent_clause | deallocate_unused_clause)
;
alter_overflow_clause
: add_overflow_clause
| OVERFLOW (segment_attributes_clause | allocate_extent_clause | shrink_clause | deallocate_unused_clause)+
;
add_overflow_clause
: ADD OVERFLOW segment_attributes_clause? ('(' PARTITION segment_attributes_clause? (',' PARTITION segment_attributes_clause?)* ')' )?
;
enable_disable_clause
: (ENABLE | DISABLE) (VALIDATE | NOVALIDATE)?
(UNIQUE '(' column_name (',' column_name)* ')'
| PRIMARY KEY
| CONSTRAINT constraint_name
) using_index_clause? exceptions_clause?
CASCADE? ((KEEP | DROP) INDEX)?
;
using_index_clause
: USING INDEX (index_name | '(' create_index ')' | index_attributes )?
;
index_attributes
: ( physical_attributes_clause
| logging_clause
| TABLESPACE (tablespace | DEFAULT)
| key_compression
| sort_or_nosort
| REVERSE
| visible_or_invisible
| parallel_clause
)+
;
sort_or_nosort
: SORT
| NOSORT
;
exceptions_clause
: EXCEPTIONS INTO tableview_name
;
move_table_clause
: MOVE ONLINE? segment_attributes_clause? table_compression? index_org_table_clause? ((lob_storage_clause | varray_col_properties)+)? parallel_clause?
;
index_org_table_clause
: (mapping_table_clause | PCTTHRESHOLD UNSIGNED_INTEGER | key_compression) index_org_overflow_clause?
;
mapping_table_clause
: MAPPING TABLE
| NOMAPPING
;
key_compression
: NOCOMPRESS
| COMPRESS UNSIGNED_INTEGER
;
index_org_overflow_clause
: (INCLUDING column_name)? OVERFLOW segment_attributes_clause?
;
column_clauses
: add_modify_drop_column_clauses
| rename_column_clause
| modify_collection_retrieval
| modify_lob_storage_clause
;
modify_collection_retrieval
: MODIFY NESTED TABLE collection_item RETURN AS (LOCATOR | VALUE)
;
collection_item
: tableview_name
;
rename_column_clause
: RENAME COLUMN old_column_name TO new_column_name
;
old_column_name
: column_name
;
new_column_name
: column_name
;
add_modify_drop_column_clauses
: (add_column_clause
|modify_column_clauses
|drop_column_clause
)+
;
drop_column_clause
: SET UNUSED (COLUMN column_name| ('(' column_name (',' column_name)* ')' )) (CASCADE CONSTRAINTS | INVALIDATE)*
| DROP (COLUMN column_name | '(' column_name (',' column_name)* ')' ) (CASCADE CONSTRAINTS | INVALIDATE)* (CHECKPOINT UNSIGNED_INTEGER)?
| DROP (UNUSED COLUMNS | COLUMNS CONTINUE) (CHECKPOINT UNSIGNED_INTEGER)
;
modify_column_clauses
: MODIFY ('(' modify_col_properties (',' modify_col_properties)* ')'
| modify_col_properties
| modify_col_substitutable
)
;
modify_col_properties
: column_name datatype? (DEFAULT expression)? (ENCRYPT encryption_spec | DECRYPT)? inline_constraint* lob_storage_clause? //TODO alter_xmlschema_clause
;
modify_col_substitutable
: COLUMN column_name NOT? SUBSTITUTABLE AT ALL LEVELS FORCE?
;
add_column_clause
: ADD ('(' (column_definition | virtual_column_definition) (',' (column_definition
| virtual_column_definition)
)*
')'
| ( column_definition | virtual_column_definition ))
column_properties?
//TODO (','? out_of_line_part_storage )
;
alter_varray_col_properties
: MODIFY VARRAY varray_item '(' modify_lob_parameters ')'
;
varray_col_properties
: VARRAY varray_item ( substitutable_column_clause? varray_storage_clause
| substitutable_column_clause
)
;
varray_storage_clause
: STORE AS (SECUREFILE|BASICFILE)? LOB ( lob_segname? '(' lob_storage_parameters ')'
| lob_segname
)
;
lob_segname
: regular_id
;
lob_item
: regular_id
;
lob_storage_parameters
: TABLESPACE tablespace | (lob_parameters storage_clause? )
| storage_clause
;
lob_storage_clause
: LOB ( '(' lob_item (',' lob_item)* ')' STORE AS ( (SECUREFILE|BASICFILE) | '(' lob_storage_parameters ')' )+
| '(' lob_item ')' STORE AS ( (SECUREFILE | BASICFILE) | lob_segname | '(' lob_storage_parameters ')' )+
)
;
modify_lob_storage_clause
: MODIFY LOB '(' lob_item ')' '(' modify_lob_parameters ')'
;
modify_lob_parameters
: ( storage_clause
| (PCTVERSION | FREEPOOLS) UNSIGNED_INTEGER
| REBUILD FREEPOOLS
| lob_retention_clause
| lob_deduplicate_clause
| lob_compression_clause
| ENCRYPT encryption_spec
| DECRYPT
| CACHE
| (CACHE | NOCACHE | CACHE READS) logging_clause?
| allocate_extent_clause
| shrink_clause
| deallocate_unused_clause
)+
;
lob_parameters
: ( (ENABLE | DISABLE) STORAGE IN ROW
| CHUNK UNSIGNED_INTEGER
| PCTVERSION UNSIGNED_INTEGER
| FREEPOOLS UNSIGNED_INTEGER
| lob_retention_clause
| lob_deduplicate_clause
| lob_compression_clause
| ENCRYPT encryption_spec
| DECRYPT
| (CACHE | NOCACHE | CACHE READS) logging_clause?
)+
;
lob_deduplicate_clause
: DEDUPLICATE
| KEEP_DUPLICATES
;
lob_compression_clause
: NOCOMPRESS
| COMPRESS (HIGH | MEDIUM | LOW)?
;
lob_retention_clause
: RETENTION (MAX | MIN UNSIGNED_INTEGER | AUTO | NONE)?
;
encryption_spec
: (USING CHAR_STRING)? (IDENTIFIED BY REGULAR_ID)? CHAR_STRING? (NO? SALT)?
;
tablespace
: regular_id
;
varray_item
: (id_expression '.')? (id_expression '.')? id_expression
;
column_properties
: object_type_col_properties
| nested_table_col_properties
| (varray_col_properties | lob_storage_clause) //TODO '(' ( ','? lob_partition_storage)+ ')'
| xmltype_column_properties
;
period_definition
: {isVersion12()}? PERIOD FOR column_name
( '(' start_time_column ',' end_time_column ')' )?
;
start_time_column
: column_name
;
end_time_column
: column_name
;
column_definition
: column_name (datatype | type_name)
SORT? (DEFAULT expression)? (ENCRYPT (USING CHAR_STRING)? (IDENTIFIED BY regular_id)? CHAR_STRING? (NO? SALT)? )? (inline_constraint* | inline_ref_constraint)
;
virtual_column_definition
: column_name datatype? autogenerated_sequence_definition?
VIRTUAL? inline_constraint*
;
autogenerated_sequence_definition
: GENERATED (ALWAYS | BY DEFAULT (ON NULL_)?)? AS IDENTITY ( '(' (sequence_start_clause | sequence_spec)* ')' )?
;
out_of_line_part_storage
: PARTITION partition_name
;
nested_table_col_properties
: NESTED TABLE (nested_item | COLUMN_VALUE) substitutable_column_clause? (LOCAL | GLOBAL)?
STORE AS tableview_name ( '(' ( '(' object_properties ')'
| physical_properties
| column_properties
)+
')'
)?
(RETURN AS? (LOCATOR | VALUE) )?
;
nested_item
: regular_id
;
substitutable_column_clause
: ELEMENT? IS OF TYPE? '(' type_name ')'
| NOT? SUBSTITUTABLE AT ALL LEVELS
;
partition_name
: regular_id
;
supplemental_logging_props
: SUPPLEMENTAL LOG (supplemental_log_grp_clause | supplemental_id_key_clause)
;
column_or_attribute
: regular_id
;
object_type_col_properties
: COLUMN column=regular_id substitutable_column_clause
;
constraint_clauses
: ADD '(' (out_of_line_constraint* | out_of_line_ref_constraint) ')'
| ADD (out_of_line_constraint* | out_of_line_ref_constraint)
| MODIFY (CONSTRAINT constraint_name | PRIMARY KEY | UNIQUE '(' column_name (',' column_name)* ')') constraint_state CASCADE?
| RENAME CONSTRAINT old_constraint_name TO new_constraint_name
| drop_constraint_clause+
;
old_constraint_name
: constraint_name
;
new_constraint_name
: constraint_name
;
drop_constraint_clause
: DROP drop_primary_key_or_unique_or_generic_clause
;
drop_primary_key_or_unique_or_generic_clause
: (PRIMARY KEY | UNIQUE '(' column_name (',' column_name)* ')') CASCADE? (KEEP | DROP)?
| CONSTRAINT constraint_name CASCADE?
;
add_constraint
: ADD (CONSTRAINT constraint_name)? add_constraint_clause (',' (CONSTRAINT constraint_name)? add_constraint_clause)+
;
add_constraint_clause
: primary_key_clause
| foreign_key_clause
| unique_key_clause
| check_constraint
;
check_constraint
: CHECK '(' condition ')' DISABLE?
;
drop_constraint
: DROP CONSTRAINT constraint_name
;
enable_constraint
: ENABLE CONSTRAINT constraint_name
;
disable_constraint
: DISABLE CONSTRAINT constraint_name
;
foreign_key_clause
: FOREIGN KEY paren_column_list references_clause on_delete_clause?
;
references_clause
: REFERENCES tableview_name paren_column_list
;
on_delete_clause
: ON DELETE (CASCADE | SET NULL_)
;
unique_key_clause
: UNIQUE paren_column_list using_index_clause?
;
primary_key_clause
: PRIMARY KEY paren_column_list using_index_clause?
;
// Anonymous PL/SQL code block
anonymous_block
: (DECLARE seq_of_declare_specs)? BEGIN seq_of_statements (EXCEPTION exception_handler+)? END SEMICOLON
;
// Common DDL Clauses
invoker_rights_clause
: AUTHID (CURRENT_USER | DEFINER)
;
call_spec
: LANGUAGE (java_spec | c_spec)
;
// Call Spec Specific Clauses
java_spec
: JAVA NAME CHAR_STRING
;
c_spec
: C_LETTER (NAME CHAR_STRING)? LIBRARY identifier c_agent_in_clause? (WITH CONTEXT)? c_parameters_clause?
;
c_agent_in_clause
: AGENT IN '(' expressions ')'
;
c_parameters_clause
: PARAMETERS '(' (expressions | '.' '.' '.') ')'
;
parameter
: parameter_name (IN | OUT | INOUT | NOCOPY)* type_spec? default_value_part?
;
default_value_part
: (ASSIGN_OP | DEFAULT) expression
;
// Elements Declarations
seq_of_declare_specs
: declare_spec+
;
declare_spec
: pragma_declaration
| exception_declaration
| variable_declaration
| subtype_declaration
| cursor_declaration
| type_declaration
| procedure_spec
| function_spec
| procedure_body
| function_body
;
// incorporates constant_declaration
variable_declaration
: identifier CONSTANT? type_spec (NOT NULL_)? default_value_part? ';'
;
subtype_declaration
: SUBTYPE identifier IS type_spec (RANGE expression '..' expression)? (NOT NULL_)? ';'
;
// cursor_declaration incorportates curscursor_body and cursor_spec
cursor_declaration
: CURSOR identifier ('(' parameter_spec (',' parameter_spec)* ')' )? (RETURN type_spec)? (IS select_statement)? ';'
;
parameter_spec
: parameter_name (IN? type_spec)? default_value_part?
;
exception_declaration
: identifier EXCEPTION ';'
;
pragma_declaration
: PRAGMA (SERIALLY_REUSABLE
| AUTONOMOUS_TRANSACTION
| EXCEPTION_INIT '(' exception_name ',' numeric_negative ')'
| INLINE '(' id1=identifier ',' expression ')'
| RESTRICT_REFERENCES '(' (identifier | DEFAULT) (',' identifier)+ ')') ';'
;
// Record Declaration Specific Clauses
// incorporates ref_cursor_type_definition
record_type_def
: RECORD '(' field_spec (',' field_spec)* ')'
;
field_spec
: column_name type_spec? (NOT NULL_)? default_value_part?
;
ref_cursor_type_def
: REF CURSOR (RETURN type_spec)?
;
type_declaration
: TYPE identifier IS (table_type_def | varray_type_def | record_type_def | ref_cursor_type_def) ';'
;
table_type_def
: TABLE OF type_spec table_indexed_by_part? (NOT NULL_)?
;
table_indexed_by_part
: (idx1=INDEXED | idx2=INDEX) BY type_spec
;
varray_type_def
: (VARRAY | VARYING ARRAY) '(' expression ')' OF type_spec (NOT NULL_)?
;
// Statements
seq_of_statements
: (statement (';' | EOF) | label_declaration)+
;
label_declaration
: ltp1= '<' '<' label_name '>' '>'
;
statement
: body
| block
| assignment_statement
| continue_statement
| exit_statement
| goto_statement
| if_statement
| loop_statement
| forall_statement
| null_statement
| raise_statement
| return_statement
| case_statement
| sql_statement
| function_call
| pipe_row_statement
| procedure_call
;
swallow_to_semi
: ~';'+
;
assignment_statement
: (general_element | bind_variable) ASSIGN_OP expression
;
continue_statement
: CONTINUE label_name? (WHEN condition)?
;
exit_statement
: EXIT label_name? (WHEN condition)?
;
goto_statement
: GOTO label_name
;
if_statement
: IF condition THEN seq_of_statements elsif_part* else_part? END IF
;
elsif_part
: ELSIF condition THEN seq_of_statements
;
else_part
: ELSE seq_of_statements
;
loop_statement
: label_declaration? (WHILE condition | FOR cursor_loop_param)? LOOP seq_of_statements END LOOP label_name?
;
// Loop Specific Clause
cursor_loop_param
: index_name IN REVERSE? lower_bound range_separator='..' upper_bound
| record_name IN (cursor_name ('(' expressions? ')')? | '(' select_statement ')')
;
forall_statement
: FORALL index_name IN bounds_clause sql_statement (SAVE EXCEPTIONS)?
;
bounds_clause
: lower_bound '..' upper_bound
| INDICES OF collection_name between_bound?
| VALUES OF index_name
;
between_bound
: BETWEEN lower_bound AND upper_bound
;
lower_bound
: concatenation
;
upper_bound
: concatenation
;
null_statement
: NULL_
;
raise_statement
: RAISE exception_name?
;
return_statement
: RETURN expression?
;
function_call
: CALL? routine_name function_argument?
;
procedure_call
: routine_name function_argument?
;
pipe_row_statement
: PIPE ROW '(' expression ')';
body
: BEGIN seq_of_statements (EXCEPTION exception_handler+)? END label_name?
;
// Body Specific Clause
exception_handler
: WHEN exception_name (OR exception_name)* THEN seq_of_statements
;
trigger_block
: (DECLARE declare_spec*)? body
;
block
: DECLARE? declare_spec+ body
;
// SQL Statements
sql_statement
: execute_immediate
| data_manipulation_language_statements
| cursor_manipulation_statements
| transaction_control_statements
;
execute_immediate
: EXECUTE IMMEDIATE expression (into_clause using_clause? | using_clause dynamic_returning_clause? | dynamic_returning_clause)?
;
// Execute Immediate Specific Clause
dynamic_returning_clause
: (RETURNING | RETURN) into_clause
;
// DML Statements
data_manipulation_language_statements
: merge_statement
| lock_table_statement
| select_statement
| update_statement
| delete_statement
| insert_statement
| explain_statement
;
// Cursor Manipulation Statements
cursor_manipulation_statements
: close_statement
| open_statement
| fetch_statement
| open_for_statement
;
close_statement
: CLOSE cursor_name
;
open_statement
: OPEN cursor_name ('(' expressions? ')')?
;
fetch_statement
: FETCH cursor_name (it1=INTO variable_name (',' variable_name)* | BULK COLLECT INTO variable_name (',' variable_name)* (LIMIT (numeric | variable_name))?)
;
open_for_statement
: OPEN variable_name FOR (select_statement | expression) using_clause?
;
// Transaction Control SQL Statements
transaction_control_statements
: set_transaction_command
| set_constraint_command
| commit_statement
| rollback_statement
| savepoint_statement
;
set_transaction_command
: SET TRANSACTION
(READ (ONLY | WRITE) | ISOLATION LEVEL (SERIALIZABLE | READ COMMITTED) | USE ROLLBACK SEGMENT rollback_segment_name)?
(NAME quoted_string)?
;
set_constraint_command
: SET (CONSTRAINT | CONSTRAINTS) (ALL | constraint_name (',' constraint_name)*) (IMMEDIATE | DEFERRED)
;
commit_statement
: COMMIT WORK?
(COMMENT expression | FORCE (CORRUPT_XID expression | CORRUPT_XID_ALL | expression (',' expression)?))?
write_clause?
;
write_clause
: WRITE (WAIT | NOWAIT)? (IMMEDIATE | BATCH)?
;
rollback_statement
: ROLLBACK WORK? (TO SAVEPOINT? savepoint_name | FORCE quoted_string)?
;
savepoint_statement
: SAVEPOINT savepoint_name
;
// Dml
/* TODO
//SHOULD BE OVERRIDEN!
compilation_unit
: seq_of_statements* EOF
;
//SHOULD BE OVERRIDEN!
seq_of_statements
: select_statement
| update_statement
| delete_statement
| insert_statement
| lock_table_statement
| merge_statement
| explain_statement
// | case_statement[true]
;
*/
explain_statement
: EXPLAIN PLAN (SET STATEMENT_ID '=' quoted_string)? (INTO tableview_name)?
FOR (select_statement | update_statement | delete_statement | insert_statement | merge_statement)
;
select_only_statement
: subquery_factoring_clause? subquery
;
select_statement
: select_only_statement (for_update_clause | order_by_clause | offset_clause | fetch_clause)*
;
// Select Specific Clauses
subquery_factoring_clause
: WITH factoring_element (',' factoring_element)*
;
factoring_element
: query_name paren_column_list? AS '(' subquery order_by_clause? ')'
search_clause? cycle_clause?
;
search_clause
: SEARCH (DEPTH | BREADTH) FIRST BY column_name ASC? DESC? (NULLS FIRST)? (NULLS LAST)?
(',' column_name ASC? DESC? (NULLS FIRST)? (NULLS LAST)?)* SET column_name
;
cycle_clause
: CYCLE column_list SET column_name TO expression DEFAULT expression
;
subquery
: subquery_basic_elements subquery_operation_part*
;
subquery_basic_elements
: query_block
| '(' subquery ')'
;
subquery_operation_part
: (UNION ALL? | INTERSECT | MINUS) subquery_basic_elements
;
query_block
: SELECT (DISTINCT | UNIQUE | ALL)? selected_list
into_clause? from_clause where_clause? hierarchical_query_clause? group_by_clause? model_clause? order_by_clause? fetch_clause?
;
selected_list
: '*'
| select_list_elements (',' select_list_elements)*
;
from_clause
: FROM table_ref_list
;
select_list_elements
: tableview_name '.' ASTERISK
| expression column_alias?
;
table_ref_list
: table_ref (',' table_ref)*
;
// NOTE to PIVOT clause
// according the SQL reference this should not be possible
// according to he reality it is. Here we probably apply pivot/unpivot onto whole join clause
// eventhough it is not enclosed in parenthesis. See pivot examples 09,10,11
table_ref
: table_ref_aux join_clause* (pivot_clause | unpivot_clause)?
;
table_ref_aux
: table_ref_aux_internal flashback_query_clause* (/*{isTableAlias()}?*/ table_alias)?
;
table_ref_aux_internal
: dml_table_expression_clause (pivot_clause | unpivot_clause)? # table_ref_aux_internal_one
| '(' table_ref subquery_operation_part* ')' (pivot_clause | unpivot_clause)? # table_ref_aux_internal_two
| ONLY '(' dml_table_expression_clause ')' # table_ref_aux_internal_three
;
join_clause
: query_partition_clause? (CROSS | NATURAL)? (INNER | outer_join_type)?
JOIN table_ref_aux query_partition_clause? (join_on_part | join_using_part)*
;
join_on_part
: ON condition
;
join_using_part
: USING paren_column_list
;
outer_join_type
: (FULL | LEFT | RIGHT) OUTER?
;
query_partition_clause
: PARTITION BY (('(' (subquery | expressions)? ')') | expressions)
;
flashback_query_clause
: VERSIONS BETWEEN (SCN | TIMESTAMP) expression
| AS OF (SCN | TIMESTAMP | SNAPSHOT) expression
;
pivot_clause
: PIVOT XML? '(' pivot_element (',' pivot_element)* pivot_for_clause pivot_in_clause ')'
;
pivot_element
: aggregate_function_name '(' expression ')' column_alias?
;
pivot_for_clause
: FOR (column_name | paren_column_list)
;
pivot_in_clause
: IN '(' (subquery | ANY (',' ANY)* | pivot_in_clause_element (',' pivot_in_clause_element)*) ')'
;
pivot_in_clause_element
: pivot_in_clause_elements column_alias?
;
pivot_in_clause_elements
: expression
| '(' expressions? ')'
;
unpivot_clause
: UNPIVOT ((INCLUDE | EXCLUDE) NULLS)?
'(' (column_name | paren_column_list) pivot_for_clause unpivot_in_clause ')'
;
unpivot_in_clause
: IN '(' unpivot_in_elements (',' unpivot_in_elements)* ')'
;
unpivot_in_elements
: (column_name | paren_column_list)
(AS (constant | '(' constant (',' constant)* ')'))?
;
hierarchical_query_clause
: CONNECT BY NOCYCLE? condition start_part?
| start_part CONNECT BY NOCYCLE? condition
;
start_part
: START WITH condition
;
group_by_clause
: GROUP BY group_by_elements (',' group_by_elements)* having_clause?
| having_clause (GROUP BY group_by_elements (',' group_by_elements)*)?
;
group_by_elements
: grouping_sets_clause
| rollup_cube_clause
| expression
;
rollup_cube_clause
: (ROLLUP | CUBE) '(' grouping_sets_elements (',' grouping_sets_elements)* ')'
;
grouping_sets_clause
: GROUPING SETS '(' grouping_sets_elements (',' grouping_sets_elements)* ')'
;
grouping_sets_elements
: rollup_cube_clause
| '(' expressions? ')'
| expression
;
having_clause
: HAVING condition
;
model_clause
: MODEL cell_reference_options* return_rows_clause? reference_model* main_model
;
cell_reference_options
: (IGNORE | KEEP) NAV
| UNIQUE (DIMENSION | SINGLE REFERENCE)
;
return_rows_clause
: RETURN (UPDATED | ALL) ROWS
;
reference_model
: REFERENCE reference_model_name ON '(' subquery ')' model_column_clauses cell_reference_options*
;
main_model
: (MAIN main_model_name)? model_column_clauses cell_reference_options* model_rules_clause
;
model_column_clauses
: model_column_partition_part? DIMENSION BY model_column_list MEASURES model_column_list
;
model_column_partition_part
: PARTITION BY model_column_list
;
model_column_list
: '(' model_column (',' model_column)* ')'
;
model_column
: (expression | query_block) column_alias?
;
model_rules_clause
: model_rules_part? '(' (model_rules_element (',' model_rules_element)*)? ')'
;
model_rules_part
: RULES (UPDATE | UPSERT ALL?)? ((AUTOMATIC | SEQUENTIAL) ORDER)? model_iterate_clause?
;
model_rules_element
: (UPDATE | UPSERT ALL?)? cell_assignment order_by_clause? '=' expression
;
cell_assignment
: model_expression
;
model_iterate_clause
: ITERATE '(' expression ')' until_part?
;
until_part
: UNTIL '(' condition ')'
;
order_by_clause
: ORDER SIBLINGS? BY order_by_elements (',' order_by_elements)*
;
order_by_elements
: expression (ASC | DESC)? (NULLS (FIRST | LAST))?
;
offset_clause
: OFFSET expression (ROW | ROWS)
;
fetch_clause
: FETCH (FIRST | NEXT) (expression PERCENT_KEYWORD?)? (ROW | ROWS) (ONLY | WITH TIES)
;
for_update_clause
: FOR UPDATE for_update_of_part? for_update_options?
;
for_update_of_part
: OF column_list
;
for_update_options
: SKIP_ LOCKED
| NOWAIT
| WAIT expression
;
update_statement
: UPDATE general_table_ref update_set_clause where_clause? static_returning_clause? error_logging_clause?
;
// Update Specific Clauses
update_set_clause
: SET
(column_based_update_set_clause (',' column_based_update_set_clause)* | VALUE '(' identifier ')' '=' expression)
;
column_based_update_set_clause
: column_name '=' expression
| paren_column_list '=' subquery
;
delete_statement
: DELETE FROM? general_table_ref where_clause? static_returning_clause? error_logging_clause?
;
insert_statement
: INSERT (single_table_insert | multi_table_insert)
;
// Insert Specific Clauses
single_table_insert
: insert_into_clause (values_clause static_returning_clause? | select_statement) error_logging_clause?
;
multi_table_insert
: (ALL multi_table_element+ | conditional_insert_clause) select_statement
;
multi_table_element
: insert_into_clause values_clause? error_logging_clause?
;
conditional_insert_clause
: (ALL | FIRST)? conditional_insert_when_part+ conditional_insert_else_part?
;
conditional_insert_when_part
: WHEN condition THEN multi_table_element+
;
conditional_insert_else_part
: ELSE multi_table_element+
;
insert_into_clause
: INTO general_table_ref paren_column_list?
;
values_clause
: VALUES (REGULAR_ID | '(' expressions ')')
;
merge_statement
: MERGE INTO tableview_name table_alias? USING selected_tableview ON '(' condition ')'
(merge_update_clause merge_insert_clause? | merge_insert_clause merge_update_clause?)?
error_logging_clause?
;
// Merge Specific Clauses
merge_update_clause
: WHEN MATCHED THEN UPDATE SET merge_element (',' merge_element)* where_clause? merge_update_delete_part?
;
merge_element
: column_name '=' expression
;
merge_update_delete_part
: DELETE where_clause
;
merge_insert_clause
: WHEN NOT MATCHED THEN INSERT paren_column_list?
values_clause where_clause?
;
selected_tableview
: (tableview_name | '(' select_statement ')') table_alias?
;
lock_table_statement
: LOCK TABLE lock_table_element (',' lock_table_element)* IN lock_mode MODE wait_nowait_part?
;
wait_nowait_part
: WAIT expression
| NOWAIT
;
// Lock Specific Clauses
lock_table_element
: tableview_name partition_extension_clause?
;
lock_mode
: ROW SHARE
| ROW EXCLUSIVE
| SHARE UPDATE?
| SHARE ROW EXCLUSIVE
| EXCLUSIVE
;
// Common DDL Clauses
general_table_ref
: (dml_table_expression_clause | ONLY '(' dml_table_expression_clause ')') table_alias?
;
static_returning_clause
: (RETURNING | RETURN) expressions into_clause
;
error_logging_clause
: LOG ERRORS error_logging_into_part? expression? error_logging_reject_part?
;
error_logging_into_part
: INTO tableview_name
;
error_logging_reject_part
: REJECT LIMIT (UNLIMITED | expression)
;
dml_table_expression_clause
: table_collection_expression
| '(' select_statement subquery_restriction_clause? ')'
| tableview_name sample_clause?
;
table_collection_expression
: (TABLE | THE) ('(' subquery ')' | '(' expression ')' outer_join_sign?)
;
subquery_restriction_clause
: WITH (READ ONLY | CHECK OPTION (CONSTRAINT constraint_name)?)
;
sample_clause
: SAMPLE BLOCK? '(' expression (',' expression)? ')' seed_part?
;
seed_part
: SEED '(' expression ')'
;
// Expression & Condition
condition
: expression
;
expressions
: expression (',' expression)*
;
expression
: cursor_expression
| logical_expression
;
cursor_expression
: CURSOR '(' subquery ')'
;
logical_expression
: unary_logical_expression
| logical_expression AND logical_expression
| logical_expression OR logical_expression
;
unary_logical_expression
: NOT? multiset_expression (IS NOT? logical_operation)*
;
logical_operation:
(NULL_
| NAN | PRESENT
| INFINITE | A_LETTER SET | EMPTY
| OF TYPE? '(' ONLY? type_spec (',' type_spec)* ')')
;
multiset_expression
: relational_expression (multiset_type=(MEMBER | SUBMULTISET) OF? concatenation)?
;
relational_expression
: relational_expression relational_operator relational_expression
| compound_expression
;
compound_expression
: concatenation
(NOT? ( IN in_elements
| BETWEEN between_elements
| like_type=(LIKE | LIKEC | LIKE2 | LIKE4) concatenation (ESCAPE concatenation)?))?
;
relational_operator
: '='
| (NOT_EQUAL_OP | '<' '>' | '!' '=' | '^' '=')
| ('<' | '>') '='?
;
in_elements
: '(' subquery ')'
| '(' concatenation (',' concatenation)* ')'
| constant
| bind_variable
| general_element
;
between_elements
: concatenation AND concatenation
;
concatenation
: model_expression
(AT (LOCAL | TIME ZONE concatenation) | interval_expression)?
(ON OVERFLOW (TRUNCATE | ERROR))?
| concatenation op=(ASTERISK | SOLIDUS) concatenation
| concatenation op=(PLUS_SIGN | MINUS_SIGN) concatenation
| concatenation BAR BAR concatenation
;
interval_expression
: DAY ('(' concatenation ')')? TO SECOND ('(' concatenation ')')?
| YEAR ('(' concatenation ')')? TO MONTH
;
model_expression
: unary_expression ('[' model_expression_element ']')?
;
model_expression_element
: (ANY | expression) (',' (ANY | expression))*
| single_column_for_loop (',' single_column_for_loop)*
| multi_column_for_loop
;
single_column_for_loop
: FOR column_name
( IN '(' expressions? ')'
| (LIKE expression)? FROM fromExpr=expression TO toExpr=expression
action_type=(INCREMENT | DECREMENT) action_expr=expression)
;
multi_column_for_loop
: FOR paren_column_list
IN '(' (subquery | '(' expressions? ')') ')'
;
unary_expression
: ('-' | '+') unary_expression
| PRIOR unary_expression
| CONNECT_BY_ROOT unary_expression
| /*TODO {input.LT(1).getText().equalsIgnoreCase("new") && !input.LT(2).getText().equals(".")}?*/ NEW unary_expression
| DISTINCT unary_expression
| ALL unary_expression
| /*TODO{(input.LA(1) == CASE || input.LA(2) == CASE)}?*/ case_statement/*[false]*/
| quantified_expression
| standard_function
| atom
;
case_statement /*TODO [boolean isStatementParameter]
TODO scope {
boolean isStatement;
}
@init {$case_statement::isStatement = $isStatementParameter;}*/
: searched_case_statement
| simple_case_statement
;
// CASE
simple_case_statement
: label_name? ck1=CASE expression simple_case_when_part+ case_else_part? END CASE? label_name?
;
simple_case_when_part
: WHEN expression THEN (/*TODO{$case_statement::isStatement}?*/ seq_of_statements | expression)
;
searched_case_statement
: label_name? ck1=CASE searched_case_when_part+ case_else_part? END CASE? label_name?
;
searched_case_when_part
: WHEN expression THEN (/*TODO{$case_statement::isStatement}?*/ seq_of_statements | expression)
;
case_else_part
: ELSE (/*{$case_statement::isStatement}?*/ seq_of_statements | expression)
;
atom
: table_element outer_join_sign
| bind_variable
| constant
| general_element
| '(' subquery ')' subquery_operation_part*
| '(' expressions ')'
;
quantified_expression
: (SOME | EXISTS | ALL | ANY) ('(' select_only_statement ')' | '(' expression ')')
;
string_function
: SUBSTR '(' expression ',' expression (',' expression)? ')'
| TO_CHAR '(' (table_element | standard_function | expression)
(',' quoted_string)? (',' quoted_string)? ')'
| DECODE '(' expressions ')'
| CHR '(' concatenation USING NCHAR_CS ')'
| NVL '(' expression ',' expression ')'
| TRIM '(' ((LEADING | TRAILING | BOTH)? quoted_string? FROM)? concatenation ')'
| TO_DATE '(' (table_element | standard_function | expression) (',' quoted_string)? ')'
;
standard_function
: string_function
| numeric_function_wrapper
| other_function
;
literal
: CHAR_STRING
| string_function
| numeric
| MAXVALUE
;
numeric_function_wrapper
: numeric_function (single_column_for_loop | multi_column_for_loop)?
;
numeric_function
: SUM '(' (DISTINCT | ALL)? expression ')'
| COUNT '(' ( ASTERISK | ((DISTINCT | UNIQUE | ALL)? concatenation)? ) ')' over_clause?
| ROUND '(' expression (',' UNSIGNED_INTEGER)? ')'
| AVG '(' (DISTINCT | ALL)? expression ')'
| MAX '(' (DISTINCT | ALL)? expression ')'
| LEAST '(' expressions ')'
| GREATEST '(' expressions ')'
;
other_function
: over_clause_keyword function_argument_analytic over_clause?
| /*TODO stantard_function_enabling_using*/ regular_id function_argument_modeling using_clause?
| COUNT '(' ( ASTERISK | (DISTINCT | UNIQUE | ALL)? concatenation) ')' over_clause?
| (CAST | XMLCAST) '(' (MULTISET '(' subquery ')' | concatenation) AS type_spec ')'
| COALESCE '(' table_element (',' (numeric | quoted_string))? ')'
| COLLECT '(' (DISTINCT | UNIQUE)? concatenation collect_order_by_part? ')'
| within_or_over_clause_keyword function_argument within_or_over_part+
| cursor_name ( PERCENT_ISOPEN | PERCENT_FOUND | PERCENT_NOTFOUND | PERCENT_ROWCOUNT )
| DECOMPOSE '(' concatenation (CANONICAL | COMPATIBILITY)? ')'
| EXTRACT '(' regular_id FROM concatenation ')'
| (FIRST_VALUE | LAST_VALUE) function_argument_analytic respect_or_ignore_nulls? over_clause
| standard_prediction_function_keyword
'(' expressions cost_matrix_clause? using_clause? ')'
| TRANSLATE '(' expression (USING (CHAR_CS | NCHAR_CS))? (',' expression)* ')'
| TREAT '(' expression AS REF? type_spec ')'
| TRIM '(' ((LEADING | TRAILING | BOTH)? quoted_string? FROM)? concatenation ')'
| XMLAGG '(' expression order_by_clause? ')' ('.' general_element_part)?
| (XMLCOLATTVAL | XMLFOREST)
'(' xml_multiuse_expression_element (',' xml_multiuse_expression_element)* ')' ('.' general_element_part)?
| XMLELEMENT
'(' (ENTITYESCAPING | NOENTITYESCAPING)? (NAME | EVALNAME)? expression
(/*TODO{input.LT(2).getText().equalsIgnoreCase("xmlattributes")}?*/ ',' xml_attributes_clause)?
(',' expression column_alias?)* ')' ('.' general_element_part)?
| XMLEXISTS '(' expression xml_passing_clause? ')'
| XMLPARSE '(' (DOCUMENT | CONTENT) concatenation WELLFORMED? ')' ('.' general_element_part)?
| XMLPI
'(' (NAME identifier | EVALNAME concatenation) (',' concatenation)? ')' ('.' general_element_part)?
| XMLQUERY
'(' concatenation xml_passing_clause? RETURNING CONTENT (NULL_ ON EMPTY)? ')' ('.' general_element_part)?
| XMLROOT
'(' concatenation (',' xmlroot_param_version_part)? (',' xmlroot_param_standalone_part)? ')' ('.' general_element_part)?
| XMLSERIALIZE
'(' (DOCUMENT | CONTENT) concatenation (AS type_spec)?
xmlserialize_param_enconding_part? xmlserialize_param_version_part? xmlserialize_param_ident_part? ((HIDE | SHOW) DEFAULTS)? ')'
('.' general_element_part)?
| xmltable
;
over_clause_keyword
: AVG
| CORR
| LAG
| LEAD
| MAX
| MEDIAN
| MIN
| NTILE
| RATIO_TO_REPORT
| ROW_NUMBER
| SUM
| VARIANCE
| REGR_
| STDDEV
| VAR_
| COVAR_
;
within_or_over_clause_keyword
: CUME_DIST
| DENSE_RANK
| LISTAGG
| PERCENT_RANK
| PERCENTILE_CONT
| PERCENTILE_DISC
| RANK
;
standard_prediction_function_keyword
: PREDICTION
| PREDICTION_BOUNDS
| PREDICTION_COST
| PREDICTION_DETAILS
| PREDICTION_PROBABILITY
| PREDICTION_SET
;
over_clause
: OVER '(' query_partition_clause? (order_by_clause windowing_clause?)? ')'
;
windowing_clause
: windowing_type
(BETWEEN windowing_elements AND windowing_elements | windowing_elements)
;
windowing_type
: ROWS
| RANGE
;
windowing_elements
: UNBOUNDED PRECEDING
| CURRENT ROW
| concatenation (PRECEDING | FOLLOWING)
;
using_clause
: USING (ASTERISK | using_element (',' using_element)*)
;
using_element
: (IN OUT? | OUT)? select_list_elements
;
collect_order_by_part
: ORDER BY concatenation
;
within_or_over_part
: WITHIN GROUP '(' order_by_clause ')'
| over_clause
;
cost_matrix_clause
: COST (MODEL AUTO? | '(' cost_class_name (',' cost_class_name)* ')' VALUES '(' expressions? ')')
;
xml_passing_clause
: PASSING (BY VALUE)? expression column_alias? (',' expression column_alias?)*
;
xml_attributes_clause
: XMLATTRIBUTES
'(' (ENTITYESCAPING | NOENTITYESCAPING)? (SCHEMACHECK | NOSCHEMACHECK)?
xml_multiuse_expression_element (',' xml_multiuse_expression_element)* ')'
;
xml_namespaces_clause
: XMLNAMESPACES
'(' (concatenation column_alias)? (',' concatenation column_alias)* xml_general_default_part? ')'
;
xml_table_column
: xml_column_name
(FOR ORDINALITY | type_spec (PATH concatenation)? xml_general_default_part?)
;
xml_general_default_part
: DEFAULT concatenation
;
xml_multiuse_expression_element
: expression (AS (id_expression | EVALNAME concatenation))?
;
xmlroot_param_version_part
: VERSION (NO VALUE | expression)
;
xmlroot_param_standalone_part
: STANDALONE (YES | NO VALUE?)
;
xmlserialize_param_enconding_part
: ENCODING concatenation
;
xmlserialize_param_version_part
: VERSION concatenation
;
xmlserialize_param_ident_part
: NO INDENT
| INDENT (SIZE '=' concatenation)?
;
// SqlPlus
sql_plus_command
: '/'
| EXIT
| PROMPT_MESSAGE
| SHOW (ERR | ERRORS)
| START_CMD
| whenever_command
| set_command
;
whenever_command
: WHENEVER (SQLERROR | OSERROR)
( EXIT (SUCCESS | FAILURE | WARNING | variable_name) (COMMIT | ROLLBACK)
| CONTINUE (COMMIT | ROLLBACK | NONE))
;
set_command
: SET regular_id (CHAR_STRING | ON | OFF | /*EXACT_NUM_LIT*/numeric | regular_id)
;
// Common
partition_extension_clause
: (SUBPARTITION | PARTITION) FOR? '(' expressions? ')'
;
column_alias
: AS? (identifier | quoted_string)
| AS
;
table_alias
: identifier
| quoted_string
;
where_clause
: WHERE (CURRENT OF cursor_name | expression)
;
into_clause
: (BULK COLLECT)? INTO (general_element | bind_variable) (',' (general_element | bind_variable))*
;
// Common Named Elements
xml_column_name
: identifier
| quoted_string
;
cost_class_name
: identifier
;
attribute_name
: identifier
;
savepoint_name
: identifier
;
rollback_segment_name
: identifier
;
table_var_name
: identifier
;
schema_name
: identifier
;
routine_name
: identifier ('.' id_expression)* ('@' link_name)?
;
package_name
: identifier
;
implementation_type_name
: identifier ('.' id_expression)?
;
parameter_name
: identifier
;
reference_model_name
: identifier
;
main_model_name
: identifier
;
container_tableview_name
: identifier ('.' id_expression)?
;
aggregate_function_name
: identifier ('.' id_expression)*
;
query_name
: identifier
;
grantee_name
: id_expression identified_by?
;
role_name
: id_expression
| CONNECT
;
constraint_name
: identifier ('.' id_expression)* ('@' link_name)?
;
label_name
: id_expression
;
type_name
: id_expression ('.' id_expression)*
;
sequence_name
: id_expression ('.' id_expression)*
;
exception_name
: identifier ('.' id_expression)*
;
function_name
: identifier ('.' id_expression)?
;
procedure_name
: identifier ('.' id_expression)?
;
trigger_name
: identifier ('.' id_expression)?
;
variable_name
: (INTRODUCER char_set_name)? id_expression ('.' id_expression)?
| bind_variable
;
index_name
: identifier ('.' id_expression)?
;
cursor_name
: general_element
| bind_variable
;
record_name
: identifier
| bind_variable
;
collection_name
: identifier ('.' id_expression)?
;
link_name
: identifier
;
column_name
: identifier ('.' id_expression)*
;
tableview_name
: identifier ('.' id_expression)?
(AT_SIGN link_name (PERIOD link_name)? | /*TODO{!(input.LA(2) == BY)}?*/ partition_extension_clause)?
| xmltable outer_join_sign?
;
xmltable
: XMLTABLE '(' (xml_namespaces_clause ',')? concatenation xml_passing_clause? (COLUMNS xml_table_column (',' xml_table_column)*)? ')' ('.' general_element_part)?
;
char_set_name
: id_expression ('.' id_expression)*
;
synonym_name
: identifier
;
// Represents a valid DB object name in DDL commands which are valid for several DB (or schema) objects.
// For instance, create synonym ... for <DB object name>, or rename <old DB object name> to <new DB object name>.
// Both are valid for sequences, tables, views, etc.
schema_object_name
: id_expression
;
dir_object_name
: id_expression
;
user_object_name
: id_expression
;
grant_object_name
: tableview_name
| USER user_object_name (',' user_object_name)*
| DIRECTORY dir_object_name
| EDITION schema_object_name
| MINING MODEL schema_object_name
| JAVA (SOURCE | RESOURCE) schema_object_name
| SQL TRANSLATION PROFILE schema_object_name
;
column_list
: column_name (',' column_name)*
;
paren_column_list
: LEFT_PAREN column_list RIGHT_PAREN
;
// PL/SQL Specs
// NOTE: In reality this applies to aggregate functions only
keep_clause
: KEEP '(' DENSE_RANK (FIRST | LAST) order_by_clause ')' over_clause?
;
function_argument
: '(' (argument (',' argument)*)? ')' keep_clause?
;
function_argument_analytic
: '(' (argument respect_or_ignore_nulls? (',' argument respect_or_ignore_nulls?)*)? ')' keep_clause?
;
function_argument_modeling
: '(' column_name (',' (numeric | NULL_) (',' (numeric | NULL_))?)?
USING (tableview_name '.' ASTERISK | ASTERISK | expression column_alias? (',' expression column_alias?)*)
')' keep_clause?
;
respect_or_ignore_nulls
: (RESPECT | IGNORE) NULLS
;
argument
: (identifier '=' '>')? expression
;
type_spec
: datatype
| REF? type_name (PERCENT_ROWTYPE | PERCENT_TYPE)?
;
datatype
: native_datatype_element precision_part? (WITH LOCAL? TIME ZONE | CHARACTER SET char_set_name)?
| INTERVAL (YEAR | DAY) ('(' expression ')')? TO (MONTH | SECOND) ('(' expression ')')?
;
precision_part
: '(' (numeric | ASTERISK) (',' (numeric | numeric_negative))? (CHAR | BYTE)? ')'
;
native_datatype_element
: BINARY_INTEGER
| PLS_INTEGER
| NATURAL
| BINARY_FLOAT
| BINARY_DOUBLE
| NATURALN
| POSITIVE
| POSITIVEN
| SIGNTYPE
| SIMPLE_INTEGER
| NVARCHAR2
| DEC
| INTEGER
| INT
| NUMERIC
| SMALLINT
| NUMBER
| DECIMAL
| DOUBLE PRECISION?
| FLOAT
| REAL
| NCHAR
| LONG RAW?
| CHAR
| CHARACTER
| VARCHAR2
| VARCHAR
| STRING
| RAW
| BOOLEAN
| DATE
| ROWID
| UROWID
| YEAR
| MONTH
| DAY
| HOUR
| MINUTE
| SECOND
| TIMEZONE_HOUR
| TIMEZONE_MINUTE
| TIMEZONE_REGION
| TIMEZONE_ABBR
| TIMESTAMP
| TIMESTAMP_UNCONSTRAINED
| TIMESTAMP_TZ_UNCONSTRAINED
| TIMESTAMP_LTZ_UNCONSTRAINED
| YMINTERVAL_UNCONSTRAINED
| DSINTERVAL_UNCONSTRAINED
| BFILE
| BLOB
| CLOB
| NCLOB
| MLSLABEL
;
bind_variable
: (BINDVAR | ':' UNSIGNED_INTEGER)
// Pro*C/C++ indicator variables
(INDICATOR? (BINDVAR | ':' UNSIGNED_INTEGER))?
('.' general_element_part)*
;
general_element
: general_element_part ('.' general_element_part)*
;
general_element_part
: (INTRODUCER char_set_name)? id_expression ('.' id_expression)* ('@' link_name)? function_argument?
;
table_element
: (INTRODUCER char_set_name)? id_expression ('.' id_expression)*
;
object_privilege
: ALL PRIVILEGES?
| ALTER
| DEBUG
| DELETE
| EXECUTE
| FLASHBACK ARCHIVE
| INDEX
| INHERIT PRIVILEGES
| INSERT
| KEEP SEQUENCE
| MERGE VIEW
| ON COMMIT REFRESH
| QUERY REWRITE
| READ
| REFERENCES
| SELECT
| TRANSLATE SQL
| UNDER
| UPDATE
| USE
| WRITE
;
//Ordered by type rather than alphabetically
system_privilege
: ALL PRIVILEGES
| ADVISOR
| ADMINISTER ANY? SQL TUNING SET
| (ALTER | CREATE | DROP) ANY SQL PROFILE
| ADMINISTER SQL MANAGEMENT OBJECT
| CREATE ANY? CLUSTER
| (ALTER | DROP) ANY CLUSTER
| (CREATE | DROP) ANY CONTEXT
| EXEMPT REDACTION POLICY
| ALTER DATABASE
| (ALTER | CREATE) PUBLIC? DATABASE LINK
| DROP PUBLIC DATABASE LINK
| DEBUG CONNECT SESSION
| DEBUG ANY PROCEDURE
| ANALYZE ANY DICTIONARY
| CREATE ANY? DIMENSION
| (ALTER | DROP) ANY DIMENSION
| (CREATE | DROP) ANY DIRECTORY
| (CREATE | DROP) ANY EDITION
| FLASHBACK (ARCHIVE ADMINISTER | ANY TABLE)
| (ALTER | CREATE | DROP) ANY INDEX
| CREATE ANY? INDEXTYPE
| (ALTER | DROP | EXECUTE) ANY INDEXTYPE
| CREATE (ANY | EXTERNAL)? JOB
| EXECUTE ANY (CLASS | PROGRAM)
| MANAGE SCHEDULER
| ADMINISTER KEY MANAGEMENT
| CREATE ANY? LIBRARY
| (ALTER | DROP | EXECUTE) ANY LIBRARY
| LOGMINING
| CREATE ANY? MATERIALIZED VIEW
| (ALTER | DROP) ANY MATERIALIZED VIEW
| GLOBAL? QUERY REWRITE
| ON COMMIT REFRESH
| CREATE ANY? MINING MODEL
| (ALTER | DROP | SELECT | COMMENT) ANY MINING MODEL
| CREATE ANY? CUBE
| (ALTER | DROP | SELECT | UPDATE) ANY CUBE
| CREATE ANY? MEASURE FOLDER
| (DELETE | DROP | INSERT) ANY MEASURE FOLDER
| CREATE ANY? CUBE DIMENSION
| (ALTER | DELETE | DROP | INSERT | SELECT | UPDATE) ANY CUBE DIMENSION
| CREATE ANY? CUBE BUILD PROCESS
| (DROP | UPDATE) ANY CUBE BUILD PROCESS
| CREATE ANY? OPERATOR
| (ALTER | DROP | EXECUTE) ANY OPERATOR
| (CREATE | ALTER | DROP) ANY OUTLINE
| CREATE PLUGGABLE DATABASE
| SET CONTAINER
| CREATE ANY? PROCEDURE
| (ALTER | DROP | EXECUTE) ANY PROCEDURE
| (CREATE | ALTER | DROP ) PROFILE
| CREATE ROLE
| (ALTER | DROP | GRANT) ANY ROLE
| (CREATE | ALTER | DROP) ROLLBACK SEGMENT
| CREATE ANY? SEQUENCE
| (ALTER | DROP | SELECT) ANY SEQUENCE
| (ALTER | CREATE | RESTRICTED) SESSION
| ALTER RESOURCE COST
| CREATE ANY? SQL TRANSLATION PROFILE
| (ALTER | DROP | USE) ANY SQL TRANSLATION PROFILE
| TRANSLATE ANY SQL
| CREATE ANY? SYNONYM
| DROP ANY SYNONYM
| (CREATE | DROP) PUBLIC SYNONYM
| CREATE ANY? TABLE
| (ALTER | BACKUP | COMMENT | DELETE | DROP | INSERT | LOCK | READ | SELECT | UPDATE) ANY TABLE
| (CREATE | ALTER | DROP | MANAGE | UNLIMITED) TABLESPACE
| CREATE ANY? TRIGGER
| (ALTER | DROP) ANY TRIGGER
| ADMINISTER DATABASE TRIGGER
| CREATE ANY? TYPE
| (ALTER | DROP | EXECUTE | UNDER) ANY TYPE
| (CREATE | ALTER | DROP) USER
| CREATE ANY? VIEW
| (DROP | UNDER | MERGE) ANY VIEW
| (ANALYZE | AUDIT) ANY
| BECOME USER
| CHANGE NOTIFICATION
| EXEMPT ACCESS POLICY
| FORCE ANY? TRANSACTION
| GRANT ANY OBJECT? PRIVILEGE
| INHERIT ANY PRIVILEGES
| KEEP DATE TIME
| KEEP SYSGUID
| PURGE DBA_RECYCLEBIN
| RESUMABLE
| SELECT ANY (DICTIONARY | TRANSACTION)
| SYSBACKUP
| SYSDBA
| SYSDG
| SYSKM
| SYSOPER
;
// $>
// $<Lexer Mappings
constant
: TIMESTAMP (quoted_string | bind_variable) (AT TIME ZONE quoted_string)?
| INTERVAL (quoted_string | bind_variable | general_element_part)
(YEAR | MONTH | DAY | HOUR | MINUTE | SECOND)
('(' (UNSIGNED_INTEGER | bind_variable) (',' (UNSIGNED_INTEGER | bind_variable) )? ')')?
(TO ( DAY | HOUR | MINUTE | SECOND ('(' (UNSIGNED_INTEGER | bind_variable) ')')?))?
| numeric
| DATE quoted_string
| quoted_string
| NULL_
| TRUE
| FALSE
| DBTIMEZONE
| SESSIONTIMEZONE
| MINVALUE
| MAXVALUE
| DEFAULT
;
numeric
: UNSIGNED_INTEGER
| APPROXIMATE_NUM_LIT
;
numeric_negative
: MINUS_SIGN numeric
;
quoted_string
: variable_name
| CHAR_STRING
//| CHAR_STRING_PERL
| NATIONAL_CHAR_STRING_LIT
;
identifier
: (INTRODUCER char_set_name)? id_expression
;
id_expression
: regular_id
| DELIMITED_ID
;
outer_join_sign
: '(' '+' ')'
;
regular_id
: non_reserved_keywords_pre12c
| non_reserved_keywords_in_12c
| REGULAR_ID
| A_LETTER
| AGENT
| AGGREGATE
| ANALYZE
| AUTONOMOUS_TRANSACTION
| BATCH
| BINARY_INTEGER
| BOOLEAN
| C_LETTER
| CHAR
| CLUSTER
| CONSTRUCTOR
| CUSTOMDATUM
| DECIMAL
| DELETE
| DETERMINISTIC
| DSINTERVAL_UNCONSTRAINED
| ERR
| EXCEPTION
| EXCEPTION_INIT
| EXCEPTIONS
| EXISTS
| EXIT
| FLOAT
| FORALL
| INDICES
| INOUT
| INTEGER
| LANGUAGE
| LONG
| LOOP
| NUMBER
| ORADATA
| OSERROR
| OUT
| OVERRIDING
| PARALLEL_ENABLE
| PIPELINED
| PLS_INTEGER
| POSITIVE
| POSITIVEN
| PRAGMA
| RAISE
| RAW
| RECORD
| REF
| RENAME
| RESTRICT_REFERENCES
| RESULT
| SELF
| SERIALLY_REUSABLE
| SET
| SIGNTYPE
| SIMPLE_INTEGER
| SMALLINT
| SQLDATA
| SQLERROR
| SUBTYPE
| TIMESTAMP_LTZ_UNCONSTRAINED
| TIMESTAMP_TZ_UNCONSTRAINED
| TIMESTAMP_UNCONSTRAINED
| TRIGGER
| VARCHAR
| VARCHAR2
| VARIABLE
| WARNING
| WHILE
| XMLAGG
| YMINTERVAL_UNCONSTRAINED
| REGR_
| VAR_
| COVAR_
;
non_reserved_keywords_in_12c
: ACL
| ACTION
| ACTIONS
| ACTIVE
| ACTIVE_DATA
| ACTIVITY
| ADAPTIVE_PLAN
| ADVANCED
| AFD_DISKSTRING
| ANOMALY
| ANSI_REARCH
| APPLICATION
| APPROX_COUNT_DISTINCT
| ARCHIVAL
| ARCHIVED
| ASIS
| ASSIGN
| AUTO_LOGIN
| AUTO_REOPTIMIZE
| AVRO
| BACKGROUND
| BATCHSIZE
| BATCH_TABLE_ACCESS_BY_ROWID
| BEGINNING
| BEQUEATH
| BITMAP_AND
| BSON
| CACHING
| CALCULATED
| CALLBACK
| CAPACITY
| CDBDEFAULT
| CLASSIFIER
| CLEANUP
| CLIENT
| CLUSTER_DETAILS
| CLUSTER_DISTANCE
| CLUSTERING
| COMMON_DATA
| COMPONENT
| COMPONENTS
| CON_DBID_TO_ID
| CONDITION
| CONDITIONAL
| CON_GUID_TO_ID
| CON_ID
| CON_NAME_TO_ID
| CONTAINER_DATA
| CONTAINERS
| CON_UID_TO_ID
| COOKIE
| COPY
| CREATE_FILE_DEST
| CREDENTIAL
| CRITICAL
| CUBE_AJ
| CUBE_SJ
| DATAMOVEMENT
| DATAOBJ_TO_MAT_PARTITION
| DATAPUMP
| DATA_SECURITY_REWRITE_LIMIT
| DAYS
| DB_UNIQUE_NAME
| DECORRELATE
| DEFINE
| DELEGATE
| DELETE_ALL
| DESTROY
| DIMENSIONS
| DISABLE_ALL
| DISABLE_PARALLEL_DML
| DISCARD
| DISTRIBUTE
| DUPLICATE
| DV
| EDITIONABLE
| ELIM_GROUPBY
| EM
| ENABLE_ALL
| ENABLE_PARALLEL_DML
| EQUIPART
| EVAL
| EVALUATE
| EXISTING
| EXPRESS
| EXTRACTCLOBXML
| FACTOR
| FAILOVER
| FAILURE
| FAMILY
| FAR
| FASTSTART
| FEATURE_DETAILS
| FETCH
| FILE_NAME_CONVERT
| FIXED_VIEW_DATA
| FORMAT
| GATHER_OPTIMIZER_STATISTICS
| GET
| ILM
| INACTIVE
| INDEXING
| INHERIT
| INMEMORY
| INMEMORY_PRUNING
| INPLACE
| INTERLEAVED
| JSON
| JSON_ARRAY
| JSON_ARRAYAGG
| JSON_EQUAL
| JSON_EXISTS
| JSON_EXISTS2
| JSONGET
| JSON_OBJECT
| JSON_OBJECTAGG
| JSONPARSE
| JSON_QUERY
| JSON_SERIALIZE
| JSON_TABLE
| JSON_TEXTCONTAINS
| JSON_TEXTCONTAINS2
| JSON_VALUE
| KEYSTORE
| LABEL
| LAX
| LIFECYCLE
| LINEAR
| LOCKING
| LOGMINING
| MAP
| MATCH
| MATCHES
| MATCH_NUMBER
| MATCH_RECOGNIZE
| MAX_SHARED_TEMP_SIZE
| MEMCOMPRESS
| METADATA
| MODEL_NB
| MODEL_SV
| MODIFICATION
| MODULE
| MONTHS
| MULTIDIMENSIONAL
| NEG
| NO_ADAPTIVE_PLAN
| NO_ANSI_REARCH
| NO_AUTO_REOPTIMIZE
| NO_BATCH_TABLE_ACCESS_BY_ROWID
| NO_CLUSTERING
| NO_COMMON_DATA
| NOCOPY
| NO_DATA_SECURITY_REWRITE
| NO_DECORRELATE
| NO_ELIM_GROUPBY
| NO_GATHER_OPTIMIZER_STATISTICS
| NO_INMEMORY
| NO_INMEMORY_PRUNING
| NOKEEP
| NONEDITIONABLE
| NO_OBJECT_LINK
| NO_PARTIAL_JOIN
| NO_PARTIAL_ROLLUP_PUSHDOWN
| NOPARTITION
| NO_PQ_CONCURRENT_UNION
| NO_PQ_REPLICATE
| NO_PQ_SKEW
| NO_PX_FAULT_TOLERANCE
| NORELOCATE
| NOREPLAY
| NO_ROOT_SW_FOR_LOCAL
| NO_SQL_TRANSLATION
| NO_USE_CUBE
| NO_USE_VECTOR_AGGREGATION
| NO_VECTOR_TRANSFORM
| NO_VECTOR_TRANSFORM_DIMS
| NO_VECTOR_TRANSFORM_FACT
| NO_ZONEMAP
| OBJ_ID
| OFFSET
| OLS
| OMIT
| ONE
| ORA_CHECK_ACL
| ORA_CHECK_PRIVILEGE
| ORA_CLUSTERING
| ORA_INVOKING_USER
| ORA_INVOKING_USERID
| ORA_INVOKING_XS_USER
| ORA_INVOKING_XS_USER_GUID
| ORA_RAWCOMPARE
| ORA_RAWCONCAT
| ORA_WRITE_TIME
| PARTIAL
| PARTIAL_JOIN
| PARTIAL_ROLLUP_PUSHDOWN
| PAST
| PATCH
| PATH_PREFIX
| PATTERN
| PER
| PERIOD
| PERIOD_KEYWORD
| PERMUTE
| PLUGGABLE
| POOL_16K
| POOL_2K
| POOL_32K
| POOL_4K
| POOL_8K
| PQ_CONCURRENT_UNION
| PQ_DISTRIBUTE_WINDOW
| PQ_FILTER
| PQ_REPLICATE
| PQ_SKEW
| PRELOAD
| PRETTY
| PREV
| PRINTBLOBTOCLOB
| PRIORITY
| PRIVILEGED
| PROXY
| PRUNING
| PX_FAULT_TOLERANCE
| REALM
| REDEFINE
| RELOCATE
| RESTART
| ROLESET
| ROWID_MAPPING_TABLE
| RUNNING
| SAVE
| SCRUB
| SDO_GEOM_MBR
| SECRET
| SERIAL
| SERVICE_NAME_CONVERT
| SERVICES
| SHARING
| SHELFLIFE
| SOURCE_FILE_DIRECTORY
| SOURCE_FILE_NAME_CONVERT
| SQL_TRANSLATION_PROFILE
| STANDARD_HASH
| STANDBYS
| STATE
| STATEMENT
| STREAM
| SUBSCRIBE
| SUBSET
| SUCCESS
| SYSBACKUP
| SYS_CHECK_PRIVILEGE
| SYSDG
| SYS_GET_COL_ACLIDS
| SYSGUID
| SYSKM
| SYS_MKXTI
| SYSOBJ
| SYS_OP_CYCLED_SEQ
| SYS_OP_HASH
| SYS_OP_KEY_VECTOR_CREATE
| SYS_OP_KEY_VECTOR_FILTER
| SYS_OP_KEY_VECTOR_FILTER_LIST
| SYS_OP_KEY_VECTOR_SUCCEEDED
| SYS_OP_KEY_VECTOR_USE
| SYS_OP_PART_ID
| SYS_OP_ZONE_ID
| SYS_RAW_TO_XSID
| SYS_XSID_TO_RAW
| SYS_ZMAP_FILTER
| SYS_ZMAP_REFRESH
| TAG
| TEXT
| TIER
| TIES
| TO_ACLID
| TRANSLATION
| TRUST
| UCS2
| UNCONDITIONAL
| UNMATCHED
| UNPLUG
| UNSUBSCRIBE
| USABLE
| USE_CUBE
| USE_HIDDEN_PARTITIONS
| USER_DATA
| USER_TABLESPACES
| USE_VECTOR_AGGREGATION
| USING_NO_EXPAND
| UTF16BE
| UTF16LE
| UTF32
| UTF8
| V1
| V2
| VALID_TIME_END
| VECTOR_TRANSFORM
| VECTOR_TRANSFORM_DIMS
| VECTOR_TRANSFORM_FACT
| VERIFIER
| VIOLATION
| VISIBILITY
| WEEK
| WEEKS
| WITH_PLSQL
| WRAPPER
| XS
| YEARS
| ZONEMAP
;
non_reserved_keywords_pre12c
: ABORT
| ABS
| ACCESSED
| ACCESS
| ACCOUNT
| ACOS
| ACTIVATE
| ACTIVE_COMPONENT
| ACTIVE_FUNCTION
| ACTIVE_TAG
| ADD_COLUMN
| ADD_GROUP
| ADD_MONTHS
| ADD
| ADJ_DATE
| ADMINISTER
| ADMINISTRATOR
| ADMIN
| ADVISE
| ADVISOR
| AFTER
| ALIAS
| ALLOCATE
| ALLOW
| ALL_ROWS
| ALWAYS
| ANALYZE
| ANCILLARY
| AND_EQUAL
| ANTIJOIN
| ANYSCHEMA
| APPENDCHILDXML
| APPEND
| APPEND_VALUES
| APPLY
| ARCHIVELOG
| ARCHIVE
| ARRAY
| ASCII
| ASCIISTR
| ASIN
| ASSEMBLY
| ASSOCIATE
| ASYNCHRONOUS
| ASYNC
| ATAN2
| ATAN
| AT
| ATTRIBUTE
| ATTRIBUTES
| AUTHENTICATED
| AUTHENTICATION
| AUTHID
| AUTHORIZATION
| AUTOALLOCATE
| AUTOEXTEND
| AUTOMATIC
| AUTO
| AVAILABILITY
| AVG
| BACKUP
| BASICFILE
| BASIC
| BATCH
| BECOME
| BEFORE
| BEGIN
| BEGIN_OUTLINE_DATA
| BEHALF
| BFILE
| BFILENAME
| BIGFILE
| BINARY_DOUBLE_INFINITY
| BINARY_DOUBLE
| BINARY_DOUBLE_NAN
| BINARY_FLOAT_INFINITY
| BINARY_FLOAT
| BINARY_FLOAT_NAN
| BINARY
| BIND_AWARE
| BINDING
| BIN_TO_NUM
| BITAND
| BITMAP
| BITMAPS
| BITMAP_TREE
| BITS
| BLOB
| BLOCK
| BLOCK_RANGE
| BLOCKSIZE
| BLOCKS
| BODY
| BOTH
| BOUND
| BRANCH
| BREADTH
| BROADCAST
| BUFFER_CACHE
| BUFFER
| BUFFER_POOL
| BUILD
| BULK
| BYPASS_RECURSIVE_CHECK
| BYPASS_UJVC
| BYTE
| CACHE_CB
| CACHE_INSTANCES
| CACHE
| CACHE_TEMP_TABLE
| CALL
| CANCEL
| CARDINALITY
| CASCADE
| CASE
| CAST
| CATEGORY
| CEIL
| CELL_FLASH_CACHE
| CERTIFICATE
| CFILE
| CHAINED
| CHANGE_DUPKEY_ERROR_INDEX
| CHANGE
| CHARACTER
| CHAR_CS
| CHARTOROWID
| CHECK_ACL_REWRITE
| CHECKPOINT
| CHILD
| CHOOSE
| CHR
| CHUNK
| CLASS
| CLEAR
| CLOB
| CLONE
| CLOSE_CACHED_OPEN_CURSORS
| CLOSE
| CLUSTER_BY_ROWID
| CLUSTER_ID
| CLUSTERING_FACTOR
| CLUSTER_PROBABILITY
| CLUSTER_SET
| COALESCE
| COALESCE_SQ
| COARSE
| CO_AUTH_IND
| COLD
| COLLECT
| COLUMNAR
| COLUMN_AUTH_INDICATOR
| COLUMN
| COLUMNS
| COLUMN_STATS
| COLUMN_VALUE
| COMMENT
| COMMIT
| COMMITTED
| COMPACT
| COMPATIBILITY
| COMPILE
| COMPLETE
| COMPLIANCE
| COMPOSE
| COMPOSITE_LIMIT
| COMPOSITE
| COMPOUND
| COMPUTE
| CONCAT
| CONFIRM
| CONFORMING
| CONNECT_BY_CB_WHR_ONLY
| CONNECT_BY_COMBINE_SW
| CONNECT_BY_COST_BASED
| CONNECT_BY_ELIM_DUPS
| CONNECT_BY_FILTERING
| CONNECT_BY_ISCYCLE
| CONNECT_BY_ISLEAF
| CONNECT_BY_ROOT
| CONNECT_TIME
| CONSIDER
| CONSISTENT
| CONSTANT
| CONST
| CONSTRAINT
| CONSTRAINTS
| CONTAINER
| CONTENT
| CONTENTS
| CONTEXT
| CONTINUE
| CONTROLFILE
| CONVERT
| CORR_K
| CORR
| CORR_S
| CORRUPTION
| CORRUPT_XID_ALL
| CORRUPT_XID
| COSH
| COS
| COST
| COST_XML_QUERY_REWRITE
| COUNT
| COVAR_POP
| COVAR_SAMP
| CPU_COSTING
| CPU_PER_CALL
| CPU_PER_SESSION
| CRASH
| CREATE_STORED_OUTLINES
| CREATION
| CROSSEDITION
| CROSS
| CSCONVERT
| CUBE_GB
| CUBE
| CUME_DISTM
| CUME_DIST
| CURRENT_DATE
| CURRENT
| CURRENT_SCHEMA
| CURRENT_TIME
| CURRENT_TIMESTAMP
| CURRENT_USER
| CURRENTV
| CURSOR
| CURSOR_SHARING_EXACT
| CURSOR_SPECIFIC_SEGMENT
| CV
| CYCLE
| DANGLING
| DATABASE
| DATAFILE
| DATAFILES
| DATA
| DATAOBJNO
| DATAOBJ_TO_PARTITION
| DATE_MODE
| DAY
| DBA
| DBA_RECYCLEBIN
| DBMS_STATS
| DB_ROLE_CHANGE
| DBTIMEZONE
| DB_VERSION
| DDL
| DEALLOCATE
| DEBUGGER
| DEBUG
| DECLARE
| DEC
| DECOMPOSE
| DECREMENT
| DECR
| DECRYPT
| DEDUPLICATE
| DEFAULTS
| DEFERRABLE
| DEFERRED
| DEFINED
| DEFINER
| DEGREE
| DELAY
| DELETEXML
| DEMAND
| DENSE_RANKM
| DENSE_RANK
| DEPENDENT
| DEPTH
| DEQUEUE
| DEREF
| DEREF_NO_REWRITE
| DETACHED
| DETERMINES
| DICTIONARY
| DIMENSION
| DIRECT_LOAD
| DIRECTORY
| DIRECT_PATH
| DISABLE
| DISABLE_PRESET
| DISABLE_RPKE
| DISALLOW
| DISASSOCIATE
| DISCONNECT
| DISKGROUP
| DISK
| DISKS
| DISMOUNT
| DISTINGUISHED
| DISTRIBUTED
| DML
| DML_UPDATE
| DOCFIDELITY
| DOCUMENT
| DOMAIN_INDEX_FILTER
| DOMAIN_INDEX_NO_SORT
| DOMAIN_INDEX_SORT
| DOUBLE
| DOWNGRADE
| DRIVING_SITE
| DROP_COLUMN
| DROP_GROUP
| DST_UPGRADE_INSERT_CONV
| DUMP
| DYNAMIC
| DYNAMIC_SAMPLING_EST_CDN
| DYNAMIC_SAMPLING
| EACH
| EDITIONING
| EDITION
| EDITIONS
| ELEMENT
| ELIMINATE_JOIN
| ELIMINATE_OBY
| ELIMINATE_OUTER_JOIN
| EMPTY_BLOB
| EMPTY_CLOB
| EMPTY
| ENABLE
| ENABLE_PRESET
| ENCODING
| ENCRYPTION
| ENCRYPT
| END_OUTLINE_DATA
| ENFORCED
| ENFORCE
| ENQUEUE
| ENTERPRISE
| ENTITYESCAPING
| ENTRY
| ERROR_ARGUMENT
| ERROR
| ERROR_ON_OVERLAP_TIME
| ERRORS
| ESCAPE
| ESTIMATE
| EVALNAME
| EVALUATION
| EVENTS
| EVERY
| EXCEPTIONS
| EXCEPT
| EXCHANGE
| EXCLUDE
| EXCLUDING
| EXECUTE
| EXEMPT
| EXISTSNODE
| EXPAND_GSET_TO_UNION
| EXPAND_TABLE
| EXPIRE
| EXPLAIN
| EXPLOSION
| EXP
| EXPORT
| EXPR_CORR_CHECK
| EXTENDS
| EXTENT
| EXTENTS
| EXTERNALLY
| EXTERNAL
| EXTRACT
| EXTRACTVALUE
| EXTRA
| FACILITY
| FACT
| FACTORIZE_JOIN
| FAILED_LOGIN_ATTEMPTS
| FAILED
| FAILGROUP
| FALSE
| FAST
| FBTSCAN
| FEATURE_ID
| FEATURE_SET
| FEATURE_VALUE
| FILE
| FILESYSTEM_LIKE_LOGGING
| FILTER
| FINAL
| FINE
| FINISH
| FIRSTM
| FIRST
| FIRST_ROWS
| FIRST_VALUE
| FLAGGER
| FLASHBACK
| FLASH_CACHE
| FLOB
| FLOOR
| FLUSH
| FOLDER
| FOLLOWING
| FOLLOWS
| FORCE
| FORCE_XML_QUERY_REWRITE
| FOREIGN
| FOREVER
| FORWARD
| FRAGMENT_NUMBER
| FREELIST
| FREELISTS
| FREEPOOLS
| FRESH
| FROM_TZ
| FULL
| FULL_OUTER_JOIN_TO_OUTER
| FUNCTION
| FUNCTIONS
| GATHER_PLAN_STATISTICS
| GBY_CONC_ROLLUP
| GBY_PUSHDOWN
| GENERATED
| GLOBALLY
| GLOBAL
| GLOBAL_NAME
| GLOBAL_TOPIC_ENABLED
| GREATEST
| GROUP_BY
| GROUP_ID
| GROUPING_ID
| GROUPING
| GROUPS
| GUARANTEED
| GUARANTEE
| GUARD
| HASH_AJ
| HASHKEYS
| HASH
| HASH_SJ
| HEADER
| HEAP
| HELP
| HEXTORAW
| HEXTOREF
| HIDDEN_KEYWORD
| HIDE
| HIERARCHY
| HIGH
| HINTSET_BEGIN
| HINTSET_END
| HOT
| HOUR
| HWM_BROKERED
| HYBRID
| IDENTIFIER
| IDENTITY
| IDGENERATORS
| IDLE_TIME
| ID
| IF
| IGNORE
| IGNORE_OPTIM_EMBEDDED_HINTS
| IGNORE_ROW_ON_DUPKEY_INDEX
| IGNORE_WHERE_CLAUSE
| IMMEDIATE
| IMPACT
| IMPORT
| INCLUDE
| INCLUDE_VERSION
| INCLUDING
| INCREMENTAL
| INCREMENT
| INCR
| INDENT
| INDEX_ASC
| INDEX_COMBINE
| INDEX_DESC
| INDEXED
| INDEXES
| INDEX_FFS
| INDEX_FILTER
| INDEX_JOIN
| INDEX_ROWS
| INDEX_RRS
| INDEX_RS_ASC
| INDEX_RS_DESC
| INDEX_RS
| INDEX_SCAN
| INDEX_SKIP_SCAN
| INDEX_SS_ASC
| INDEX_SS_DESC
| INDEX_SS
| INDEX_STATS
| INDEXTYPE
| INDEXTYPES
| INDICATOR
| INFINITE
| INFORMATIONAL
| INITCAP
| INITIALIZED
| INITIALLY
| INITIAL
| INITRANS
| INLINE
| INLINE_XMLTYPE_NT
| IN_MEMORY_METADATA
| INNER
| INSERTCHILDXMLAFTER
| INSERTCHILDXMLBEFORE
| INSERTCHILDXML
| INSERTXMLAFTER
| INSERTXMLBEFORE
| INSTANCE
| INSTANCES
| INSTANTIABLE
| INSTANTLY
| INSTEAD
| INSTR2
| INSTR4
| INSTRB
| INSTRC
| INSTR
| INTERMEDIATE
| INTERNAL_CONVERT
| INTERNAL_USE
| INTERPRETED
| INTERVAL
| INT
| INVALIDATE
| INVISIBLE
| IN_XQUERY
| ISOLATION_LEVEL
| ISOLATION
| ITERATE
| ITERATION_NUMBER
| JAVA
| JOB
| JOIN
| KEEP_DUPLICATES
| KEEP
| KERBEROS
| KEY_LENGTH
| KEY
| KEYSIZE
| KEYS
| KILL
| LAG
| LAST_DAY
| LAST
| LAST_VALUE
| LATERAL
| LAYER
| LDAP_REGISTRATION_ENABLED
| LDAP_REGISTRATION
| LDAP_REG_SYNC_INTERVAL
| LEADING
| LEAD
| LEAST
| LEFT
| LENGTH2
| LENGTH4
| LENGTHB
| LENGTHC
| LENGTH
| LESS
| LEVEL
| LEVELS
| LIBRARY
| LIFE
| LIFETIME
| LIKE2
| LIKE4
| LIKEC
| LIKE_EXPAND
| LIMIT
| LINK
| LISTAGG
| LIST
| LN
| LNNVL
| LOAD
| LOB
| LOBNVL
| LOBS
| LOCAL_INDEXES
| LOCAL
| LOCALTIME
| LOCALTIMESTAMP
| LOCATION
| LOCATOR
| LOCKED
| LOGFILE
| LOGFILES
| LOGGING
| LOGICAL
| LOGICAL_READS_PER_CALL
| LOGICAL_READS_PER_SESSION
| LOG
| LOGOFF
| LOGON
| LOG_READ_ONLY_VIOLATIONS
| LOWER
| LOW
| LPAD
| LTRIM
| MAIN
| MAKE_REF
| MANAGED
| MANAGEMENT
| MANAGE
| MANAGER
| MANUAL
| MAPPING
| MASTER
| MATCHED
| MATERIALIZED
| MATERIALIZE
| MAXARCHLOGS
| MAXDATAFILES
| MAXEXTENTS
| MAXIMIZE
| MAXINSTANCES
| MAXLOGFILES
| MAXLOGHISTORY
| MAXLOGMEMBERS
| MAX
| MAXSIZE
| MAXTRANS
| MAXVALUE
| MEASURE
| MEASURES
| MEDIAN
| MEDIUM
| MEMBER
| MEMORY
| MERGEACTIONS
| MERGE_AJ
| MERGE_CONST_ON
| MERGE
| MERGE_SJ
| METHOD
| MIGRATE
| MIGRATION
| MINEXTENTS
| MINIMIZE
| MINIMUM
| MINING
| MIN
| MINUS_NULL
| MINUTE
| MINVALUE
| MIRRORCOLD
| MIRRORHOT
| MIRROR
| MLSLABEL
| MODEL_COMPILE_SUBQUERY
| MODEL_DONTVERIFY_UNIQUENESS
| MODEL_DYNAMIC_SUBQUERY
| MODEL_MIN_ANALYSIS
| MODEL
| MODEL_NO_ANALYSIS
| MODEL_PBY
| MODEL_PUSH_REF
| MODIFY_COLUMN_TYPE
| MODIFY
| MOD
| MONITORING
| MONITOR
| MONTH
| MONTHS_BETWEEN
| MOUNT
| MOUNTPATH
| MOVEMENT
| MOVE
| MULTISET
| MV_MERGE
| NAMED
| NAME
| NAMESPACE
| NAN
| NANVL
| NATIONAL
| NATIVE_FULL_OUTER_JOIN
| NATIVE
| NATURAL
| NAV
| NCHAR_CS
| NCHAR
| NCHR
| NCLOB
| NEEDED
| NESTED
| NESTED_TABLE_FAST_INSERT
| NESTED_TABLE_GET_REFS
| NESTED_TABLE_ID
| NESTED_TABLE_SET_REFS
| NESTED_TABLE_SET_SETID
| NETWORK
| NEVER
| NEW
| NEW_TIME
| NEXT_DAY
| NEXT
| NL_AJ
| NLJ_BATCHING
| NLJ_INDEX_FILTER
| NLJ_INDEX_SCAN
| NLJ_PREFETCH
| NLS_CALENDAR
| NLS_CHARACTERSET
| NLS_CHARSET_DECL_LEN
| NLS_CHARSET_ID
| NLS_CHARSET_NAME
| NLS_COMP
| NLS_CURRENCY
| NLS_DATE_FORMAT
| NLS_DATE_LANGUAGE
| NLS_INITCAP
| NLS_ISO_CURRENCY
| NL_SJ
| NLS_LANG
| NLS_LANGUAGE
| NLS_LENGTH_SEMANTICS
| NLS_LOWER
| NLS_NCHAR_CONV_EXCP
| NLS_NUMERIC_CHARACTERS
| NLS_SORT
| NLSSORT
| NLS_SPECIAL_CHARS
| NLS_TERRITORY
| NLS_UPPER
| NO_ACCESS
| NOAPPEND
| NOARCHIVELOG
| NOAUDIT
| NO_BASETABLE_MULTIMV_REWRITE
| NO_BIND_AWARE
| NO_BUFFER
| NOCACHE
| NO_CARTESIAN
| NO_CHECK_ACL_REWRITE
| NO_CLUSTER_BY_ROWID
| NO_COALESCE_SQ
| NO_CONNECT_BY_CB_WHR_ONLY
| NO_CONNECT_BY_COMBINE_SW
| NO_CONNECT_BY_COST_BASED
| NO_CONNECT_BY_ELIM_DUPS
| NO_CONNECT_BY_FILTERING
| NO_COST_XML_QUERY_REWRITE
| NO_CPU_COSTING
| NOCPU_COSTING
| NOCYCLE
| NODELAY
| NO_DOMAIN_INDEX_FILTER
| NO_DST_UPGRADE_INSERT_CONV
| NO_ELIMINATE_JOIN
| NO_ELIMINATE_OBY
| NO_ELIMINATE_OUTER_JOIN
| NOENTITYESCAPING
| NO_EXPAND_GSET_TO_UNION
| NO_EXPAND
| NO_EXPAND_TABLE
| NO_FACT
| NO_FACTORIZE_JOIN
| NO_FILTERING
| NOFORCE
| NO_FULL_OUTER_JOIN_TO_OUTER
| NO_GBY_PUSHDOWN
| NOGUARANTEE
| NO_INDEX_FFS
| NO_INDEX
| NO_INDEX_SS
| NO_LOAD
| NOLOCAL
| NOLOGGING
| NOMAPPING
| NOMAXVALUE
| NO_MERGE
| NOMINIMIZE
| NOMINVALUE
| NO_MODEL_PUSH_REF
| NO_MONITORING
| NOMONITORING
| NO_MONITOR
| NO_MULTIMV_REWRITE
| NO
| NO_NATIVE_FULL_OUTER_JOIN
| NONBLOCKING
| NONE
| NO_NLJ_BATCHING
| NO_NLJ_PREFETCH
| NONSCHEMA
| NOORDER
| NO_ORDER_ROLLUPS
| NO_OUTER_JOIN_TO_ANTI
| NO_OUTER_JOIN_TO_INNER
| NOOVERRIDE
| NO_PARALLEL_INDEX
| NOPARALLEL_INDEX
| NO_PARALLEL
| NOPARALLEL
| NO_PARTIAL_COMMIT
| NO_PLACE_DISTINCT
| NO_PLACE_GROUP_BY
| NO_PQ_MAP
| NO_PRUNE_GSETS
| NO_PULL_PRED
| NO_PUSH_PRED
| NO_PUSH_SUBQ
| NO_PX_JOIN_FILTER
| NO_QKN_BUFF
| NO_QUERY_TRANSFORMATION
| NO_REF_CASCADE
| NORELY
| NOREPAIR
| NORESETLOGS
| NO_RESULT_CACHE
| NOREVERSE
| NO_REWRITE
| NOREWRITE
| NORMAL
| NOROWDEPENDENCIES
| NOSCHEMACHECK
| NOSEGMENT
| NO_SEMIJOIN
| NO_SEMI_TO_INNER
| NO_SET_TO_JOIN
| NOSORT
| NO_SQL_TUNE
| NO_STAR_TRANSFORMATION
| NO_STATEMENT_QUEUING
| NO_STATS_GSETS
| NOSTRICT
| NO_SUBQUERY_PRUNING
| NO_SUBSTRB_PAD
| NO_SWAP_JOIN_INPUTS
| NOSWITCH
| NO_TABLE_LOOKUP_BY_NL
| NO_TEMP_TABLE
| NOTHING
| NOTIFICATION
| NO_TRANSFORM_DISTINCT_AGG
| NO_UNNEST
| NO_USE_HASH_AGGREGATION
| NO_USE_HASH_GBY_FOR_PUSHDOWN
| NO_USE_HASH
| NO_USE_INVISIBLE_INDEXES
| NO_USE_MERGE
| NO_USE_NL
| NOVALIDATE
| NO_XDB_FASTPATH_INSERT
| NO_XML_DML_REWRITE
| NO_XMLINDEX_REWRITE_IN_SELECT
| NO_XMLINDEX_REWRITE
| NO_XML_QUERY_REWRITE
| NTH_VALUE
| NTILE
| NULLIF
| NULLS
| NUMERIC
| NUM_INDEX_KEYS
| NUMTODSINTERVAL
| NUMTOYMINTERVAL
| NVARCHAR2
| NVL2
| NVL
| OBJECT2XML
| OBJECT
| OBJNO
| OBJNO_REUSE
| OCCURENCES
| OFFLINE
| OFF
| OIDINDEX
| OID
| OLAP
| OLD
| OLD_PUSH_PRED
| OLTP
| ONLINE
| ONLY
| OPAQUE
| OPAQUE_TRANSFORM
| OPAQUE_XCANONICAL
| OPCODE
| OPEN
| OPERATIONS
| OPERATOR
| OPT_ESTIMATE
| OPTIMAL
| OPTIMIZE
| OPTIMIZER_FEATURES_ENABLE
| OPTIMIZER_GOAL
| OPT_PARAM
| ORA_BRANCH
| ORADEBUG
| ORA_DST_AFFECTED
| ORA_DST_CONVERT
| ORA_DST_ERROR
| ORA_GET_ACLIDS
| ORA_GET_PRIVILEGES
| ORA_HASH
| ORA_ROWSCN
| ORA_ROWSCN_RAW
| ORA_ROWVERSION
| ORA_TABVERSION
| ORDERED
| ORDERED_PREDICATES
| ORDINALITY
| OR_EXPAND
| ORGANIZATION
| OR_PREDICATES
| OTHER
| OUTER_JOIN_TO_ANTI
| OUTER_JOIN_TO_INNER
| OUTER
| OUTLINE_LEAF
| OUTLINE
| OUT_OF_LINE
| OVERFLOW
| OVERFLOW_NOMOVE
| OVERLAPS
| OVER
| OWNER
| OWNERSHIP
| OWN
| PACKAGE
| PACKAGES
| PARALLEL_INDEX
| PARALLEL
| PARAMETERS
| PARAM
| PARENT
| PARITY
| PARTIALLY
| PARTITION_HASH
| PARTITION_LIST
| PARTITION
| PARTITION_RANGE
| PARTITIONS
| PARTNUMINST
| PASSING
| PASSWORD_GRACE_TIME
| PASSWORD_LIFE_TIME
| PASSWORD_LOCK_TIME
| PASSWORD
| PASSWORD_REUSE_MAX
| PASSWORD_REUSE_TIME
| PASSWORD_VERIFY_FUNCTION
| PATH
| PATHS
| PBL_HS_BEGIN
| PBL_HS_END
| PCTINCREASE
| PCTTHRESHOLD
| PCTUSED
| PCTVERSION
| PENDING
| PERCENTILE_CONT
| PERCENTILE_DISC
| PERCENT_KEYWORD
| PERCENT_RANKM
| PERCENT_RANK
| PERFORMANCE
| PERMANENT
| PERMISSION
| PFILE
| PHYSICAL
| PIKEY
| PIV_GB
| PIVOT
| PIV_SSF
| PLACE_DISTINCT
| PLACE_GROUP_BY
| PLAN
| PLSCOPE_SETTINGS
| PLSQL_CCFLAGS
| PLSQL_CODE_TYPE
| PLSQL_DEBUG
| PLSQL_OPTIMIZE_LEVEL
| PLSQL_WARNINGS
| POINT
| POLICY
| POST_TRANSACTION
| POWERMULTISET_BY_CARDINALITY
| POWERMULTISET
| POWER
| PQ_DISTRIBUTE
| PQ_MAP
| PQ_NOMAP
| PREBUILT
| PRECEDES
| PRECEDING
| PRECISION
| PRECOMPUTE_SUBQUERY
| PREDICATE_REORDERS
| PREDICTION_BOUNDS
| PREDICTION_COST
| PREDICTION_DETAILS
| PREDICTION
| PREDICTION_PROBABILITY
| PREDICTION_SET
| PREPARE
| PRESENT
| PRESENTNNV
| PRESENTV
| PRESERVE
| PRESERVE_OID
| PREVIOUS
| PRIMARY
| PRIVATE
| PRIVATE_SGA
| PRIVILEGE
| PRIVILEGES
| PROCEDURAL
| PROCEDURE
| PROCESS
| PROFILE
| PROGRAM
| PROJECT
| PROPAGATE
| PROTECTED
| PROTECTION
| PULL_PRED
| PURGE
| PUSH_PRED
| PUSH_SUBQ
| PX_GRANULE
| PX_JOIN_FILTER
| QB_NAME
| QUERY_BLOCK
| QUERY
| QUEUE_CURR
| QUEUE
| QUEUE_ROWP
| QUIESCE
| QUORUM
| QUOTA
| RANDOM_LOCAL
| RANDOM
| RANGE
| RANKM
| RANK
| RAPIDLY
| RATIO_TO_REPORT
| RAWTOHEX
| RAWTONHEX
| RBA
| RBO_OUTLINE
| RDBA
| READ
| READS
| REAL
| REBALANCE
| REBUILD
| RECORDS_PER_BLOCK
| RECOVERABLE
| RECOVER
| RECOVERY
| RECYCLEBIN
| RECYCLE
| REDACTION
| REDO
| REDUCED
| REDUNDANCY
| REF_CASCADE_CURSOR
| REFERENCED
| REFERENCE
| REFERENCES
| REFERENCING
| REF
| REFRESH
| REFTOHEX
| REGEXP_COUNT
| REGEXP_INSTR
| REGEXP_LIKE
| REGEXP_REPLACE
| REGEXP_SUBSTR
| REGISTER
| REGR_AVGX
| REGR_AVGY
| REGR_COUNT
| REGR_INTERCEPT
| REGR_R2
| REGR_SLOPE
| REGR_SXX
| REGR_SXY
| REGR_SYY
| REGULAR
| REJECT
| REKEY
| RELATIONAL
| RELY
| REMAINDER
| REMOTE_MAPPED
| REMOVE
| REPAIR
| REPEAT
| REPLACE
| REPLICATION
| REQUIRED
| RESETLOGS
| RESET
| RESIZE
| RESOLVE
| RESOLVER
| RESPECT
| RESTORE_AS_INTERVALS
| RESTORE
| RESTRICT_ALL_REF_CONS
| RESTRICTED
| RESTRICT
| RESULT_CACHE
| RESUMABLE
| RESUME
| RETENTION
| RETRY_ON_ROW_CHANGE
| RETURNING
| RETURN
| REUSE
| REVERSE
| REWRITE
| REWRITE_OR_ERROR
| RIGHT
| ROLE
| ROLES
| ROLLBACK
| ROLLING
| ROLLUP
| ROUND
| ROWDEPENDENCIES
| ROWID
| ROWIDTOCHAR
| ROWIDTONCHAR
| ROW_LENGTH
| ROW
| ROW_NUMBER
| ROWNUM
| ROWS
| RPAD
| RTRIM
| RULE
| RULES
| SALT
| SAMPLE
| SAVE_AS_INTERVALS
| SAVEPOINT
| SB4
| SCALE
| SCALE_ROWS
| SCAN_INSTANCES
| SCAN
| SCHEDULER
| SCHEMACHECK
| SCHEMA
| SCN_ASCENDING
| SCN
| SCOPE
| SD_ALL
| SD_INHIBIT
| SD_SHOW
| SEARCH
| SECOND
| SECUREFILE_DBA
| SECUREFILE
| SECURITY
| SEED
| SEG_BLOCK
| SEG_FILE
| SEGMENT
| SELECTIVITY
| SEMIJOIN_DRIVER
| SEMIJOIN
| SEMI_TO_INNER
| SEQUENCED
| SEQUENCE
| SEQUENTIAL
| SERIALIZABLE
| SERVERERROR
| SESSION_CACHED_CURSORS
| SESSION
| SESSIONS_PER_USER
| SESSIONTIMEZONE
| SESSIONTZNAME
| SETS
| SETTINGS
| SET_TO_JOIN
| SEVERE
| SHARED
| SHARED_POOL
| SHOW
| SHRINK
| SHUTDOWN
| SIBLINGS
| SID
| SIGNAL_COMPONENT
| SIGNAL_FUNCTION
| SIGN
| SIMPLE
| SINGLE
| SINGLETASK
| SINH
| SIN
| SKIP_EXT_OPTIMIZER
| SKIP_
| SKIP_UNQ_UNUSABLE_IDX
| SKIP_UNUSABLE_INDEXES
| SMALLFILE
| SNAPSHOT
| SOME
| SORT
| SOUNDEX
| SOURCE
| SPACE_KEYWORD
| SPECIFICATION
| SPFILE
| SPLIT
| SPREADSHEET
| SQLLDR
| SQL
| SQL_TRACE
| SQRT
| STALE
| STANDALONE
| STANDBY_MAX_DATA_DELAY
| STANDBY
| STAR
| STAR_TRANSFORMATION
| STARTUP
| STATEMENT_ID
| STATEMENT_QUEUING
| STATEMENTS
| STATIC
| STATISTICS
| STATS_BINOMIAL_TEST
| STATS_CROSSTAB
| STATS_F_TEST
| STATS_KS_TEST
| STATS_MODE
| STATS_MW_TEST
| STATS_ONE_WAY_ANOVA
| STATS_T_TEST_INDEP
| STATS_T_TEST_INDEPU
| STATS_T_TEST_ONE
| STATS_T_TEST_PAIRED
| STATS_WSR_TEST
| STDDEV
| STDDEV_POP
| STDDEV_SAMP
| STOP
| STORAGE
| STORE
| STREAMS
| STRICT
| STRING
| STRIPE_COLUMNS
| STRIPE_WIDTH
| STRIP
| STRUCTURE
| SUBMULTISET
| SUBPARTITION
| SUBPARTITION_REL
| SUBPARTITIONS
| SUBQUERIES
| SUBQUERY_PRUNING
| SUBSTITUTABLE
| SUBSTR2
| SUBSTR4
| SUBSTRB
| SUBSTRC
| SUBSTR
| SUCCESSFUL
| SUMMARY
| SUM
| SUPPLEMENTAL
| SUSPEND
| SWAP_JOIN_INPUTS
| SWITCH
| SWITCHOVER
| SYNCHRONOUS
| SYNC
| SYSASM
| SYS_AUDIT
| SYSAUX
| SYS_CHECKACL
| SYS_CONNECT_BY_PATH
| SYS_CONTEXT
| SYSDATE
| SYSDBA
| SYS_DBURIGEN
| SYS_DL_CURSOR
| SYS_DM_RXFORM_CHR
| SYS_DM_RXFORM_NUM
| SYS_DOM_COMPARE
| SYS_DST_PRIM2SEC
| SYS_DST_SEC2PRIM
| SYS_ET_BFILE_TO_RAW
| SYS_ET_BLOB_TO_IMAGE
| SYS_ET_IMAGE_TO_BLOB
| SYS_ET_RAW_TO_BFILE
| SYS_EXTPDTXT
| SYS_EXTRACT_UTC
| SYS_FBT_INSDEL
| SYS_FILTER_ACLS
| SYS_FNMATCHES
| SYS_FNREPLACE
| SYS_GET_ACLIDS
| SYS_GET_PRIVILEGES
| SYS_GETTOKENID
| SYS_GETXTIVAL
| SYS_GUID
| SYS_MAKEXML
| SYS_MAKE_XMLNODEID
| SYS_MKXMLATTR
| SYS_OP_ADT2BIN
| SYS_OP_ADTCONS
| SYS_OP_ALSCRVAL
| SYS_OP_ATG
| SYS_OP_BIN2ADT
| SYS_OP_BITVEC
| SYS_OP_BL2R
| SYS_OP_BLOOM_FILTER_LIST
| SYS_OP_BLOOM_FILTER
| SYS_OP_C2C
| SYS_OP_CAST
| SYS_OP_CEG
| SYS_OP_CL2C
| SYS_OP_COMBINED_HASH
| SYS_OP_COMP
| SYS_OP_CONVERT
| SYS_OP_COUNTCHG
| SYS_OP_CSCONV
| SYS_OP_CSCONVTEST
| SYS_OP_CSR
| SYS_OP_CSX_PATCH
| SYS_OP_DECOMP
| SYS_OP_DESCEND
| SYS_OP_DISTINCT
| SYS_OP_DRA
| SYS_OP_DUMP
| SYS_OP_DV_CHECK
| SYS_OP_ENFORCE_NOT_NULL
| SYSOPER
| SYS_OP_EXTRACT
| SYS_OP_GROUPING
| SYS_OP_GUID
| SYS_OP_IIX
| SYS_OP_ITR
| SYS_OP_LBID
| SYS_OP_LOBLOC2BLOB
| SYS_OP_LOBLOC2CLOB
| SYS_OP_LOBLOC2ID
| SYS_OP_LOBLOC2NCLOB
| SYS_OP_LOBLOC2TYP
| SYS_OP_LSVI
| SYS_OP_LVL
| SYS_OP_MAKEOID
| SYS_OP_MAP_NONNULL
| SYS_OP_MSR
| SYS_OP_NICOMBINE
| SYS_OP_NIEXTRACT
| SYS_OP_NII
| SYS_OP_NIX
| SYS_OP_NOEXPAND
| SYS_OP_NTCIMG
| SYS_OP_NUMTORAW
| SYS_OP_OIDVALUE
| SYS_OP_OPNSIZE
| SYS_OP_PAR_1
| SYS_OP_PARGID_1
| SYS_OP_PARGID
| SYS_OP_PAR
| SYS_OP_PIVOT
| SYS_OP_R2O
| SYS_OP_RAWTONUM
| SYS_OP_RDTM
| SYS_OP_REF
| SYS_OP_RMTD
| SYS_OP_ROWIDTOOBJ
| SYS_OP_RPB
| SYS_OPTLOBPRBSC
| SYS_OP_TOSETID
| SYS_OP_TPR
| SYS_OP_TRTB
| SYS_OPTXICMP
| SYS_OPTXQCASTASNQ
| SYS_OP_UNDESCEND
| SYS_OP_VECAND
| SYS_OP_VECBIT
| SYS_OP_VECOR
| SYS_OP_VECXOR
| SYS_OP_VERSION
| SYS_OP_VREF
| SYS_OP_VVD
| SYS_OP_XMLCONS_FOR_CSX
| SYS_OP_XPTHATG
| SYS_OP_XPTHIDX
| SYS_OP_XPTHOP
| SYS_OP_XTXT2SQLT
| SYS_ORDERKEY_DEPTH
| SYS_ORDERKEY_MAXCHILD
| SYS_ORDERKEY_PARENT
| SYS_PARALLEL_TXN
| SYS_PATHID_IS_ATTR
| SYS_PATHID_IS_NMSPC
| SYS_PATHID_LASTNAME
| SYS_PATHID_LASTNMSPC
| SYS_PATH_REVERSE
| SYS_PXQEXTRACT
| SYS_RID_ORDER
| SYS_ROW_DELTA
| SYS_SC_2_XMLT
| SYS_SYNRCIREDO
| SYSTEM_DEFINED
| SYSTEM
| SYSTIMESTAMP
| SYS_TYPEID
| SYS_UMAKEXML
| SYS_XMLANALYZE
| SYS_XMLCONTAINS
| SYS_XMLCONV
| SYS_XMLEXNSURI
| SYS_XMLGEN
| SYS_XMLI_LOC_ISNODE
| SYS_XMLI_LOC_ISTEXT
| SYS_XMLINSTR
| SYS_XMLLOCATOR_GETSVAL
| SYS_XMLNODEID_GETCID
| SYS_XMLNODEID_GETLOCATOR
| SYS_XMLNODEID_GETOKEY
| SYS_XMLNODEID_GETPATHID
| SYS_XMLNODEID_GETPTRID
| SYS_XMLNODEID_GETRID
| SYS_XMLNODEID_GETSVAL
| SYS_XMLNODEID_GETTID
| SYS_XMLNODEID
| SYS_XMLT_2_SC
| SYS_XMLTRANSLATE
| SYS_XMLTYPE2SQL
| SYS_XQ_ASQLCNV
| SYS_XQ_ATOMCNVCHK
| SYS_XQBASEURI
| SYS_XQCASTABLEERRH
| SYS_XQCODEP2STR
| SYS_XQCODEPEQ
| SYS_XQCON2SEQ
| SYS_XQCONCAT
| SYS_XQDELETE
| SYS_XQDFLTCOLATION
| SYS_XQDOC
| SYS_XQDOCURI
| SYS_XQDURDIV
| SYS_XQED4URI
| SYS_XQENDSWITH
| SYS_XQERRH
| SYS_XQERR
| SYS_XQESHTMLURI
| SYS_XQEXLOBVAL
| SYS_XQEXSTWRP
| SYS_XQEXTRACT
| SYS_XQEXTRREF
| SYS_XQEXVAL
| SYS_XQFB2STR
| SYS_XQFNBOOL
| SYS_XQFNCMP
| SYS_XQFNDATIM
| SYS_XQFNLNAME
| SYS_XQFNNM
| SYS_XQFNNSURI
| SYS_XQFNPREDTRUTH
| SYS_XQFNQNM
| SYS_XQFNROOT
| SYS_XQFORMATNUM
| SYS_XQFTCONTAIN
| SYS_XQFUNCR
| SYS_XQGETCONTENT
| SYS_XQINDXOF
| SYS_XQINSERT
| SYS_XQINSPFX
| SYS_XQIRI2URI
| SYS_XQLANG
| SYS_XQLLNMFRMQNM
| SYS_XQMKNODEREF
| SYS_XQNILLED
| SYS_XQNODENAME
| SYS_XQNORMSPACE
| SYS_XQNORMUCODE
| SYS_XQ_NRNG
| SYS_XQNSP4PFX
| SYS_XQNSPFRMQNM
| SYS_XQPFXFRMQNM
| SYS_XQ_PKSQL2XML
| SYS_XQPOLYABS
| SYS_XQPOLYADD
| SYS_XQPOLYCEL
| SYS_XQPOLYCSTBL
| SYS_XQPOLYCST
| SYS_XQPOLYDIV
| SYS_XQPOLYFLR
| SYS_XQPOLYMOD
| SYS_XQPOLYMUL
| SYS_XQPOLYRND
| SYS_XQPOLYSQRT
| SYS_XQPOLYSUB
| SYS_XQPOLYUMUS
| SYS_XQPOLYUPLS
| SYS_XQPOLYVEQ
| SYS_XQPOLYVGE
| SYS_XQPOLYVGT
| SYS_XQPOLYVLE
| SYS_XQPOLYVLT
| SYS_XQPOLYVNE
| SYS_XQREF2VAL
| SYS_XQRENAME
| SYS_XQREPLACE
| SYS_XQRESVURI
| SYS_XQRNDHALF2EVN
| SYS_XQRSLVQNM
| SYS_XQRYENVPGET
| SYS_XQRYVARGET
| SYS_XQRYWRP
| SYS_XQSEQ2CON4XC
| SYS_XQSEQ2CON
| SYS_XQSEQDEEPEQ
| SYS_XQSEQINSB
| SYS_XQSEQRM
| SYS_XQSEQRVS
| SYS_XQSEQSUB
| SYS_XQSEQTYPMATCH
| SYS_XQSTARTSWITH
| SYS_XQSTATBURI
| SYS_XQSTR2CODEP
| SYS_XQSTRJOIN
| SYS_XQSUBSTRAFT
| SYS_XQSUBSTRBEF
| SYS_XQTOKENIZE
| SYS_XQTREATAS
| SYS_XQ_UPKXML2SQL
| SYS_XQXFORM
| TABLE
| TABLE_LOOKUP_BY_NL
| TABLES
| TABLESPACE
| TABLESPACE_NO
| TABLE_STATS
| TABNO
| TANH
| TAN
| TBLORIDXPARTNUM
| TEMPFILE
| TEMPLATE
| TEMPORARY
| TEMP_TABLE
| TEST
| THAN
| THE
| THEN
| THREAD
| THROUGH
| TIME
| TIMEOUT
| TIMES
| TIMESTAMP
| TIMEZONE_ABBR
| TIMEZONE_HOUR
| TIMEZONE_MINUTE
| TIME_ZONE
| TIMEZONE_OFFSET
| TIMEZONE_REGION
| TIV_GB
| TIV_SSF
| TO_BINARY_DOUBLE
| TO_BINARY_FLOAT
| TO_BLOB
| TO_CHAR
| TO_CLOB
| TO_DATE
| TO_DSINTERVAL
| TO_LOB
| TO_MULTI_BYTE
| TO_NCHAR
| TO_NCLOB
| TO_NUMBER
| TOPLEVEL
| TO_SINGLE_BYTE
| TO_TIME
| TO_TIMESTAMP
| TO_TIMESTAMP_TZ
| TO_TIME_TZ
| TO_YMINTERVAL
| TRACE
| TRACING
| TRACKING
| TRAILING
| TRANSACTION
| TRANSFORM_DISTINCT_AGG
| TRANSITIONAL
| TRANSITION
| TRANSLATE
| TREAT
| TRIGGERS
| TRIM
| TRUE
| TRUNCATE
| TRUNC
| TRUSTED
| TUNING
| TX
| TYPE
| TYPES
| TZ_OFFSET
| UB2
| UBA
| UID
| UNARCHIVED
| UNBOUNDED
| UNBOUND
| UNDER
| UNDO
| UNDROP
| UNIFORM
| UNISTR
| UNLIMITED
| UNLOAD
| UNLOCK
| UNNEST_INNERJ_DISTINCT_VIEW
| UNNEST
| UNNEST_NOSEMIJ_NODISTINCTVIEW
| UNNEST_SEMIJ_VIEW
| UNPACKED
| UNPIVOT
| UNPROTECTED
| UNQUIESCE
| UNRECOVERABLE
| UNRESTRICTED
| UNTIL
| UNUSABLE
| UNUSED
| UPDATABLE
| UPDATED
| UPDATEXML
| UPD_INDEXES
| UPD_JOININDEX
| UPGRADE
| UPPER
| UPSERT
| UROWID
| USAGE
| USE_ANTI
| USE_CONCAT
| USE_HASH_AGGREGATION
| USE_HASH_GBY_FOR_PUSHDOWN
| USE_HASH
| USE_INVISIBLE_INDEXES
| USE_MERGE_CARTESIAN
| USE_MERGE
| USE
| USE_NL
| USE_NL_WITH_INDEX
| USE_PRIVATE_OUTLINES
| USER_DEFINED
| USERENV
| USERGROUP
| USER
| USER_RECYCLEBIN
| USERS
| USE_SEMI
| USE_STORED_OUTLINES
| USE_TTT_FOR_GSETS
| USE_WEAK_NAME_RESL
| USING
| VALIDATE
| VALIDATION
| VALUE
| VARIANCE
| VAR_POP
| VARRAY
| VARRAYS
| VAR_SAMP
| VARYING
| VECTOR_READ
| VECTOR_READ_TRACE
| VERIFY
| VERSIONING
| VERSION
| VERSIONS_ENDSCN
| VERSIONS_ENDTIME
| VERSIONS
| VERSIONS_OPERATION
| VERSIONS_STARTSCN
| VERSIONS_STARTTIME
| VERSIONS_XID
| VIRTUAL
| VISIBLE
| VOLUME
| VSIZE
| WAIT
| WALLET
| WELLFORMED
| WHENEVER
| WHEN
| WHITESPACE
| WIDTH_BUCKET
| WITHIN
| WITHOUT
| WORK
| WRAPPED
| WRITE
| XDB_FASTPATH_INSERT
| X_DYN_PRUNE
| XID
| XML2OBJECT
| XMLATTRIBUTES
| XMLCAST
| XMLCDATA
| XMLCOLATTVAL
| XMLCOMMENT
| XMLCONCAT
| XMLDIFF
| XML_DML_RWT_STMT
| XMLELEMENT
| XMLEXISTS2
| XMLEXISTS
| XMLFOREST
| XMLINDEX_REWRITE_IN_SELECT
| XMLINDEX_REWRITE
| XMLINDEX_SEL_IDX_TBL
| XMLISNODE
| XMLISVALID
| XML
| XMLNAMESPACES
| XMLPARSE
| XMLPATCH
| XMLPI
| XMLQUERY
| XMLQUERYVAL
| XMLROOT
| XMLSCHEMA
| XMLSERIALIZE
| XMLTABLE
| XMLTRANSFORMBLOB
| XMLTRANSFORM
| XMLTYPE
| XPATHTABLE
| XS_SYS_CONTEXT
| YEAR
| YES
| ZONE
;
string_function_name
: CHR
| DECODE
| SUBSTR
| TO_CHAR
| TRIM
;
numeric_function_name
: AVG
| COUNT
| NVL
| ROUND
| SUM
;
|
programs/oeis/081/A081006.asm | jmorken/loda | 1 | 27671 | ; A081006: a(n) = Fibonacci(4n) - 1, or Fibonacci(2n+1)*Lucas(2n-1).
; 2,20,143,986,6764,46367,317810,2178308,14930351,102334154,701408732,4807526975,32951280098,225851433716,1548008755919,10610209857722,72723460248140,498454011879263,3416454622906706,23416728348467684
mul $0,2
add $0,1
lpb $0
sub $0,1
add $1,1
add $2,$1
add $1,$2
lpe
|
fast_fwd/arm/thunks.asm | sylveon/cppwinrt | 859 | 173654 | ; ARM fast forwarder thunk implementations
; Calling convention: https://docs.microsoft.com/en-us/cpp/build/overview-of-arm-abi-conventions
#include "ksarm.h"
IMPORT __guard_check_icall_fptr
TEXTAREA
CFG_ALIGN
NESTED_ENTRY InvokeForwarder
; Save enregistered args and return address
PROLOG_PUSH {r0-r4, lr}
; Replace forwarder abi with owner abi
ldr r1, [r0, #4]
str r1, [sp]
; Add offset and index (on stack)
ldr r2, [sp, #24]
ldr r3, [r0, #8]
add r2, r2, r3
; Get method address from owner abi vtable
ldr r0, [r1]
ldr r4, [r0, r2, lsl #2]
mov r0, r4
; Verify indirect call target
mov32 r12, __guard_check_icall_fptr
ldr r12, [r12]
blx r12
; Restore method address, return address, and args
mov r12, r4
EPILOG_POP {r0-r4, lr}
EPILOG_NOP add sp, #4
; Jump to method
EPILOG_NOP bx r12
NESTED_END InvokeForwarder
; Define thunks
MACRO
WINRT_FF_THUNK $i
LEAF_ENTRY winrt_ff_thunk$i
; Note: no scratch registers available (r12/IP is used by CFG), must use stack
mov r12, $i
push r12
ldr pc, =InvokeForwarder
LEAF_END winrt_ff_thunk$i
MEND
#include "thunks.inc"
END |
src/006/steps.adb | xeenta/learning-ada | 0 | 9424 | <filename>src/006/steps.adb
with Ada.Text_IO; use Ada.Text_IO;
procedure Steps is
task Step_By_Step is
entry Step_One;
entry Step_Two;
entry Step_Three;
end Step_By_Step;
task body Step_By_Step is
begin
accept Step_One do
Put_Line ("1");
end Step_One;
accept Step_Two do
Put_Line ("2");
end Step_Two;
accept Step_Three do
Put_Line ("3");
end Step_Three;
end Step_By_Step;
begin
Put_Line ("Steps");
Step_By_Step.Step_One;
Step_By_Step.Step_Two;
Put_Line ("Redo step 1?");
Step_By_Step.Step_One;
Put_Line ("Just before the end");
end;
|
disorderly/bday_tst_1.adb | jscparker/math_packages | 30 | 15209 | <gh_stars>10-100
-- Set up at present to test the compiler's Numerics.Discrete_Random.
--
-- Warning: puts large array on stack. You get segmentation fault if stack
-- space is insufficient. To get more stack space in bash shell, type:
-- ulimit -s 1024M
-- ulimit -s unlimited
-- at the prompt. Type ulimit -a for summary of limits.
-- In c shell type
-- limit stacksize 1024M
-- limit stacksize unlimited
--
-- after 30738012 trials have 50% probability of 2 or more collisions (if
-- using 48 bit uniformly distributed rands).
with Chi_Gaussian_CDF; -- cumulative distribution functions for getting p_vals
with Disorderly.Random; use Disorderly.Random;
with Disorderly.Random.Clock_Entropy;
with Text_IO; use Text_IO;
with Ada.Numerics.Discrete_Random;
with Sorted_Array;
-- Test bday_tst_1 generates N random numbers (usually N = 2**25 + 2**24),
-- and then counts how many of these random numbers occurred more than
-- once in the set of N.
--
-- Uses package Sorted_Array to sort the N random numbers. The sorted
-- data is then inspected to find the number of rands that occurred
-- more than once in the sample (collisions). The number of collisions
-- should follow a poisson distribution, which is tested with a Chi-square
-- goodness-of-fit test. This routine does not count the number of collisions
-- in the spacings of the N random numbers (Marsaglia's birthday-spacings-test).
--
-- You have a choice of 2 random num generators:
--
-- Disorderly.Random or Ada.Numerics.Discrete_Random.
--
procedure bday_tst_1 is
-- Choose your Random Number Generator:
Use_Compilers_Stnd_Generator : constant Boolean := True;
-- IF False then use Disorderly.Random
-- IF True then use Ada.Numerics.Discrete_Random
Bits_per_Random_Word : constant := 48; -- can't change
type Real is digits 15;
package Chi_CDF is new Chi_Gaussian_CDF (Real);
-- prob of no collisions (of an event of probability 2**(-48) = e) in n trials,
-- (ie prob of no repeats of any of the 2**48 = 1/e possibilities):
-- p(0) = 1*(1-e)*(1-2e)* ... *(1-(n-1)e)
--
-- prob of exactly 1 collision:
-- p(1) = (n(n+1)/2) * 1*e*(1-e)*(1-2e)* ... *(1-(n-2)e)
-- = p(0) * (n(n+1)/2) * e * (1+(n-1)e)
--
-- Poissonian p(k) = lambda^k exp(-lambda) / k!
--
-- p(0) = exp(-lambda)
-- p(1) = exp(-lambda)* lambda = p(0) * lambda
--
-- say e = 2**(-48) and n = 2**25
--
-- so by the 1st Poissonian p(0) above:
-- lambda = -log (1*(1-e)*(1-2e)* ... *(1-(n-1)e)) = 2.00000001987
-- by the 2nd Poissonian p(1) above:
-- lambda = (n(n+1)/2) * e * (1+(n-1)e) = 2.000000298
--
-- Agree to 7 significant figures, so we'll assume poissonian statistics
-- with lambda obtained as above.
--
Min_Recorded_Cnt : constant := 2; -- counts 0..2 goto 1st bin
Max_Recorded_Cnt : constant := 7; -- counts 7..inf goto last bin
N : constant Parent_Random_Int := 2**25 + 2**24;
-- When N = 2**25 + 2**24, collision counts of 0..2 go into 1st bin,
-- and then counts of 7 and higher go into bin 6th bin.
Max_Val_of_Random_Ints : constant Parent_Random_Int := 2**Bits_per_Random_Word-1;
type Table_Index is mod 2**26;
package Sorted_Table is
new Sorted_Array
(Item => Parent_Random_Int,
Max_Size_of_Item => Max_Val_of_Random_Ints,
Max_Allowed_No_of_Items => N,
Table_Index => Table_Index);
subtype Range_of_Recorded_Outcomes is Table_Index
range Min_Recorded_Cnt..Max_Recorded_Cnt;
type Birthday_Count_Statistics is array (Range_of_Recorded_Outcomes) of Real;
Prob_of_k_Collisions : constant Birthday_Count_Statistics :=
(
1.73578060853667E-01, 1.68717879896370E-01, 1.89807618654555E-01,
1.70826860183124E-01, 1.28120147682862E-01, 1.68949432729422E-01
);
True_Degrees_of_Freedom : constant := 5.0; -- Prob sums to 1.0.
-- The following is stronger, (N=2**26) but requires a larger array.
--
--N : constant := 2**26;
-- When N = 2**26, collision counts of 0..4 go into 1st bin,
-- and then counts of 12 and higher go into bin 9th bin.
--Min_Recorded_Cnt : constant := 4; -- counts 0..4 goto 1st bin
--Max_Recorded_Cnt : constant := 12; -- counts 12..inf goto last bin
--
--Prob_of_k_Collisions : Birthday_Count_Statistics :=
-- (
-- 9.96323936620416E-02, 9.16036574975765E-02, 1.22138211816770E-01,
-- 1.39586529870595E-01, 1.39586531950597E-01, 1.24076919138310E-01,
-- 9.92615367897598E-02, 7.21902096500887E-02, 1.11924009624262E-01
-- );
--
--True_Degrees_of_Freedom : constant := 8.0;
-- Prob sums to 1.0.
Bday_Year_Length : constant := N;
Sample_Size : constant := 1600; -- can use 1000 for N=2**26 case above.
No_of_Chi_Tests : constant := 2**31-1; -- just keep doing chi tests
Cnt : Table_Index;
Observed_Count : Birthday_Count_Statistics := (others => 0.0);
Expected_Count : Birthday_Count_Statistics := (others => 0.0);
p_val : Real;
Stream_1 : State;
X : Random_Int;
--------------------
-- Get_Random_Stnd -
--------------------
-- Compiler's built in random number generator.
-- GNAT compiler complains if you ask for more than 48 bits.
type Unsigned_Stnd is mod 2**Bits_per_Random_Word;
package rnd is new Ada.Numerics.Discrete_Random (Unsigned_Stnd);
Stream_stnd : rnd.Generator;
procedure Get_Random_Stnd(X : out Random_Int; S : in rnd.Generator)
is
begin
X := Random_Int (rnd.Random (S));
end Get_Random_Stnd;
pragma Inline (Get_Random_Stnd);
begin
-- Initialize states of the random number generators.
-- Both generators use the clock to choose an initial seed.
-- Call Reset only once; then repeat Test many times using Stream_1.
rnd.Reset (Stream_stnd);
Clock_Entropy.Reset (Stream_1);
-- Use Probability to init Expection values:
for k in Range_of_Recorded_Outcomes loop
Expected_Count(k) := Real (Sample_Size) * Prob_of_k_Collisions(k);
end loop;
-- get p_val for each repetition of the chi test
new_line;
if Use_Compilers_Stnd_Generator then
put ("Using Ada.Numerics.Discrete_Random to generate random numbers");
else
put ("Using Disorderly.Random to generate random numbers");
end if;
new_line;
put ("Doing a Chi-squared Goodness-of-fit test with sample size =");
put (Integer'Image (Sample_Size));
new_line;
put ("Usually takes several hours on a 64-bit PC.");
new_line;
for Chi_Test_id in 1 .. No_of_Chi_Tests loop
Observed_Count := (others => 0.0);
Fill_the_Bins:
for Trial_id in 1 .. Sample_Size loop
Sorted_Table.Initialize_Table_for_Restart;
for i in 1 .. Bday_Year_Length loop
if Use_Compilers_Stnd_Generator then
Get_Random_Stnd (X, Stream_stnd);
else
Get_Random (X, Stream_1);
end if;
Sorted_Table.Insert_and_Sort (X mod 2**Bits_per_Random_Word);
end loop; -- in i
Cnt := Sorted_Table.No_of_Collisions_Detected;
put (Table_Index'Image (Cnt));
if Cnt >= Max_Recorded_Cnt then
Observed_Count(Max_Recorded_Cnt) := Observed_Count(Max_Recorded_Cnt) + 1.0;
elsif Cnt <= Min_Recorded_Cnt then
Observed_Count(Min_Recorded_Cnt) := Observed_Count(Min_Recorded_Cnt) + 1.0;
else
Observed_Count(Cnt) := Observed_Count(Cnt) + 1.0;
end if;
if not Sorted_Table.Array_Sort_Successful then
put_line ("Failure in array sort. Should never happen.");
return;
end if;
end loop Fill_the_Bins; -- Trial_id in 1 .. Sample_Size
Get_Chi_p_val:
declare
chi, e, s, p : Real;
begin
chi := 0.0;
for i in Range_of_Recorded_Outcomes loop
e := Expected_Count(i);
s := (Observed_Count(i) - e)**2 / e;
chi := chi + s;
end loop;
p := chi_cdf . Chi_Squared_CDF (True_Degrees_of_Freedom, chi);
p_val := p;
end Get_Chi_p_val;
new_line;
put ("Chi-squared Goodness-of-fit test, number"); put (Integer'Image (Chi_Test_id));
put (" with sample size "); put (Integer'Image (Sample_Size));
new_line;
put ("p-val (should be uniformly distributed in [0, 1) )");
new_line;
put (Real'Image (p_val));
new_line;
end loop; -- for Chi_Test_id in 1..No_of_Chi_Tests
end;
|
asm/scriptcode/magicunlock.asm | Dimedime-d/kptranslation | 3 | 175639 | <filename>asm/scriptcode/magicunlock.asm<gh_stars>1-10
.byte 0x02,0x00,0x01,0x00
.word @loc0
.byte 0x07,0xFF,0xFF,0x7F
.byte 0xFF,0xFF,0xFF,0xFF
.byte 0x0E,0x00,0x01,0x00
.byte 0x54,0x00,0x00,0x00
.byte 0x02,0x00,0x02,0x00
.word @loc1
.byte 0x07,0xFF,0xFF,0x7F
.byte 0x00,0x00,0x00,0x00
.byte 0x06,0x00,0x00,0x00
.byte 0x12,0xFF,0xFF,0x7F
.byte 0x10,0x00,0x00,0x00
.byte 0x06,0x00,0x00,0x00
.byte 0x13,0xFF,0xFF,0x7F
.byte 0x95,0x00,0x00,0x00
.byte 0x0A,0x00,0x14,0x00
.byte 0x18,0xFF,0xFF,0x7F
S_unlockMagic s_magic0
.byte 0x02,0x00,0x09,0x00
.word 0x080AC5EC
.byte 0x05,0x00,0x02,0x00
.byte 0x00,0x00,0x00,0x00
.byte 0x02,0x00,0x00,0x00
.word 0x080ACFC4
@loc1:
.byte 0x02,0x00,0x02,0x00
.word @loc2
.byte 0x07,0xFF,0xFF,0x7F
.byte 0x01,0x00,0x00,0x00
.byte 0x06,0x00,0x00,0x00
.byte 0x12,0xFF,0xFF,0x7F
.byte 0x10,0x00,0x00,0x00
.byte 0x06,0x00,0x00,0x00
.byte 0x13,0xFF,0xFF,0x7F
.byte 0x95,0x00,0x00,0x00
.byte 0x0A,0x00,0x14,0x00
.byte 0x18,0xFF,0xFF,0x7F
S_unlockMagic s_magic1
.byte 0x02,0x00,0x09,0x00
.word 0x080AC5EC
.byte 0x05,0x00,0x02,0x00
.byte 0x00,0x00,0x00,0x00
.byte 0x02,0x00,0x00,0x00
.word 0x080ACFC4
@loc2:
.byte 0x02,0x00,0x02,0x00
.word @loc3
.byte 0x07,0xFF,0xFF,0x7F
.byte 0x02,0x00,0x00,0x00
.byte 0x06,0x00,0x00,0x00
.byte 0x12,0xFF,0xFF,0x7F
.byte 0x10,0x00,0x00,0x00
.byte 0x06,0x00,0x00,0x00
.byte 0x13,0xFF,0xFF,0x7F
.byte 0x95,0x00,0x00,0x00
.byte 0x0A,0x00,0x14,0x00
.byte 0x18,0xFF,0xFF,0x7F
S_unlockMagic s_magic2
.byte 0x02,0x00,0x09,0x00
.word 0x080AC5EC
.byte 0x05,0x00,0x02,0x00
.byte 0x00,0x00,0x00,0x00
.byte 0x02,0x00,0x00,0x00
.word 0x080ACFC4
@loc3:
.byte 0x02,0x00,0x02,0x00
.word @loc4
.byte 0x07,0xFF,0xFF,0x7F
.byte 0x03,0x00,0x00,0x00
.byte 0x06,0x00,0x00,0x00
.byte 0x12,0xFF,0xFF,0x7F
.byte 0x10,0x00,0x00,0x00
.byte 0x06,0x00,0x00,0x00
.byte 0x13,0xFF,0xFF,0x7F
.byte 0x95,0x00,0x00,0x00
.byte 0x0A,0x00,0x14,0x00
.byte 0x18,0xFF,0xFF,0x7F
S_unlockMagic s_magic3
.byte 0x02,0x00,0x09,0x00
.word 0x080AC5EC
.byte 0x05,0x00,0x02,0x00
.byte 0x00,0x00,0x00,0x00
.byte 0x02,0x00,0x00,0x00
.word 0x080ACFC4
@loc4:
.byte 0x02,0x00,0x02,0x00
.word @loc5
.byte 0x07,0xFF,0xFF,0x7F
.byte 0x04,0x00,0x00,0x00
.byte 0x06,0x00,0x00,0x00
.byte 0x12,0xFF,0xFF,0x7F
.byte 0x10,0x00,0x00,0x00
.byte 0x06,0x00,0x00,0x00
.byte 0x13,0xFF,0xFF,0x7F
.byte 0x95,0x00,0x00,0x00
.byte 0x0A,0x00,0x14,0x00
.byte 0x18,0xFF,0xFF,0x7F
S_unlockMagic s_magic4
.byte 0x02,0x00,0x09,0x00
.word 0x080AC5EC
.byte 0x05,0x00,0x02,0x00
.byte 0x00,0x00,0x00,0x00
.byte 0x02,0x00,0x00,0x00
.word 0x080ACFC4
@loc5:
.byte 0x02,0x00,0x02,0x00
.word @loc6
.byte 0x07,0xFF,0xFF,0x7F
.byte 0x05,0x00,0x00,0x00
.byte 0x06,0x00,0x00,0x00
.byte 0x12,0xFF,0xFF,0x7F
.byte 0x10,0x00,0x00,0x00
.byte 0x06,0x00,0x00,0x00
.byte 0x13,0xFF,0xFF,0x7F
.byte 0x95,0x00,0x00,0x00
.byte 0x0A,0x00,0x14,0x00
.byte 0x18,0xFF,0xFF,0x7F
S_unlockMagic s_magic5
.byte 0x02,0x00,0x09,0x00
.word 0x080AC5EC
.byte 0x05,0x00,0x02,0x00
.byte 0x00,0x00,0x00,0x00
.byte 0x02,0x00,0x00,0x00
.word 0x080ACFC4
@loc6:
.byte 0x02,0x00,0x02,0x00
.word @loc7
.byte 0x07,0xFF,0xFF,0x7F
.byte 0x06,0x00,0x00,0x00
.byte 0x06,0x00,0x00,0x00
.byte 0x12,0xFF,0xFF,0x7F
.byte 0x10,0x00,0x00,0x00
.byte 0x06,0x00,0x00,0x00
.byte 0x13,0xFF,0xFF,0x7F
.byte 0x95,0x00,0x00,0x00
.byte 0x0A,0x00,0x14,0x00
.byte 0x18,0xFF,0xFF,0x7F
S_unlockMagic s_magic6
.byte 0x02,0x00,0x09,0x00
.word 0x080AC5EC
.byte 0x05,0x00,0x02,0x00
.byte 0x00,0x00,0x00,0x00
.byte 0x02,0x00,0x00,0x00
.word 0x080ACFC4
@loc7:
.byte 0x02,0x00,0x02,0x00
.word @loc8
.byte 0x07,0xFF,0xFF,0x7F
.byte 0x07,0x00,0x00,0x00
.byte 0x06,0x00,0x00,0x00
.byte 0x12,0xFF,0xFF,0x7F
.byte 0x10,0x00,0x00,0x00
.byte 0x06,0x00,0x00,0x00
.byte 0x13,0xFF,0xFF,0x7F
.byte 0x95,0x00,0x00,0x00
.byte 0x0A,0x00,0x14,0x00
.byte 0x18,0xFF,0xFF,0x7F
S_unlockMagic s_magic7
.byte 0x02,0x00,0x09,0x00
.word 0x080AC5EC
.byte 0x05,0x00,0x02,0x00
.byte 0x00,0x00,0x00,0x00
.byte 0x02,0x00,0x00,0x00
.word 0x080ACFC4
@loc8:
.byte 0x02,0x00,0x02,0x00
.word @loc9
.byte 0x07,0xFF,0xFF,0x7F
.byte 0x08,0x00,0x00,0x00
.byte 0x06,0x00,0x00,0x00
.byte 0x12,0xFF,0xFF,0x7F
.byte 0x10,0x00,0x00,0x00
.byte 0x06,0x00,0x00,0x00
.byte 0x13,0xFF,0xFF,0x7F
.byte 0x95,0x00,0x00,0x00
.byte 0x0A,0x00,0x14,0x00
.byte 0x18,0xFF,0xFF,0x7F
S_unlockMagic s_magic8
.byte 0x02,0x00,0x09,0x00
.word 0x080AC5EC
.byte 0x05,0x00,0x02,0x00
.byte 0x00,0x00,0x00,0x00
.byte 0x02,0x00,0x00,0x00
.word 0x080ACFC4
@loc9:
.byte 0x02,0x00,0x02,0x00
.word @loc10
.byte 0x07,0xFF,0xFF,0x7F
.byte 0x09,0x00,0x00,0x00
.byte 0x06,0x00,0x00,0x00
.byte 0x12,0xFF,0xFF,0x7F
.byte 0x10,0x00,0x00,0x00
.byte 0x06,0x00,0x00,0x00
.byte 0x13,0xFF,0xFF,0x7F
.byte 0x95,0x00,0x00,0x00
.byte 0x0A,0x00,0x14,0x00
.byte 0x18,0xFF,0xFF,0x7F
S_unlockMagic s_magic9
.byte 0x02,0x00,0x09,0x00
.word 0x080AC5EC
.byte 0x05,0x00,0x02,0x00
.byte 0x00,0x00,0x00,0x00
.byte 0x02,0x00,0x00,0x00
.word 0x080ACFC4
@loc10:
.byte 0x02,0x00,0x02,0x00
.word @loc11
.byte 0x07,0xFF,0xFF,0x7F
.byte 0x0A,0x00,0x00,0x00
.byte 0x06,0x00,0x00,0x00
.byte 0x12,0xFF,0xFF,0x7F
.byte 0x10,0x00,0x00,0x00
.byte 0x06,0x00,0x00,0x00
.byte 0x13,0xFF,0xFF,0x7F
.byte 0x95,0x00,0x00,0x00
.byte 0x0A,0x00,0x14,0x00
.byte 0x18,0xFF,0xFF,0x7F
S_unlockMagic s_magicA
.byte 0x02,0x00,0x09,0x00
.word 0x080AC5EC
.byte 0x05,0x00,0x02,0x00
.byte 0x00,0x00,0x00,0x00
.byte 0x02,0x00,0x00,0x00
.word 0x080ACFC4
@loc11:
.byte 0x02,0x00,0x02,0x00
.word @loc12
.byte 0x07,0xFF,0xFF,0x7F
.byte 0x0B,0x00,0x00,0x00
.byte 0x06,0x00,0x00,0x00
.byte 0x12,0xFF,0xFF,0x7F
.byte 0x10,0x00,0x00,0x00
.byte 0x06,0x00,0x00,0x00
.byte 0x13,0xFF,0xFF,0x7F
.byte 0x95,0x00,0x00,0x00
.byte 0x0A,0x00,0x14,0x00
.byte 0x18,0xFF,0xFF,0x7F
S_unlockMagic s_magicB
.byte 0x02,0x00,0x09,0x00
.word 0x080AC5EC
.byte 0x05,0x00,0x02,0x00
.byte 0x00,0x00,0x00,0x00
.byte 0x02,0x00,0x00,0x00
.word 0x080ACFC4
@loc12:
.byte 0x02,0x00,0x02,0x00
.word @loc13
.byte 0x07,0xFF,0xFF,0x7F
.byte 0x0C,0x00,0x00,0x00
.byte 0x06,0x00,0x00,0x00
.byte 0x12,0xFF,0xFF,0x7F
.byte 0x10,0x00,0x00,0x00
.byte 0x06,0x00,0x00,0x00
.byte 0x13,0xFF,0xFF,0x7F
.byte 0x95,0x00,0x00,0x00
.byte 0x0A,0x00,0x14,0x00
.byte 0x18,0xFF,0xFF,0x7F
S_unlockMagic s_magicC
.byte 0x02,0x00,0x09,0x00
.word 0x080AC5EC
.byte 0x05,0x00,0x02,0x00
.byte 0x00,0x00,0x00,0x00
.byte 0x02,0x00,0x00,0x00
.word 0x080ACFC4
@loc13:
.byte 0x02,0x00,0x02,0x00
.word @loc14
.byte 0x07,0xFF,0xFF,0x7F
.byte 0x0D,0x00,0x00,0x00
.byte 0x06,0x00,0x00,0x00
.byte 0x12,0xFF,0xFF,0x7F
.byte 0x10,0x00,0x00,0x00
.byte 0x06,0x00,0x00,0x00
.byte 0x13,0xFF,0xFF,0x7F
.byte 0x95,0x00,0x00,0x00
.byte 0x0A,0x00,0x14,0x00
.byte 0x18,0xFF,0xFF,0x7F
S_unlockMagic s_magicD
.byte 0x02,0x00,0x09,0x00
.word 0x080AC5EC
.byte 0x05,0x00,0x02,0x00
.byte 0x00,0x00,0x00,0x00
.byte 0x02,0x00,0x00,0x00
.word 0x080ACFC4
@loc14:
.byte 0x02,0x00,0x02,0x00
.word @loc15
.byte 0x07,0xFF,0xFF,0x7F
.byte 0x0E,0x00,0x00,0x00
.byte 0x06,0x00,0x00,0x00
.byte 0x12,0xFF,0xFF,0x7F
.byte 0x10,0x00,0x00,0x00
.byte 0x06,0x00,0x00,0x00
.byte 0x13,0xFF,0xFF,0x7F
.byte 0x95,0x00,0x00,0x00
.byte 0x0A,0x00,0x14,0x00
.byte 0x18,0xFF,0xFF,0x7F
S_unlockMagic s_magicE
.byte 0x02,0x00,0x09,0x00
.word 0x080AC5EC
.byte 0x05,0x00,0x02,0x00
.byte 0x00,0x00,0x00,0x00
.byte 0x02,0x00,0x00,0x00
.word 0x080ACFC4
@loc15:
.byte 0x02,0x00,0x02,0x00
.word 0x080ACFC4
.byte 0x07,0xFF,0xFF,0x7F
.byte 0x0F,0x00,0x00,0x00
.byte 0x06,0x00,0x00,0x00
.byte 0x12,0xFF,0xFF,0x7F
.byte 0x10,0x00,0x00,0x00
.byte 0x06,0x00,0x00,0x00
.byte 0x13,0xFF,0xFF,0x7F
.byte 0x95,0x00,0x00,0x00
.byte 0x0A,0x00,0x14,0x00
.byte 0x18,0xFF,0xFF,0x7F
S_unlockMagic s_magicF
.byte 0x02,0x00,0x09,0x00
.word 0x080AC5EC
.byte 0x05,0x00,0x02,0x00
.byte 0x00,0x00,0x00,0x00
@loc0:
.byte 0x03,0x00,0x00,0x00 |
src/chips/Chip.asm | sharksym/vgmplay-sharksym | 6 | 101380 | <reponame>sharksym/vgmplay-sharksym<filename>src/chips/Chip.asm
;
; VGM chip
;
Chip: MACRO ?name, ?headerClockOffset, ?connecter
super: Device ?name
driver:
dw 0
driver2:
dw 0
headerClockOffset:
dw ?headerClockOffset
connecter:
dw ?connecter
ENDM
; ix = this
; iy = header
Chip_Construct:
call Device_Construct
ld e,(ix + Chip.headerClockOffset)
ld d,(ix + Chip.headerClockOffset + 1)
call Utils_GetDoubleWordIYOffset
jp Device_SetClock
; ix = this
Chip_Destruct: equ System_Return
; ret
; ix = this
; f <- z: not active
; Modifies: af, de, hl
Chip_IsActive: equ Chip_GetClock
; jp Chip_GetClock
; ix = this
; dehl <- clock (Hz)
; f <- z: not active
Chip_GetClock: equ Device_GetClock
; jp Device_GetClock
; ix = this
; f <- nz: dual chip
Chip_IsDualChip: equ Device_GetFlagBit6
; jp Device_GetFlagBit6
; ix = this
; hl <- name
Chip_GetName: equ Device_GetName
; jp Device_GetName
; hl = name
; ix = this
Chip_SetName: equ Device_SetName
; jp Device_SetName
; de = driver
; ix = this
Chip_SetDriver:
ld (ix + Chip.driver),e
ld (ix + Chip.driver + 1),d
ret
; de = driver
; ix = this
Chip_SetDriver2:
ld (ix + Chip.driver2),e
ld (ix + Chip.driver2 + 1),d
ret
; iy = drivers
; ix = this
Chip_Connect:
ld l,(ix + Chip.connecter)
ld h,(ix + Chip.connecter + 1)
jp hl
; ix = this
Chip_PrintInfo:
call Device_PrintInfo
ld de,Chip.driver
call Driver_PrintInfoIXOffset
call Chip_IsDualChip
ret z
call Device_PrintInfo
ld de,Chip.driver2
jp Driver_PrintInfoIXOffset
|
programs/oeis/275/A275346.asm | jmorken/loda | 1 | 28002 | <filename>programs/oeis/275/A275346.asm
; A275346: In Go, minimum total number of liberties player 1 (black) can have on a standard 19 X 19 board after n moves when no player passes a move, with no repeating game positions allowed.
; 2,1,2,1,1,0,1,0,1,0,1,0,1,0,1,0,1,0,1,0,1,0,1,0,1,0,1,0,1,0,1,0,1,0,1,0,1,0,1,0,1,0,1,0,1,0,1,0,1,0,1,0,1,0,1,0,1,0,1,0,1,0,1,0,1,0,1,0,1,0,1,0,1,0,1,0,1,0,1,0,1,0,1,0,1,0,1
mov $1,$0
gcd $1,2
lpb $0
mov $0,3
div $1,2
lpe
|
src/main/antlr/quova.antlr/QuovaParser.g4 | FauxKiwi/QuovaLanguage | 0 | 7120 | <reponame>FauxKiwi/QuovaLanguage<filename>src/main/antlr/quova.antlr/QuovaParser.g4<gh_stars>0
parser grammar QuovaParser;
options { tokenVocab = QuovaLexer; }
quovaFile
: ShebangLine? (PACKAGE identifier SEMI)? importHeader* declaration* EOF
;
importHeader
: IMPORT identifier (DOT STAR | AS simpleIdentifier)? SEMI
| FROM identifier IMPORT (STAR | simpleIdentifier (COMMA simpleIdentifier)*) SEMI
;
//////////////////
// DECLARATIONS //
//////////////////
declaration
: typeDeclaration
| functionDeclaration
| propertyDeclaration
| SEMI
;
typeDeclaration
: annotation* visibilityModifier?
( classDeclaration
| singletonDeclaration
| interfaceDeclaration
| enumClassDeclaration
| primitiveEnumDeclaration
| recordDeclaration
| inlineClassDeclaration
| annotationDeclaration )
;
classDeclaration
: inheritanceModifier? (SEALED | INNER)* CLASS simpleIdentifier variantTypeParameters? valueParameters? supertypes? (classBody | SEMI)
;
singletonDeclaration
: STATIC CLASS simpleIdentifier supertypes? (singletonBody | SEMI)
;
interfaceDeclaration
: ABSTRACT? INTERFACE simpleIdentifier variantTypeParameters? (COLON userType (COMMA userType)*)? (interfaceBody | SEMI)?
;
enumClassDeclaration
: ENUM CLASS? simpleIdentifier variantTypeParameters? valueParameters? supertypes? (enumClassBody | SEMI)
;
primitiveEnumDeclaration
: ENUM BITFIELD? primitiveNumberType simpleIdentifier (primitiveEnumBody | SEMI)
;
recordDeclaration
: RECORD simpleIdentifier variantTypeParameters? LPAREN valueParameter (COMMA valueParameter)* RPAREN (classBody | SEMI)
;
inlineClassDeclaration
: INLINE CLASS simpleIdentifier LPAREN valueParameter RPAREN (classBody | SEMI)
;
annotationDeclaration
: AT_INTERFACE simpleIdentifier annotationMembers
;
functionDeclaration
: annotation* functionModifiers typeParameters? (typeOrVoid | DEF) simpleIdentifier valueParameters throwExceptions? (functionBody | SEMI)
;
propertyDeclaration
: annotation* propertyModifiers (READONLY | CONST)? typeOrVar property (COMMA property)* SEMI
;
property
: simpleIdentifier ((LCURL (getter setter? | setter getter) RCURL)? (ASSIGN value=expression)? | LANGLE DASH delegate=expression)
;
///////////////////////
// DECLARATION PARTS //
///////////////////////
classBody
: LCURL classMember* RCURL
;
singletonBody
: LCURL singletonMember* RCURL
;
interfaceBody
: LCURL declaration* RCURL
;
primitiveEnumBody
: LCURL (primitiveEnumEntry (COMMA primitiveEnumEntry)*)? SEMI? RCURL
;
enumClassBody
: LCURL (enumClassEntries | enumClassEntries SEMI classMember* | classMember+) RCURL
;
annotationMembers
: LCURL (annotationParameter | classMember)* RCURL
;
classMember
: declaration
| constructor
| initBlock
;
singletonMember
: initBlock
| declaration
;
constructor
: annotation* visibilityModifier? typeParameters? (simpleIdentifier | CONSTRUCTOR) valueParameters constructorDelegations? (SEMI | functionBody)
;
constructorDelegations
: COLON constructorDelegation (COMMA constructorDelegation)*
;
constructorDelegation
: (THIS | superLiteral) valueArguments
;
initBlock
: STATIC? block
;
primitiveEnumEntry
: simpleIdentifier ((ASSIGN | SHL) expression)?
;
enumClassEntries
: enumClassEntry (COMMA enumClassEntry)*
;
enumClassEntry
: simpleIdentifier valueArguments? classBody?
;
annotationParameter
: annotation* type simpleIdentifier LPAREN RPAREN (DEFAULT expression)?
;
functionBody
: DOUBLE_ARROW expression SEMI
| block
;
valueParameters
: LPAREN (valueParameter (COMMA valueParameter)*)? RPAREN
;
valueParameter
: annotation* (CROSSINLINE | NOINLINE)? VAR? type ELLIPSIS? simpleIdentifier (ASSIGN expression)?
;
typeParameters
: LANGLE typeParameter (COMMA typeParameter)* RANGLE
;
typeParameter
: annotation* REIFIED? simpleIdentifier (COLON type (AMP type)*)?
;
variantTypeParameters
: LANGLE variantTypeParameter (COMMA variantTypeParameter)* RANGLE
;
variantTypeParameter
: annotation* varianceModifier? simpleIdentifier (COLON type (AMP type)*)?
;
valueArguments
: LPAREN (valueArgument (COMMA valueArgument)*)? RPAREN
;
valueArgument
: (simpleIdentifier ASSIGN)? expression
;
typeArguments
: LANGLE typeArgument (COMMA typeArgument)* RANGLE
;
typeArgument
: varianceModifier? type
| QUEST
;
supertypes
: COLON (supertype (COMMA supertype)*)
;
supertype
: userType (valueArguments | LANGLE DASH expression)?
;
throwExceptions
: THROWS userType (COMMA userType)*
;
getter
: annotation* GET (SEMI | LPAREN RPAREN functionBody)
;
setter
: annotation* SET (SEMI | LPAREN setterParameter RPAREN functionBody)
;
setterParameter
: annotation* simpleIdentifier
;
////////////////
// STATEMENTS //
////////////////
statement
: labeledStatement
| assignment SEMI
| ifStatement
| switchExpression
| loopStatement
| tryCatchFinally
| jumpStatement SEMI
| block
| declaration
| expression SEMI
;
simpleStatement
: ifStatement
| loopStatement
| block
| expression
;
labeledStatement
: simpleIdentifier COLON statement
;
assignment
: expression assignmentOperator expression
;
ifStatement
: IF LPAREN expression RPAREN statementBody (ELSE statementBody)?
;
loopStatement
: forStatement
| whileStatement
;
forStatement
: FOR LPAREN (classicForCondition | forEachCondition) RPAREN statementBody
;
classicForCondition
: (classicForVarDecl (COMMA classicForVarDecl)*)? SEMI
(expression (COMMA expression)*)? SEMI
(simpleStatement (COMMA simpleStatement)*)?
;
classicForVarDecl
: typeOrVar? simpleIdentifier ASSIGN expression
;
forEachCondition
: typeOrVar? simpleIdentifier COLON expression
;
whileStatement
: DO statementBody WHILE LPAREN expression RPAREN SEMI
| WHILE LPAREN expression RPAREN statementBody
;
statementBody
: (block | statement | SEMI)
;
jumpStatement
: BREAK simpleIdentifier
| CONTINUE
| THROW expression
| RETURN expression (AT simpleIdentifier)?
;
tryCatchFinally
: TRY LPAREN resource (SEMI resource)* RPAREN tryBody=statementBody catchBlock* (FINALLY finallyBody=statementBody)?
| TRY tryBody=statementBody (catchBlock* FINALLY finallyBody=statementBody | catchBlock+)
;
catchBlock
: CATCH LPAREN userType (PIPE userType)* simpleIdentifier RPAREN statementBody
;
resource
: identifier | annotation* typeOrVar simpleIdentifier ASSIGN expression
;
/////////////////
// EXPRESSIONS //
/////////////////
expression
: primaryExpression
| operatorExpression
| expression forSuffix
;
block
: LCURL statement* RCURL
;
operatorExpression
: operatorExpression (INCR | DECR | BANG BANG | invocationSuffix | indexingSuffix | callSuffix) #postfix
| (PLUS | DASH | INCR | DECR | BANG | TILDE | COLONCOLON) operatorExpression #prefix
| LPAREN type RPAREN QUEST? operatorExpression #cast
| operatorExpression (STAR | SLASH | PERCENT) operatorExpression #product
| operatorExpression (PLUS | DASH) operatorExpression #sum
| operatorExpression (SHL | SHR | USHR) operatorExpression #shift
| operatorExpression RANGE operatorExpression #range
| operatorExpression ELVIS operatorExpression #elvis
| operatorExpression (inOperator | instanceOperator) operatorExpression #namedCheck
| operatorExpression SPACESHIP operatorExpression #spaceship
| operatorExpression (LANGLE | RANGLE | LE | GE) operatorExpression #comparison
| operatorExpression (EQEQ | NOT_EQ | EQEQEQ | NOT_EQEQ) operatorExpression #equality
| operatorExpression AMP operatorExpression #bitAnd
| operatorExpression CARET operatorExpression #bitXor
| operatorExpression PIPE operatorExpression #bitOr
| operatorExpression CONJ operatorExpression #conjunction
| operatorExpression DISJ operatorExpression #disjunction
| <assoc=right> operatorExpression QUEST expression COLON expression #ternary
| ELLIPSIS operatorExpression #spread
| <assoc=right> operatorExpression assignmentOperator operatorExpression #assign
| primaryExpression #primary
;
invocationSuffix
: typeArguments? (valueArguments lambdaBody? | lambda | lambdaBody)
;
indexingSuffix
: LSQUARE expression (COMMA expression)* RSQUARE
;
callSuffix
: DOT CLASS
| (QUEST? DOT | COLONCOLON) expression
;
forSuffix
: FOR forEachCondition (IF expression)?
;
primaryExpression
: LPAREN expression RPAREN
| constructorInvocation
| literal
| identifier
;
constructorInvocation
: NEW userType (valueArguments | initializerList)
| NEW (primitiveTypeNoArray | userType) (LSQUARE RSQUARE)+ initializerList
| NEW (primitiveTypeNoArray | userType) arraySize+
;
arraySize
: LSQUARE expression RSQUARE
;
switchExpression
: SWITCH LPAREN expression RPAREN LCURL (switchCondition ARROW statementBody)* (DEFAULT ARROW statementBody)? RCURL
| whenExpression
;
switchCondition
: (CASE | inOperator | instanceOperator) expression ((COMMA expression)+ | COMMA switchCondition)?
;
whenExpression
: IF LCURL (whenCondition ARROW statementBody)* (ELSE ARROW statementBody)? RCURL
;
whenCondition
: expression (COMMA expression)*
;
//////////////
// LITERALS //
//////////////
literal
: STRING_LITERAL | RAW_STRING_LITERAL | REGEX_LITERAL //stringLiteral
| MULTILINE_STRING_LITERAL //multilineStringLiteral
| THIS
| superLiteral
| INTEGER_LITERAL
| LONG_LITERAL
| UINT_LITERAL | ULONG_LITERAL
| REAL_LITERAL
| CHAR_LITERAL
| TRUE
| FALSE
| NULL
| VOID
| lambda
| initializerList
;
/*stringLiteral
: STRING_LITERAL stringLiteralContent* END
;
stringLiteralContent
: CHARACTERS
| SINGLE_EXPR
| stringLiteralExpression
;
stringLiteralExpression
: COMPLEX_EXPR expression RCURL
;
multilineStringLiteral
: MULTILINE_STRING_LITERAL multilineStringLiteralContent* END
;
multilineStringLiteralContent
: CHARACTERS
| stringLiteralExpression
;*/
superLiteral
: SUPER (LANGLE userType RANGLE)?
;
lambda
: (lambdaParameter | LPAREN (lambdaParameter (COMMA lambdaParameter)*)? RPAREN) ARROW (lambdaBody | expression)
;
lambdaParameter
: (annotation* typeOrVar)? simpleIdentifier
| UNDERSCORE
;
lambdaBody
: LCURL statement* expression? RCURL
;
initializerList
: LCURL (valueArgument (COMMA valueArgument)*)? RCURL
| dictionaryInitializer
;
dictionaryInitializer
: LCURL (expression COLON expression (COMMA expression COLON expression)*)? RCURL
;
///////////////
// OPERATORS //
///////////////
assignmentOperator
: ASSIGN
| PLUS_ASSIGN
| MINUS_ASSIGN
| TIMES_ASSIGN
| DIV_ASSIGN
| MOD_ASSIGN
| AND_ASSIGN
| XOR_ASSIGN
| OR_ASSIGN
| SHL_ASSIGN
| SHR_ASSIGN
| USHR_ASSIGN
| COALESCING_ASSIGN
;
inOperator
: IN
| NOT_IN
;
instanceOperator
: INSTANCEOF
| NOT_INSTANCEOF
;
///////////
// TYPES //
///////////
typeOrVoid
: type
| VOID
;
typeOrVar
: type
| VAR
;
type
: (typeReference | functionType) (LSQUARE RSQUARE)* QUEST?
;
typeReference
: primitiveType
| userType
;
primitiveTypeNoArray
: primitiveNumberType
| FLOAT
| DOUBLE
| CHAR
| BOOLEAN
;
primitiveType
: primitiveTypeNoArray (LSQUARE RSQUARE)?
;
primitiveNumberType
: BYTE
| SBYTE
| SHORT
| USHORT
| INT
| UINT
| LONG
| ULONG
;
userType
: identifier typeArguments?
;
functionType
: SUSPEND? FUNCTION LANGLE typeOrVoid LPAREN (type (COMMA type)*)? RPAREN RANGLE
;
///////////////
// MODIFIERS //
///////////////
annotation
: AT identifier typeArguments? (LPAREN (annotationArgument (COMMA annotationArgument)*)? RPAREN)?
;
annotationArgument
: (simpleIdentifier ASSIGN)? LCURL (expression (COMMA expression)*)? RCURL
| valueArgument
;
functionModifiers
: visibilityModifier? inheritanceModifier?
( INLINE
| TAILREC
| STATIC
| DEFAULT
| SUSPEND
| STRICTFP
| SYNCHRONIZED
| NATIVE )*
;
visibilityModifier
: PUBLIC
| PRIVATE
| INTERNAL
| PROTECTED
;
inheritanceModifier
: FINAL
| ABSTRACT
| VIRTUAL
;
varianceModifier
: IN
| OUT
;
propertyModifiers
: visibilityModifier? inheritanceModifier?
( READONLY
| STATIC
| CONST
| VOLATILE
| TRANSIENT )*
;
/////////////////
// IDENTIFIERS //
/////////////////
identifier
: simpleIdentifier (DOT simpleIdentifier)*
;
simpleIdentifier
: IDENTIFIER
| IMPORT
| ENUM
| RECORD
| TYPEDEF
| DEF
| AS
| BITFIELD
| CONSTRUCTOR
| THROWS
| SEALED
| DEFAULT
| GET
| SET
| PUBLIC
| PRIVATE
| INTERNAL
| PROTECTED
| READONLY
| FINAL
| ABSTRACT
| VIRTUAL
| INLINE
| TAILREC
| SUSPEND
| NOINLINE
| CROSSINLINE
| REIFIED
| OUT
| CONST
| STRICTFP
| NATIVE
| SYNCHRONIZED
| TRANSIENT
| VOLATILE
; |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.