We planned to upgrade GitLab and Mattermost to the latest version this Friday morning (early). You may experience some downtime!

Verified Commit cefc36dc authored by Camil Staps's avatar Camil Staps 🚀

Move catAC from traps to new bytecode instruction (jesr will be removed)

parent 08f94a86
Pipeline #17017 failed with stages
in 16 minutes and 13 seconds
......@@ -137,6 +137,7 @@ const char *instruction_type (BC_WORD i) {
case Cbuild_u2b: return "nl";
case Cbuild_u31: return "l";
case Cbuild_ua1: return "nl";
case CcatAC: return "";
case Cccall: return "";
case Ccentry: return "";
case CcosR: return "";
......
......@@ -123,6 +123,7 @@ enum {
INSTRUCTION(build_u2b)
INSTRUCTION(build_u31)
INSTRUCTION(build_ua1)
INSTRUCTION(catAC)
INSTRUCTION(ccall)
INSTRUCTION(centry)
INSTRUCTION(cosR)
......
......@@ -2259,10 +2259,12 @@ void code_jsr(char label_name[]) {
lib_function_n = get_lib_function_n(label_name);
if (lib_function_n>=0) {
if (lib_function_n==0)
add_instruction(CeqAC);
else
add_instruction_w(Cjesr,lib_function_n);
switch (lib_function_n) {
case 0: add_instruction(CeqAC); break;
case 1: add_instruction(CcatAC); break;
default:
add_instruction_w(Cjesr,lib_function_n);
}
last_jsr_with_d=0;
return;
......
......@@ -1628,6 +1628,40 @@ INSTRUCTION_BLOCK(build_ua1):
hp[-1]=*bsp++;
END_INSTRUCTION_BLOCK;
}
INSTRUCTION_BLOCK(catAC):
{
BC_WORD *s1,*s2;
unsigned int l1,l2,l,lw,i;
char *s1_p,*s2_p,*s_p;
s1=(BC_WORD*)asp[0];
s2=(BC_WORD*)asp[-1];
l1=s1[1];
l2=s2[1];
s1_p=(char*)&s1[2];
s2_p=(char*)&s2[2];
l=l1+l2;
lw=IF_INT_64_OR_32((l+7)>>3,(l+3)>>2)+2;
NEED_HEAP(lw);
*--asp=(BC_WORD)hp;
hp[0]=(BC_WORD)&__STRING__+2;
hp[1]=l;
s_p=(char*)&hp[2];
hp+=lw;
for (i=0; i<l1; ++i)
s_p[i]=s1_p[i];
s_p+=l1;
for (i=0; i<l2; ++i)
s_p[i]=s2_p[i];
pc++;
END_INSTRUCTION_BLOCK;
}
INSTRUCTION_BLOCK(cosR):
{
BC_REAL d=cos(*(BC_REAL*)&bsp[0]);
......@@ -8846,9 +8880,6 @@ INSTRUCTION_BLOCK(jesr):
g_heap_free=heap_free;
g_hp=hp;
switch (pc[1]){
case 1:
clean_catAC();
break;
case 2:
clean_sliceAC();
break;
......
......@@ -5,48 +5,6 @@
#include "traps.h"
#include "util.h"
void clean_catAC (void)
{
BC_WORD *s1,*s2;
unsigned int l1,l2,l,lw,i;
unsigned char *s1_p,*s2_p,*s_p;
s1=(BC_WORD*)g_asp[0];
s2=(BC_WORD*)g_asp[-1];
l1=s1[1];
l2=s2[1];
s1_p=(unsigned char*)&s1[2];
s2_p=(unsigned char*)&s2[2];
l=l1+l2;
lw=(l+3)>>2;
if ((g_heap_free -= (int)(lw+2)) < 0){
g_heap_free += lw+2;
trap_needs_gc = 1;
return;
}
g_hp[0]=(BC_WORD)&__STRING__+2;
g_hp[1]=l;
g_asp-=1;
g_asp[0] = (BC_WORD)g_hp;
s_p=(unsigned char *)&g_hp[2];
g_hp+=2+lw;
for (i=0; i<l1; ++i)
s_p[i]=s1_p[i];
s_p+=l1;
for (i=0; i<l2; ++i)
s_p[i]=s2_p[i];
}
void clean_readLineF (void)
{
BC_WORD *bsp,*hp;
......
#ifndef _H_ABCINT_TRAPS
#define _H_ABCINT_TRAPS
void clean_catAC (void);
void clean_readLineF (void);
void clean_sliceAC (void);
void clean_ItoAC (void);
......
......@@ -33,6 +33,7 @@ rfib
sieve
squeen
str_arit
strings
stwice
sudoku
symsieve
......
["","a0","%0","X0","a0a1","a0%1","a0X1","%0a2","%0%2","%0X2","X0a3","X0%3","X0X3","a0a1a4","a0a1%4","a0a1X4","a0%1a5","a0%1%5","a0%1X5","a0X1a6","a0X1%6","a0X1X6","%0a2a7","%0a2%7","%0a2X7","%0%2a8","%0%2%8","%0%2X8","%0X2a9","%0X2%9","%0X2X9","X0a3a10","X0a3%10","X0a3X10","X0%3a11","X0%3%11","X0%3X11","X0X3a12","X0X3%12","X0X3X12","a0a1a4a13","a0a1a4%13","a0a1a4X13","a0a1%4a14","a0a1%4%14","a0a1%4X14","a0a1X4a15","a0a1X4%15","a0a1X4X15","a0%1a5a16","a0%1a5%16","a0%1a5X16","a0%1%5a17","a0%1%5%17","a0%1%5X17","a0%1X5a18","a0%1X5%18","a0%1X5X18","a0X1a6a19","a0X1a6%19","a0X1a6X19","a0X1%6a20","a0X1%6%20","a0X1%6X20","a0X1X6a21","a0X1X6%21","a0X1X6X21","%0a2a7a22","%0a2a7%22","%0a2a7X22","%0a2%7a23","%0a2%7%23","%0a2%7X23","%0a2X7a24","%0a2X7%24","%0a2X7X24","%0%2a8a25","%0%2a8%25","%0%2a8X25","%0%2%8a26","%0%2%8%26","%0%2%8X26","%0%2X8a27","%0%2X8%27","%0%2X8X27","%0X2a9a28","%0X2a9%28","%0X2a9X28","%0X2%9a29","%0X2%9%29","%0X2%9X29","%0X2X9a30","%0X2X9%30","%0X2X9X30","X0a3a10a31","X0a3a10%31","X0a3a10X31","X0a3%10a32","X0a3%10%32","X0a3%10X32"]
halt at 4
4548 519740 524288
["","a0","%0","X0","a0a1","a0%1","a0X1","%0a2","%0%2","%0X2","X0a3","X0%3","X0X3","a0a1a4","a0a1%4","a0a1X4","a0%1a5","a0%1%5","a0%1X5","a0X1a6","a0X1%6","a0X1X6","%0a2a7","%0a2%7","%0a2X7","%0%2a8","%0%2%8","%0%2X8","%0X2a9","%0X2%9","%0X2X9","X0a3a10","X0a3%10","X0a3X10","X0%3a11","X0%3%11","X0%3X11","X0X3a12","X0X3%12","X0X3X12","a0a1a4a13","a0a1a4%13","a0a1a4X13","a0a1%4a14","a0a1%4%14","a0a1%4X14","a0a1X4a15","a0a1X4%15","a0a1X4X15","a0%1a5a16","a0%1a5%16","a0%1a5X16","a0%1%5a17","a0%1%5%17","a0%1%5X17","a0%1X5a18","a0%1X5%18","a0%1X5X18","a0X1a6a19","a0X1a6%19","a0X1a6X19","a0X1%6a20","a0X1%6%20","a0X1%6X20","a0X1X6a21","a0X1X6%21","a0X1X6X21","%0a2a7a22","%0a2a7%22","%0a2a7X22","%0a2%7a23","%0a2%7%23","%0a2%7X23","%0a2X7a24","%0a2X7%24","%0a2X7X24","%0%2a8a25","%0%2a8%25","%0%2a8X25","%0%2%8a26","%0%2%8%26","%0%2%8X26","%0%2X8a27","%0%2X8%27","%0%2X8X27","%0X2a9a28","%0X2a9%28","%0X2a9X28","%0X2%9a29","%0X2%9%29","%0X2%9X29","%0X2X9a30","%0X2X9%30","%0X2X9X30","X0a3a10a31","X0a3a10%31","X0a3a10X31","X0a3%10a32","X0a3%10%32","X0a3%10X32"]
halt at 4
4441 257703 262144
module strings
import StdArray
import StdList
import StdString
strings :: [String]
strings = ["":[s +++ {#c} +++ toString i \\ s <- strings & i <- [0..], c <- ['a%X']]]
Start = take 100 strings
Version: 1.4
Global
ProjectRoot: .
Target: ByteCode
Exec: {Project}/strings
ByteCode: {Project}/strings.bc
CodeGen
CheckStacks: False
CheckIndexes: False
OptimiseABC: True
GenerateByteCode: True
Application
HeapSize: 2097152
StackSize: 512000
ExtraMemory: 8192
IntialHeapSize: 204800
HeapSizeMultiplier: 4096
ShowExecutionTime: False
ShowGC: False
ShowStackSize: False
MarkingCollector: False
DisableRTSFlags: False
StandardRuntimeEnv: True
Profile
Memory: False
MemoryMinimumHeapSize: 0
Time: False
Stack: False
Dynamics: False
GenericFusion: False
DescExL: True
Output
Output: ShowConstructors
Font: Monaco
FontSize: 9
WriteStdErr: False
Link
LinkMethod: Static
GenerateRelocations: False
GenerateSymbolTable: False
GenerateLinkMap: False
LinkResources: False
ResourceSource:
GenerateDLL: False
ExportedNames:
StripByteCode: True
Paths
Path: {Project}
OtherPaths
Path: {Application}*lib*StdEnv
Precompile:
Postlink:
MainModule
Name: strings
Dir: {Project}
Compiler
NeverMemoryProfile: False
NeverTimeProfile: False
StrictnessAnalysis: True
ListTypes: StrictExportTypes
ListAttributes: True
Warnings: True
Verbose: True
ReadableABC: False
ReuseUniqueNodes: True
Fusion: False
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment