Skip to content

Commit 633939f

Browse files
committed
Revert "lastError" for now
It appears to be responsible for a considerable slowdown
1 parent 76e76c6 commit 633939f

File tree

9 files changed

+2
-80
lines changed

9 files changed

+2
-80
lines changed

M2/Macaulay2/d/actors5.d

Lines changed: 1 addition & 31 deletions
Original file line numberDiff line numberDiff line change
@@ -1814,9 +1814,6 @@ export StandardE := Expr(StandardS);
18141814
export topLevelMode := Expr(StandardS);
18151815
topLevelModeS := dummySymbol;
18161816
1817-
threadLocal lastError := nullE;
1818-
lastErrorS := dummySymbol;
1819-
18201817
initialRandomSeed := zeroZZ;
18211818
initialRandomHeight := toInteger(10);
18221819
@@ -1851,8 +1848,7 @@ syms := SymbolSequence(
18511848
( handleInterruptsS = setupvar("handleInterrupts",toExpr(handleInterrupts)); handleInterruptsS ),
18521849
( printWidthS = setupvar("printWidth",toExpr(printWidth)); printWidthS ),
18531850
( notifyS = setupvar("notify",toExpr(notify)); notifyS ),
1854-
( topLevelModeS = setupvar("topLevelMode",topLevelMode); topLevelModeS ),
1855-
( lastErrorS = setupvarThread("lastError", lastError); lastErrorS )
1851+
( topLevelModeS = setupvar("topLevelMode",topLevelMode); topLevelModeS )
18561852
);
18571853
18581854
export setDebuggingMode(b:bool):void := (
@@ -1891,17 +1887,6 @@ export sethandleInterrupts(b:bool):void := (
18911887
handleInterruptsSetup(b);
18921888
setGlobalVariable(handleInterruptsS,toExpr(b));
18931889
);
1894-
setLastError(position:Position, message:string):void := (
1895-
if !(
1896-
message == returnMessage ||
1897-
message == continueMessage || message == continueMessageWithArg ||
1898-
message == stepMessage || message == stepMessageWithArg ||
1899-
message == breakMessage)
1900-
then (
1901-
lastError = seq(locate(position), toExpr(message));
1902-
setGlobalVariable(lastErrorS, lastError)));
1903-
setLastErrorpointer = setLastError;
1904-
19051890
threadLocal resetvars := (
19061891
-- These are the thread local variables that got re-initialized in tokens.d:
19071892
-- Actually, this is no good! If the user assigns to one of these variables, the "top level" version
@@ -1925,21 +1910,6 @@ store(e:Expr):Expr := ( -- called with (symbol,newvalue)
19251910
else when s.1
19261911
is Nothing do (
19271912
if sym === debuggerHookS then (debuggerHook = s.1; e)
1928-
else if sym === lastErrorS then (lastError = s.1; e)
1929-
else buildErrorPacket(msg))
1930-
is a:Sequence do (
1931-
if sym === lastErrorS then (
1932-
if length(a) == 2 then (
1933-
when a.0
1934-
is p:List
1935-
do (
1936-
if p.Class == filePositionClass then (
1937-
when a.1
1938-
is msg:stringCell do (lastError = s.1; e)
1939-
else WrongArgString(2))
1940-
else WrongArg(1, "a file position"))
1941-
else WrongArg(1, "a file position"))
1942-
else WrongNumArgs(2))
19431913
else buildErrorPacket(msg))
19441914
is b:Boolean do (
19451915
n := b.v;

M2/Macaulay2/d/binding.d

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -415,12 +415,10 @@ export makeSymbol(t:Token):Symbol := (
415415
export makeErrorTree(e:ParseTree,message:string):void := (
416416
HadError = true;
417417
printErrorMessage(treePosition(e),message);
418-
setLastErrorpointer(treePosition(e), message);
419418
);
420419
export makeErrorTree(e:Token,message:string):void := (
421420
HadError = true;
422421
printErrorMessage(e,message);
423-
setLastErrorpointer(e.position, message);
424422
);
425423
makeSymbol(e:ParseTree,dictionary:Dictionary):void := (
426424
when e

M2/Macaulay2/d/evaluate.d

Lines changed: 1 addition & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1585,14 +1585,7 @@ export evalraw(c:Code):Expr := (
15851585
tmp)
15861586
else AngleBarList(r)
15871587
));
1588-
when e is Error
1589-
do (
1590-
f := handleError(c,e);
1591-
when f is err:Error
1592-
do setLastErrorpointer(err.position, err.message)
1593-
else nothing;
1594-
f)
1595-
else e);
1588+
when e is Error do handleError(c,e) else e);
15961589

15971590
export evalexcept(c:Code):Expr := (
15981591
-- printErrorMessage(codePosition(c),"--evaluating: "+present(tostring(c)));

M2/Macaulay2/d/lex.d

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -82,14 +82,8 @@ export install(name:string,word:Word):Word := (
8282
foreach ch in name do node = install(node,int(ch));
8383
node.word = word;
8484
word);
85-
86-
-- setLastError defined in actors5.d
87-
dummysetLastError(position:Position, message:string):void := nothing;
88-
export setLastErrorpointer := dummysetLastError;
89-
9085
makeLexError(position:Position, message:string):void := (
9186
printErrorMessage(position, message);
92-
setLastErrorpointer(position, message);
9387
empty(tokenbuf));
9488

9589
newPosition(file:PosFile, line:ushort, column:ushort):Position := Position(

M2/Macaulay2/d/parser.d

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -184,7 +184,6 @@ accumulate(e:ParseTree,file:TokenFile,prec:int,obeylines:bool):ParseTree := (
184184
);
185185
makeParseError(token:Token, message:string):ParseTree := (
186186
printErrorMessage(token, message);
187-
setLastErrorpointer(token.position, message);
188187
errorTree);
189188
export errorunary(token1:Token,file:TokenFile,prec:int,obeylines:bool):ParseTree := (
190189
makeParseError(token1,"syntax error at '" + token1.word.name + "'"));

M2/Macaulay2/m2/exports.m2

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1338,7 +1338,6 @@ exportMutable {
13381338
"handleInterrupts",
13391339
"homeDirectory",
13401340
"interpreterDepth",
1341-
"lastError",
13421341
"lastMatch",
13431342
"lineNumber",
13441343
"loadDepth",

M2/Macaulay2/packages/Macaulay2Doc/ov_debugging.m2

Lines changed: 0 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -327,32 +327,6 @@ document {
327327
}
328328
}
329329

330-
doc ///
331-
Key
332-
symbol lastError
333-
Headline
334-
information about the last error
335-
Usage
336-
lastError
337-
Outputs
338-
:Sequence
339-
of two elements, the @TO FilePosition@ of the code that generated
340-
the last error and a string containing the error message
341-
Description
342-
Example
343-
try 1/0
344-
lastError
345-
Text
346-
The last error is local to each thread.
347-
Example
348-
taskResult schedule(() -> try error "foo" else lastError)
349-
lastError
350-
Text
351-
Clear the value by assigning null.
352-
Example
353-
lastError = null
354-
///
355-
356330

357331
document {
358332
Key => "recursionLimit",

M2/Macaulay2/packages/Macaulay2Doc/ov_language.m2

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -704,7 +704,6 @@ document {
704704
TO "error",
705705
TO "try",
706706
TO "throw",
707-
TO "Macaulay2Doc::lastError" -- TODO: why do we need to specify pkg?
708707
}
709708
}
710709

M2/Macaulay2/tests/normal/error-messages.m2

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,3 @@
1-
assert(try 1/0 else lastError#1 == "division by zero")
2-
lastError = null
3-
assert(lastError === null)
4-
51
stderr << "--testing the error messages must be done manually" << endl
62
end
73

0 commit comments

Comments
 (0)