ときどきの雑記帖 RE* (新南口)
Call of Cthulhu
MATのが欲しい
円谷プロ作品に登場する防衛チームのバッジを商品化!流星バッジA・B、MATバッジ、SGMバッジ、マイティジャックバッジの全5種で展開! | 電撃ホビーウェブ
ウルトラ警備隊がないのが意外な感じ。
洋書のお値段
ふと気になってO’reillyの本の近刊を調べてみたら、 面白そうなタイトルが見つかったのはいいんだけど 値段を見て考え込むなど。
.jpだと元の値段がわからないので、.comで同じ本を調べると
- Learning Functional Programming: Managing Code Complexity by Thinking Functionally
- Fluent C: Principles, Practices, and Patterns
…うーむ。
Mother of COBOL
つづき。
本当のところどうなのかはさておき、 じゃあなぜCOBOLのおばちゃま(Grace Hopper)が 「Mother of COBOL」と呼ばれるようになったのかが気になるわけで。
ということで まずは COBOL - Wikipedia をみていくとこんな記述が見つかった。
The committee mainly examined the FLOW-MATIC, AIMACO and COMTRAN programming languages.[24][33] The FLOW-MATIC language was particularly influential because it had been implemented and because AIMACO was a derivative of it with only minor changes.[34][35] FLOW-MATIC’s inventor, Grace Hopper, also served as a technical adviser to the committee.[28] FLOW-MATIC’s major contributions to COBOL were long variable names, English words for commands and the separation of data descriptions and instructions.[36] Hopper is sometimes referred to as “the mother of COBOL” or “the grandmother of COBOL”,[37][38][39] although Jean Sammet, a lead designer of COBOL, stated that Hopper “was not the mother, creator or developer of Cobol”.[40][1]
(略) In 1980, Grace Hopper commented that “COBOL 60 is 95% FLOW-MATIC” and that COMTRAN had had an “extremely small” influence. Furthermore, she said that she would claim that work was influenced by both FLOW-MATIC and COMTRAN only to “keep other people happy [so they] wouldn’t try to knock us out”.[46] Features from COMTRAN incorporated into COBOL included formulas,[47] the PICTURE clause,[48] an improved IF statement, which obviated the need for GO TOs, and a more robust file management system.[41]
最初のパラグラフの最後にJean Sammetの発言(の一部)がありますね。
そして二つ目のパラグラフでは、
Grace Hopper が"COBOL 60 is 95% FLOW-MATIC"
とコメントしたとある。
後続の部分も含めてこういうコメントをしていたのなら、
mother of COBOL
やそれに類するものを
自称しても(それ自体の是非はさておき)不思議はない気もするけど、
実際のところはどうなんですかね。
ということでリンクをたどると
https://web.archive.org/web/20171225202555/http://archive.computerhistory.org/resources/text/Oral_History/Hopper_Grace/102702026.05.01.pdf
もしくは
http://archive.computerhistory.org/resources/text/Oral_History/Hopper_Grace/102702026.05.01.pdf
のp.37に95% FLOW-MATIC
が見つかりました。
それを含む部分をざっと眺めると…
(訳は各自で頼む😄)
COBOL and CODASYL
Pantages: What were you working on at that point that you felt needed that kind of concentration, the three or four earmarked developments?
Hopper: The real development of what COBOL is today. The very first COBOL was pretty naïve when you think about it. And the first COBOL, the early COBOL’s, were built for the dedicated computer, where there was no such thing as interrelationship with an operating system or anything else. Each program was a unit in itself and it ran all by itself. And we began to come up to the point of the interactions, and the direct access and all those things that were beginning to appear. And the compilers were going to have to change.
Pantages: Where are we now, at post COBOL 60?
Hopper: This is where we step forward into the real COBOL we have today: where you have things interacting, things happening simultaneously. And we began to think about systems and computers and communications between them. This is where communications really comes in, where they aren’t just on an access, asking a question, but beginning to really interact.
Pantages: Is this what you took your group off to do?
Hopper: Yes, we were beginning to look toward the future. People were beginning to have three UNIVAC IIs instead of just one. The whole thing was no longer monolithic.
Pantages: Univac was of course one of the real pioneers…
Hopper: Has been all the way along the line, which people have forgotten
Pantages: …but in real-time and on-line programming.
Hopper: And that influence was coming in from the Navy on account of the nuclear submarines… where you had three computers operating simultaneously and they had to compare. That influence is beginning to penetrate, and of course, there again I was getting the feed-in on my training duty, and that reinforced the idea of multiple computers.
Pantages: What was your role in this?
Hopper: As far as the Navy was concerned I was a listener. What would it do in business. I was listening to everything under the sun, from every direction at all times and reading everything I could get my hands on. And then trying to see how I could put them together and use them in the business environment. Being alone I spent a lot more time reading than most people did. So these things were coming at me from all directions and I was trying to figure out how to use them.
Pantages: Howard Bromberg said he complained to you about that. He said you would ride home together in the evening and you would talk about a problem that needed solution. And you’d discuss it a bit. He said, “I’d go home and read a newspaper. And I’d pick Hopper up in the morning and at 8 o’clock she would have the problem solved. I told her she was taking our problem-solving fun away from us.”
Hopper: Again it was a constant reading in all areas. People sort of stayed in separate boxes, but if you combined the boxes, you had the answer. I didn’t invent the answer. It was being aware of everything that was going on and combining the pieces.
Pantages: In parallel – at the same time this was going on, CODASYL – it started a few years earlier, right? And you were involved in that.
Hopper: Yes, it started in 1958. But the leadership of that was Cunningham. And Jack Jones and Al Ash, the Air Force.
Pantages: That goes back to the development of COBOL itself, right?
Hopper: That’s right.
Pantages: Your role was to implement the specs they came up with.
Hopper: We’d written FLOW-MATIC before that, and if you take the FLOW-MATIC manual and compare it with COBOL 60 you’ll find COBOL 60 is 95% FLOW-MATIC. So the influence of Commercial Translator in fact was extremely small. But I figured the thing to do was corral those people and when we had something to say, we’d say it was a compound of FLOW- MATIC and Commercial Translator and keep the other people happy and wouldn’t try to knock us out. We’d give them some credit and they’d have to get on board with us. But if you compare the two manuals you’d find that it had hardly any influence at all. But if you gave them credit for it, why they’d go right along with you. If you didn’t, they’d fight you. You can always give credit, you can always afford to.
That again is the practical. Think about the other guy and his position and his interest. You are always trying to work with people rather than against them. You’ve got a new idea; give the boss credit for it. It doesn’t cost you anything.
Pantages: COMTRAN was an IBM development wasn’t it? That’s what they wanted rather than COBOL. So that’s the way you got around them.
Hopper: Yeah, give them credit for it. Meld it into COBOL. Bob Bemer went along with it. He was the original representative to CODASYL for IBM. He’d gone back as head of the scientific engineering FORTRAN group and Bob Bemer was the one doing the data processing side and he and I were originally technical advisors to the CODASYL committee.
Pantages: Are you still an advisor?
Hopper: No, they decided that was giving too much favoritism to Univac and IBM. Eventually I was actually a member… after I stopped working for Univac and became a user. I’m on the executive committee. I was the Univac representative on the COBOL committee, until I found that I was fighting for my ideas instead of looking at the whole picture and decided they better put someone else on. You can get too wrapped up in your own ideas.
Pantages: People have said those two things about you – not that you get wrapped up in your own ideas, but you are very strong for your own ideas. “The problem with Hopper was that she’s right most of the time.” On the other hand – and people would turn around – I think you very successfully carried this off – they would say, “She is always willing to listen to someone else’s ideas.” So you are very successful in defense of your own ideas, but people still have the sense that you will give them their day if they can prove it to you.
Hopper: Yes, because some times I get out of date. I’ve got to listen to the new ones. When someone comes up with good ideas, I will sell theirs as hard as I sell mine. When we came to the sub routines, it was George [Baird’s] ideas of how we could fix our programs to run on anyone’s computer. And I’ve been selling that every since. Because most people haven’t realized it yet. It was George who wrote the program – when we wrote the COBOL program, he invented the way by which to used Xs, x sub something for the special names and control cards. And then he stored little files that contained those. So he just told the routine which computer was one and he stuck the special names and control cards and off he went. That was totally George Baird’s convention. And people still haven’t fully appreciated that. Those test routines for both COBOL and FORTRAN would run on anybody’s computer and they have – by sticking to the standard language in his technique for handling the control cards. George is the one that came up with that.
if you take the FLOW-MATIC manual and compare it with COBOL 60 you’ll find COBOL 60 is 95% FLOW-MATIC.
とまで言うんだから、比較してみたらどうなんだろうと思ったものの
COBOL 60の資料がすぐには見つかりそうにないなあ。
Mother of COBOL
実際のところどのくらい使われていたのかはわからないけど ちょっと探しただけでも結構見つかる。
- Grace Hopper - The Mother of Cobol
- A Salute to Grace Hopper, the Grandmother of COBOL
- Who is the mother of COBOL? - FAQs
- Grace Hopper
いつ頃から使われ始めたんだろう?
HOPL
当然のように(?)、HOPLにはCOBOLもあった(出ていた)のだけど なにか参考になりそうな記述(発言)は残されていないだろうか。 HOPLの本は持っていたはずだがさてどこだ。
ところで The beginning and development of FORMAC (FORmula MAnipulation Compiler) | ACM SIGPLAN Notices にJean Sammetの名前がありますね。
FORTRAN Compiler on IBM 704
以前ネタ振りだけした配列要素の並べ方のはなし。
column major
FORTRAN のp.11 Arrangement of Arrays in Storageに
A 2-dimensional array A will, in the object program, be stored sequentialy in the order A1,1, A2,1, …., Am,1, A1,2, A2,2, ….., Am,2, ……, Am,n. Thus it is stored “columnwise”, with the first of its subscripts varying most rapidly, and the last varying least rapidly. The same is true of 3-dimensional arrays. 1-dimentional arrays are of course simply stored sequentially. All arrays are stored backwards in storage; i.e, the above sequence is in the order of decreasing absolute location.
order of decreasing absolute location
が気になるけど、
the first of its subscripts varying most rapidly
と最初の次元の添え字が最も頻繁に変化する==column major
であるとしっかり書かれている(当然と言えば当然)。
さて、ここで4行4列の二次元配列を考えてみる (以後の説明の簡単のため、0始まりかつ配列要素の大きさは1として表す)。
(0,0) (0,1) (0,2) (0,3)
(1,0) (1,1) (1,2) (1,3)
(2,0) (2,1) (2,2) (2,3)
(3,0) (3,1) (3,2) (3,3)
こんなの。
これを一次元に並べるとすると row majorではこんなイメージになり
(0,0) (0,1) (0,2) (0,3) (1,0) (1,1) (1,2) (1,3) (2,0) (2,1) (2,2) (2,3) (3,0) (3,1) (3,2) (3,3)
一方column majorではこうなる。
(0,0) (1,0) (2,0) (3,0) (0,1) (1,1) (2,1) (3,1) (0,2) (1,2) (2,2) (3,2) (0,3) (1,3) (2,3) (3,3)
さらに大きい3×3×3の三次元配列で考えると (二次元で表すのはつらいけど)
(0, 0, 0) (0, 0, 1) (0, 0, 2)
(0, 1, 0) (0, 1, 1) (0, 1, 2)
(0, 2, 0) (0, 2, 1) (0, 2, 2)
(1, 0, 0) (1, 0, 1) (1, 0, 2)
(1, 1, 0) (1, 1, 1) (1, 1, 2)
(1, 2, 0) (1, 2, 1) (1, 2, 2)
(2, 0, 0) (2, 0, 1) (2, 0, 2)
(2, 1, 0) (2, 1, 1) (2, 1, 2)
(2, 2, 0) (2, 2, 1) (2, 2, 2)
column majorでは(row majorは略)
(0, 0, 0)
(1, 0, 0)
(2, 0, 0)
(0, 1, 0)
(1, 1, 0)
(2, 1, 0)
(0, 2, 0)
(1, 2, 0)
(2, 2, 0)
(0, 0, 1)
(1, 0, 1)
(2, 0, 1)
(0, 1, 1)
(1, 1, 1)
(2, 1, 1)
(0, 2, 1)
(1, 2, 1)
(2, 2, 1)
(0, 0, 2)
(1, 0, 2)
(2, 0, 2)
(0, 1, 2)
(1, 1, 2)
(2, 1, 2)
(0, 2, 2)
(1, 2, 2)
(2, 2, 2)
こうなる(途中の空行で何かを察して欲しい😄)。
ここでこういった配列にある要素にアクセスすることを考える。 まず一番単純な一次元配列から。
配列の先頭アドレスがAとして以下の要素にアクセスするときのアドレスは それぞれ
A(0) → A
A(1) → A+1
A(2) → A+2
のようになる。
次に二次元配列。ここでは先に挙げた例と同じく4×4のもので考えると
A(0,0) → A+0
A(1,0) → A+1
A(2,0) → A+2
A(3,0) → A+3
A(0,1) → A+4
A(0,2) → A+0+(2*4)
A(0,3) → A+0+(3*4)
A(1,3) → A+1+(3*4)
となる。
左の次元をi、 右の次元をjで表して これを一般化するとこうなる。
A(i) → A + i
A(i,j) → A + i + j*(iの次元の要素数)
そして三次元配列まで考えるとこう
A(i,j,k) → A + i + j*(iの次元の要素数) + k*(iの次元の要素数*jの次元の要素数)
つまりどういうことかというと、 row majorだとすべての次元の添え字を見てからでないと 目的のアドレスが求められないのに対し、 column majorでは左から見て出てきた順に計算していけばよいということになる。
で、FORTRAN IIの添え字関連の部分と思われるコード。
DIMSR CAL SA IF THIS VARIABLE 4F12921
SLW E+2 DOES NOT HAVE A SUBSCRIPT, THEN 4F12922
RD1 TSX DIM1SR,4 * GO SEARCH DIM1 TABLE, 4F12923
TXI RD2,0 IF FOUND, THEN 4F12924
CS1 CLA D12 PICKUP DIMENSION 1 4F12925
TXI DVS,0 AND GO TEST SIZE. OTHERWISE, 4F12926
RD2 TSX DIM2SR,4 * GO SEARCH DIM2 TABLE. 4F12927
TXI RD3,0 AND IF FOUND, 4F12928
CS2 LDQ D12 PICKUP 4F12929
STZ N2 DIMENSION 1 AND 4F12930
SLQ N2 DIMENSION 2 4F12931
LGL 18 AND MULTIPLY 4F12932
MPY N2 THEM TOGETHER. 4F12933
ARS 1 THEN 4F12934
TXI DVS,0 GO TEST THE PRODUCT. OTHERWISE, 4F12935
RD3 TSX DIM3SR,4 * GO SEARCH DIM3 TABLE. 4F12936
TXI NODIM,0 AND IF FOUND, 4F12937
CS3 LDQ D12 PICKUP 4F12938
STZ N2 DIMENSION 1, 4F12939
SLQ N2 DIMENSION 2, 4F12940
LGL 18 AND DIMENSION 3. 4F12941
MPY N2 MULTIPLY 4F12942
LRS 18 THEM TOGETHER, 4F12943
MPY D3 AND IF 4F12944
LLS 17 THEIR 4F12945
DVS SUB L(1) PRODUCT IS 4F12946
TZE NODIM GREATER THAN 1, THEN 4F12947
ALS 18 PLACE DIMENSION-1 IN THE 4F12948
STO G DECREMENT OF G, AND 4F12949
TSX FXCNIX,4 * GO ENTER IN FIXCON, AND GET TAG. 4F12950
ALS 18 ADJUST, AND STORE TAG IN THE 4F12951
STD RAT DECREMENT OF RAT. THEN 4F12952
TSX JIF,4 * GO JUMP IFN, AND SET SL AND TL. 4F12953
TSX CIT,4 * GO MAKE THE FOLLOWING CIT ENTRY= 4F12954
PZE SL WORD1--0(IFN)000 4F12955
PZE LXD WORD2--LXD000 4F12956
PZE 2P WORD3--200000 4F12957
PZE RAT WORD4--0(FIXCON TAG)008 4F12958
TSX JIF,4 * GO JUMP IFN, AND SET SL AND TL. 4F12959
TSX ETMSW,4 * IF LTMSW = NOP, COMPILE LTM. SL=0. 4F12960
TSX CIT,4 * GO MAKE THE FOLLOWING CIT ENTRY= 4F12961
PZE SL WORD1--0(IFN)000 OR 000000 4F12962
PZE OP WORD2--(OPERATION CODE) 4F12963
PZE SA WORD3--(SYMBOLIC ADDRESS) 4F12964
PZE ST WORD4--000008 4F12965
STZ SL CLEAR SL, AND 4F12966
TSX LTMSW,4 * IF LTMSW = NOP, COMPILE LTM. SL=0. 4F12967
TSX GIF,4 * GET IFN IN SL AND TL. 4F12968
TSX CIT,4 * GO MAKE THE FOLLOWING CIT ENTRY= 4F12969
PZE L(0) WORD1--000000 4F12970
PZE TIX WORD2--TIX001 4F12971
PZE SL WORD3--0(IFN)000 4F12972
PZE ST WORD4--000008 4F12973
STZ SL CLEAR SL, AND 4F12974
TSX ETMSW,4 * IF ETMSW = NOP, COMPILE ETM, SL=0. 4F12975
TSX CIT,4 * GO MAKE THE FOLLOWING CIT ENTRY= 4F12976
PZE L(0) WORD1--000000 4F12977
PZE DED WORD2--DED000 4F12978
PZE L(0) WORD3--000000 4F12979
PZE ST WORD4--000008 4F12980
TXI CMA5,0 IF THE PRODUCT OF DIMENSIONS IS 4F12981
NODIM TSX IFFIX,1 * LESS THAN 2, TEST TYPE OF VARIABLE, 4F12982
TXI CMA5,0 AND IF FIXED POINT, 4F12983
TSX TET00,1 * GO ENTER VARIABLE IN 4F12984
INOUT PZE ** EITHER FORVAL OR FORVAR TABLE. 4F12985
CMA5 TSX CIT,4 * GO MAKE THE FOLLOWING CIT ENTRY= 4F12986
PZE SL WORD1--0(IFN)000 OR 000000 4F12987
PZE OP WORD2--NTR000 OR CPY000 4F12988
PZE SA WORD3--(SYMBOL) 4F12989
PZE RA WORD4--(RELATIVE ADDRESS) 4F12990
STZ SL CLEAR SL, AND 4F12991
STZ GTAG CLEAR GTAG. THEN TAKE EXIT 4F12992
CMA3 TXI NXS,0 * SWITCH TO RPT OR NXS, 4F12993
REM END OF PROGRAM CMA. 4F12994
REM ******* *********************** 4F12995
REM DIM.SR,4/ CALLS=DIAG. CALLERS=C1200,SS000,CMA. 4F10621
REM DIM.SR SEARCHS THE DIMENSION TABLES. ENTRANCE IS TO DIM1SR, 4F10622
REM DIM2SR, OR DIM3SR ACCORDING TO THE DIMENSION. 4F10623
REM DIM1SR= ENTRY POINT FOR 1 DIMENSION TABLE. 4F10624
DIM1SR SXD DMSR00,4 SAVE THE C(XR4) FOR RETURN, 4F10625
LXD DIM1IX-3,4 SET XR4 = NUMBER OF ENTRIES IN DIM14F10626
CLA ORGDM1 AND PICK UP 1ST ADDRESS 0F DIM1 TO 4F10627
DMSR00 TXI DMSR01,0,** GO SET DRUM ADDRESS. 4F10628
REM DIM2SR= ENTRY POINT FOR 2 DIMENSION TABLE. 4F10629
DIM2SR SXD DMSR00,4 SAVE THE C(XR4) FOR RETURN, 4F10630
LXD DIM2IX-3,4 SET XR4 = NUMBER OF ENTRIES IN DIM24F10631
CLA ORGDM2 AND PICK UP 1ST ADDRESS OF DIM2 TO 4F10632
DMSR01 STA DRMADR SET DRUM ADDRESS. 4F10633
CLA DMSR99 SET LOOP ADDRESS TO 4F10634
STA DMSR15 DMSRO5+1 FOR DIM1 AND DIM2. 4F10635
CAL DMCN12 (STZ D3) 4F10636
DMSR11 TXI DMSR02,0,** GO SET OP FOR DIM1 AND DIM2. 4F10637
REM DIM3SR= ENTRY POINT FOR 3 DIMENSION TABLE. 4F10638
DIM3SR SXD DMSR00,4 SAVE THE C(XR4) FOR RETURN, 4F10639
LXD DIM3IX-3,4 SET XR4 = NUMBER OF ENTRIES IN DIM34F10640
CLA ORGDM3 AND PICK UP 1ST ADDRESS 0F DIM3 TO 4F10641
STA DRMADR SET DRUM ADDRESS. 4F10642
CLA DMSR98 SET LOOP ADDRESS TO 4F10643
STA DMSR15 DMSR05 FOR DIM3. 4F10644
CAL DMCN3 (CPY D3) 4F10645
DMSR02 SLW DMSR05 4 SET OP CODES ACCORDING 4F10646
SLW DMSR07 TO DIMENSION. 4F10647
TXL DMSR08,4,0 IF TABLE IS EMPTY, GO OUT. 4F10648
SXD DMSR11,4 SAVE ENTRY COUNT IN CASE OF ERROR. 4F10649
DMSR14 LXA L(5),4 SET ERROR COUNTER FOR 5 ATTEMPTS. 4F10650
DMSR13 SXD DMSR12,4 SAVE ERROR COUNTER, AND 4F10651
LXD DMSR11,4 RESET ENTRY COUNT. 4F10652
RDR 3 SELECT DRUM. 4F10653
CLA E+2 GET NAME OF VARIABLE. 4F10654
LDA DRMADR LOAD CURRENT DRUM ADDRESS, AND 4F10655
DMSR04 CPY DRSYM COPY DRUM SYMBOl. 4F10656
TLQ DMSR06 COMPARE WITH NAME OF VARIABLE, AND 4F10657
CPY D12 IF NOT LESS, COPY N1 AND N2. 4F10658
DMSR05 PZE D3 (DIM1 AND DIM2 = STZ , DIM3 = CPY).4F10659
CPY DRCKSM COPY CHECKSUM. 4F10660
CAS DRSYM COMPARE DRUM SYMBOL WITH NAME OF V.4F10661
TSX DIAG,4 * GO TO DIAGNOSTIC - MACHINE ERROR. 4F10662
DMSR12 TXI DMSR09,0,** IF NOT EQUAL, THEN 4F10663
CPY DRSYM CONTINUE 4F10664
TLQ DMSR06 PROCESS 4F10665
CPY D12 UNTIL 4F10666
DMSR15 TIX **,4,1 TABLE 4F10667
TXI DMSR08,0 IS EXHAUSTED. 4F10668
DMSR06 CPY D12 PASS OVER ENTRY 4F10669
DMSR07 PZE D3 (DIM1 AND DIM2 = STZ, DIM3 = CPY). 4F10670
CPY DRCKSM AND CHECKSUM, AND 4F10671
TIX DMSR04,4,1 REPEAT LOOP. 4F10672
DMSR08 LXD DMSR00,4 RESTORE THE C(XR4), AND 4F10673
TRA 1,4 * TAKE NOT FOUND EXIT. 4F10674
DMSR09 CAL DRSYM COMPUTE A 4F10675
ACL D12 NEW 4F10676
ACL D3 LOGICAL CHECKSUM 4F10677
COM FOR ENTRY, AND 4F10678
ACL DRCKSM COMPARE WITH 4F10679
COM DRUM CHECKSUM. 4F10680
TZE DMSR10 IF NOT EQUAL, THEN 4F10681
LXD DMSR12,4 REPEAT ATTEMPT, 4F10682
TIX DMSR13,4,1 UNLESS PROCESS 4F10683
TSX DIAG,4 * FAILED 5 TIMES IN READING DRUM. 4F10684
DMSR10 LXD DMSR00,4 RESTORE THE C(XR4), AND 4F10685
TRA 2,4 * TAKE FOUND EXIT TO MAIN ROUTINE. 4F10686
REM 4F10687
DMCN12 STZ D3 CONSTANT USED BY DIM.SR. 4F10688
DMCN3 CPY D3 CONSTANT USED BY DIM.SR. 4F10689
ENT BCD 1NTR000 VARIABLE USED BY IO AND FL. 4F10690
NZE BCD 1PZE000 VARIABLE USED BY FL. 4F10691
REM END OF PROGRAM DIM.SR. 4F10692
って馴染みのないアーキテクチャのアセンブリ言語貼られても困るよね😓
自分もまだ大雑把にしか理解できていないのよ😄
— けしかん🌪️ (@keshinomi_88pro) September 17, 2022
16→32→64→128
もう64ビットのアドレス空間では足りない - Matthew Wilcox が提唱した "ZettaLinux" 計画では、128ビットレジスタのCPUを想定している。彼は128ビットのアドレスが必要になるのは2035年ごろと想定しているが、ASLRの需要を考えるともっと早いという専門家もいる。https://t.co/s7TZFL701s
— 新山祐介 (Yusuke Shinyama) (@mootastic) September 18, 2022
アドレス長が128bitな時代にLinuxカーネルはどうあるべきかについて。Linuxカーネルはさまざまな部分で「ポインタは長くても64bit」という前提で実装されていて、どう移行を進めれば「32bitから64bitの時ほど苦しまずに」128bitに対応できるかについての提案がなされているhttps://t.co/fmKXoZ0srq
— Fadis (@fadis_) September 16, 2022
同じ話題を取り上げているけど、Fadisさんは複数ツイートでより詳細に説明している (ありがたや)。
このような理由から128bitアドレス空間はわりと現実的な期間のうちに必要になると考えられている。実際の128bit ISAとしては128bitの RISC-V rv128が既に提案されているが、ここで一緒に提案されているABIではポインタは128bitにするが、longは引き続き64bitにする事が提案されている
— Fadis (@fadis_) September 16, 2022
ところがLinuxカーネルの中には「longはポインタの値を保持するのに十分な長さがある」という期待をする行儀の悪いコードが山ほどあり、long 64bit ポインタ 128bitを採用するのは辛い改修を乗り越える必要がある。そこで128bitのLinuxカーネルではlongを128bitにしようという提案がなされている
— Fadis (@fadis_) September 16, 2022
intが32bitでlongが128bitになると64bit整数を表す型がなくなってしまう為、これをするには何らかのコンパイラの拡張を使って64bit整数型を作れるようにする必要がある
— Fadis (@fadis_) September 16, 2022
この流れからふと「Cプログラマーの十戒」 (The Ten Commandments for C Programmers (Annotated Edition)) を思い出したのだけど、該当するのがないな? 「(longではなく)intとポインターの大きさが同じだという仮定をするな」 みたいのがあったと思ったんだけど…
移行そのものの手間とかlongの大きさとか64bit長の整数型名云々はまあ (longを128bitにしたらlong longは256bit?)。
同時にAS/400も思い浮かんだのだけど
IBM AS/400、今のSystem iは1988年の登場当初から論理アドレス128bit。しかもOSすらアドレス長を意識してない。秘密はTIMI。僕が本物の仮想記憶だと思う単一レベル記憶を実装。RDBMSは前身のSystem/38からハードがサポート。https://t.co/ejP94juKYchttps://t.co/Kmmst6HIoc
— Shozaburo Nakamura (@shownakamura) September 17, 2022
という引用ツイートがあって、どうも中村正三郎さん らしくてなるほどなと (昔からAS/400推しだった)。
CVE-2020-10735
Pythonの多倍長演算(bignum)は非効率であり、これがDDoS攻撃に使われる可能性は2年前のCVEで知られていたが、最近やっと対処された。しかしこの対応 (sys.set_int_max_str_digitsで最大桁数を指定、デフォルトは4300桁) はアドホックであり、論議を呼んでいる。https://t.co/YJDAjGk1C6
— 新山祐介 (Yusuke Shinyama) (@mootastic) September 18, 2022
CVEに対処というのは記憶にあったのだけど2年前というのに 引っかかったので改めて見返してみると 確かに2年前のもの(CVE-2020-10735)だった。
- CVE-2020-10735: Prevent DoS by large int<->str conversions · Issue #95778 · python/cpython
- Prevent DoS by large int-str conversions | Hacker News
- Python Insider: Python releases 3.10.7, 3.9.14, 3.8.14, and 3.7.14 are now available