From 34c7ffbf53ccd96c03ef8954e4c7a560cb7cd96a Mon Sep 17 00:00:00 2001 From: crc <> Date: Mon, 8 Aug 2022 16:04:29 +0000 Subject: [PATCH] mem:get is now mem:fetch, mem:set is now mem:store FossilOrigin-Name: 1a2425fe8ad9a5b2300c4e810680964ddf369a60f3fb2d69d59c0ea2a8fd6152 --- interface/malloc.retro | 4 +- tests/malloc.retro | 18 +++--- vm/nga-c/image.c | 136 ++++++++++++++++++++--------------------- 3 files changed, 79 insertions(+), 79 deletions(-) diff --git a/interface/malloc.retro b/interface/malloc.retro index 954d900..b5d183e 100644 --- a/interface/malloc.retro +++ b/interface/malloc.retro @@ -14,8 +14,8 @@ ---reveal--- :mem:alloc (n--aa) ALLOC mem:invoke ; - :mem:set (an--) STORE mem:invoke ; - :mem:get (a--n) FETCH mem:invoke ; + :mem:store (an--) STORE mem:invoke ; + :mem:fetch (a--n) FETCH mem:invoke ; :mem:free (aa--) FREE mem:invoke ; :mem:resize (aan--) RESIZE mem:invoke ; }} diff --git a/tests/malloc.retro b/tests/malloc.retro index 4e4f62b..d7e3603 100644 --- a/tests/malloc.retro +++ b/tests/malloc.retro @@ -24,10 +24,10 @@ region1 double:print '===OK print nl nl ``` -## Test 2: `mem:set` +## Test 2: `mem:store` ``` -'===TEST2:_mem:set print +'===TEST2:_mem:store print 'Creating_a_random_value... print n:random 'Storing_to_`random-value`... print @@ -35,19 +35,19 @@ n:random 'New_random_value_is: print random-value n:print 'Storing_value_to_`region1`... print -region1 random-value mem:set -region1 #8 + random-value mem:set +region1 random-value mem:store +region1 #8 + random-value mem:store '===OK print nl nl ``` -## Test 3: `mem:get` +## Test 3: `mem:fetch` ``` -'===TEST3:_mem:get print +'===TEST3:_mem:fetch print 'Expect_ s:put 'to_contain_ s:put random-value n:put nl -'Actual_value:_____ s:put region1 mem:get n:put nl +'Actual_value:_____ s:put region1 mem:fetch n:put nl 'Calculating_memory_offset_should_not_segfault... -region1 #8 + mem:get +region1 #8 + mem:fetch 'Contents_of_(region1_+_1)_=_ s:put n:put nl '===OK print nl nl ``` @@ -69,7 +69,7 @@ region1 #64 mem:resize ``` 'Region2_contains: print -region2 mem:get n:put nl +region2 mem:fetch n:put nl 'Should_equal: print random-value n:print nl ``` diff --git a/vm/nga-c/image.c b/vm/nga-c/image.c index 1d8c26e..d0dd620 100644 --- a/vm/nga-c/image.c +++ b/vm/nga-c/image.c @@ -10,8 +10,8 @@ #define CELL_MAX LLONG_MAX - 1 #endif #endif -CELL ngaImageCells = 18953; -CELL ngaImage[] = { 1793,18460,18908,18952,202207,410,382,1242,1535,0,10,1,10,2,10,3,10,4,10, +CELL ngaImageCells = 18957; +CELL ngaImage[] = { 1793,18464,18912,18956,202207,410,382,1242,1535,0,10,1,10,2,10,3,10,4,10, 5,10,6,10,7,10,8,10,11,10,12,10,13,10,14,10,15,10,16,10, 17,10,18,10,19,10,20,10,21,10,22,10,23,10,24,10,25,68223234,1,2575, 85000450,1,656912,161,178,268505089,63,62,285281281,0,63,2063,10,101384453,0,9,10,68485378,255,18350338, @@ -20,8 +20,8 @@ CELL ngaImage[] = { 1793,18460,18908,18952,202207,410,382,1242,1535,0,10,1,10,2, 101777669,1,17565186,107,524545,111,64,167838467,-1,134287105,3,59,659457,3,459023,128,2049,56,25,2049, 128,1793,135,2049,135,117506307,0,128,0,524545,26,133,168820993,0,147,1642241,147,134283523,11,133, 1793,128,524545,2049,128,1793,128,16846593,147,161,178,1793,64,16846593,147,133,178,1793,64,7, - 10,659713,1,659713,2,659713,3,659713,4,659713,5,1793,18715,17108737,3,2,524559,128,2049,128, - 2049,128,524545,0,128,524545,0,128,2049,142,168820998,2,17696,1242,167841793,211,9,17826049,0,211, + 10,659713,1,659713,2,659713,3,659713,4,659713,5,1793,18719,17108737,3,2,524559,128,2049,128, + 2049,128,524545,0,128,524545,0,128,2049,142,168820998,2,17700,1242,167841793,211,9,17826049,0,211, 2,15,25,524546,188,134287105,212,116,2305,213,459023,221,134287361,212,216,659201,211,10,659969,7, 2049,56,25,17694978,58,237,9,84152833,48,319750404,236,117507601,239,184618754,45,25,16974851,-1,168886532,1, 134284289,1,252,134284289,0,239,660227,32,0,0,115,105,103,105,108,58,105,0,285278479,269, @@ -170,7 +170,7 @@ CELL ngaImage[] = { 1793,18460,18908,18952,202207,410,382,1242,1535,0,10,1,10,2, 110,58,105,110,99,0,659713,1,10,3114,3139,166,16136,266800217,110,58,100,101,99,0, 659969,1,10,3128,3158,166,16136,1032861494,110,58,98,101,116,119,101,101,110,63,0,67503109, 1793,3166,67503109,67503109,2049,3106,10,1,3161,2049,2241,11,10,3142,3187,166,16136,-2130983749,83,99, - 111,112,101,76,105,115,116,0,18810,18864,10,3172,3198,166,16136,5864091,123,123,0,2049, + 111,112,101,76,105,115,116,0,18814,18868,10,3172,3198,166,16136,5864091,123,123,0,2049, 1576,2,1,3187,2049,59,16,10,3190,3225,166,16136,-1644352334,45,45,45,114,101,118,101, 97,108,45,45,45,0,2049,1576,1,3187,2049,3125,16,10,3207,3241,166,16136,5864159,125, 125,0,1,3187,2049,56,4,15,11,1793,3255,3841,3187,4097,2,10,1,3250,1793,3281, @@ -891,71 +891,71 @@ CELL ngaImage[] = { 1793,18460,18908,18952,202207,410,382,1242,1535,0,10,1,10,2, 76,79,67,0,17532,1,154,0,0,70,82,69,69,0,17543,2,154,0,0,83, 84,79,82,69,0,17553,3,154,0,0,70,69,84,67,72,0,17564,4,154,0, 0,82,69,83,73,90,69,0,17484,17602,166,0,369169257,109,101,109,58,97,108,108, - 111,99,0,1,0,2049,17525,10,17587,17620,166,0,-1111837014,109,101,109,58,115,101,116, - 0,1,2,2049,17525,10,17607,17638,166,0,-1111850082,109,101,109,58,103,101,116,0,1, - 3,2049,17525,10,17625,17657,166,0,1963630784,109,101,109,58,102,114,101,101,0,1,1, - 2049,17525,10,17643,17678,166,0,-45070288,109,101,109,58,114,101,115,105,122,101,0,1, - 4,2049,17525,10,17662,17692,166,18479,193470948,84,73,66,0,1,7,15,10,17683,17712,166, - 18479,-460132687,105,109,97,103,101,58,115,97,118,101,0,1,1000,2049,10655,2049,10636,10, - 17696,17730,166,0,0,101,100,105,116,63,0,2,1793,17737,1,8,11,10,1,17733, - 1793,17745,1,127,11,10,1,17741,2049,2255,22,10,17719,17763,166,0,0,103,97,116, - 104,101,114,0,2049,17730,1,15,1,4134,2049,64,10,17751,17783,166,0,0,99,121, - 99,108,101,0,2049,10985,2049,2217,4,8,2049,2644,25,3,2049,17763,1,17783,7,10, - 17696,17816,166,18479,-1658019367,112,97,114,115,101,45,117,110,116,105,108,0,1793,17828,2049, - 4451,2049,4234,2049,17783,771,2049,4096,10,1,17818,2049,4260,10,17799,17844,166,18479,272733106,115, - 58,103,101,116,0,1793,17866,1793,17852,1,13,11,10,1,17848,1793,17860,1,10,11, - 10,1,17856,2049,2255,22,10,1,17846,2049,17816,10,17833,17882,166,18479,255552908,99,108,101, - 97,114,0,2049,4472,92,94,91,50,74,92,94,91,48,59,48,72,0,1,17884, - 2049,8246,2049,10761,10,17871,17916,154,18479,-976122143,78,111,69,99,104,111,0,0,17904,17926, - 154,0,0,69,79,84,0,0,17917,17941,154,0,0,73,103,110,111,114,105,110, - 103,0,0,17927,17957,166,0,0,105,103,110,111,114,105,110,103,63,0,3841,17941, - 10,17942,17973,166,0,0,118,101,114,115,105,111,110,0,3841,4,1,100,20,10, - 17960,17990,166,0,0,100,111,110,101,63,0,2,4097,17926,1793,17999,1,13,11,10, - 1,17995,1793,18007,1,10,11,10,1,18003,1793,18015,1,32,11,10,1,18011,2049,2298, - 22,22,10,17979,18032,166,0,0,101,111,108,63,0,3841,17926,1793,18040,1,13,11, - 10,1,18036,1793,18048,1,10,11,10,1,18044,2049,2255,22,10,18022,18066,166,0,0, - 118,97,108,105,100,63,0,2,2049,102,2049,2812,10,18054,18087,166,0,0,99,104, - 101,99,107,45,101,111,102,0,2,1793,18094,1,-1,11,10,1,18090,1793,18102,1, - 4,11,10,1,18098,2049,2255,22,1793,18112,2049,11052,10,1,18109,9,10,18072,18124,166, - 0,0,98,115,0,2049,4212,1,2,2049,2675,1793,18136,2049,4160,3,10,1,18132,9, - 2049,4160,3,10,18116,18157,166,0,0,99,104,101,99,107,45,98,115,0,2,1793, - 18164,1,8,11,10,1,18160,1793,18172,1,127,11,10,1,18168,2049,2255,22,1793,18182, - 2049,18124,10,1,18179,9,10,18143,18197,166,0,0,99,104,101,99,107,0,2049,18087, - 2049,18157,10,18186,18217,166,0,0,99,104,97,114,97,99,116,101,114,0,2049,10985, - 2,2049,4134,10,18202,18235,166,0,0,98,117,102,102,101,114,0,1793,18245,2049,17692, - 2049,4234,8,2049,4096,10,1,18237,2049,4260,10,18223,18266,166,0,0,114,101,97,100, - 45,116,111,107,101,110,0,1793,18282,1793,18277,2049,18217,2049,18197,2049,17990,10,1,18270, - 2049,2397,10,1,18268,2049,18235,2049,4587,10,18250,18300,166,0,0,105,110,112,117,116, - 0,2049,18266,2049,18066,10,18289,18318,166,0,0,112,114,111,99,101,115,115,0,2049, - 17957,1793,18336,771,2049,18032,1793,18332,1,17941,2049,3931,10,1,18327,9,10,1,18322,2049, - 2862,1,410,1,15,2049,64,10,17904,18355,178,18479,5861507,47,47,0,2049,15624,1,17941, - 2049,3916,10,18347,18374,166,18479,-208531877,98,97,110,110,101,114,0,2049,17973,2049,4472,82, - 69,84,82,79,32,49,50,32,40,37,110,46,37,110,41,92,110,0,1,18378, - 2049,8246,2049,10761,2049,10837,2049,1545,2049,10837,18,2049,1545,2049,4472,37,110,32,77,97, - 120,44,32,37,110,32,85,115,101,100,44,32,37,110,32,70,114,101,101,92, - 110,0,1,18414,2049,8246,2049,10761,10,18362,18460,166,18479,192495636,108,105,115,116,101,110, - 0,3841,17916,1793,18467,2049,18374,10,1,18464,2049,72,2049,18300,2049,18318,1,18471,7,10, - 105,110,116,101,114,102,97,99,101,47,114,101,116,114,111,45,117,110,105,120, - 46,114,101,116,114,111,0,18448,18519,154,0,0,83,111,117,114,99,101,115,0, - 1,18758,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, + 111,99,0,1,0,2049,17525,10,17587,17622,166,0,390806699,109,101,109,58,115,116,111, + 114,101,0,1,2,2049,17525,10,17607,17642,166,0,374855624,109,101,109,58,102,101,116, + 99,104,0,1,3,2049,17525,10,17627,17661,166,0,1963630784,109,101,109,58,102,114,101, + 101,0,1,1,2049,17525,10,17647,17682,166,0,-45070288,109,101,109,58,114,101,115,105, + 122,101,0,1,4,2049,17525,10,17666,17696,166,18483,193470948,84,73,66,0,1,7,15, + 10,17687,17716,166,18483,-460132687,105,109,97,103,101,58,115,97,118,101,0,1,1000,2049, + 10655,2049,10636,10,17700,17734,166,0,0,101,100,105,116,63,0,2,1793,17741,1,8, + 11,10,1,17737,1793,17749,1,127,11,10,1,17745,2049,2255,22,10,17723,17767,166,0, + 0,103,97,116,104,101,114,0,2049,17734,1,15,1,4134,2049,64,10,17755,17787,166, + 0,0,99,121,99,108,101,0,2049,10985,2049,2217,4,8,2049,2644,25,3,2049,17767, + 1,17787,7,10,17700,17820,166,18483,-1658019367,112,97,114,115,101,45,117,110,116,105,108, + 0,1793,17832,2049,4451,2049,4234,2049,17787,771,2049,4096,10,1,17822,2049,4260,10,17803,17848, + 166,18483,272733106,115,58,103,101,116,0,1793,17870,1793,17856,1,13,11,10,1,17852,1793, + 17864,1,10,11,10,1,17860,2049,2255,22,10,1,17850,2049,17820,10,17837,17886,166,18483, + 255552908,99,108,101,97,114,0,2049,4472,92,94,91,50,74,92,94,91,48,59,48, + 72,0,1,17888,2049,8246,2049,10761,10,17875,17920,154,18483,-976122143,78,111,69,99,104,111, + 0,0,17908,17930,154,0,0,69,79,84,0,0,17921,17945,154,0,0,73,103,110, + 111,114,105,110,103,0,0,17931,17961,166,0,0,105,103,110,111,114,105,110,103, + 63,0,3841,17945,10,17946,17977,166,0,0,118,101,114,115,105,111,110,0,3841,4, + 1,100,20,10,17964,17994,166,0,0,100,111,110,101,63,0,2,4097,17930,1793,18003, + 1,13,11,10,1,17999,1793,18011,1,10,11,10,1,18007,1793,18019,1,32,11,10, + 1,18015,2049,2298,22,22,10,17983,18036,166,0,0,101,111,108,63,0,3841,17930,1793, + 18044,1,13,11,10,1,18040,1793,18052,1,10,11,10,1,18048,2049,2255,22,10,18026, + 18070,166,0,0,118,97,108,105,100,63,0,2,2049,102,2049,2812,10,18058,18091,166, + 0,0,99,104,101,99,107,45,101,111,102,0,2,1793,18098,1,-1,11,10,1, + 18094,1793,18106,1,4,11,10,1,18102,2049,2255,22,1793,18116,2049,11052,10,1,18113,9, + 10,18076,18128,166,0,0,98,115,0,2049,4212,1,2,2049,2675,1793,18140,2049,4160,3, + 10,1,18136,9,2049,4160,3,10,18120,18161,166,0,0,99,104,101,99,107,45,98, + 115,0,2,1793,18168,1,8,11,10,1,18164,1793,18176,1,127,11,10,1,18172,2049, + 2255,22,1793,18186,2049,18128,10,1,18183,9,10,18147,18201,166,0,0,99,104,101,99, + 107,0,2049,18091,2049,18161,10,18190,18221,166,0,0,99,104,97,114,97,99,116,101, + 114,0,2049,10985,2,2049,4134,10,18206,18239,166,0,0,98,117,102,102,101,114,0, + 1793,18249,2049,17696,2049,4234,8,2049,4096,10,1,18241,2049,4260,10,18227,18270,166,0,0, + 114,101,97,100,45,116,111,107,101,110,0,1793,18286,1793,18281,2049,18221,2049,18201,2049, + 17994,10,1,18274,2049,2397,10,1,18272,2049,18239,2049,4587,10,18254,18304,166,0,0,105, + 110,112,117,116,0,2049,18270,2049,18070,10,18293,18322,166,0,0,112,114,111,99,101, + 115,115,0,2049,17961,1793,18340,771,2049,18036,1793,18336,1,17945,2049,3931,10,1,18331,9, + 10,1,18326,2049,2862,1,410,1,15,2049,64,10,17908,18359,178,18483,5861507,47,47,0, + 2049,15624,1,17945,2049,3916,10,18351,18378,166,18483,-208531877,98,97,110,110,101,114,0,2049, + 17977,2049,4472,82,69,84,82,79,32,49,50,32,40,37,110,46,37,110,41,92, + 110,0,1,18382,2049,8246,2049,10761,2049,10837,2049,1545,2049,10837,18,2049,1545,2049,4472,37, + 110,32,77,97,120,44,32,37,110,32,85,115,101,100,44,32,37,110,32,70, + 114,101,101,92,110,0,1,18418,2049,8246,2049,10761,10,18366,18464,166,18483,192495636,108,105, + 115,116,101,110,0,3841,17920,1793,18471,2049,18378,10,1,18468,2049,72,2049,18304,2049,18322, + 1,18475,7,10,105,110,116,101,114,102,97,99,101,47,114,101,116,114,111,45, + 117,110,105,120,46,114,101,116,114,111,0,18452,18523,154,0,0,83,111,117,114, + 99,101,115,0,1,18762,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,0,0,0,0,0,0,0,0,0,0,0, - 0,0,0,0,0,0,0,0,18506,18659,166,0,0,107,110,111,119,110,63,0, - 2,1,18519,2049,9003,10,18647,18676,166,0,0,105,110,100,101,120,0,1,18519,4, - 2049,9320,1,18519,4,2049,9140,10,18665,18699,166,0,0,114,101,99,111,114,100,0, - 2049,4500,2,1,18519,2049,3864,3841,18519,1,18519,17,16,10,1793,18756,2049,15559,2049,18659, - 1793,18724,2049,18676,10,1,18721,1793,18731,2049,18699,10,1,18728,2049,64,1793,18744,1,190, - 1,2,17,8,10,1,18737,2049,2229,2049,1576,2049,184,16,2049,11116,10,1,18715,100, - 105,99,116,45,119,111,114,100,115,45,108,105,115,116,105,110,103,46,102,111, - 114,116,104,0,18448,18796,166,18758,-1519205998,100,58,119,111,114,100,115,0,1793,18805,2049, - 188,2049,10761,2049,10731,10,1,18798,2049,8491,10,18783,18828,166,18758,1750461083,100,58,119,111, - 114,100,115,45,119,105,116,104,0,2049,1977,2049,5573,1793,18859,2049,188,2,2049,1977, - 2049,5286,1793,18848,2049,10761,2049,10731,10,1,18843,1793,18854,3,10,1,18852,2049,64,10, - 1,18834,2049,8491,10,18810,18885,166,18758,-1509196721,100,105,115,112,108,97,121,45,105,102, - 45,108,101,102,116,0,2,2049,1977,2049,5519,1793,18897,2049,10761,2049,10731,10,1,18892, - 1793,18903,3,10,1,18901,2049,64,10,18810,18936,166,18758,-1159574567,100,58,119,111,114,100, - 115,45,98,101,103,105,110,110,105,110,103,45,119,105,116,104,0,2049,1977,2049, - 5573,1793,18947,2049,188,2049,18885,10,1,18942,2049,8491,10,0 }; + 0,0,0,0,0,0,0,0,0,0,0,0,18510,18663,166,0,0,107,110,111, + 119,110,63,0,2,1,18523,2049,9003,10,18651,18680,166,0,0,105,110,100,101,120, + 0,1,18523,4,2049,9320,1,18523,4,2049,9140,10,18669,18703,166,0,0,114,101,99, + 111,114,100,0,2049,4500,2,1,18523,2049,3864,3841,18523,1,18523,17,16,10,1793,18760, + 2049,15559,2049,18663,1793,18728,2049,18680,10,1,18725,1793,18735,2049,18703,10,1,18732,2049,64, + 1793,18748,1,190,1,2,17,8,10,1,18741,2049,2229,2049,1576,2049,184,16,2049,11116, + 10,1,18719,100,105,99,116,45,119,111,114,100,115,45,108,105,115,116,105,110, + 103,46,102,111,114,116,104,0,18452,18800,166,18762,-1519205998,100,58,119,111,114,100,115, + 0,1793,18809,2049,188,2049,10761,2049,10731,10,1,18802,2049,8491,10,18787,18832,166,18762,1750461083, + 100,58,119,111,114,100,115,45,119,105,116,104,0,2049,1977,2049,5573,1793,18863,2049, + 188,2,2049,1977,2049,5286,1793,18852,2049,10761,2049,10731,10,1,18847,1793,18858,3,10,1, + 18856,2049,64,10,1,18838,2049,8491,10,18814,18889,166,18762,-1509196721,100,105,115,112,108,97, + 121,45,105,102,45,108,101,102,116,0,2,2049,1977,2049,5519,1793,18901,2049,10761,2049, + 10731,10,1,18896,1793,18907,3,10,1,18905,2049,64,10,18814,18940,166,18762,-1159574567,100,58, + 119,111,114,100,115,45,98,101,103,105,110,110,105,110,103,45,119,105,116,104, + 0,2049,1977,2049,5573,1793,18951,2049,188,2049,18889,10,1,18946,2049,8491,10,0 };