Closed Bug 503571 Opened 17 years ago Closed 14 years ago

Let user code refer to fragments by weak pointers

Categories

(Core :: JavaScript Engine, enhancement)

enhancement
Not set
normal

Tracking

()

RESOLVED WONTFIX

People

(Reporter: dmandelin, Unassigned)

Details

Currently, code that uses Nanojit uses hash keys to refer to fragments and hash lookups to access fragments. Clearly, a pointer would be a simpler, faster way to check for and access fragments and/or fragment code. But a plain pointer will not work because the Nanojit might clear out the referent fragment at any time. Weak pointers would work. Example API: template<typename T> class WeakPtr { public: T* get() const; // return ptr value or NULL. } // In jstracer.cpp WeakPtr<Fragment> getAnchor(...) { ... } // In Nanojit WeakPtr<uint8> compile(...) { ... } As an example of usage, JSRegExp could get a WeakPtr<uint8> for the compiled code. If the pointer has a value, we simply call it. If not, we compile the new code. No hash lookups, no hash functions, no need to copy the regexp to a Nanojit-owned buffer.
Tamarin has weak pointers but fragments are short lived (See MMgc/GCWeakRef.h). Changing product to Tracemonkey.
Assignee: nobody → general
Component: JIT Compiler (NanoJIT) → JavaScript Engine
Product: Tamarin → Core
QA Contact: nanojit → general
Obsolete with the removal of tracejit.
Status: NEW → RESOLVED
Closed: 14 years ago
Resolution: --- → WONTFIX
You need to log in before you can comment on or make changes to this bug.