★ wanayoo — archive 1999 https://github.com/livecode/livecode/pull/6310Nouvelle recherche | Portail wanayoo
Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[[ Bug 20931 ]] Bridge values in LCB assign-array and assign-list ops #6310

Merged
merged 7 commits into from Jun 6, 2018

Conversation

@runrevmark
Copy link
Contributor

@runrevmark runrevmark commented Feb 1, 2018

This patch fixes a bug where the behavior of code built using the
[ ... ] and { ... } syntax in LCB is different from that when using
explicit code.

A new method 'Bridge' has been added to the VM's execute context.
This method performs a 'convert to optional any' on the input value
resulting in bridgeable foreign values being imported, and all other
values being retained.

This method is now called on the input values in the assign-list
and assign-array opcodes meaning that foreign values being built
into lists will bridge.

Additionally, an extra compiler check has been added to variadic
arguments (i.e. arguments to the variadic portion of a C variadic
handler). This check restricts such arguments to being variable
identifiers where the variable has an explicit type declaration.
This is necessary to ensure that code explicitly states the type
which is being passed in variadic positions as there is no other
means for the compiler or the VM to know what the type should be.

This patch fixes a bug where the behavior of code built using the
[ ... ] and { ... } syntax in LCB is different from that when using
explicit code.

A new method 'Bridge' has been added to the VM's execute context.
This method performs a 'convert to optional any' on the input value
resulting in bridgeable foreign values being imported, and all other
values being retained.

This method is now called on the input values in the assign-list
and assign-array opcodes meaning that foreign values being built
into lists will bridge.

Additionally, an extra compiler check has been added to variadic
arguments (i.e. arguments to the variadic portion of a C variadic
handler). This check restricts such arguments to being variable
identifiers where the variable has an explicit type declaration.
This is necessary to ensure that code explicitly states the type
which is being passed in variadic positions as there is no other
means for the compiler or the VM to know what the type should be.
@runrevmark runrevmark force-pushed the runrevmark:bugfix-20931 branch from adf23bf to a7125ee Feb 1, 2018
@peter-b
Copy link
Contributor

@peter-b peter-b commented Feb 1, 2018

One possible concern (that I'm sure you've considered) is that this change may make it harder to manage collections of foreign values without paying the cost of bridging.

@runrevmark
Copy link
Contributor Author

@runrevmark runrevmark commented Feb 2, 2018

@peter-b : Hehe - indeed! The idea here is that the VM has three kinds of slot - temporary which hold values as they are, typed which convert a value on assignment and untyped which bridge but do not convert. As lcb doesn't yet have typed lists, we take the element of type of lists as they are now as 'untyped'. In the future lists of foreign values will be managed by being able to specify list of . I.e. Foreign values only stay foreign if bring places in temporary or types slots.

@livecodeali
Copy link
Member

@livecodeali livecodeali commented Mar 7, 2018

All apparently explicitly typed params to variadic functions now seem to be failing, eg:

      variable tInt as SInt16
      variable tLong as SInt32
      variable tLongLong as SInt64
      variable tFloat as CFloat
      variable tDouble as CDouble
      put 1000 into tInt
      put 1000000000 into tLong
      put tLong * 1000000 into tLongLong
      put 3.5 into tFloat
      put 7.5 into tDouble
      sprintf(tOutputBuffer, "%d %ld %lld %.1f %.1lf", tInt, tLong, tLongLong, tFloat, tDouble)
  • all of these are causing this kind of error
lcb/vm/foreign-invoke.lcb:48:56: error: Variadic arguments must be an explicitly-typed variable
       sprintf(tOutputBuffer, "%d %ld %lld %.1f %.1lf", tInt, tLong, tLongLong, tFloat, tDouble)
@livecodeali livecodeali modified the milestones: 9.0.0-rc-1, 9.0.1-rc-1 Mar 19, 2018
@livecodeali livecodeali changed the base branch from develop to develop-9.0 Mar 19, 2018
put false into tVar

variable tValue as Pointer
put MCProperListFetchElementAtIndex([tVar], 1) into tValue

This comment has been minimized.

@livecodeian

livecodeian May 31, 2018
Contributor

The index to MCProperListFetchElementAtIndex should be 0 no?

This comment has been minimized.

@livecodeali

livecodeali Jun 1, 2018
Member

Yes! Thanks, fixed.

@livecodeian
Copy link
Contributor

@livecodeian livecodeian commented Jun 6, 2018

@livecode-vulcan
Copy link
Contributor

@livecode-vulcan livecode-vulcan commented Jun 6, 2018

💙 review by @livecodeian ok 615a87b

livecode-vulcan added a commit that referenced this pull request Jun 6, 2018
[[ Bug 20931 ]] Bridge values in LCB assign-array and assign-list ops

This patch fixes a bug where the behavior of code built using the
[ ... ] and { ... } syntax in LCB is different from that when using
explicit code.

A new method 'Bridge' has been added to the VM's execute context.
This method performs a 'convert to optional any' on the input value
resulting in bridgeable foreign values being imported, and all other
values being retained.

This method is now called on the input values in the assign-list
and assign-array opcodes meaning that foreign values being built
into lists will bridge.

Additionally, an extra compiler check has been added to variadic
arguments (i.e. arguments to the variadic portion of a C variadic
handler). This check restricts such arguments to being variable
identifiers where the variable has an explicit type declaration.
This is necessary to ensure that code explicitly states the type
which is being passed in variadic positions as there is no other
means for the compiler or the VM to know what the type should be.
@livecode-vulcan
Copy link
Contributor

@livecode-vulcan livecode-vulcan commented Jun 6, 2018

😎 test success 615a87b

  • try-community-armv6-android-api8: success
  • try-community-armv6-android-api9: success
  • try-community-js-emscripten-sdk1.35: success
  • try-community-universal-ios-iphoneos11.4: success
  • try-community-universal-ios-iphonesimulator11.4: success
  • try-community-universal-mac-macosx10.6: success
  • try-community-universal-mac-macosx10.9: success
  • try-community-x86-linux-debian7: success
  • try-community-x86-linux-debian8: success
  • try-community-x86_64-linux-debian7: success
  • try-community-x86_64-linux-debian8: success
  • try-community-x86-win32: success
  • try-community-x86_64-win32: success
@livecodepanos livecodepanos merged commit 07474c7 into livecode:develop-9.0 Jun 6, 2018
4 checks passed
4 checks passed
continuous-integration/travis-ci/pr The Travis CI build passed
Details
continuous-integration/vulcan/cla Contributor Agreement signed by @runrevmark
continuous-integration/vulcan/pr The Vulcan build succeeded on 13 builders
continuous-integration/vulcan/review Approved by reviewer @livecodeian
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Linked issues

Successfully merging this pull request may close these issues.

None yet

6 participants
You can’t perform that action at this time.