Skip to content

Conversation

@jianchun
Copy link

This change enables building lib/Runtime/Library.

  • Added a few unimplemented stubs into CommonPal.h.
  • Replaced a bunch of __try/__finally(__leave) with TryFinally.
  • JavascriptBuiltInFunctions.cpp: Added BUILTIN_TEMPLATE to work with
    all TypedArray types as they are template specializations and need
    template<>.
  • TypedArray.cpp: Needed to move Is/FromVar specializations forward
    before being used.

TODO:

  • Figure out how to work around one __try/__except use -- to resume from
    out of bound array access AV.

2 files excluded from build:

  • JavascriptErrorDebug.cpp: using interfaces
  • MathLibrary.cpp: using intrinsics conflicting with stdlib/math.h

}
#endif

// xplat-todo: This __try/__except catches AV and resumes from out of bound TypedArray access.
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think for now, the plan should be to disable this feature on linux. I think you should change JavascriptArrayBuffer's constructor to use malloc on linux always, and also assert that JavascriptArrayBuffer::AllocWrapper is never used on linux. Also, in TypedArray::NewInstance, compile assert virtualAllocated is false on linux.

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for referring to the related virtualAlloc dependencies. From the code, IsValidVirtualBufferLength always returns false and JavascriptArrayBuffer::AllocWrapper already has Assert(false) on non _WIN64 platforms. This feature is already disabled. I'll change the comment and remove this xplat-todo.

@digitalinfinity
Copy link
Contributor

Just one comment re TypedArray usage. Other than that, LGTM (modulo the arm build error 😄)

return __sync_sub_and_fetch(Addend, T(1));
}

inline __int64 _abs64(__int64 n)
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

can we use stl llabs instead ?

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We haven't used any STL in chakracore for various reasons. Maybe in future we could reevaluate.

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Isn't that (_abs64) already part of standard library? (MS flavored)
BTW; If I'm not mistaking, llabs, abs are already used in the project.

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

My mistake, I thought you were talking about STL.

Yes, _abs64 is on MS system, but not on non _WIN32. I added it to non _WIN32 only.

You are right I could use llabs. I couldn't find existing usage of it in the project. Since long long doesn't guarantee to be same as __int64, a version for __int64 might be ok?

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

abs from pal.h looks like a good candidate ? something like #define _abs64 abs

This change enables building `lib/Runtime/Library`.
- Added a few unimplemented stubs into `CommonPal.h`.
- Replaced a bunch of `__try/__finally(__leave)` with `TryFinally`.
- `JavascriptBuiltInFunctions.cpp`: Added `BUILTIN_TEMPLATE` to work with
  all TypedArray types as they are template specializations and need
  `template<>`.
- `TypedArray.cpp`: Needed to move `Is`/`FromVar` specializations forward
  before being used.

2 files excluded from build:
- JavascriptErrorDebug.cpp: using interfaces
- MathLibrary.cpp: using intrinsics conflicting with stdlib/math.h
@chakrabot chakrabot merged commit 13f6e3b into chakra-core:linux Apr 12, 2016
chakrabot pushed a commit that referenced this pull request Apr 12, 2016
Merge pull request #779 from jianchun:lib
This change enables building `lib/Runtime/Library`.
- Added a few unimplemented stubs into `CommonPal.h`.
- Replaced a bunch of `__try/__finally(__leave)` with `TryFinally`.
- `JavascriptBuiltInFunctions.cpp`: Added `BUILTIN_TEMPLATE` to work with
  all TypedArray types as they are template specializations and need
  `template<>`.
- `TypedArray.cpp`: Needed to move `Is`/`FromVar` specializations forward
  before being used.

2 files excluded from build:
- JavascriptErrorDebug.cpp: using interfaces
- MathLibrary.cpp: using intrinsics conflicting with stdlib/math.h
@jianchun jianchun deleted the lib branch April 12, 2016 18:54
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants