pFad - Phone/Frame/Anonymizer/Declutterfier! Saves Data!


--- a PPN by Garber Painting Akron. With Image Size Reduction included!

URL: http://github.com/AssemblyScript/assemblyscript/commit/f9dee7220ff173307b3f1c10bad137513fbc3d91

b.githubassets.com/assets/global-d18f184ea1a06a2c.css" /> fix: fix shadowstack pass discard debuginfo (#2496) · AssemblyScript/assemblyscript@f9dee72 · GitHub
Skip to content

Commit f9dee72

Browse files
authored
fix: fix shadowstack pass discard debuginfo (#2496)
1 parent 078a4d0 commit f9dee72

71 files changed

Lines changed: 18347 additions & 18324 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

src/passes/shadowstack.ts

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -132,7 +132,7 @@ import {
132132
ExternalKind,
133133
ExportRef,
134134
expandType,
135-
isConstZero
135+
isConstZero,
136136
} from "../module";
137137

138138
import {
@@ -477,7 +477,11 @@ export class ShadowStackPass extends Pass {
477477
let moduleRef = this.module.ref;
478478
_BinaryenRemoveFunction(moduleRef, name);
479479
let cArr = allocPtrArray(vars);
480-
_BinaryenAddFunction(moduleRef, name, params, results, cArr, vars.length, body);
480+
let newFuncRef = _BinaryenAddFunction(moduleRef, name, params, results, cArr, vars.length, body);
481+
if (this.options.sourceMap || this.options.debugInfo) {
482+
let func = this.compiler.program.searchFunctionByRef(newFuncRef);
483+
if (func) func.addDebugInfo(this.module, newFuncRef);
484+
}
481485
_free(cArr);
482486
}
483487

src/program.ts

Lines changed: 20 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -117,7 +117,8 @@ import {
117117
import {
118118
Module,
119119
FunctionRef,
120-
MemorySegment
120+
MemorySegment,
121+
getFunctionName
121122
} from "./module";
122123

123124
import {
@@ -812,6 +813,20 @@ export class Program extends DiagnosticEmitter {
812813
return this.blockOverhead + this.objectOverhead;
813814
}
814815

816+
searchFunctionByRef(ref: FunctionRef): Function | null {
817+
const modifiedFunctionName = getFunctionName(ref);
818+
if (modifiedFunctionName) {
819+
const instancesByName = this.instancesByName;
820+
if (instancesByName.has(modifiedFunctionName)) {
821+
const element = assert(instancesByName.get(modifiedFunctionName));
822+
if (element.kind == ElementKind.FUNCTION) {
823+
return <Function>element;
824+
}
825+
}
826+
}
827+
return null;
828+
}
829+
815830
/** Computes the next properly aligned offset of a memory manager block, given the current bump offset. */
816831
computeBlockStart(currentOffset: i32): i32 {
817832
var blockOverhead = this.blockOverhead;
@@ -3763,6 +3778,10 @@ export class Function extends TypedElement {
37633778
this.breakStack = breakStack = null;
37643779
this.breakLabel = null;
37653780
this.tempI32s = this.tempI64s = this.tempF32s = this.tempF64s = null;
3781+
this.addDebugInfo(module, ref);
3782+
}
3783+
3784+
addDebugInfo(module: Module, ref: FunctionRef): void {
37663785
if (this.program.options.sourceMap) {
37673786
let debugLocations = this.debugLocations;
37683787
for (let i = 0, k = debugLocations.length; i < k; ++i) {

0 commit comments

Comments
 (0)
pFad - Phonifier reborn

Pfad - The Proxy pFad © 2024 Your Company Name. All rights reserved.





Check this box to remove all script contents from the fetched content.



Check this box to remove all images from the fetched content.


Check this box to remove all CSS styles from the fetched content.


Check this box to keep images inefficiently compressed and original size.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy