Skip to content

Commit

Permalink
Fix several bugs
Browse files Browse the repository at this point in the history
  • Loading branch information
MatwayBurkow committed Aug 21, 2020
1 parent cd4e4aa commit 4ca248d
Show file tree
Hide file tree
Showing 4 changed files with 41 additions and 22 deletions.
2 changes: 1 addition & 1 deletion builtinImpl.mpl
Original file line number Diff line number Diff line change
Expand Up @@ -1188,7 +1188,7 @@ staticityOfBinResult: [

result: @processor.@varForCallTrace FALSE dynamic @processor @block createRefNoOp @processor @block createAllocIR Dynamic @processor @block makeStaticity;
result @processor @block createGetCallTrace
result @block push
result @processor @block derefAndPush

TRUE @block.!hasCallTrace
] "mplBuiltinGetCallTrace" @declareBuiltin ucall
Expand Down
31 changes: 19 additions & 12 deletions codeNode.mpl
Original file line number Diff line number Diff line change
Expand Up @@ -2777,24 +2777,31 @@ addNamesFromModule: [

finalizeListNode: [
struct: Struct;
validOutputCount: block.stack.size;

processor compilable [
i: 0 dynamic;

[
i block.stack.size < [
curRef: i @[email protected];
curRef getVar.data.getTag VarInvalid = [
i @validOutputCount set
FALSE
] [
newField: Field;
processor.specialNames.emptyNameInfo @newField.@nameInfo set

newField: Field;
processor.specialNames.emptyNameInfo @newField.@nameInfo set
curRef getVar.temporary [
curRef @newField.@refToVar set
] [
@curRef TRUE dynamic @processor @block createRef @newField.@refToVar set
@curRef makeVarPtrCaptured
] if

curRef getVar.temporary [
curRef @newField.@refToVar set
] [
@curRef TRUE dynamic @processor @block createRef @newField.@refToVar set
@curRef makeVarPtrCaptured
newField @[email protected]
i 1 + @i set processor compilable
] if

newField @[email protected]
i 1 + @i set processor compilable
] &&
] loop
] when
Expand All @@ -2809,7 +2816,7 @@ finalizeListNode: [

i: 0 dynamic;
[
i block.stack.size < [
i validOutputCount < [
curFieldRef: i @[email protected].@refToVar;

curFieldRef isVirtual [
Expand All @@ -2826,7 +2833,7 @@ finalizeListNode: [
] &&
] loop

@block.@stack.clear
block.stack.size validOutputCount - @block.@stack.shrink
refToStruct @[email protected]
] when
];
Expand Down
20 changes: 12 additions & 8 deletions debugWriter.mpl
Original file line number Diff line number Diff line change
Expand Up @@ -128,7 +128,9 @@ getPointerTypeDebugDeclaration: [
var: refToVar getVar;
debugDeclarationIndex: refToVar @processor getMplSchema.dbgTypeDeclarationId copy;
[debugDeclarationIndex -1 = ~] "Pointee has no type debug info!" assert
"DW_TAG_pointer_type" makeStringView debugDeclarationIndex processor.options.pointerSize 0ix cast 0 cast @processor addDerivedTypeInfo
index: "DW_TAG_pointer_type" makeStringView debugDeclarationIndex processor.options.pointerSize 0ix cast 0 cast @processor addDerivedTypeInfo;

index
];

addMemberInfo: [
Expand All @@ -147,17 +149,16 @@ addMemberInfo: [
name: field.nameInfo processor.nameManager.getText;

name "" = [
("!" index " = !DIDerivedType(tag: DW_TAG_member, name: \"f" fieldNumber "\", scope: !" block.funcDbgIndex
("!" index " = !DIDerivedType(tag: DW_TAG_member, name: \"f" fieldNumber "\""
", file: !" processor.positions.last.file.debugId
", line: " processor.positions.last.line ", baseType: !" debugDeclarationIndex ", size: " fsize 8 * ", offset: " offset 8 * ")") assembleString
] [
("!" index " = !DIDerivedType(tag: DW_TAG_member, name: \"" name "\", scope: !" block.funcDbgIndex
("!" index " = !DIDerivedType(tag: DW_TAG_member, name: \"" name "\""
", file: !" processor.positions.last.file.debugId
", line: " processor.positions.last.line ", baseType: !" debugDeclarationIndex ", size: " fsize 8 * ", offset: " offset 8 * ")") assembleString
] if

addDebugString
index block.funcDbgIndex @processor.@[email protected]

offset fsize + @offset set
index
Expand Down Expand Up @@ -213,15 +214,13 @@ getTypeDebugDeclaration: [
"}" @newDebugInfo.cat
@newDebugInfo move addDebugString

index block.funcDbgIndex @processor.@[email protected]

index: processor.debugInfo.lastId copy;
processor.debugInfo.lastId 1 + @processor.@debugInfo.@lastId set

("!" index " = distinct !DICompositeType(tag: DW_TAG_structure_type, file: !" processor.positions.last.file.debugId
", name: \"" refToVar @processor block getDebugType "\", line: " processor.positions.last.line ", size: " refToVar @processor getStorageSize 0ix cast 0 cast 8 * ", elements: !" index 1 -
", name: \"" refToVar @processor block getDebugType "\", size: " refToVar @processor getStorageSize 0ix cast 0 cast 8 * ", elements: !" index 1 -
")") assembleString addDebugString
index block.funcDbgIndex @processor.@[email protected]
index
] [
[FALSE] "Unknown type in getTypeDebugDeclaration!" assert
Expand Down Expand Up @@ -508,13 +507,18 @@ correctUnitInfo: [
clearUnusedDebugInfo: [
processor:;

clearString: [
s:;
String @s set
];

processor.debugInfo.locationIds [
pair:;
locId: pair.key;
funcDbgId: pair.value;
debugString: funcDbgId 4 + processor.debugInfo.strings.at;
debugString.size 0 = [
String locId 4 + @processor.@[email protected] set
locId 4 + @processor.@[email protected] clearString
] when
] each

Expand Down
10 changes: 9 additions & 1 deletion processSubNodes.mpl
Original file line number Diff line number Diff line change
Expand Up @@ -838,7 +838,15 @@ applyNodeChanges: [
addAppliedVar: [
stackEntry: cacheEntry: appliedVars: ;;;

[stackEntry cacheEntry variablesAreSame] "Applied vars has different type!" assert
[stackEntry cacheEntry variablesAreSame
[
(
"Stack entry type is " stackEntry @processor @block getMplType LF
"cache entry type is " cacheEntry @processor @block getMplType LF
) printList
FALSE
] ||
] "Applied vars has different type!" assert

stackEntry noMatterToCopy ~ [
[stackEntry getVar.host.id block.id =] "Stack entry is not from here!" assert
Expand Down

0 comments on commit 4ca248d

Please sign in to comment.